Accessing the Transparent UART Service using Android™ BLE

In the MCHP Transparent UART Android app, after a successful connection has been established and BLE Services Discovery returns with a BLEService.ACTION_GATT_SERVICES_DISCOVERED event in the PeripheralControlActivity, the returned services list is queried for the Microchip Transparent UART service. If the Microchip Transparent UART service is available, then the notification is enabled for the Microchip Transparent UART TX characteristic and the BluetoothGattCharacteristic objects for Microchip Transparent UART TX and Microchip Transparent UART RX characteristics are saved for access operation as highlighted in the below screenshot.

execchar.png

Once the app discovers the Microchip Transparent UART service and its characteristics, it can then perform access operations on the characteristics as needed.

The app can send the data to the BM70/RN4870 by performing a BluetoothGatt.writeCharacteritsic() through the BLEService.writeCharacteristic() to the Microchip Transparent UART RX characteristic.

writeexchar.png

The data is received from BM70/RN4870 as a notification event for the Microchip Transparent UART RX characteristic from the BluetoothGattCallback.onCharcateristicChanged() callback through the BLEService broadcast.

notifyexchar.png

In the PeripheralControlActivity view, once the data is entered in the input text field and the Send button is clicked, the entered data is written using BLEService.writeCharacteristic() and transferred over BLE link and seen on the UART output of the BM70/RN4870 module.

controlviewsend.png
mtusreceive.png

Any data that is entered on the UART input of the BM70/RN4870 module is notified to the Android app. The PeripheralControlActivity view receives a notification callback from the BLEService with the received data. The received data is populated in the receive text view.

mtussend.png
controlviewreceive.png
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.