黑莓蓝牙开发帮助
我的蓝牙应用程序已经被困了好几天了。 它的作用是接收来自蓝牙设备的数据,使用串口协议... 该应用程序在手机和设备的后台运行,当它们需要发送信息时,打开蓝牙并尝试发送数据帧。
问题是可以使用此应用程序连接多个设备。而且我没有设法将手机作为服务器,以便它可以接收连续的数据。 这意味着我可以用 AcceptAndOpen() 创建一个 Connector.open("btspp: localhost :...."),但是这个函数只启动一次,我不能无休止地重新启动。
解决方案是启动 AcceptAndOpen () 当蓝牙通话结束时...重新启动该功能,但我不能(我只是重新创建打开端口的对象)
我尝试使用但没有成功: - PushRegistry(“btspp”不兼容) - Connector.open () 与客户端的 mac 地址(但这不是自阻止)
如果有人可以帮助我解决这个问题。因为我已经在黑莓论坛上彻底搜索过了......
谢谢你,Fabrice
PS:如果你需要源代码,我可以给你......但我不确定这可以帮助你回答我。
I've been stuck since several days on my bluetooth application.
Its role is to receive data from Bluetooth devices, using Serial Port Protocol ...
The application runs in the background of the phone and devices, when they need to send an information, turns on the bluetooth and try to send a data frame.
The problem is that several devices can connect using this application. And I don't manage to put the phone as a server so it could receive continuous data.
This means that I can create a Connector.open ("btspp: localhost :....") with AcceptAndOpen (), but this function starts only once and I can not relaunch endlessly.
The solution would be to launch a AcceptAndOpen ()
When a bluetooth call is over ... restart the function, but I can not (I simply recreates the object that made the port opening)
I try to use without success:
- PushRegistry ("btspp" is not compatible)
- Connector.open () with the mac address of clients (but this is not self-blocking)
If someone could help me on how to solve this issue. Because I have searched thoroughly on the blackberry forums...
Thank you, Fabrice
PS: If you need source code, I can give you ... But I'm not sure this can help you to answer me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确保从acceptAndOpen 获得连接后,将该连接传递到新线程中。这允许当前的“服务器”线程返回并接受另一个连接(假设它在循环中)。
Make sure after you get a connection from acceptAndOpen, you pass that connection into a new thread. This allows the current "server" thread to go back and accept another connection (assuming it's in a loop).
抱歉我的回答迟了。
我创建了一个类:BluetoothReceiver,她在后台启动(链接文本)。
我的源代码的一部分可以尝试帮助您:
问候,Fabrice
Sorry for my late answer.
I've create a class: BluetoothReceiver that's she is launch in background (link text).
There is a part of my sourcecode for try to help you:
Regards, Fabrice
我刚刚放置了
acceptAndOpen()
:现在可以了。
I've just put around
acceptAndOpen()
:Now it's okay.