[][src]Trait bluetooth_hci::host::Hci

pub trait Hci<E> {
    type VS;
    fn disconnect(
        &mut self,
        conn_handle: ConnectionHandle,
        reason: Status<Self::VS>
    ) -> Result<(), Error<E, Self::VS>>;
fn read_remote_version_information(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), E>;
fn set_event_mask(&mut self, mask: EventFlags) -> Result<(), E>;
fn reset(&mut self) -> Result<(), E>;
fn read_tx_power_level(
        &mut self,
        conn_handle: ConnectionHandle,
        power_level_type: TxPowerLevel
    ) -> Result<(), E>;
fn read_local_version_information(&mut self) -> Result<(), E>;
fn read_local_supported_commands(&mut self) -> Result<(), E>;
fn read_local_supported_features(&mut self) -> Result<(), E>;
fn read_bd_addr(&mut self) -> Result<(), E>;
fn read_rssi(&mut self, conn_handle: ConnectionHandle) -> Result<(), E>;
fn le_set_event_mask(&mut self, event_mask: LeEventFlags) -> Result<(), E>;
fn le_read_buffer_size(&mut self) -> Result<(), E>;
fn le_read_local_supported_features(&mut self) -> Result<(), E>;
fn le_set_random_address(
        &mut self,
        bd_addr: BdAddr
    ) -> Result<(), Error<E, Self::VS>>;
fn le_set_advertising_parameters(
        &mut self,
        params: &AdvertisingParameters
    ) -> Result<(), Error<E, Self::VS>>;
fn le_read_advertising_channel_tx_power(&mut self) -> Result<(), E>;
fn le_set_advertising_data(
        &mut self,
        data: &[u8]
    ) -> Result<(), Error<E, Self::VS>>;
fn le_set_scan_response_data(
        &mut self,
        data: &[u8]
    ) -> Result<(), Error<E, Self::VS>>;
fn le_set_advertise_enable(&mut self, enable: bool) -> Result<(), E>;
fn le_set_scan_parameters(
        &mut self,
        params: &ScanParameters
    ) -> Result<(), E>;
fn le_set_scan_enable(
        &mut self,
        enable: bool,
        filter_duplicates: bool
    ) -> Result<(), E>;
fn le_create_connection(
        &mut self,
        params: &ConnectionParameters
    ) -> Result<(), E>;
fn le_create_connection_cancel(&mut self) -> Result<(), E>;
fn le_read_white_list_size(&mut self) -> Result<(), E>;
fn le_clear_white_list(&mut self) -> Result<(), E>;
fn le_add_device_to_white_list(&mut self, addr: BdAddrType) -> Result<(), E>;
fn le_remove_device_from_white_list(
        &mut self,
        addr: BdAddrType
    ) -> Result<(), E>;
fn le_connection_update(
        &mut self,
        params: &ConnectionUpdateParameters
    ) -> Result<(), E>;
fn le_set_host_channel_classification(
        &mut self,
        channels: ChannelClassification
    ) -> Result<(), Error<E, Self::VS>>;
fn le_read_channel_map(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), E>;
fn le_read_remote_used_features(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), E>;
fn le_encrypt(&mut self, params: &AesParameters) -> Result<(), E>;
fn le_rand(&mut self) -> Result<(), E>;
fn le_start_encryption(
        &mut self,
        params: &EncryptionParameters
    ) -> Result<(), E>;
fn le_long_term_key_request_reply(
        &mut self,
        conn_handle: ConnectionHandle,
        key: &EncryptionKey
    ) -> Result<(), E>;
fn le_long_term_key_request_negative_reply(
        &mut self,
        conn_handle: ConnectionHandle
    ) -> Result<(), E>;
fn le_read_supported_states(&mut self) -> Result<(), E>;
fn le_receiver_test(
        &mut self,
        channel: u8
    ) -> Result<(), Error<E, Self::VS>>;
fn le_transmitter_test(
        &mut self,
        channel: u8,
        payload_length: usize,
        payload: TestPacketPayload
    ) -> Result<(), Error<E, Self::VS>>;
fn le_test_end(&mut self) -> Result<(), E>; }

