0

I am able to scan a ble device from my android application after this I want to send data to that scanned device. How to do? Kindly share me example code if any one have.

I referred to answered some one asked same question here [Working with BLE Android 4.3 how to write characteristics?

but am not getting below piace of code

 BluetoothGattService Service = mBluetoothGatt.getService(your Services);

Here what is `your seervice`

BluetoothGattCharacteristic charac = Service
            .getCharacteristic(your characteristic);

  Here what is `your characteristic`  

Kindly explain above code

Thanks

Community
  • 1
  • 1
Prasad
  • 1,375
  • 5
  • 17
  • 31

1 Answers1

0

To understand about services and characteristic, ddl and run the official BLE projet : https://android.googlesource.com/platform/development/+/cefd49aae65dc85161d08419494071d74ffb982f/samples/BluetoothLeGatt

Your device contains many services which describe what it can offer to you. With the official projet you can have access to them. Note that each services is like : 0000XXXX-0000-1000-8000-00805f9b34f you can find the XXXX here :https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx And it is the same for the characteristic

For example if you want to find the name of the device Service UUID code is 00001800-0000-1000-8000-00805f9b34f and the characteristic is Device name. UUID 00002A00-0000-1000-8000-00805f9b34f.

To answer you, your services is an UUID.