Skip to content

Commit

Permalink
Add on_disconnect callback to server example.
Browse files Browse the repository at this point in the history
  • Loading branch information
taks committed Oct 20, 2023
1 parent 8cd5554 commit 87fdceb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/ble_secure_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ fn main() {
.set_io_cap(SecurityIOCap::DisplayOnly);

let server = device.get_server();
server.on_connect(|server, desc| {
::log::info!("Client connected");
});
server.on_disconnect(|desc, reason| {
::log::info!("Client disconnected ({:X})", reason);
});

let service = server.create_service(BleUuid::Uuid16(0xABCD));

let non_secure_characteristic = service
Expand Down
3 changes: 3 additions & 0 deletions examples/ble_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ fn main() {
::log::info!("Multi-connect support: start advertising");
ble_device.get_advertising().start().unwrap();
});
server.on_disconnect(|desc, reason| {
::log::info!("Client disconnected ({:X})", reason);
});
let service = server.create_service(uuid128!("fafafafa-fafa-fafa-fafa-fafafafafafa"));

// A static characteristic.
Expand Down

0 comments on commit 87fdceb

Please sign in to comment.