Trait defining the interface from the host to the controller.

Defines one function for each command in the Bluetooth Specification Vol 2, Part E, Sections 7.1-7.6.

Specializations must define the error type E, used for communication errors.

An implementation is defined or all types that implement Controller.

Associated Types

type VS

Vendor-specific status codes.

Loading content...

Required methods

fn disconnect(
    &mut self,
    conn_handle: ConnectionHandle,
    reason: Status<Self::VS>
) -> Result<(), Error<E, Self::VS>>

Terminates an existing connection. All synchronous connections on a physical link should be disconnected before the ACL connection on the same physical connection is disconnected.

  • conn_handle indicates which connection is to be disconnected.
  • reason indicates the reason for ending the connection. The remote Controller will receive the Reason command parameter in the Disconnection Complete event.

See the Bluetooth spec, Vol 2, Part E, Section 7.1.6.

Errors

Generated Events

When the Controller receives the Disconnect command, it shall send the Command Status event to the Host. The Disconnection Complete event will occur at each Host when the termination of the connection has completed, and indicates that this command has been completed.

Note: No Command Complete event will be sent by the Controller to indicate that this command has been completed. Instead, the Disconnection Complete event will indicate that this command has been completed.

fn read_remote_version_information(
    &mut self,
    conn_handle: ConnectionHandle
) -> Result<(), E>

Obtains the values for the version information for the remote device identified by the conn_handle parameter, which must be a connection handle for an ACL or LE connection.

See the Bluetooth spec, Vol 2, Part E, Section 7.1.23.

Errors

Only underlying communication errors are reported.

Generated Events

When the Controller receives the Read Remote Version Information command, the Controller shall send the Command Status event to the Host. When the Link Manager or Link Layer has completed the sequence to determine the remote version information, the local Controller shall send a Read Remote Version Information Complete event to the Host. That event contains the status of this command, and parameters describing the version and subversion of the LMP or Link Layer used by the remote device.

Note: No Command Complete event will be sent by the Controller to indicate that this command has been completed. Instead, the Read Remote Version Information Complete event will indicate that this command has been completed.

fn set_event_mask(&mut self, mask: EventFlags) -> Result<(), E>

Controls which events are generated by the HCI for the Host. If the flag in the mask is set, then the event associated with that bit will be enabled. For an LE Controller, the LE Meta Event flag shall enable or disable all LE events (see Section 7.7.65). The Host has to deal with each event that occurs. The event mask allows the Host to control how much it is interrupted.

See the Bluetooth spec, Vol 2, Part E, Section 7.3.1.

Errors

Only underlying communication errors are reported.

Generated Events

A Command Complete event is generated.

fn reset(&mut self) -> Result<(), E>

Resets the Controller and the Link Manager on the BR/EDR Controller, the PAL on an AMP Controller, or the Link Layer on an LE Controller. If the Controller supports both BR/EDR and LE then the Reset command shall reset the Link Manager, Baseband and Link Layer. The Reset command shall not affect the used HCI transport layer since the HCI transport layers may have reset mechanisms of their own. After the reset is completed, the current operational state will be lost, the Controller will enter standby mode and the Controller will automatically revert to the default values for the parameters for which default values are defined in the specification.

Note: The Reset command will not necessarily perform a hardware reset. This is implementation defined. On an AMP Controller, the Reset command shall reset the service provided at the logical HCI to its initial state, but beyond this the exact effect on the Controller device is implementation defined and should not interrupt the service provided to other protocol stacks.

The Host shall not send additional HCI commands before the Command Complete event related to the Reset command has been received.

See the Bluetooth spec, Vol 2, Part E, Section 7.3.2.

Errors

Only underlying communication errors are reported.

Generated Events

A Command Complete event is generated.

fn read_tx_power_level(
    &mut self,
    conn_handle: ConnectionHandle,
    power_level_type: TxPowerLevel
) -> Result<(), E>

Reads the values for the transmit power level for the specified conn_handle. conn_handle shall be a connection handle for an ACL connection.

