Hi, I have a simple application that requires command-response, and notifications interaction between an Android App and an embedded device. The communication is bidirectional, with the Android App being the master sending commands to the peripheral device which is required to respond to each command, and the slave having notifications/alarms to be sent to the master.
I want to avoid polling, so the following communication models I might need:
-
client-server type, where [Android App==client], and sends commands to the [embedded device==server]; server responds to commands.
-
publisher-subscriber, where [Android App==subscriber], and subscribes to receive data from the [embedded device==publisher]. The data published by the embedded device is periodic (i.e. sensors readings)
-
alarms and alerts notification -- this probably could be the reverse of (1) with the [embedded device==client] notifying the [Android App==server] that alarms are available to be read. The master then would perform a read of new/unread alarms from the slave device using (1). The alarms are considered critical and must be processed immediately thus they cannot be sent periodically by (2).
What would be the recommended existing service(s) to be used in such application? I am thinking of using the ANS and/or a custom service like Nordic's example of BLE_UART (ble_nus). Please let me know your opinion. Regards, G