问题
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