Skip to content

Commit

Permalink
Merge pull request #107 from sampaioletti/subscribe
Browse files Browse the repository at this point in the history
Add docs to BLECharacteristic::on_subscription
  • Loading branch information
taks authored Mar 1, 2024
2 parents e25fbd3 + 9f61879 commit 77fa1e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/server/ble_characteristic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ impl NotifyTx<'_> {
bitflags! {
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
///Empty NimbleSub i.e. `NimbleSub::is_empty()==true` means Unsubscribe(d)
pub struct NimbleSub: u16 {
/// Subscribe if Notify
const NOTIFY = 0x0001;
/// Subscribe if Indicate
const INDICATE = 0x0002;
}
}
Expand Down Expand Up @@ -365,6 +368,8 @@ impl BLECharacteristic {

/// Do not call `lock` on this characteristic inside the callback, use the first input instead.
/// In the future, this characteristic could be locked while the callback executes.
/// * `callback` - Function to call when a subscription event is recieved, including subscribe and unsubscribe events
/// see [`crate::NimbleSub`] for event type
pub fn on_subscribe(
&mut self,
callback: impl FnMut(&Self, &BLEConnDesc, NimbleSub) + Send + Sync + 'static,
Expand Down

0 comments on commit 77fa1e3

Please sign in to comment.