The app acts a Notifier that keeps the user updated with the relevant information over serial terminal as well as nRF Connect App over BLE. The data that's displayed depends on what the user has subscribed to through the supported commands.
User can interface with the app over UART and nRF Connect App, which acts as a central and talks to the peripheral (nRF52 DK) running the FW.
Following are the currently supported commands:
Commands | Function |
---|---|
tempOff | unsubscribes the temperature sensor from the Notification class: user would no longer see any updated temperature values |
tempOn | subscribes the temperature sensor to the Notification : user would receive notifications containing temperature values in C° |
The sensor class forms a concrete Subject that stores a reference to the Observer which in our case is the Notification class.
As soon as there's a sensor data ready to be pushed to a notification list, it invokes a corresponding Subject::notify()
that in turn calls a correspondg update() call of Notification classes that takes care of updating the notification list with a desired data.
This pattern is used for scalability: for X amount of sensors to be used (in the future), each of which could be attached by the Notification
class. And there's always flexibility to unsubscribe any sensor from the Notification class.
- UART terminal with supported user commands alongside the view from Logic Analyzer
Following is a zoomed-in view of a sensor reading
-
nRF Connect App The value attribute contains 0x13 represents the temperature value sent from the peripheral/GATT server. The (blue) highlighted button on the far-right indicates notification is enabled by the central/GATT client.
- The output over serial terminal seems to be lagging particularly after the scheduler kicks in. Need to investigate.
- Finish the Logger class
- Do something meaningful with the notification list -- thoughts: upload data to a server that displays the data graphically
- Look into why more than 1 byte is shown in the value in BLE service in nRF Connect app