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>
impl<'stack, 'server, P: PacketPool> GattEvent<'stack, 'server, P>
Sourcepub fn new(
data: GattData<'stack, P>,
server: &'server dyn DynamicAttributeServer<P>,
) -> Self
pub fn new( data: GattData<'stack, P>, server: &'server dyn DynamicAttributeServer<P>, ) -> Self
Create a new GATT event from the provided GattData
and DynamicAttributeServer
.
Sourcepub fn accept(self) -> Result<Reply<'stack, P>, Error>
pub fn accept(self) -> Result<Reply<'stack, P>, Error>
Accept the event, making it processed by the server.
Sourcepub fn reject(self, err: AttErrorCode) -> Result<Reply<'stack, P>, Error>
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.
Sourcepub fn payload(&self) -> &GattData<'stack, P>
pub fn payload(&self) -> &GattData<'stack, P>
Get a reference to the underlying GattData
payload that this event is enclosing
Sourcepub fn into_payload(self) -> GattData<'stack, P>
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.