Android Question Changing the longUUID in BlePeripheral2.java [SOLVED]

Peter Simpson

Expert
Licensed User
Longtime User
I resolved my issue my updating and rereleasing Erels original library bleperipheral2 library, link below...

I'm trying to change the main GATT Service UUID in BlePeripheral2.java below.

Every time I change the UUIS from

return UUID.fromString("0000" + shortName + "-0000-1000-8000-00805f9b34fb");
to for example
return UUID.fromString("2fdb0461-0461-4216-9fde-2c318f1866ed");
the GATT service app runs perfectly fine but the GATT service UUID is not visible to other devices.

It appears that all I can change is the 'shortName', if I change anything else like the whole UUID (which I have to change and set manually), the GATT service UUID is not visible to other devices.

I don't really do Java, so any help would be appreciated.



Thank you.
Peter...
 
Last edited:

drgottjr

Expert
Licensed User
Longtime User
your uuid does not match the required ble format. that's what the snippet in the source does: it allows for that part of a uuid which can fit into a larger required format.
according to documentation for ble uuids, they have to end in "00805f9b34fb". you supply that part of the uuid that pertains to your device, and the little snippet build a correct ble uuid around it.

i should modify this a little by adding that, although your uuid does not conform to ble's so-called characteristic uuid format, you could use a custom uuid. in that case, you wouldn't use the method in that java source since that method constructs a characteristic uuid.

constructing a custom uuid probably involves a couple of standard uuid-related java methods (maybe even something online which returns a custom uuid ready to go). it could be hard-coded in the java source. worth a try.
 
Last edited:
Upvote 0
Top