Android NFC 蓝牙切换
我在 http://fupeg.blogspot.com/search/label/nfc 但我无法理解示例中未提及的 startBluetooth() 方法。
那么,是否有人可以分享一个“Android 中的 NFC 到蓝牙切换”的示例?
I found an uncompleted example over http://fupeg.blogspot.com/search/label/nfc but i am unable to understand the method startBluetooth() that it is not mentioned in the example.
So if any one can share an example of "NFC to Bluetooth Handover in android"?.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
startBluetooth(msg)
方法应按照本文中讨论的方式比较时间戳,并决定哪部手机应充当客户端或服务器。接下来是从 NDEF 消息中解码蓝牙地址和服务 UUID。然后根据时间戳启动ServerThread
或ClientThread
并启动它们。如果代码缺失,那么这一部分以及处理双方套接字通信的CommThread
类一样。顺便说一下,这是 NFC 蓝牙切换的一个很好的例子,即使省略了实用功能。我很好地强调了关键的 NFC 和蓝牙操作。
The
startBluetooth(msg)
method should compare the timestamaps as discussed in the article and decide which phone should act as client or server. Next is to decode the Bluetooth address and the service UUID from the NDEF message. Then initiate either theServerThread
orClientThread
based on the timestamp and start them. This piece if code is missing, just as well as theCommThread
class, that handles the socket communications on both side.By the way this is a very good example for the NFC Bluetooth handover, even with omitting the utility functions. I highlights the key NFC and Bluetooth operations very well.