See the Bluetooth spec, Vol 2, Part E, Section 7.3.35.

Errors

Only underlying communication errors are reported.

Generated Events

A Comand Complete event is generated.

fn read_local_version_information(&mut self) -> Result<(), E>

This command reads the values for the version information for the local Controller.

Defined in Bluetooth Specification Vol 2, Part E, Section 7.4.1.

Errors

Only underlying communication errors are reported

Generated events

A Comand Complete event is generated.

fn read_local_supported_commands(&mut self) -> Result<(), E>

Reads the list of HCI commands supported for the local Controller.

This command shall return the supported commands configuration parameter. It is implied that if a command is listed as supported, the feature underlying that command is also supported.

See the Bluetooth Spec, Vol 2, Part E, Section 6.27 for more information.

See the Bluetooth spec, Vol 2, Part E, Section 7.4.2.

Errors

Only underlying communication errors are reported

Generated events

A Command Complete event is generated.

fn read_local_supported_features(&mut self) -> Result<(), E>

Requests a list of the supported features for the local BR/EDR Controller.

See the Bluetooth Spec, Vol 2, Part C, Section 3.3 for more information about the features.

See the Bluetooth spec, Vol 2, Part E, Section 7.4.3.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn read_bd_addr(&mut self) -> Result<(), E>

On a BR/EDR Controller, this command reads the Bluetooth Controller address (BD_ADDR).

On an LE Controller, this command shall read the Public Device Address as defined in the Bluetooth spec, Vol 6, Part B, Section 1.3. If this Controller does not have a Public Device Address, the value 0x000000000000 shall be returned.

On a BR/EDR/LE Controller, the public address shall be the same as the BD_ADDR.

See the Bluetooth spec, Vol 2, Part E, Section 7.4.6.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn read_rssi(&mut self, conn_handle: ConnectionHandle) -> Result<(), E>

Reads the Received Signal Strength Indication (RSSI) value from a Controller.

For a BR/EDR Controller, a connection handle is used as the Handle command parameter and return parameter. The RSSI parameter returns the difference between the measured Received Signal Strength Indication (RSSI) and the limits of the Golden Receive Power Range for a connection handle to another BR/EDR Controller. The connection handle must be a connection handle for an ACL connection. Any positive RSSI value returned by the Controller indicates how many dB the RSSI is above the upper limit, any negative value indicates how many dB the RSSI is below the lower limit. The value zero indicates that the RSSI is inside the Golden Receive Power Range.

Note: How accurate the dB values will be depends on the Bluetooth hardware. The only requirements for the hardware are that the BR/EDR Controller is able to tell whether the RSSI is inside, above or below the Golden Device Power Range.

The RSSI measurement compares the received signal power with two threshold levels, which define the Golden Receive Power Range. The lower threshold level corresponds to a received power between -56 dBm and 6 dB above the actual sensitivity of the receiver. The upper threshold level is 20 dB above the lower threshold level to an accuracy of +/- 6 dB.

For an AMP Controller, a physical link handle is used for the Handle command parameter and return parameter. The meaning of the RSSI metric is AMP type specific and defined in the AMP PALs (see Volume 5, Core System Package, AMP Controller volume).

For an LE transport, a connection handle is used as the Handle command parameter and return parameter. The meaning of the RSSI metric is an absolute receiver signal strength value in dBm to ± 6 dB accuracy. If the RSSI cannot be read, the RSSI metric shall be set to 127.

See the Bluetooth spec, Vol 2, Part E, Section 7.5.4.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_set_event_mask(&mut self, event_mask: LeEventFlags) -> Result<(), E>

Controls which LE events are generated by the HCI for the Host. If the flag in event_mask is set, then the event associated with that flag will be enabled. The Host has to deal with each event that is generated by an LE Controller. The event mask allows the Host to control which events will interrupt it.

For LE events to be generated, the LE Meta-Event flag in the Event Mask shall also be set. If that bit is not set, then LE events shall not be generated, regardless of how the LE Event Mask is set.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.1.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_read_buffer_size(&mut self) -> Result<(), E>

