Strange UUID reversal from fetchUuidsWithSdp

…衆ロ難τιáo~ 提交于 2019-12-12 16:10:00

问题


I have a python bluetooth server (using PyBluez) running on a raspberry pi. The uuid I use in the server is:

8f86d132-4ab8-4c15-b8df-0b70cf10ea56

I am calling device.fetchUuidsWithSdp() on the bluetooth server in my Android app. When it eventually fetches the uuids, they have been reversed in groups of two (it seems the endianness has changed).

In the broadcast receiver:

Parcelable[] uuids = intent.getParcelableArrayExtra(BluetoothDevice.EXTRA_UUID);
if (uuids != null) {
    if (uuids.length > 0) {
         for (Parcelable uuid : uuids) {
              Utilities.err(uuid.toString());
         }
    } else {
         Utilities.err("no uuids");
    }
} 

For example:

8f86d132-4ab8-4c15-b8df-0b70cf10ea56 -> 56ea10cf-700b-dfb8-154c-b84a32d1868f

look at the first two characters 8f, they are the last two characters of the reversed uuid.

look at the second two characters 86, they are the second last two characters of the reversed uuid

What is causing this?

Does this have anything do to with the UUID being little or big-endian?


回答1:


are you by any chance experiencing this on android version 6.0.1? sadly there seems to be a bug in android causing this. https://code.google.com/p/android/issues/detail?id=197341




回答2:


your uuid is in version 4 and your variante is little Endianess. It's normal. Depend's of your system. If you want big Endianess put 8f86d132-4ab8-4c15-88df-0b70cf10ea56

I change the b to 8.



来源:https://stackoverflow.com/questions/35339982/strange-uuid-reversal-from-fetchuuidswithsdp

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