pub struct WriteEvent<'stack, 'server, P: PacketPool> { /* private fields */ }Expand description
A characteristic write event returned while processing GATT requests.
Implementations§
Source§impl<'stack, P: PacketPool> WriteEvent<'stack, '_, P>
impl<'stack, P: PacketPool> WriteEvent<'stack, '_, P>
Sourcepub fn value<T: FromGatt>(
&self,
_c: &Characteristic<T>,
) -> Result<T, FromGattError>
pub fn value<T: FromGatt>( &self, _c: &Characteristic<T>, ) -> Result<T, FromGattError>
Characteristic data to be written
Sourcepub fn validate(&self, len: usize, capacity: usize) -> Result<(), AttErrorCode>
pub fn validate(&self, len: usize, capacity: usize) -> Result<(), AttErrorCode>
Validate the offset and length of the write request against the attribute’s len and capacity
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.
Automatically called if drop() is invoked.
Sourcepub fn accept_unprocessed(self) -> Result<Reply<'stack, P>, Error>
pub fn accept_unprocessed(self) -> Result<Reply<'stack, P>, Error>
Accept the event without server processing.
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.