蓝牙并发连接数
为了庆祝我大学的节日,我们正在计划举办一场智力竞赛。
对于压哨回合,我正在考虑为 Android 编写 2 个应用程序(我们有一些手机),一个用于测验大师,另一个用于参赛者
参赛者将通过蓝牙连接到测验大师。
阅读问题后,测验大师单击他/她的应用程序中的按钮,参赛者应用程序中的按钮将启用 X 秒。一旦参赛者单击他/她的按钮,测验大师的应用程序就会闪烁该参赛者的名字。
我的问题:
是否有可能拥有多个连接并在蓝牙中接受来自它们的并发(或多路复用)消息(类似于 unix/c 中的 select() )?
如果可能的话,我应该在哪里寻找示例?我在尝试开发这个产品时会遇到什么样的问题(我知道可靠性是一个问题)以及如何避免这些问题?
我之前曾在笔记本电脑上尝试过此操作,但失败了。但也许我很早就放弃了。请帮忙。
编辑:
我放弃了该项目(连接丢失太多)。不过我仍然保留这个问题。
For a fest at my college, we are planning a quiz contest.
For the buzzer round, I was thinking of writing 2 app for android (we have a few handsets), one for the quiz master and the other for the contestants
The contestants will be connected to the quiz master through bluetooth.
After reading the question, the quiz-master clicks a button in his/her app, the button in the contestant apps will be enabled for X seconds. As soon as a contestant clicks his/her button, the quiz master's app will flash the name of that contestant.
My questions:
Is it even possible to have multiple connections and accept concurrent (or multiplexed) messages from them in bluetooth (something similar to select() in unix/c)?
If possible, where should I look for any examples? What kind of problems will I face trying to develop this (I know reliability is an issue here) and how to avoid them?
I had tried this on laptops before and failed. But maybe I gave-up very early. Please help.
EDIT:
I gave-up the project (too many connection drops). I'm keeping the question open though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
蓝牙支持微微网,其中单个(测验)主设备可以与最多 7 个从设备进行通信。
所以,在蓝牙层面,这应该是可行的。不过,我不是说是否可以使用 Android 的蓝牙 API 来实现的人。
Bluetooth supports piconets, in which a single (quiz) master can communicate with up to 7 slaves.
So, at the Bluetooth level, this should be doable. I'm not the person to say if it's possible to implement using Android's Bluetooth API:s, though.
您是否已阅读本文以及其他专门针对 Android 的信息?
http://developer.android.com/guide/topics/wireless/bluetooth。 html
旁白:当我在大学时,我们以老式的方式(纸和笔)进行琐事之夜,但从好的方面来说,你不必担心喝醉的大学生手中有昂贵的手机! ;-)
Have you read though this and the rest of the information available specifically for Android?
http://developer.android.com/guide/topics/wireless/bluetooth.html
Aside: When I was in college we did trivia nights the old fashioned way (paper and pencil) but on the plus side you didn't have to worry about having expensive phone handsets in the hands of drunken college students! ;-)