Reads the maximum size of the data portion of HCI LE ACL Data Packets sent from the Host to the Controller. The Host will segment the data transmitted to the Controller according to these values, so that the HCI Data Packets will contain data with up to this size. This command also returns the total number of HCI LE ACL Data Packets that can be stored in the data buffers of the Controller. This command must be issued by the Host before it sends any data to an LE Controller (see Section 4.1.1).

If the Controller returns a length value of zero, the Host shall use the read_buffer_size command to determine the size of the data buffers (shared between BR/EDR and LE transports).

Note: Both the read_buffer_size and le_read_buffer_size commands may return buffer length and number of packets parameter values that are nonzero. This allows a Controller to offer different buffers and number of buffers for BR/EDR data packets and LE data packets.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.2.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_read_local_supported_features(&mut self) -> Result<(), E>

Requests the list of the supported LE features for the Controller.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.3.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_set_random_address(
    &mut self,
    bd_addr: BdAddr
) -> Result<(), Error<E, Self::VS>>

Sets the LE Random Device Address in the Controller.

See the Bluetooth spec, Vol 6, Part B, Section 1.3.

Details added in v5.0:

  • If this command is used to change the address, the new random address shall take effect for advertising no later than the next successful le_set_advertise_enable command (v4.x, renamed to le_set_advertising_enable in v5.0), for scanning no later than the next successful le_set_scan_enable command or le_set_extended_scan_enable command, and for initiating no later than the next successful le_create_connection command or le_extended_create_connection command.

  • Note: If Extended Advertising is in use, this command only affects the address used for scanning and initiating. The addresses used for advertising are set by the le_set_advertising_set_random_address command (see Section 7.8.52).

See the Bluetooth spec, Vol 2, Part E, Section 7.8.4.

Errors

  • If the given address does not meet the requirements from Vol 6, Part B, Section 1.3, a BadRandomAddress error is returned.
    • The 2 most significant bits of the (last byte of the) address must be 00 (non-resolvable private address), 10 (resolvable private address), or 11 (static address).
    • The random part of the address must contain at least one 0 and at least one 1. For static and non-resolvable private addresses, the random part is the entire address (except the 2 most significant bits). For resolvable private addresses, the 3 least significant bytes are a hash, and the random part is the 3 most significant bytes. The hash part of resolvable private addresses is not checked.
  • Underlying communication errors are reported.

Generated Events

A Command Complete event is generated.

(v5.0) If the Host issues this command when scanning or legacy advertising is enabled, the Controller shall return the error code Command Disallowed.

fn le_set_advertising_parameters(
    &mut self,
    params: &AdvertisingParameters
) -> Result<(), Error<E, Self::VS>>

Sets the advertising parameters on the Controller.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.5.

Errors

  • BadChannelMap if no channels are enabled in the channel map.
  • Underlying communication errors

Generated events

A Command Complete event is generated.

The Host shall not issue this command when advertising is enabled in the Controller; if it is the Command Disallowed error code shall be used.

fn le_read_advertising_channel_tx_power(&mut self) -> Result<(), E>

Reads the transmit power level used for LE advertising channel packets.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.6.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_set_advertising_data(
    &mut self,
    data: &[u8]
) -> Result<(), Error<E, Self::VS>>

Sets the data used in advertising packets that have a data field.

Only the significant part of the advertising data should be transmitted in the advertising packets, as defined in the Bluetooth spec, Vol 3, Part C, Section 11. All bytes in data are considered significant.

If advertising is currently enabled, the Controller shall use the new data in subsequent advertising events. If an advertising event is in progress when this command is issued, the Controller may use the old or new data for that event. If advertising is currently disabled, the data shall be kept by the Controller and used once advertising is enabled.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.7.

Errors

Generated events

A Command Complete event is generated.

fn le_set_scan_response_data(
    &mut self,
    data: &[u8]
) -> Result<(), Error<E, Self::VS>>

Provides data used in scanning packets that have a data field.

