Bluetooth: Continuous Glucose Monitoring Service (CGMS)
The Peripheral Continuous Glucose Monitoring Service (CGMS) sample demonstrates how to use the GATT Continuous Glucose Monitoring Service (CGMS) to implement a glucose monitoring device.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
Build target |
---|---|---|---|
PCA10095 |
|
||
PCA10040 |
|
||
PCA10056 |
|
||
PCA10100 |
|
When built for an _ns
build target, the sample is configured to compile and run as a non-secure application with Cortex-M Security Extensions enabled.
Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.
Overview
The sample demonstrates a basic Bluetooth® Low Energy Peripheral role functionality that exposes the Continuous Glucose Monitoring GATT Service. Once it connects to a Central device, it generates dummy glucose measurement values. You can use it together with the Continuous Glucose module in the nRF Toolbox app. You may also use nRF Connect app to interact with the CGMS module.
Building and running
This sample can be found under samples/bluetooth/peripheral_cgms
in the nRF Connect SDK folder structure.
When built as firmware image for the _ns
build target, the sample has Cortex-M Security Extensions (CMSE) enabled and separates the firmware between Non-Secure Processing Environment (NSPE) and Secure Processing Environment (SPE).
Because of this, it automatically includes the Trusted Firmware-M (TF-M).
To read more about CMSE, see Processing environments.
To build the sample with Visual Studio Code, follow the steps listed on the How to build an application page in the nRF Connect for VS Code extension documentation. See Building and programming an application for other building and programming scenarios and Testing and debugging an application for general information about testing and debugging in the nRF Connect SDK.
Testing
After programming the sample to your development kit, connect to a smartphone with the nRF Toolbox installed to test it as follows:
Connect to the kit that runs this sample with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.
Reset the development kit.
Open the nRF Toolbox app and select the Continuous Glucose module.
Click the name of the development kit to connect to it.
Authentication is required. The device prints the pairing key in the terminal.
Enter the pairing key on the client side.
If pairing is successful, in the terminal window, observe that notifications are enabled:
<inf> cgms: CGMS Measurement: notification enabled <inf> cgms: CGMS RACP: indication enabled <inf> cgms: CGMS SOCP: indication enabled
The glucose measurement is sent to the client using a notification. The client can also retrieve the record using the record access control point.
Dependencies
This sample uses the following Zephyr libraries:
include/zephyr/types.h
include/errno.h
include/zephyr.h
include/sys/printk.h
include/sys/byteorder.h
include/bluetooth/bluetooth.h
include/bluetooth/conn.h
include/bluetooth/uuid.h
include/bluetooth/gatt.h
include/bluetooth/services/cgms.h