简体   繁体   中英

Web Bluetooth with a Custom GATT Service?

First, the source code for the BLE Peripheral Simulator is a tremendous resource for anyone investigating Web Bluetooth.

There is a an approved list of GATT Services .

When I modified the Android source code to use a custom defined GATT service (easy to do by simply specifying your own UUID in the Android code) pairing from the web page to the Android app running the GATT sever fails.

The Web Bluetooth documentation does state, "If device's advertised Service UUIDs have a non-empty intersection with the set of Service UUIDs, add device to result and abort these sub-steps [for pairing]."

Does this mean only services in the approved GATT list are supported? If so, what is the rational? It seems that such a restriction would limit innovation.

If I had done some more research on Stack Overflow I would have realized the UUID spec requires lowercase af. Type of Character generated by UUID

The following values work for a custom defined service and characteristic:

private static final UUID SERVICE_UUID = UUID.fromString("29143321-ef6c-4761-947c-c858f9a2e8f1");

private static final UUID CHARACTERISTIC_UUID = UUID.fromString("92f3131b-ffa8-4dd1-a12b-641d65a78857");

I am working with web-bluetooth also and i was able to talk with custom services, yet to read data from them you have to have device docs explaining how to talk to that services. I think this approved list is like generally used list which doesn't require unique logic to get data. However there is difference since some characteristics are blacklisted for web-bluetooth yet available to fetch data from using ios/android stuff.

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