How to find the UUID of serial port Bluetooth device?

只谈情不闲聊 提交于 2019-11-26 20:11:49

问题


I want to receive data from the serial port bluetooth device to android phone. But i don't know the UUID of that device how to find the UUID of that device?


回答1:


Extending what pwc said about the UUID being 0x1101, this is the 16 bit version of the UUID as far as I can tell. I could not work out how to instantiate an UUID with a 16 bit UUID. But as this post says you can do it by:

private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");

This worked for me to connect to a serial bluetooth module I bought from Deal Extreme




回答2:


If the device is using serial port profile, then yes, it is simply:

0x1101

For other pre-defined options, see the list of pre-defined UUIDs as listed in javax.bluetooth:

UUID.




回答3:


The UUID for the SPP Serial Port service is defined by the Bluetooth SIG to be 0x1101.




回答4:


Just open your device in adb shell type sdptool and browse you got your device UUID




回答5:


In the Android Bluetooth API documentation:

Create RFCOMM Socket to Service Record - UUID.




回答6:


From API level 15, you can query the supported features (UUIDs) of the remote device, use the method on the BluetoothDevice object obtained in the search:

public ParcelUuid[] getUuids ()



回答7:


you can get Device UID by simple Calling

perticulerDevice.getUuids()[0].toString()


来源:https://stackoverflow.com/questions/4632524/how-to-find-the-uuid-of-serial-port-bluetooth-device

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