通过无线信号在两个设备之间进行实时同步
我从来没有做过嵌入式(我不知道这是否是你所说的)编程,对此一无所知。我的问题:
是否可以让两个设备共享无线连接(没有互联网,仅在它们之间,也许是蓝牙,但我不知道什么是最好的)?
是否可以让一个人编辑一个文件,另一个人编辑同一个文件,并且他们可以实时看到更改?有点像谷歌文档?
这已经存在吗?
我可以做什么来开始这种编程?
澄清:
我希望两个拥有 iPhone 或任何其他手持设备的人能够同时编辑文本文件并实时查看彼此的更改。我该怎么做?
i have never done embedded (i dont know if thats what you call this) programming and know nothing about it. my question:
is it possible to have two devices sharing a wireless connection (no internet, just between themselves, perhaps bluetooth, but i dont know what ever is best) ?
is it possible to have one editing a file and the other person editing the same file and they can see changes in real time? sort of like google docs?
does this exist already?
what can i do to get started regarding this kind of programming?
to clarify:
i want two people with iphones or any other hand held device, to be able to edit a text file at the same time and see each other's changes in real-time. how do i do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你的问题中隐藏着一堆有点奇怪的假设。我会尽力把它们拆开。
您以一种奇怪的方式使用了“嵌入式”编程。通常这会建议在某种意义上没有直接用户交互的设置中使用某种低功耗设备(例如工厂控制器、冰箱控制器、传感器节点),执行非常具体的任务,但您继续谈论人们编辑文件。这里的用户界面到底是什么?是什么让这个嵌入式编程变得如此?我认为您需要先描述一个应用程序,然后才能提供任何建议。
如果您实际上指的是嵌入式设备,那么它们是否可以相互无线连接将取决于设备的性质。同样,所涉及的协议/技术将取决于设备。嵌入式编程往往是特定于设备的。例如,当然存在包含用于串行通信的小型无线电收发器的无线传感器节点。
谷歌文档已经存在。如果没有更清晰的问题描述,很难说你想要的东西是否已经存在。
我认为您应该真正弄清楚您想要进行哪种编程,然后我们才能提供有关如何最好地开始使用它的要点。也许查找“嵌入式编程”的定义,看看它与您的目标有何关系,以便您可以更清楚地重新表述您的问题。
我也不确定“实时”如何适合这种情况。这个术语以多种方式被使用和滥用。事物只有在某些约束下才是实时的,这些约束通常是根据应用程序定义的。
(注:这可能作为评论更合适,但我觉得为了在字符限制内总结,有太多需要回应的内容,鉴于限制,我希望纠正一些混乱构成某种答案。的问题)。
There are a bunch of slightly strange assumptions hidden in your questions. I'll try to unpick them as best as I can.
You've used "embedded" programming in a strange way. Usually this would suggest some kind of low-power devices used in settings without direct user interaction in some sense (e.g. factory controllers, refrigerator controllers, sensor nodes), performing a very specific task, but you've gone on to talk bout people editing files. What exactly would be the user interface here? What would make this embedded programming? I think you need to describe an application before any advice can be offered.
If you actually mean embedded devices, then whether they can connect wirelessly to one another is going to depend on the nature of the device. Similarly, the protocol/technologies involved will depend on the device. Embedded programming tends to be very much device-specific. There certainly exist wireless sensor nodes, for example, that incorporate small radio transceivers for serial comms.
Google docs already exists. Without a clearer problem description it's difficult to say whether what you want exists already or not.
I think you should really figure out exactly what kind of programming it is that you want to do before we can offer points as to how to best get started with it. Maybe look up a definition of "embedded programming" and see how this relates to your goals such that you can reformulate your questions a little more clearly.
I'm not sure how "real time" would fit into this scenario either. This term is used and abused in many ways. Things are only ever real-time with respect to some constraint, usually defined in terms of the application.
(Note: This might have been more appropriate as a comment, but I felt there was too much to respond to in order to sum up within character limits, and I hope correcting some of the confusion constitutes something of an answer, given the limitations of the question).
两个设备可以像这样共享连接。一直都是这么做的。为此有很多协议。对于 90% 的情况来说,天气与否、有线还是无线或是否使用互联网并不重要。
这有点可行,但实际上并非如此。当两个人同时编辑时,确实会出现竞争状况。这通常是可以避免的,方法是一次锁定文档的一小部分,只允许一名编辑者访问(就像一次只有一个人能够编辑电子表格的一个单元格),但这也有问题(就像活动编辑器花费的时间太长——这也是许多源版本控制系统中出现的问题)。
1 已经以多种形式存在。 2有多种形式存在,但我提到的问题是不可能完全克服的。
你问这个问题的方式让我相信你距离做到这一点还很远。此外,您没有告诉我们任何有关您知道如何做的事情。你能为 iPhone(或其他设备)编写一个简单的文本编辑器吗?从头开始编写不蹩脚的简单文本编辑器并不容易。
如果您确实想这样做,您需要做的是制定一个协议,供两个(或更多)设备相互通信。为此,最好弄清楚什么类型的设备设备之间可以进行通信,以及您将使用哪些设备以及您需要的哪些设备未提供的功能。
您可以尝试在进行编辑时在两个设备之间发送文件的补丁(或类似的内容),但随后您必须决定在发生冲突时该怎么做(在同一位置附近进行编辑)。
或者,您可以让两个设备交换进行编辑的权限(就像在令牌环网络中一样)。
但是,如果两个设备在编辑文件期间彼此失去通信,您仍然会遇到问题。使用令牌环类型设置,您可能会丢失令牌并且无法轻松自动恢复。无论您做什么,最终都会遇到两个问题:两者对文件内容的看法不同。
Two devices can share a connection like this. It's done all the time. There are many many protocols for this. Weather or not it is wired or wireless or uses the Internet doesn't really matter for 90% of this.
This is sort of doable, but not really. You really have a race condition when two people are editing at the same time. This is generally avoidable by locking out small parts of the document at from all but one editor at a time (like only one person being able to edit one cell of a spreadsheet at a time), but this has problems too (like of the one active editor is taking way too long -- this is a problem seen in many source version control systems too).
1 already exists in many many forms. 2 sort of exists in many forms, but the problems I mentioned are impossible to completely overcome.
The way you asked this question leads me to believe that you are very far from being able to do this. In addition, you didn't tell us anything about what you do know how to do. Can you write a simple text editor for an iPhone (or anything else)? Simple text editors from scratch that aren't crappy aren't easy to write.
What you need to do, if you really want to do this, is to come up with a protocol for the two (or more) devices to talk to each other in. To do this it is probably best if you figure out what type of communication is available between the devices and which of those you will use and what features it does not provide that you will need on top.
You could try to send patches of the file (or something similar) between the two devices as edits are made, but then you'll have to decide what to do in the event of a collision (edits near the same place).
Alternately you could have the two devices exchange permission to make edits (like in token ring networks).
You still have a problem if the two devices lose communication with each other during the editing of the file, though. With the token ring type setup you stand the possibility of losing the token and neither being able to automatically recover easily. Whatever you do you end up with the problem of the two ending up with different ideas of the file's contents.
“iPhone 或任何其他手持设备”——实现这一点的技术堆栈目前还不存在。您必须在多种语言和系统之间进行协调。 (好吧,也许您想编写该软件,但这是一项艰巨的任务)。
最好的选择是创建一个所有移动浏览器都可以运行并保存文本文件的网页。
"iphones or any other hand held device" - the technology stack to do that doesn't exist today. You have to co-ordinate between multiple languages and systems. (Okay, maybe you want to write that software, but it's a huge undertaking).
Your best bet would be to create a web page that all of the mobile browsers can work on and save a text file from.