Only the significant part of the scan response data should be transmitted in the Scanning Packets, as defined in the Bluetooth spec, Vol 3, Part C, Section 11. All bytes in data are considered significant.

If advertising is currently enabled, the Controller shall use the new data in subsequent advertising events. If an advertising event is in progress when this command is issued, the Controller may use the old or new data for that event. If advertising is currently disabled, the data shall be kept by the Controller and used once advertising is enabled.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.8.

Errors

Generated events

A Command Complete event is generated.

fn le_set_advertise_enable(&mut self, enable: bool) -> Result<(), E>

Requests the Controller to start or stop advertising. The Controller manages the timing of advertisements as per the advertising parameters given in the le_set_advertising_parameters command.

The Controller shall continue advertising until the Host issues this command with enable set to false (Advertising is disabled) or until a connection is created or until the advertising is timed out due to high duty cycle directed advertising. In these cases, advertising is then disabled.

This function is renamed le_set_advertising_enable in Bluetooth v5.0.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.9, in versions 4.1 and 4.2.

Errors

Only underlying communication errors are reported.

Generated events

When the command has completed, a Command Complete event shall be generated.

If the advertising type is ConnectableDirectedHighDutyCycle and the directed advertising fails to create a connection, an LE Connection Complete event shall be generated with the Status code set to AdvertisingTimeout.

If the advertising type is ConnectableUndirected, ConnectableDirectedHighDutyCycle, or ConnectableDirectedLowDutyCycle and a connection is established, an LE Connection Complete event shall be generated.

Note: There is a possible race condition if enable is set to false (Disable) and the advertising type is ConnectableUndirected, ConnectableDirectedHighDutyCycle, or ConnectableDirectedLowDutyCycle. The advertisements might not be stopped before a connection is created, and therefore both the Command Complete event and an LE Connection Complete event could be generated. This can also occur when high duty cycle directed advertising is timed out and this command disables advertising.

fn le_set_scan_parameters(&mut self, params: &ScanParameters) -> Result<(), E>

Sets the scan parameters.

The Host shall not issue this command when scanning is enabled in the Controller; if it is the CommandDisallowed error code shall be used.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.10.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_set_scan_enable(
    &mut self,
    enable: bool,
    filter_duplicates: bool
) -> Result<(), E>

Starts scanning. Scanning is used to discover advertising devices nearby.

filter_duplicates controls whether the Link Layer shall filter duplicate advertising reports to the Host, or if the Link Layer should generate advertising reports for each packet received.

If own_address_type is set to Random or PrivateFallbackRandom and the random address for the device has not been initialized, the Controller shall return the error code InvalidParameters.

If enable is true and scanning is already enabled, any change to the filter_duplicates setting shall take effect.

Note: Disabling scanning when it is disabled has no effect.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.11.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

Zero or more LE Advertising Reports are generated by the Controller based on advertising packets received and the duplicate filtering. More than one advertising packet may be reported in each LE Advertising Report event.

fn le_create_connection(
    &mut self,
    params: &ConnectionParameters
) -> Result<(), E>

Creates a Link Layer connection to a connectable advertiser.

The Host shall not issue this command when another le_create_connection is pending in the Controller; if this does occur the Controller shall return the CommandDisallowed error code.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.12.

Errors

Only underlying communication errors are reported.

Generated events

The Controller sends the Command Status event to the Host when the event is received. An LE Connection Complete event shall be generated when a connection is created or the connection creation procedure is cancelled.

Note: No Command Complete event is sent by the Controller to indicate that this command has been completed. Instead, the LE Connection Complete event indicates that this command has been completed.

fn le_create_connection_cancel(&mut self) -> Result<(), E>

Cancels the le_create_connection or le_extended_create_connection (for v5.0) command. This command shall only be issued after the le_create_connection command has been issued, a CommandStatus event has been received for the le_create_connection command and before the LeConnectionComplete event.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.13.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event shall be generated.

If this command is sent to the Controller without a preceding le_create_connection command, the Controller shall return a Command Complete event with the error code CommandDisallowed.

