Trait LocalService

Source
pub trait LocalService<T: ServerTypes> {
    // Required methods
    fn publish(&self) -> T::ServiceEventStream;
    fn notify(&self, characteristic: &Handle, data: &[u8], peers: &[PeerId]);
    fn indicate(
        &self,
        characteristic: &Handle,
        data: &[u8],
        peers: &[PeerId],
    ) -> T::IndicateConfirmationStream;
}

Required Methods§

Source

fn publish(&self) -> T::ServiceEventStream

Publish the service. Returns an EventStream providing Events to be processed by the local service implementation. Events will only be delivered to one ServiceEventStream at a time. Calling publish while a previous ServiceEventStream is still active will return a stream with only Err(AlreadyPublished).

Source

fn notify(&self, characteristic: &Handle, data: &[u8], peers: &[PeerId])

Notify a characteristic. Leave peers empty to notify all peers who have configured notifications. Peers that have not configured for notifications will not be notified.

Source

fn indicate( &self, characteristic: &Handle, data: &[u8], peers: &[PeerId], ) -> T::IndicateConfirmationStream

Indicate on a characteristic. Leave peers empty to notify all peers who have configured indications. Peers that have not configured for indications will be skipped. Returns a stream which has items for each peer that confirms the notification, and terminates when all peers have either timed out or confirmed.

Implementors§