pub trait GattCommands {
Show 51 methods
// Required methods
async fn init(&mut self);
async fn add_service(&mut self, params: &AddServiceParameters);
async fn include_service(&mut self, params: &IncludeServiceParameters);
async fn add_characteristic(&mut self, params: &AddCharacteristicParameters);
async fn add_characteristic_descriptor(
&mut self,
params: &AddDescriptorParameters<'_>,
) -> Result<(), Error>;
async fn update_characteristic_value(
&mut self,
params: &UpdateCharacteristicValueParameters<'_>,
) -> Result<(), Error>;
async fn delete_characteristic(
&mut self,
service: AttributeHandle,
characteristic: AttributeHandle,
);
async fn delete_service(&mut self, service: AttributeHandle);
async fn delete_included_service(
&mut self,
params: &DeleteIncludedServiceParameters,
);
async fn set_event_mask(&mut self, mask: Event);
async fn exchange_configuration(&mut self, conn_handle: ConnectionHandle);
async fn find_information_request(
&mut self,
conn_handle: ConnectionHandle,
attribute_range: Range<AttributeHandle>,
);
async fn find_by_type_value_request(
&mut self,
params: &FindByTypeValueParameters<'_>,
) -> Result<(), Error>;
async fn read_by_type_request(&mut self, params: &ReadByTypeParameters);
async fn read_by_group_type_request(
&mut self,
params: &ReadByTypeParameters,
);
async fn prepare_write_request(
&mut self,
params: &WriteRequest<'_>,
) -> Result<(), Error>;
async fn execute_write_request(&mut self, conn_handle: ConnectionHandle);
async fn cancel_write_request(&mut self, conn_handle: ConnectionHandle);
async fn discover_all_primary_services(
&mut self,
conn_handle: ConnectionHandle,
);
async fn discover_primary_services_by_uuid(
&mut self,
conn_handle: ConnectionHandle,
uuid: Uuid,
);
async fn find_included_services(
&mut self,
conn_handle: ConnectionHandle,
service_handle_range: Range<AttributeHandle>,
);
async fn discover_all_characteristics_of_service(
&mut self,
conn_handle: ConnectionHandle,
attribute_handle_range: Range<AttributeHandle>,
);
async fn discover_characteristics_by_uuid(
&mut self,
conn_handle: ConnectionHandle,
attribute_handle_range: Range<AttributeHandle>,
uuid: Uuid,
);
async fn discover_all_characteristic_descriptors(
&mut self,
conn_handle: ConnectionHandle,
characteristic_handle_range: Range<AttributeHandle>,
);
async fn read_characteristic_value(
&mut self,
conn_handle: ConnectionHandle,
characteristic_handle: AttributeHandle,
);
async fn read_characteristic_using_uuid(
&mut self,
conn_handle: ConnectionHandle,
characteristic_handle_range: Range<AttributeHandle>,
uuid: Uuid,
);
async fn read_long_characteristic_value(
&mut self,
params: &LongCharacteristicReadParameters,
);
async fn read_multiple_characteristic_values(
&mut self,
params: &MultipleCharacteristicReadParameters<'_>,
) -> Result<(), Error>;
async fn write_characteristic_value(
&mut self,
params: &CharacteristicValue<'_>,
) -> Result<(), Error>;
async fn write_long_characteristic_value(
&mut self,
params: &LongCharacteristicValue<'_>,
) -> Result<(), Error>;
async fn write_characteristic_value_reliably(
&mut self,
params: &LongCharacteristicValue<'_>,
) -> Result<(), Error>;
async fn write_long_characteristic_descriptor(
&mut self,
params: &LongCharacteristicValue<'_>,
) -> Result<(), Error>;
async fn read_long_characteristic_descriptor(
&mut self,
params: &LongCharacteristicReadParameters,
);
async fn write_characteristic_descriptor(
&mut self,
params: &CharacteristicValue<'_>,
) -> Result<(), Error>;
async fn read_characteristic_descriptor(
&mut self,
conn_handle: ConnectionHandle,
characteristic_handle: AttributeHandle,
);
async fn write_without_response(
&mut self,
params: &CharacteristicValue<'_>,
) -> Result<(), Error>;
async fn signed_write_without_response(
&mut self,
params: &CharacteristicValue<'_>,
) -> Result<(), Error>;
async fn confirm_indication(&mut self, conn_handle: ConnectionHandle);
async fn write_response(
&mut self,
params: &WriteResponseParameters<'_>,
) -> Result<(), Error>;
async fn allow_read(&mut self, conn_handle: ConnectionHandle);
async fn set_security_permission(
&mut self,
params: &SecurityPermissionParameters,
);
async fn set_descriptor_value(
&mut self,
params: &DescriptorValueParameters<'_>,
) -> Result<(), Error>;
async fn read_handle_value_offset(
&mut self,
handle: AttributeHandle,
offset: usize,
);
async fn update_characteristic_value_ext(
&mut self,
params: &UpdateCharacteristicValueExt<'_>,
) -> Result<(), Error>;
async fn deny_read(&mut self, handle: ConnectionHandle, err: u8);
async fn set_access_permission(
&mut self,
service: AttributeHandle,
attribute: AttributeHandle,
permissions: AccessPermission,
);
async fn store_database(&mut self);
async fn send_multiple_notification(
&mut self,
conn_handle: ConnectionHandle,
handles: &[AttributeHandle],
);
async fn read_multiple_variable_characteristic_value(
&mut self,
conn_handle: ConnectionHandle,
handles: &[AttributeHandle],
);
// Provided methods
async fn init_gatt(&mut self) { ... }
async fn set_gatt_event_mask(&mut self, mask: Event) { ... }
}
Expand description
GATT-specific.
Required Methods§
Sourceasync fn init(&mut self)
async fn init(&mut self)
Initialize the GATT server on the slave device. Initialize all the pools and active nodes. Also it adds GATT service with service changed characteristic. Until this command is issued the GATT channel will not process any commands even if the connection is opened. This command has to be given before using any of the GAP features.
§Errors
Only underlying communication errors are reported.
§Generated events
A Command Complete event is generated.
Sourceasync fn add_service(&mut self, params: &AddServiceParameters)
async fn add_service(&mut self, params: &AddServiceParameters)
Add a service to GATT Server.
When a service is created in the server, the host needs to reserve the handle ranges for
this service using max_attribute_records
.
This parameter specifies the maximum number of attribute records that can be added to this
service (including the service attribute, include attribute, characteristic attribute,
characteristic value attribute and characteristic descriptor attribute). Handle of the
created service is returned in command complete event.
§Errors
Only underlying communication errors are reported.
§Generated events
A Command complete event is generated.
Sourceasync fn include_service(&mut self, params: &IncludeServiceParameters)
async fn include_service(&mut self, params: &IncludeServiceParameters)
Include a service to another service.
Attribute server creates an INCLUDE definition attribute.
§Errors
Only underlying communication errors are reported.
§Generated events
A Command complete event is generated.
Sourceasync fn add_characteristic(&mut self, params: &AddCharacteristicParameters)
async fn add_characteristic(&mut self, params: &AddCharacteristicParameters)
Add a characteristic to a service.
§Errors
Only underlying communication errors are reported.
§Generated events
When the command is completed, a command complete event will be generated by the controller which carries the status of the command and the handle of the characteristic as parameters.
Sourceasync fn add_characteristic_descriptor(
&mut self,
params: &AddDescriptorParameters<'_>,
) -> Result<(), Error>
async fn add_characteristic_descriptor( &mut self, params: &AddDescriptorParameters<'_>, ) -> Result<(), Error>
Add a characteristic descriptor to a service.
§Errors
- DescriptorTooLong if the descriptor value is longer than the maximum descriptor value length.
- DescriptorBufferTooLong if the descriptor value maximum length is so large that the serialized structure may be more than 255 bytes. The maximum size is 227.
- Underlying communication errors.
§Generated events
When this command is completed, a command complete event will be generated by the controller which carries the status of the command and the handle of the characteristic descriptor.
Sourceasync fn update_characteristic_value(
&mut self,
params: &UpdateCharacteristicValueParameters<'_>,
) -> Result<(), Error>
async fn update_characteristic_value( &mut self, params: &UpdateCharacteristicValueParameters<'_>, ) -> Result<(), Error>
Update a characteristic value in a service.
§Errors
- ValueBufferTooLong if the [characteristic value](UpdateCharacteristicValueParameters::value] is so long that the command packet would exceed 255 bytes. The maximum allowed length is 249 bytes.
- Underlying communication errors.
§Generated events
When the command has completed, the controller will generate a command complete event.
Sourceasync fn delete_characteristic(
&mut self,
service: AttributeHandle,
characteristic: AttributeHandle,
)
async fn delete_characteristic( &mut self, service: AttributeHandle, characteristic: AttributeHandle, )
Delete the characteristic specified from the service.
§Errors
Only underlying communication errors are reported.
§Generated events
When the command has completed, the controller will generate a command complete event.
Sourceasync fn delete_service(&mut self, service: AttributeHandle)
async fn delete_service(&mut self, service: AttributeHandle)
Delete the service specified from the GATT server database.
§Errors
Only underlying communication errors are reported.
§Generated events
When the command has completed, the controller will generate a command complete event.
Sourceasync fn delete_included_service(
&mut self,
params: &DeleteIncludedServiceParameters,
)
async fn delete_included_service( &mut self, params: &DeleteIncludedServiceParameters, )
Delete the Include definition from the service.
§Errors
Only underlying communication errors are reported.
§Generated events
When the command has completed, the controller will generate a command complete event.
Sourceasync fn set_event_mask(&mut self, mask: Event)
async fn set_event_mask(&mut self, mask: Event)
Allows masking events from the GATT.
The default configuration is all the events masked.
§Errors
Only underlying communication errors are reported.
§Generated events
A command complete event is generated on the completion of the command.
Sourceasync fn exchange_configuration(&mut self, conn_handle: ConnectionHandle)
async fn exchange_configuration(&mut self, conn_handle: ConnectionHandle)
Perform an ATT MTU exchange.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. When the ATT MTU exchange procedure is completed, an Exchange MTU Response event is generated. Also, a procedure complete event is generated to indicate end of procedure.
Sourceasync fn find_information_request(
&mut self,
conn_handle: ConnectionHandle,
attribute_range: Range<AttributeHandle>,
)
async fn find_information_request( &mut self, conn_handle: ConnectionHandle, attribute_range: Range<AttributeHandle>, )
Post the Find information request.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Find Information Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn find_by_type_value_request(
&mut self,
params: &FindByTypeValueParameters<'_>,
) -> Result<(), Error>
async fn find_by_type_value_request( &mut self, params: &FindByTypeValueParameters<'_>, ) -> Result<(), Error>
Post the Find by type value request.
§Errors
- ValueBufferTooLong if the attribute value to find is too long to fit in one command packet (255 bytes). The maximum length is 246 bytes.
- Underlying communication errors.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Find by Type Value Response event. The end of the procedure is indicated by a Gatt Procedure Complete event.
Sourceasync fn read_by_type_request(&mut self, params: &ReadByTypeParameters)
async fn read_by_type_request(&mut self, params: &ReadByTypeParameters)
Send a Read By Type Request.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read by Type Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn read_by_group_type_request(&mut self, params: &ReadByTypeParameters)
async fn read_by_group_type_request(&mut self, params: &ReadByTypeParameters)
Sends a Read By Group Type request.
The Read By Group Type Request is used to obtain the values of grouping attributes where the attribute type is known but the handle is not known. Grouping attributes are defined at GATT layer. The grouping attribute types are: Primary Service, Secondary Service and Characteristic.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read by Group Type Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn prepare_write_request(
&mut self,
params: &WriteRequest<'_>,
) -> Result<(), Error>
async fn prepare_write_request( &mut self, params: &WriteRequest<'_>, ) -> Result<(), Error>
Sends a Prepare Write request.
§Errors
- ValueBufferTooLong if the attribute value is so long that the serialized command would be longer than 255 bytes. The maximum length is 248 bytes.
- Underlying comminication errors
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Prepare Write Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn execute_write_request(&mut self, conn_handle: ConnectionHandle)
async fn execute_write_request(&mut self, conn_handle: ConnectionHandle)
Sends an Execute Write Request to write all pending prepared writes.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The result of the procedure is given through the Execute Write Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn cancel_write_request(&mut self, conn_handle: ConnectionHandle)
async fn cancel_write_request(&mut self, conn_handle: ConnectionHandle)
Sends an Execute Write Request to discard prepared writes.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The result of the procedure is given through the Execute Write Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn discover_all_primary_services(&mut self, conn_handle: ConnectionHandle)
async fn discover_all_primary_services(&mut self, conn_handle: ConnectionHandle)
This command will start the GATT client procedure to discover all primary services on the server.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read By Group Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn discover_primary_services_by_uuid(
&mut self,
conn_handle: ConnectionHandle,
uuid: Uuid,
)
async fn discover_primary_services_by_uuid( &mut self, conn_handle: ConnectionHandle, uuid: Uuid, )
This command will start the procedure to discover the primary services of the specified UUID on the server.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Find By Type Value Response event. The end of the procedure is indicated by a Gatt Procedure Complete event.
Sourceasync fn find_included_services(
&mut self,
conn_handle: ConnectionHandle,
service_handle_range: Range<AttributeHandle>,
)
async fn find_included_services( &mut self, conn_handle: ConnectionHandle, service_handle_range: Range<AttributeHandle>, )
Start the procedure to find all included services.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read By Type Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn discover_all_characteristics_of_service(
&mut self,
conn_handle: ConnectionHandle,
attribute_handle_range: Range<AttributeHandle>,
)
async fn discover_all_characteristics_of_service( &mut self, conn_handle: ConnectionHandle, attribute_handle_range: Range<AttributeHandle>, )
Start the procedure to discover all the characteristics of a given service.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read By Type Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn discover_characteristics_by_uuid(
&mut self,
conn_handle: ConnectionHandle,
attribute_handle_range: Range<AttributeHandle>,
uuid: Uuid,
)
async fn discover_characteristics_by_uuid( &mut self, conn_handle: ConnectionHandle, attribute_handle_range: Range<AttributeHandle>, uuid: Uuid, )
Start the procedure to discover all the characteristics specified by the UUID.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Discover or Read Characteristic By UUID event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn discover_all_characteristic_descriptors(
&mut self,
conn_handle: ConnectionHandle,
characteristic_handle_range: Range<AttributeHandle>,
)
async fn discover_all_characteristic_descriptors( &mut self, conn_handle: ConnectionHandle, characteristic_handle_range: Range<AttributeHandle>, )
Start the procedure to discover all characteristic descriptors on the server.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Find Information Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn read_characteristic_value(
&mut self,
conn_handle: ConnectionHandle,
characteristic_handle: AttributeHandle,
)
async fn read_characteristic_value( &mut self, conn_handle: ConnectionHandle, characteristic_handle: AttributeHandle, )
Start the procedure to read the attribute value.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn read_characteristic_using_uuid(
&mut self,
conn_handle: ConnectionHandle,
characteristic_handle_range: Range<AttributeHandle>,
uuid: Uuid,
)
async fn read_characteristic_using_uuid( &mut self, conn_handle: ConnectionHandle, characteristic_handle_range: Range<AttributeHandle>, uuid: Uuid, )
Start the procedure to read all the characteristics specified by the UUID.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Discover or Read Characteristic by UUID event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn read_long_characteristic_value(
&mut self,
params: &LongCharacteristicReadParameters,
)
async fn read_long_characteristic_value( &mut self, params: &LongCharacteristicReadParameters, )
Start the procedure to read a long characteristic value.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read Blob Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn read_multiple_characteristic_values(
&mut self,
params: &MultipleCharacteristicReadParameters<'_>,
) -> Result<(), Error>
async fn read_multiple_characteristic_values( &mut self, params: &MultipleCharacteristicReadParameters<'_>, ) -> Result<(), Error>
Start a procedure to read multiple characteristic values from a server.
This sub-procedure is used to read multiple Characteristic Values from a server when the client knows the Characteristic Value Handles.
§Errors
- TooManyHandlesToRead if the number of handles to read would cause the length of the serialized command to exceed 255 bytes. The maximum number of handles is 126.
- Underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read Multiple Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn write_characteristic_value(
&mut self,
params: &CharacteristicValue<'_>,
) -> Result<(), Error>
async fn write_characteristic_value( &mut self, params: &CharacteristicValue<'_>, ) -> Result<(), Error>
Start the procedure to write a characteristic value.
§Errors
- ValueBufferTooLong if the value is too long to fit in one command packet. The maximum length is 250 bytes.
- Underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. When the procedure is completed, a GATT Procedure Complete event is generated.
Sourceasync fn write_long_characteristic_value(
&mut self,
params: &LongCharacteristicValue<'_>,
) -> Result<(), Error>
async fn write_long_characteristic_value( &mut self, params: &LongCharacteristicValue<'_>, ) -> Result<(), Error>
Start the procedure to write a long characteristic value.
§Errors
- ValueBufferTooLong if the value is too long to fit in one command packet. The maximum length is 248 bytes.
- Underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Prepare Write Response and Execute Write Response events. When the procedure is completed, a GATT Procedure Complete event is generated.
Sourceasync fn write_characteristic_value_reliably(
&mut self,
params: &LongCharacteristicValue<'_>,
) -> Result<(), Error>
async fn write_characteristic_value_reliably( &mut self, params: &LongCharacteristicValue<'_>, ) -> Result<(), Error>
Start the procedure to write a characteristic reliably.
§Errors
- ValueBufferTooLong if the value is too long to fit in one command packet. The maximum length is 248 bytes.
- Underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Prepare Write Response and Execute Write Response events. When the procedure is completed, a GATT Procedure Complete event is generated.
Sourceasync fn write_long_characteristic_descriptor(
&mut self,
params: &LongCharacteristicValue<'_>,
) -> Result<(), Error>
async fn write_long_characteristic_descriptor( &mut self, params: &LongCharacteristicValue<'_>, ) -> Result<(), Error>
Start the procedure to write a long characteristic descriptor.
§Errors
- ValueBufferTooLong if the value is too long to fit in one command packet. The maximum length is 248 bytes.
- Underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Prepare Write Response and Execute Write Response events. When the procedure is completed, a GATT Procedure Complete event is generated.
Sourceasync fn read_long_characteristic_descriptor(
&mut self,
params: &LongCharacteristicReadParameters,
)
async fn read_long_characteristic_descriptor( &mut self, params: &LongCharacteristicReadParameters, )
Start the procedure to read a long characteristic descriptor.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read Blob Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn write_characteristic_descriptor(
&mut self,
params: &CharacteristicValue<'_>,
) -> Result<(), Error>
async fn write_characteristic_descriptor( &mut self, params: &CharacteristicValue<'_>, ) -> Result<(), Error>
Start the procedure to write a characteristic descriptor value.
§Errors
- ValueBufferTooLong if the value is too long to fit in one command packet. The maximum length is 250 bytes.
- Underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. When the procedure is completed, a GATT Procedure Complete event is generated.
Sourceasync fn read_characteristic_descriptor(
&mut self,
conn_handle: ConnectionHandle,
characteristic_handle: AttributeHandle,
)
async fn read_characteristic_descriptor( &mut self, conn_handle: ConnectionHandle, characteristic_handle: AttributeHandle, )
Start the procedure to read a characteristic descriptor.
§Errors
Only underlying communication errors are reported.
§Generated events
A command status event is generated on the receipt of the command. The responses of the procedure are given through the Read Response event. The end of the procedure is indicated by a GATT Procedure Complete event.
Sourceasync fn write_without_response(
&mut self,
params: &CharacteristicValue<'_>,
) -> Result<(), Error>
async fn write_without_response( &mut self, params: &CharacteristicValue<'_>, ) -> Result<(), Error>
Start the procedure to write a characteristic value without waiting for any response from the server.
§Errors
- ValueBufferTooLong if the value is too long to fit in one command packet. The maximum length is 250 bytes.
- Underlying communication errors are reported.
§Generated events
A command complete event is generated when this command is processed.
Sourceasync fn signed_write_without_response(
&mut self,
params: &CharacteristicValue<'_>,
) -> Result<(), Error>
async fn signed_write_without_response( &mut self, params: &CharacteristicValue<'_>, ) -> Result<(), Error>
Start the procedure to write a characteristic value with an authentication signature without waiting for any response from the server. It cannot be used when the link is encrypted.
§Errors
- ValueBufferTooLong if the value is too long to fit in one command packet. The maximum length is 250 bytes.
- Underlying communication errors are reported.
§Generated events
A command complete event is generated when this command is processed.
Sourceasync fn confirm_indication(&mut self, conn_handle: ConnectionHandle)
async fn confirm_indication(&mut self, conn_handle: ConnectionHandle)
Allow application to confirm indication. This command has to be sent when the application receives the GATT Indication event.
§Errors
Only underlying communication errors are reported.
§Generated events
A command complete event is generated when this command is processed.
Sourceasync fn write_response(
&mut self,
params: &WriteResponseParameters<'_>,
) -> Result<(), Error>
async fn write_response( &mut self, params: &WriteResponseParameters<'_>, ) -> Result<(), Error>
Allows or rejects a write request from a client.
This command has to be sent by the application when it receives the GATT Write Permit Request event.
§Errors
- ValueBufferTooLong if the attribute value is so long that the serialized command cannot fit in one packet. The maximum length is 250 bytes.
- Underlying communication errors are reported.
§Generated events
A command complete event is generated when this command is processed.
Sourceasync fn allow_read(&mut self, conn_handle: ConnectionHandle)
async fn allow_read(&mut self, conn_handle: ConnectionHandle)
Allows the GATT server to send a response to a read request from a client.
The application has to send this command when it receives the
Read Permit Request or
Read Multiple Permit Request.
This command indicates to the stack that the response can be sent to the client. So if the application wishes to
update any of the attributes before they are read by the client, it has to update the
characteristic values using the
update_characteristic_value
and then give this
command. The application should perform the required operations within 30 seconds.
Otherwise the GATT procedure will timeout.
§Errors
Only underlying communication errors are reported.
§Generated events
A command complete event is generated when this command is processed.
Sourceasync fn set_security_permission(
&mut self,
params: &SecurityPermissionParameters,
)
async fn set_security_permission( &mut self, params: &SecurityPermissionParameters, )
This command sets the security permission for the attribute handle specified. Currently the setting of security permission is allowed only for client configuration descriptor.
§Errors
Only underlying communication errors are reported.
§Generated events
A command complete event is generated when this command is processed.
Sourceasync fn set_descriptor_value(
&mut self,
params: &DescriptorValueParameters<'_>,
) -> Result<(), Error>
async fn set_descriptor_value( &mut self, params: &DescriptorValueParameters<'_>, ) -> Result<(), Error>
This command sets the value of a descriptor.
§Errors
- ValueBufferTooLong if the length of the descriptor value is so long that the serialized command would not fit in one packet. The maximum length is 246 bytes.
- Underlying communication errors are reported.
§Generated events
A command complete event is generated when this command is processed.
Sourceasync fn read_handle_value_offset(
&mut self,
handle: AttributeHandle,
offset: usize,
)
async fn read_handle_value_offset( &mut self, handle: AttributeHandle, offset: usize, )
The command returns the value of the attribute handle from the specified offset.
If the length to be returned is greater than 128, then only 128 bytes are returned. The application should send this command with incremented offsets until it gets an error with the offset it specified or the number of byes of attribute value returned is less than 128.
§Errors
Only underlying communication errors are reported.
§Generated events
A command complete event is generated when this command is processed.
Sourceasync fn update_characteristic_value_ext(
&mut self,
params: &UpdateCharacteristicValueExt<'_>,
) -> Result<(), Error>
async fn update_characteristic_value_ext( &mut self, params: &UpdateCharacteristicValueExt<'_>, ) -> Result<(), Error>
This is a more flexible version of ACI_GATT_UPDATE_CHAR_VALUE tp support update of Long attribute up to 512 bytes and indicate selectively the generation of Indication/Notification
This command is an extension of the
update_characteristic_value
command and supports
updating of long attribute values (up to 512 bytes).
§Errors
- ValueBufferTooLong if the characteristic value is so long that the command would not fit in one packet. The maximum length is 245 bytes.
- Underlying communication errors are reported.
§Generated events
When the command has completed, the controller will generate a command complete event.
Sourceasync fn deny_read(&mut self, handle: ConnectionHandle, err: u8)
async fn deny_read(&mut self, handle: ConnectionHandle, err: u8)
This command is used to deny the GATT server to send a response to a read request from a client.
The application may send this command when it receives the ATT Read Permit Request or ATT Read Multiple Permit Request.
This command indicates to the stack that the client is not allowed to read the requested characteristic due to e.g. application restrictions.
The error code shall be either 0x08
(Insufficient Authorization) or a value in the range
0x80 .. 0x9F
(Application Error).
The application should issue the GATT Allow Read or Gatt Deny Read command within 30 seconds from the receipt of the ATT Read Permit Request or the ATT Read Multiple Permit Request events; otherwise the GATT procedure issues a timeout
Sourceasync fn set_access_permission(
&mut self,
service: AttributeHandle,
attribute: AttributeHandle,
permissions: AccessPermission,
)
async fn set_access_permission( &mut self, service: AttributeHandle, attribute: AttributeHandle, permissions: AccessPermission, )
This command sets the access permission for the attribute handle specified.
Sourceasync fn store_database(&mut self)
async fn store_database(&mut self)
This command forces the saving of the GATT database for all active connections. Note that, by default, the GATT database is saved per active connection at the time of disconnecting.
Sourceasync fn send_multiple_notification(
&mut self,
conn_handle: ConnectionHandle,
handles: &[AttributeHandle],
)
async fn send_multiple_notification( &mut self, conn_handle: ConnectionHandle, handles: &[AttributeHandle], )
This commad sends a Multiple Handle Value Notification over the ATT bearer specified in parameter. The handles provided as parameters must be the handles of the characteristic declarations.
Sourceasync fn read_multiple_variable_characteristic_value(
&mut self,
conn_handle: ConnectionHandle,
handles: &[AttributeHandle],
)
async fn read_multiple_variable_characteristic_value( &mut self, conn_handle: ConnectionHandle, handles: &[AttributeHandle], )
Starts a procedure to read multiple variable length characteristic values from a server;
This command must specify the handles of the characteristic values to be read.
When the procedure is completed, a GATT ProcedureComplete event is generated, Before procedure completion, the response packets are given through ATT Read Multiple Response event.
Provided Methods§
Sourceasync fn init_gatt(&mut self)
async fn init_gatt(&mut self)
Initialize the GATT server on a slave device.
This function exists to prevent name conflicts with other Commands traits’ init methods.
Sourceasync fn set_gatt_event_mask(&mut self, mask: Event)
async fn set_gatt_event_mask(&mut self, mask: Event)
Allows masking events from the GATT.
This function exists to prevent name conflicts with other Commands traits’ set_event_mask methods.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.