The LE Connection Complete event with the error code UnknownConnectionId shall be sent after the Command Complete event for this command if the cancellation was successful.

fn le_read_white_list_size(&mut self) -> Result<(), E>

Reads the total number of White List entries that can be stored in the Controller.

Note: The number of entries that can be stored is not fixed and the Controller can change it at any time (e.g. because the memory used to store the White List can also be used for other purposes).

See the Bluetooth spec, Vol 2, Part E, Section 7.8.14.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_clear_white_list(&mut self) -> Result<(), E>

Clears the white list stored in the Controller.

This command can be used at any time except when:

  • the advertising filter policy uses the white list and advertising is enabled.
  • the scanning filter policy uses the white list and scanning is enabled.
  • the initiator filter policy uses the white list and an le_create_connection command is outstanding.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.15

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_add_device_to_white_list(&mut self, addr: BdAddrType) -> Result<(), E>

Adds a single device to the white list stored in the Controller.

This command can be used at any time except when:

  • the advertising filter policy uses the white list and advertising is enabled.
  • the scanning filter policy uses the white list and scanning is enabled.
  • the initiator filter policy uses the white list and a le_create_connection command is outstanding.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.16.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated. When a Controller cannot add a device to the White List because there is no space available, it shall return OutOfMemory.

fn le_remove_device_from_white_list(
    &mut self,
    addr: BdAddrType
) -> Result<(), E>

Removes a single device from the white list stored in the Controller.

This command can be used at any time except when:

  • the advertising filter policy uses the white list and advertising is enabled.
  • the scanning filter policy uses the white list and scanning is enabled.
  • the initiator filter policy uses the white list and a le_create_connection command is outstanding.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.17.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_connection_update(
    &mut self,
    params: &ConnectionUpdateParameters
) -> Result<(), E>

Changes the Link Layer connection parameters of a connection. This command may be issued on both the central and peripheral devices.

The actual parameter values selected by the Link Layer may be different from the parameter values provided by the Host through this command.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.18.

Errors

Only underlying communication errors are reported.

Generated events

When the Controller receives the command, the Controller sends the Command Status event to the Host. The LE Connection Update Complete event shall be generated after the connection parameters have been applied by the Controller.

Note: a Command Complete event is not sent by the Controller to indicate that this command has been completed. Instead, the LE Connection Update Complete event indicates that this command has been completed.

fn le_set_host_channel_classification(
    &mut self,
    channels: ChannelClassification
) -> Result<(), Error<E, Self::VS>>

This command allows the Host to specify a channel classification for data channels based on its "local information". This classification persists until overwritten with a subsequent le_set_host_channel_classification command or until the Controller is reset using the reset command.

If this command is used, the Host should send it within 10 seconds of knowing that the channel classification has changed. The interval between two successive commands sent shall be at least one second.

This command shall only be used when the local device supports the central role.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.19.

Errors

  • NoValidChannel if all channels are reported as bad.
  • Underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_read_channel_map(
    &mut self,
    conn_handle: ConnectionHandle
) -> Result<(), E>

Returns the current channel map for the specified connection handle. The returned value indicates the state of the channel map specified by the last transmitted or received channel map (in a CONNECT_REQ or LL_CHANNEL_MAP_REQ message) for the specified connection handle, regardless of whether the Master has received an acknowledgement.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.20.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_read_remote_used_features(
    &mut self,
    conn_handle: ConnectionHandle
) -> Result<(), E>

Requests a list of the used LE features from the remote device. This command shall return a list of the used LE features.

This command may be issued on both the central and peripheral devices.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.21.

Errors

Only underlying communication errors are reported.

Generated events

When the Controller receives this command, the Controller shall send the Command Status event to the Host. When the Controller has completed the procedure to determine the remote features, the Controller shall send a LE Read Remote Used Features Complete event to the Host.

The LE Read Remote Used Features Complete event contains the status of this command, and the parameter describing the used features of the remote device.

Note: A Command Complete event is not sent by the Controller to indicate that this command has been completed. Instead, the LE Read Remote Used Features Complete event indicates that this command has been completed.

