Enum GattEvent

Source
pub enum GattEvent<'stack, 'server, P: PacketPool> {
    Read(ReadEvent<'stack, 'server, P>),
    Write(WriteEvent<'stack, 'server, P>),
    Other(OtherEvent<'stack, 'server, P>),
}
Expand description

An event returned while processing GATT requests.

Variants§

§

Read(ReadEvent<'stack, 'server, P>)

A characteristic was read.

§

Write(WriteEvent<'stack, 'server, P>)

A characteristic was written.

§

Other(OtherEvent<'stack, 'server, P>)

Other event.

Implementations§

Source§

impl<'stack, 'server, P: PacketPool> GattEvent<'stack, 'server, P>

Source

pub fn new( data: GattData<'stack, P>, server: &'server dyn DynamicAttributeServer<P>, ) -> Self

Create a new GATT event from the provided GattData and DynamicAttributeServer.

Source

pub fn accept(self) -> Result<Reply<'stack, P>, Error>

Accept the event, making it processed by the server.

Source

pub fn reject(self, err: AttErrorCode) -> Result<Reply<'stack, P>, Error>

Reject the event with the provided error code, it will not be processed by the attribute server.

Source

pub fn payload(&self) -> &GattData<'stack, P>

Get a reference to the underlying GattData payload that this event is enclosing

Source

pub fn into_payload(self) -> GattData<'stack, P>

Convert the event back into the GattData payload it is enclosing

Allows for custom processing of the enclosed data, as in handling payloads which are not supported yet by the enclosed attribute server. Note that this will consume the event, so it would be up to the caller to respond to the incoming payload if needed and however they see fit.

Auto Trait Implementations§

§

impl<'stack, 'server, P> Freeze for GattEvent<'stack, 'server, P>
where <P as PacketPool>::Packet: Freeze,

§

impl<'stack, 'server, P> !RefUnwindSafe for GattEvent<'stack, 'server, P>

§

impl<'stack, 'server, P> !Send for GattEvent<'stack, 'server, P>

§

impl<'stack, 'server, P> !Sync for GattEvent<'stack, 'server, P>

§

impl<'stack, 'server, P> Unpin for GattEvent<'stack, 'server, P>
where <P as PacketPool>::Packet: Unpin,

§

impl<'stack, 'server, P> !UnwindSafe for GattEvent<'stack, 'server, P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.