The BluetoothGattCharacteristic class provides additional methods to retrieve properties and descriptors.
- int getProperties()
The Characteristic value in the remote Generic ATTribute Profile Server, or GATT Server, can be read and/or written to, depending on the access property of the characteristic by the GATT Client Android app, using the readCharacteristic() or writeCharacteristic() methods in the BluetoothGatt class.
- boolean writeCharacteristic(BluetoothGattCharacteristic characteristic)
- boolean readCharacteristic(BluetoothGattCharacteristic characteristic)
The Characteristic notification or indication can be enabled or disabled by calling BluetoothGatt.writeDescriptor(), and by setting appropriate notification/indication enable/disable value set for the descriptor using BluetoothGattDescriptor.setValue().
boolean writeDescriptor(BluetoothGattDescriptor descriptor)
The getValue() and setValue() methods can be used to get or set local values when the Android app is used as a GATT Server to host a Service. Get the stored value for this characteristic.
- byte[] getValue()
Update the locally stored value of this characteristic.
- boolean setValue(byte[] value)
The Bluetooth Low Energy Service, or BLEService, provides readCharacteristic() and writeChatracteristic() wrapper methods to perform the read and write access operations on the characteristics.
The BLEService also provides setCharacteristicNotification() and setChracteristicIndication() wrapper methods to enable or disable the notification or indication for the characteristics.
The below screenshot shows the PeripheralControlActivity view of the MCHP Transparent UART Android app. This view is used for access operations of the Microchip Transparent UART Service. The view shows the connection status, the send text field to enter data to be sent from the Android app to the BM70/RN4870 BLE module, and the receive text view to show the received data from BM70/RN4870 BLE module to the Android app. Access of the Microchip Transparent UART Service using the MCHP Transparent UART Android app is discussed in the following sections.