Home > Net >  how to know device's service uuid and characteristic uuid when connecting to bluetooth
how to know device's service uuid and characteristic uuid when connecting to bluetooth

Time:01-27

i am developing react native app that connect health device via bluetooth using library

https://github.com/dotintent/react-native-ble-plx

but after connecting i try to get service by calling device.service() but then there are an eror saying no services discovered.

now i am confuse how i get service uuid and characteristic uuid to read data from bluetooth device. btw the device is glucose meter.

CodePudding user response:

As mentioned in the documentation of this library Since Android 6 to scan the app needs to have ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION runtime permission. Since Android 10 only ACCESS_FINE_LOCATION is accepted by the OS.. You need to handle Android Runtime permissions.

CodePudding user response:

sorry, i already got the answer service uuid of my device is 1808

i search it in here https://btprodspecificationrefs.blob.core.windows.net/assigned-values/16-bit UUID Numbers Document.pdf

i confirm it by log the device that show uuid of 00001808-0000-1000-8000-00805f9b34fb

then base of this answer How can I convert a Bluetooth 16 bit service UUID into a 128 bit UUID?

i know how to read that 16bit uuid to 4 digit like this

Or, to put it more simply, the 16-bit Attribute UUID replaces the x’s in the follow- ing:

0000xxxx-0000-1000-8000-00805F9B34FB In addition, the 32-bit Attribute UUID replaces the x's in the following:

xxxxxxxx-0000-1000-8000-00805F9B34FB

then the characteristic uuid i think by documentation refer to 2A18 for the same name or description

CodePudding user response:

In case there is no documentation available for a device one could use a BLE scanner app to scan for nearby devices and simply obtain the UUIDs that way.

There are multiple such apps available for both iOS and Android such as nRF Connect and LightBlue.

These can not only scan for BLE devices but can also be used to test them using simple read, write and notify operations.

  •  Tags:  
  • Related