how to programatically determine Bluetooth master/slave roles?

白昼怎懂夜的黑 提交于 2019-12-23 03:12:03

问题


So in a bluetooth piconet, there is one master with upto seven slaves. The master sets the clock and frequency hop that the slaves sync with. But is there a way to determine which device is the master and which is the slave? I'm mainly interested in portable devices (Android,iPhone) but beggars can't be choosers, if anybody has info in this field I would be interested.

Thanks


回答1:


I don't think it's possible to do it programatically.The master/slave roles which a device assumes is invisible to the user(application).The same device can act as a master of one piconet and a slave in an (adjacent) piconet.What needs to be decided in your application is whether the device will act as a client or a server or both and what will be the services(profiles) that it supports.




回答2:


It depends on the platform you are using. It should be possible to read the information associated with a connected device and the role of the device should ideally be part of that information in the API. So if the connected device is Master you can infer that you are slave and so on. -Dennis



来源:https://stackoverflow.com/questions/3066889/how-to-programatically-determine-bluetooth-master-slave-roles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!