简体   繁体   中英

Strange UUID reversal from fetchUuidsWithSdp

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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM