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 |
|
|---|---|---|---|
nRF54LV10 DK |
PCA10188 |
|
|
PCA10184 |
|
||
nRF54LC10 DK |
PCA10226 |
nrf54lc10dk |
|
PCA10156 |
|
||
PCA10156 |
|
||
PCA10156 |
|
||
PCA10175 |
|
||
PCA10095 |
|
||
PCA10040 |
|
||
PCA10056 |
|
||
PCA10100 |
|
For more security, it is recommended to use the */ns variant of the board target.
When built for this variant, the sample is configured to compile and run as a non-secure application using security by separation.
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 can also use the nRF Connect for Mobile 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.
For more security, it is recommended to use the */ns variant of the board target (see the Requirements section above.)
When built for this variant, the sample is configured to compile and run as a non-secure application using security by separation.
Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.
To build the sample, follow the instructions in Building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.
Note
When building repository applications in the SDK repositories, building with sysbuild is enabled by default.
If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild parameter to every build command or configure west to always use it.
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, the Serial Terminal app). See Testing and optimization for the required settings and steps.
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.hinclude/errno.hinclude/zephyr.hinclude/sys/printk.hinclude/sys/byteorder.hAPI:
include/bluetooth/bluetooth.hinclude/bluetooth/conn.hinclude/bluetooth/uuid.hinclude/bluetooth/gatt.hinclude/bluetooth/services/cgms.h