fn le_encrypt(&mut self, params: &AesParameters) -> Result<(), E>

Requests the Controller to encrypt the plaintext data in the command using the key given in the command and returns the encrypted data to the Host. The AES-128 bit block cypher is defined in NIST Publication FIPS-197.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.22.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

fn le_rand(&mut self) -> Result<(), E>

Requests the Controller to generate 8 octets of random data to be sent to the Host. The random number shall be generated according to the Bluetooth spec, Vol 2, Part H, Section 2 if the LL Encryption Feature is supported.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.23.

Errors

Only underlying communication are reported.

Generated events

A Command Complete event is generated.

fn le_start_encryption(
    &mut self,
    params: &EncryptionParameters
) -> Result<(), E>

Authenticates the given encryption key associated with the remote device specified by the connection handle, and once authenticated will encrypt the connection. The parameters are as defined in the Bluetooth spec, Vol 3, Part H, Section 2.4.4.

If the connection is already encrypted then the Controller shall pause connection encryption before attempting to authenticate the given encryption key, and then re-encrypt the connection. While encryption is paused no user data shall be transmitted.

On an authentication failure, the connection shall be automatically disconnected by the Link Layer. If this command succeeds, then the connection shall be encrypted.

This command shall only be used when the local device is the central device.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.24.

Errors

Only underlying communication errors are reported

Generated events

When the Controller receives this command it shall send the Command Status event to the Host. If the connection is not encrypted when this command is issued, an Encryption Change event shall occur when encryption has been started for the connection. If the connection is encrypted when this command is issued, an Encryption Key Refresh Complete event shall occur when encryption has been resumed.

Note: A Command Complete event is not sent by the Controller to indicate that this command has been completed. Instead, the Encryption Change or Encryption Key Refresh Complete events indicate that this command has been completed.

fn le_long_term_key_request_reply(
    &mut self,
    conn_handle: ConnectionHandle,
    key: &EncryptionKey
) -> Result<(), E>

Replies to an LE Long Term Key Request event from the Controller, and specifies the long term key parameter that shall be used for this connection handle.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.25.

Errors

Only underlying communication errors are reported

Generated events

A Command Complete event is generated.

fn le_long_term_key_request_negative_reply(
    &mut self,
    conn_handle: ConnectionHandle
) -> Result<(), E>

Replies to an LE Long Term Key Request event from the Controller if the Host cannot provide a Long Term Key for this connection handle.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.26.

Errors

Only underlying communication errors are reported

Generated events

A Command Complete event is generated.

fn le_read_supported_states(&mut self) -> Result<(), E>

Reads the states and state combinations that the link layer supports.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.27.

Errors

Only underlying communication errors are reported

Generated events

A Command Complete event is generated.

fn le_receiver_test(&mut self, channel: u8) -> Result<(), Error<E, Self::VS>>

Starts a test where the DUT receives test reference packets at a fixed interval. The tester generates the test reference packets.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.28.

Errors

  • InvalidTestChannel if the channel is out of range (greater than 39).
  • Underlying communication errors

Generated events

A Command Complete event is generated.

fn le_transmitter_test(
    &mut self,
    channel: u8,
    payload_length: usize,
    payload: TestPacketPayload
) -> Result<(), Error<E, Self::VS>>

Starts a test where the DUT generates test reference packets at a fixed interval. The Controller shall transmit at maximum power.

An LE Controller supporting the le_transmitter_test command shall support payload values PrbS9, Nibbles10 and Bits10. An LE Controller may support other values of payload.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.29.

Errors

Generated events

A Command Complete event is generated.

fn le_test_end(&mut self) -> Result<(), E>

Stops any test which is in progress.

See the Bluetooth spec, Vol 2, Part E, Section 7.8.30.

Errors

Only underlying communication errors are reported.

Generated events

A Command Complete event is generated.

Loading content...

Implementors

impl<E, T, Header> Hci<E> for T where
    T: Controller<Error = E, Header = Header>,
    Header: HciHeader
[src]

type VS = <<T as Controller>::Vendor as Vendor>::Status

Loading content...