blatann.examples.peripheral_battery_service module¶
This example demonstrates using Bluetooth SIG’s Battery service as a peripheral. The peripheral adds the service, then updates the battery level percentage periodically.
This can be used in conjunction with the nRF Connect apps to explore the functionality demonstrated
- blatann.examples.peripheral_battery_service.on_connect(peer, event_args)¶
Event callback for when a central device connects to us
- Parameters
peer (blatann.peer.Client) – The peer that connected to us
event_args – None
- blatann.examples.peripheral_battery_service.on_disconnect(peer, event_args)¶
Event callback for when the client disconnects from us (or when we disconnect from the client)
- Parameters
peer (blatann.peer.Client) – The peer that disconnected
event_args (blatann.event_args.DisconnectionEventArgs) – The event args
- blatann.examples.peripheral_battery_service.main(serial_port)¶