Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't know about the Android BLE API, but I can tell you how this is supposed to work with Bluetooth Low Energy.</p> <p>The device name is stored in the GATT server (a local database on the cc2541 device). If you connect to the BLE device you should be able to do a discover to figure out the structure of the database and find the ATT handle for the device name.</p> <p>The GATT server is built up of attributes with a UUID (loosely defining the type of attribute) an attribute handle (the identifier used in this instance of the GATT server) and a value. According to [1] the UUID for the device name is 0x2A00. So you can search by type and find the handle with this UUID.</p> <p>Once you have the UUID it's just a matter of using the GATT client in the Android API to send a write request to this handle with the new value</p> <p>Edit: Looking at the API I think you should use getService(0x18, 0x00) [2] to get the primary service (which should contain the device name) and then writeCharacteristic[3] to update the name.</p> <p>From [4] it looks like the code should look something like this (not tested):</p> <pre><code>public void writeCharacteristic(byte[] value) { BluetoothGattService gap_service = mBluetoothGatt.getService( UUID.fromString("00001800-0000-1000-8000-00805F9B34FB")); if (gap_service == null) { System.out.println("gap_service null";); return; } BluetoothGattCharacteristic dev_name = gap_service.getCharacteristic( UUID.fromString("00002A00-0000-1000-8000-00805F9B34FB")); if (dev_name == null) { System.out.println("dev_name null";); return; } dev_name.setValue(value); boolean status = mBluetoothGatt.writeCharacteristic(dev_name); System.out.println("Write Status: " + status); } </code></pre> <ul> <li>[1] <a href="https://www.bluetooth.org/en-us/specification/assigned-numbers/generic-attribute-profile" rel="nofollow">bluetooth.org</a></li> <li>[2] <a href="http://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#getService%28java.util.UUID%29" rel="nofollow">getService</a></li> <li>[3] <a href="http://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#writeCharacteristic%28android.bluetooth.BluetoothGattCharacteristic%29" rel="nofollow">writeCharacteristic</a></li> <li>[4] <a href="https://devzone.nordicsemi.com/index.php/writing-to-a-characteristic-using-the-android-4-3-api" rel="nofollow">devzone.nordicsemi.com</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload