我正在构建一个应用程序,我将在其中扫描所有蓝牙设备并连接到感兴趣的蓝牙设备。我读到我需要设备的UUID,以便我可以连接到它。
我使用以下代码来获取UUIDS
Class cl = Class.forName("android.bluetooth.BluetoothDevice");
Class[] par = {};
Method method = cl.getMethod("getUuids", par);
Object[] args = {};
ParcelUuid[] retval = (ParcelUuid[]) method.invoke(device, args);
return retval;现在返回的是一个UUID数组,我该如何确定连接时必须使用哪个UUID呢?
发布于 2013-07-05 05:54:15
我的理解是,任何蓝牙设备都可能提供多种服务。每个服务都有自己的UUID。您可以通过检查UUID的协议标识符(前两个字节)来确定需要使用的UUID。有一个列表here。
https://stackoverflow.com/questions/13854984
复制相似问题