blatann.examples.peripheral_glucose_service module

This example demonstrates using Bluetooth SIG’s defined Glucose service as a peripheral. The peripheral creates a range of fake glucose readings that can be queried from the central.

This can be used in conjunction with the nRF Connect apps to explore the peripheral’s functionality

blatann.examples.peripheral_glucose_service.on_connect(peer, event_args)

Event callback for when a central device connects to us

Parameters
blatann.examples.peripheral_glucose_service.on_disconnect(peer, event_args)

Event callback for when the client disconnects from us (or when we disconnect from the client)

Parameters
blatann.examples.peripheral_glucose_service.on_security_level_changed(peer, event_args)

Event callback for when the security level changes on a connection with a peer

Parameters
blatann.examples.peripheral_glucose_service.display_passkey(peer, event_args)

Event callback that is called when a passkey is required to be displayed to a user for the pairing process.

Parameters
blatann.examples.peripheral_glucose_service.add_fake_glucose_readings(glucose_database, num_records=15)

Helper method to create some glucose readings and add them to the glucose database

Parameters
  • glucose_database (glucose.BasicGlucoseDatabase) – The database to add readings to

  • num_records – The number of records to generate

blatann.examples.peripheral_glucose_service.main(serial_port)