Trait bluenrg::gatt::Commands[][src]

pub trait Commands {
    type Error;
    fn init(&mut self) -> Result<(), Self::Error>;
fn add_service(
        &mut self,
        params: &AddServiceParameters
    ) -> Result<(), Self::Error>;
fn include_service(
        &mut self,
        params: &IncludeServiceParameters
    ) -> Result<(), Self::Error>;
fn add_characteristic(
        &mut self,
        params: &AddCharacteristicParameters
    ) -> Result<(), Self::Error>;
fn add_characteristic_descriptor<'a>(
        &mut self,
        params: &AddDescriptorParameters<'a>
    ) -> Result<(), Error<Self::Error>>;
fn update_characteristic_value<'a>(
        &mut self,
        params: &UpdateCharacteristicValueParameters<'a>
    ) -> Result<(), Error<Self::Error>>;
fn delete_characteristic(
        &mut self,
        service: ServiceHandle,
        characteristic: CharacteristicHandle
    ) -> Result<(), Self::Error>;
fn delete_service(
        &mut self,
        service: ServiceHandle
    ) -> Result<(), Self::Error>;
fn delete_included_service(
        &mut self,
        params: &DeleteIncludedServiceParameters
    ) -> Result<(), Self::Error>;
fn set_event_mask(&mut self, mask: Event) -> Result<(), Self::Error>;
fn exchange_configuration(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), Self::Error>;
fn find_information_request(
        &mut self,
        conn_handle: ConnectionHandle,
        attribute_range: Range<CharacteristicHandle>
    ) -> Result<(), Self::Error>;
fn find_by_type_value_request(
        &mut self,
        params: &FindByTypeValueParameters
    ) -> Result<(), Error<Self::Error>>;
fn read_by_type_request(
        &mut self,
        params: &ReadByTypeParameters
    ) -> Result<(), Self::Error>;
fn read_by_group_type_request(
        &mut self,
        params: &ReadByTypeParameters
    ) -> Result<(), Self::Error>;
fn prepare_write_request<'a>(
        &mut self,
        params: &WriteRequest<'a>
    ) -> Result<(), Error<Self::Error>>;
fn execute_write_request(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), Self::Error>;
fn cancel_write_request(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), Self::Error>;
fn discover_all_primary_services(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), Self::Error>;
fn discover_primary_services_by_uuid(
        &mut self,
        conn_handle: ConnectionHandle,
        uuid: Uuid
    ) -> Result<(), Self::Error>;
fn find_included_services(
        &mut self,
        conn_handle: ConnectionHandle,
        service_handle_range: Range<ServiceHandle>
    ) -> Result<(), Self::Error>;
fn discover_all_characteristics_of_service(
        &mut self,
        conn_handle: ConnectionHandle,
        attribute_handle_range: Range<CharacteristicHandle>
    ) -> Result<(), Self::Error>;
fn discover_characteristics_by_uuid(
        &mut self,
        conn_handle: ConnectionHandle,
        attribute_handle_range: Range<CharacteristicHandle>,
        uuid: Uuid
    ) -> Result<(), Self::Error>;
fn discover_all_characteristic_descriptors(
        &mut self,
        conn_handle: ConnectionHandle,
        characteristic_handle_range: Range<CharacteristicHandle>
    ) -> Result<(), Self::Error>;
fn read_characteristic_value(
        &mut self,
        conn_handle: ConnectionHandle,
        characteristic_handle: CharacteristicHandle
    ) -> Result<(), Self::Error>;
fn read_characteristic_using_uuid(
        &mut self,
        conn_handle: ConnectionHandle,
        characteristic_handle_range: Range<CharacteristicHandle>,
        uuid: Uuid
    ) -> Result<(), Self::Error>;
fn read_long_characteristic_value(
        &mut self,
        params: &LongCharacteristicReadParameters
    ) -> Result<(), Self::Error>;
fn read_multiple_characteristic_values<'a>(
        &mut self,
        params: &MultipleCharacteristicReadParameters<'a>
    ) -> Result<(), Error<Self::Error>>;
fn write_characteristic_value<'a>(
        &mut self,
        params: &CharacteristicValue<'a>
    ) -> Result<(), Error<Self::Error>>;
fn write_long_characteristic_value<'a>(
        &mut self,
        params: &LongCharacteristicValue<'a>
    ) -> Result<(), Error<Self::Error>>;
fn write_characteristic_value_reliably<'a>(
        &mut self,
        params: &LongCharacteristicValue<'a>
    ) -> Result<(), Error<Self::Error>>;
fn write_long_characteristic_descriptor<'a>(
        &mut self,
        params: &LongCharacteristicValue<'a>
    ) -> Result<(), Error<Self::Error>>;
fn read_long_characteristic_descriptor(
        &mut self,
        params: &LongCharacteristicReadParameters
    ) -> Result<(), Self::Error>;
fn write_characteristic_descriptor<'a>(
        &mut self,
        params: &CharacteristicValue<'a>
    ) -> Result<(), Error<Self::Error>>;
fn read_characteristic_descriptor(
        &mut self,
        conn_handle: ConnectionHandle,
        characteristic_handle: CharacteristicHandle
    ) -> Result<(), Self::Error>;
fn write_without_response<'a>(
        &mut self,
        params: &CharacteristicValue<'a>
    ) -> Result<(), Error<Self::Error>>;
fn signed_write_without_response<'a>(
        &mut self,
        params: &CharacteristicValue<'a>
    ) -> Result<(), Error<Self::Error>>;
fn confirm_indication(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), Self::Error>;
fn write_response<'a>(
        &mut self,
        params: &WriteResponseParameters<'a>
    ) -> Result<(), Error<Self::Error>>;
fn allow_read(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), Self::Error>;
fn set_security_permission(
        &mut self,
        params: &SecurityPermissionParameters
    ) -> Result<(), Self::Error>;
fn set_descriptor_value<'a>(
        &mut self,
        params: &DescriptorValueParameters<'a>
    ) -> Result<(), Error<Self::Error>>;
fn read_handle_value(
        &mut self,
        handle: CharacteristicHandle
    ) -> Result<(), Self::Error>;
fn read_handle_value_offset(
        &mut self,
        handle: CharacteristicHandle,
        offset: usize
    ) -> Result<(), Self::Error>;
fn update_long_characteristic_value<'a>(
        &mut self,
        params: &UpdateLongCharacteristicValueParameters<'a>
    ) -> Result<(), Error<Self::Error>>; }

GATT-specific commands for the ActiveBlueNRG.

Associated Types

Type of communication errors.

Required Methods

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.

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.

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.

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.

Add a characteristic descriptor to a service.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

Reads the value of the attribute handle specified from the local GATT database.

Errors

Only underlying communication errors are reported.

Generated events

A command complete event is generated when this command is processed.

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.

Update the Attribute Value of a Characteristic belonging to a specified service.

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.

Implementors