# STM32WB BLE Wireless Interface

This document describes the STM32WB BLE Application Commands Interface (ACI) and Host Commands Interface (HCI).

STM32WB Series website

## Revision history

December 2018 - Rev 1.0 - First release for interface 1.0

February 2019 - Rev 1.1 - Modified HCI_HARDWARE_ERROR_EVENT comment

March 2019 - Rev 1.2 - Removed unused event documentation

March 2019 - Rev 1.3 - Modification ACI_HAL_FW_ERROR_EVENT error code

March 2019 - Rev 1.4 - Changed default mask of HCI_SET_EVENT_MASK

May 2019 - Rev 1.5 - ACI_GATT_NOTIFICATION_EXT_EVENT added

June 2019 - Rev 1.6 - Changed comment on usage of Char Handles in multiple ACI_GATT commands; Added ACI_GATT_INDICATION_EXT_EVENT

June 2019 - Rev 1.7 - Changed descriptions of ACI_ATT_READ_BY_TYPE_REQ and ACI_GATT_READ_USING_CHAR_UUID

July 2019 - Rev 1.8 - Reworked error codes section; Added GAP_ prefix to the GAP procedure bitmap definitions

September 2019 - Rev 1.9 - Added ACI_GATT_READ_EXT_EVENT; Modified ACI_GAP_CONFIGURE_WHITELIST comment

October 2019 - Rev 1.10 - Changed descriptions of ACI_GATT_WRITE_WITHOUT_RESP and ACI_GATT_SIGNED_WRITE_WITHOUT_RESP; Removed obsolete configuration data elements

November 2019 - Rev 1.11 - Completed description of ACI_GAP_INIT; Added specific pairing status definitions

November 2019 - Rev 1.12 - Fixed status error codes

January 2020 - Rev 1.13 - Removed DIV unused configuration data; Fixed naming of HCI_LE_READ_REMOTE_FEATURES command and complete event

March 2020 - Rev 1.14 - Removed unused HCI_Data_Buffer_Overflow event; Fixed naming of FW_Error_Type possible values; Fixed pairing status possible values

March 2020 - Rev 1.15 - Added GAP scan timeout value

April 2020 - Rev 1.16 - Fixed various format issues; Added LO and SO columns for command and event tables.

May 2020 - Rev 1.17 - Updated "slave only" stack features; Added comment in HCI_LE_ADVERTISING_REPORT_EVENT description.

June 2020 - Rev 1.18 - Added BO column for command and event tables; Fixed advertising commands description; Fixed various format issues.

## Contents

HCI/ACI commands

HCI/ACI events

Status error codes

# HCI/ACI commands

HCI commands

HCI TESTING commands

ACI HAL commands

ACI GAP commands

ACI GATT/ATT commands

ACI L2CAP commands

Note: in the command tables, a "Y" in the "LO" (resp. "SO" or "BO") column, means that the corresponding command applies to the "Link Layer Only" (resp. "Slave Only" or "Beacon Only") variant of the BLE stack.

## HCI commands

##

Command | Opcode | LO | SO | BO
--- | --- | --- | --- | ---
HCI_DISCONNECT | 0x0406 | Y |  |
HCI_READ_REMOTE_VERSION_INFORMATION | 0x041D | Y | Y |
HCI_SET_EVENT_MASK | 0x0C01 | Y | Y | Y
HCI_RESET | 0x0C03 | Y | Y | Y
HCI_READ_TRANSMIT_POWER_LEVEL | 0x0C2D | Y | Y |
HCI_SET_CONTROLLER_TO_HOST_FLOW_CONTROL | 0x0C31 | Y |  |
HCI_HOST_BUFFER_SIZE | 0x0C33 | Y |  |
HCI_HOST_NUMBER_OF_COMPLETED_PACKETS | 0x0C35 | Y |  |
HCI_READ_LOCAL_VERSION_INFORMATION | 0x1001 | Y | Y | Y
HCI_READ_LOCAL_SUPPORTED_COMMANDS | 0x1002 | Y | Y | Y
HCI_READ_LOCAL_SUPPORTED_FEATURES | 0x1003 | Y | Y | Y
HCI_READ_BD_ADDR | 0x1009 | Y | Y | Y
HCI_READ_RSSI | 0x1405 | Y | Y | Y
HCI_LE_SET_EVENT_MASK | 0x2001 | Y | Y | Y
HCI_LE_READ_BUFFER_SIZE | 0x2002 | Y |  |
HCI_LE_READ_LOCAL_SUPPORTED_FEATURES | 0x2003 | Y | Y | Y
HCI_LE_SET_RANDOM_ADDRESS | 0x2005 | Y |  | Y
HCI_LE_SET_ADVERTISING_PARAMETERS | 0x2006 | Y |  | Y
HCI_LE_READ_ADVERTISING_CHANNEL_TX_POWER | 0x2007 | Y |  | Y
HCI_LE_SET_ADVERTISING_DATA | 0x2008 | Y |  | Y
HCI_LE_SET_SCAN_RESPONSE_DATA | 0x2009 | Y | Y | Y
HCI_LE_SET_ADVERTISE_ENABLE | 0x200A | Y |  | Y
HCI_LE_SET_SCAN_PARAMETERS | 0x200B | Y |  | Y
HCI_LE_SET_SCAN_ENABLE | 0x200C | Y |  | Y
HCI_LE_CREATE_CONNECTION | 0x200D | Y |  |
HCI_LE_CREATE_CONNECTION_CANCEL | 0x200E | Y |  |
HCI_LE_READ_WHITE_LIST_SIZE | 0x200F | Y |  | Y
HCI_LE_CLEAR_WHITE_LIST | 0x2010 | Y |  | Y
HCI_LE_ADD_DEVICE_TO_WHITE_LIST | 0x2011 | Y |  | Y
HCI_LE_REMOVE_DEVICE_FROM_WHITE_LIST | 0x2012 | Y |  | Y
HCI_LE_CONNECTION_UPDATE | 0x2013 | Y |  |
HCI_LE_SET_HOST_CHANNEL_CLASSIFICATION | 0x2014 | Y |  |
HCI_LE_READ_CHANNEL_MAP | 0x2015 | Y | Y |
HCI_LE_READ_REMOTE_FEATURES | 0x2016 | Y | Y |
HCI_LE_ENCRYPT | 0x2017 | Y |  |
HCI_LE_RAND | 0x2018 | Y | Y | Y
HCI_LE_START_ENCRYPTION | 0x2019 | Y |  |
HCI_LE_LONG_TERM_KEY_REQUEST_REPLY | 0x201A | Y |  |
HCI_LE_LONG_TERM_KEY_REQUESTED_NEGATIVE_REPLY | 0x201B | Y |  |
HCI_LE_READ_SUPPORTED_STATES | 0x201C | Y | Y | Y
HCI_LE_SET_DATA_LENGTH | 0x2022 | Y | Y |
HCI_LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH | 0x2023 | Y | Y |
HCI_LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH | 0x2024 | Y | Y |
HCI_LE_READ_LOCAL_P256_PUBLIC_KEY | 0x2025 | Y | Y |
HCI_LE_GENERATE_DHKEY | 0x2026 | Y |  |
HCI_LE_ADD_DEVICE_TO_RESOLVING_LIST | 0x2027 | Y |  |
HCI_LE_REMOVE_DEVICE_FROM_RESOLVING_LIST | 0x2028 | Y |  |
HCI_LE_CLEAR_RESOLVING_LIST | 0x2029 | Y |  |
HCI_LE_READ_RESOLVING_LIST_SIZE | 0x202A | Y |  |
HCI_LE_READ_PEER_RESOLVABLE_ADDRESS | 0x202B | Y |  |
HCI_LE_READ_LOCAL_RESOLVABLE_ADDRESS | 0x202C | Y |  |
HCI_LE_SET_ADDRESS_RESOLUTION_ENABLE | 0x202D | Y |  |
HCI_LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT | 0x202E | Y |  |
HCI_LE_READ_MAXIMUM_DATA_LENGTH | 0x202F | Y | Y |
HCI_LE_READ_PHY | 0x2030 | Y |  |
HCI_LE_SET_DEFAULT_PHY | 0x2031 | Y |  |
HCI_LE_SET_PHY | 0x2032 | Y |  |

## HCI_DISCONNECT

### Description

The HCI_DISCONNECT is used to terminate an existing connection. The Connection_Handle command parameter indicates which connection is to be disconnected. The Reason command parameter indicates the reason for ending the connection. The remote Controller will receive the Reason command parameter in the HCI_DISCONNECTION_COMPLETE_EVENT event. All synchronous connections on a physical link should be disconnected before the ACL connection on the same physical connection is disconnected.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.1.6)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Reason | 1 | The reason for ending the connection. | 0x05: Authentication Failure 0x13: Remote User Terminated Connection 0x14: Remote Device Terminated Connection due to Low Resources 0x15: Remote Device Terminated Connection due to Power Off 0x1A: Unsupported Remote Feature 0x3B: Unacceptable Connection Parameters

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_DISCONNECTION_COMPLETE_EVENT

## HCI_READ_REMOTE_VERSION_INFORMATION

### Description

This command will obtain the values for the version information for the remote device identified by the Connection_Handle parameter. The Connection_Handle must be a Connection_Handle for an ACL or LE connection.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.1.23)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Specifies which Connection_Handle's version information to get. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_READ_REMOTE_VERSION_INFORMATION_COMPLETE_EVENT

## HCI_SET_EVENT_MASK

### Description

The Set_Event_Mask command is used to control which events are generated by the HCI for the Host. If the bit in the Event_Mask is set to a one, then the event associated with that bit will be enabled. For an LE Controller, the LE Meta Event bit in the Event_Mask shall enable or disable all LE events in the LE Meta Event (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 Bluetooth Specification v.5.0, Vol. 2, Part E, 7.3.1)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Event_Mask | 8 | Event mask. Default: 0x20001FFFFFFFFFFF | Bitmask of: 0x0000000000000000: No events specified 0x0000000000000010: Disconnection Complete Event 0x0000000000000080: Encryption Change Event 0x0000000000000800: Read Remote Version Information Complete Event 0x0000000000008000: Hardware Error Event 0x0000800000000000: Encryption Key Refresh Complete Event 0x2000000000000000: LE Meta-Event

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_RESET

### Description

The Reset command resets the Link Layer on an LE Controller. 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 is lost, the Controller enters standby mode and the Controller automatically reverts to the default values for the parameters for which default values are defined in the specification.
Note: The Reset command does not necessarily perform a hardware reset. This is implementation defined.
The Host shall not send additional HCI commands before the Command Complete event related to the Reset command has been received.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.3.2)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_READ_TRANSMIT_POWER_LEVEL

### Description

This command reads the values for the Transmit_Power_Level parameter for the specified Connection_Handle. The Connection_Handle shall be a Connection_Handle for an ACL connection.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.3.35)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Specifies which Connection_Handle's Transmit Power Level setting to read. | 0x0000 ... 0x0EFF
Type | 1 | Current or maximum transmit power level. | 0x00: Read Current Transmit Power Level. 0x01: Read Maximum Transmit Power Level.

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Transmit_Power_Level | 1 | Size: 1 Octet (signed integer) Units: dBm | -30 ... 20

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_SET_CONTROLLER_TO_HOST_FLOW_CONTROL

### Description

This command is used by the Host to turn flow control on or off for data and/or voice sent in the direction from the Controller to the Host. If flow control is turned off, the Host should not send the Host_Number_Of_Completed_Packets command. That command will be ignored by the Controller if it is sent by the Host and flow control is off. If flow control is turned on for HCI ACL Data Packets and off for HCI synchronous Data Packets, Host_Number_Of_Completed_Packets commands sent by the Host should only contain Connection_Handles for ACL connections. If flow control is turned off for HCI ACL Data Packets and on for HCI synchronous Data Packets, Host_Number_Of_Completed_Packets commands sent by the Host should only contain Connection_Handles for synchronous connections. If flow control is turned on for HCI ACL Data Packets and HCI synchronous Data Packets, the Host will send Host_Number_Of_Completed_Packets commands both for ACL connections and synchronous connections.
The Flow_Control_Enable parameter shall only be changed if no connections exist.
(See Bluetooth Spec v.5.0, Vol. 2, Part E, 7.3.38)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Flow_Control_Enable | 1 | Enable/Disable the Flow Control | 0x00: Flow control off in direction from Controller to Host. Default. 0x01: Flow control on for HCI ACL Data Packets and off for HCI synchronous.Data Packets in direction from Controller to Host. 0x02: Flow control off for HCI ACL Data Packets and on for HCI synchronous.Data Packets in direction from Controller to Host. 0x03: Flow control on both for HCI ACL Data Packets and HCI synchronous.Data Packets in direction from Controller to Host.

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT

## HCI_HOST_BUFFER_SIZE

### Description

The Host_Buffer_Size command is used by the Host to notify the Controller about the maximum size of the data portion of HCI ACL and synchronous Data Packets sent from the Controller to the Host. The Controller shall segment the data to be transmitted from the Controller to the Host according to these sizes, so that the HCI Data Packets will contain data with up to these sizes. The Host_Buffer_Size command also notifies the Controller about the total number of HCI ACL and synchronous Data Packets that can be stored in the data buffers of the Host. If flow control from the Controller to the Host is turned off, and the Host_Buffer_Size command has not been issued by the Host, this means that the Controller will send HCI Data Packets to the Host with any lengths the Controller wants to use, and it is assumed that the data buffer sizes of the Host are unlimited. If flow control from the Controller to the Host is turned on, the Host_Buffer_Size command shall after a power-on or a reset always be sent by the Host before the first Host_Number_Of_Completed_Packets command is sent.
The Set Controller To Host Flow Control Command is used to turn flow control on or off.
The Host_ACL_Data_Packet_Length command parameter will be used to determine the size of the L2CAP segments contained in ACL Data Packets, which are transferred from the Controller to the Host.
The Host_Synchronous_Data_Packet_Length command parameter is used to determine the maximum size of HCI synchronous Data Packets. Both the Host and the Controller shall support command and event packets, where the data portion (excluding header) contained in the packets is 255 octets in size.
The Host_Total_Num_ACL_Data_Packets command parameter contains the total number of HCI ACL Data Packets that can be stored in the data buffers of the Host. The Controller will determine how the buffers are to be divided between different Connection_Handles.
The Host_Total_Num_Synchronous_Data_Packets command parameter gives the same information for HCI synchronous Data Packets.
Note: The Host_ACL_Data_Packet_Length and Host_Synchronous_Data_Packet_Length command parameters do not include the length of the HCI Data Packet header.
(See Bluetooth Spec v.5.0, Vol. 2, Part E, 7.3.39)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Host_ACL_Data_Packet_Length | 2 | Maximum length (in octets) of the data portion of each HCI ACL Data Packet that the Host is able to accept. Must be greater or equal to 251 bytes |
Host_Synchronous_Data_Packet_Length | 1 | Maximum length (in octets) of the data portion of each HCI synchronous Data Packet that the Host is able to accept. |
Host_Total_Num_ACL_Data_Packets | 2 | Total number of HCI ACL Data Packets that can be stored in the data buffers of the Host. |
Host_Total_Num_Synchronous_Data_Packets | 2 | Total number of HCI synchronous Data Packets that can be stored in the data buffers of the Host. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT

## HCI_HOST_NUMBER_OF_COMPLETED_PACKETS

### Description

The Host_Number_Of_Completed_Packets command is used by the Host to indicate to the Controller the number of HCI Data Packets that have been completed for each Connection_Handle since the previous Host_Number_Of_Completed_Packets command was sent to the Controller. This means that the corresponding buffer space has been freed in the Host. Based on this information, and the Host_Total_Num_ACL_Data_Packets and Host_Total_Num_Synchronous_Data_Packets command parameters of the Host_Buffer_Size command, the Controller can determine for which Connection_Handles the following HCI Data Packets should be sent to the Host. The command should only be issued by the Host if flow control in the direction from the Controller to the Host is on and there is at least one connection, or if the Controller is in local loopback mode. Otherwise, the command will be ignored by the Controller. When the Host has completed one or more HCI Data Packet(s) it shall send a Host_Number_Of_Completed_Packets command to the Controller, until it finally reports that all pending HCI Data Packets have been completed. The frequency at which this command is sent is manufacturer specific.
The Set Controller To Host Flow Control Command is used to turn flow control on or off. If flow control from the Controller to the Host is turned on, the Host_Buffer_Size command shall always be sent by the Host after a power-on or a reset before the first Host_Number_Of_Completed_Packets command is sent.
Note: The Host_Number_Of_Completed_Packets command is a special command in the sense that no event is normally generated after the command has completed. The command may be sent at any time by the Host when there is at least one connection, or if the Controller is in local loopback mode independent of other commands. The normal flow control for commands is not used for the Host_Number_Of_Completed_Packets command.
(See Bluetooth Spec v.5.0, Vol. 2, Part E, 7.3.40)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Number_Of_Handles | 1 | The number of Connection_Handles and Host_Num_Of_Completed_Packets parameters pairs contained in this command. | 0-255
Connection_Handle[i] | Number_Of_Handles * 2 | Connection_Handle | 0x0000-0x0EFF
Host_Num_Of_Completed_Packets[i] | Number_Of_Handles * 2 | The number of HCI Data Packets that have been completed for the associated Connection_Handle since the previous time the event was returned. | 0x0000-0xFFFF

### Output parameters

None

### Events generated

Normally, no event is generated after the Host_Number_Of_Completed_Packets command has completed. However, if the Host_Number_Of_Completed_Packets command contains one or more invalid parameters, the Controller shall return a Command Complete event with a failure status indicating the Invalid HCI Command Parameters error code. The Host may send the Host_Number_Of_Completed_Packets command at any time when there is at least one connection, or if the Controller is in local loopback mode. The normal flow control for commands is not used for this command.

## HCI_READ_LOCAL_VERSION_INFORMATION

### Description

This command reads the values for the version information for the local Controller. The HCI Version information defines the version information of the HCI layer. The LMP/PAL Version information defines the version of the LMP or PAL. The Manufacturer_Name information indicates the manufacturer of the local device. The HCI Revision and LMP/PAL Subversion are implementation dependent.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.4.1)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
HCI_Version | 1 | See Bluetooth Assigned Numbers (https://www.bluetooth.org/en-us/specification/assigned-numbers) |
HCI_Revision | 2 | Revision of the Current HCI in the BR/EDR Controller. |
LMP_PAL_Version | 1 | Version of the Current LMP or PAL in the Controller. See Bluetooth Assigned Numbers (https://www.bluetooth.org/en-us/specification/assigned-numbers) |
Manufacturer_Name | 2 | Manufacturer Name of the BR/EDR Controller. See Bluetooth Assigned Numbers (https://www.bluetooth.org/en-us/specification/assigned-numbers) |
LMP_PAL_Subversion | 2 | Subversion of the Current LMP or PAL in the Controller. This value is implementation dependent. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_READ_LOCAL_SUPPORTED_COMMANDS

### Description

This command 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 Bluetooth Specification v.5.0, Vol. 2, Part E, 7.4.2)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Supported_Commands | 64 | Bit mask for each HCI Command. If a bit is 1, the Controller supports the corresponding command and the features required for the command. Unsupported or undefined commands shall be set to 0. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_READ_LOCAL_SUPPORTED_FEATURES

### Description

This command requests a list of the supported features for the local Controller. This command will return a list of the LMP features. For details see Part C, Link Manager Protocol Specification on page 227.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.4.3)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
LMP_Features | 8 | Bit Mask List of LMP features. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_READ_BD_ADDR

### Description

On an LE Controller, this command shall read the Public Device Address as defined in [Vol 6] Part B, Section 1.3, Device Address. If this Controller does not have a Public Device Address, the value 0x000000000000 shall be returned.
On an LE Controller, the public address shall be the same as the BD_ADDR.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.4.6)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
BD_ADDR | 6 | BD_ADDR ( Bluetooth Device Address) of the Device. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_READ_RSSI

### Description

This command reads the Received Signal Strength Indication (RSSI) value from a Controller. 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 Bluetooth Specification v.5.0, Vol. 2, Part E, 7.5.4)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
RSSI | 1 | N Size: 1 Octet (signed integer) Units: dBm | 127: RSSI not available -127 ... 20

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_EVENT_MASK

### Description

The LE_Set_Event_Mask command is used to control which LE events are generated by the HCI for the Host. If the bit in the LE_Event_Mask is set to a one, then the event associated with that bit 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 bit 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 Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.1)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Event_Mask | 8 | LE event mask. Default: 0x00000000000FFFFF. | Bitmask of: 0x0000000000000000: No LE events specified 0x0000000000000001: LE Connection Complete Event 0x0000000000000002: LE Advertising Report Event 0x0000000000000004: LE Connection Update Complete Event 0x0000000000000008: LE Read Remote Used Features Complete Event 0x0000000000000010: LE Long Term Key Request Event 0x0000000000000020: LE Remote Connection Parameter Request Event 0x0000000000000040: LE Data Length Change Event 0x0000000000000080: LE Read Local P-256 Public Key Complete Event 0x0000000000000100: LE Generate DHKey Complete Event 0x0000000000000200: LE Enhanced Connection Complete Event 0x0000000000000400: LE Direct Advertising Report Event 0x0000000000000800: LE PHY Update Complete Event 0x0000000000001000: LE Extended Advertising Report Event 0x0000000000002000: LE Periodic Advertising Sync Established Event 0x0000000000004000: LE Periodic Advertising Report Event 0x0000000000008000: LE Periodic Advertising Sync Lost Event 0x0000000000010000: LE Extended Scan Timeouout Event 0x0000000000020000: LE Extended Advertising Set Terminated Event 0x0000000000040000: LE Scan Request Received Event 0x0000000000080000: LE Channel Selection Algorithm Event

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_BUFFER_SIZE

### Description

The LE_Read_Buffer_Size command is used to read 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. The LE_Read_Buffer_Size command also returns the total number of HCI LE ACL Data Packets that can be stored in the data buffers of the Controller. The LE_Read_Buffer_Size 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.
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.
The HC_LE_ACL_Data_Packet_Length return parameter shall be used to determine the size of the L2CAP PDU segments contained in ACL Data Packets, which are transferred from the Host to the Controller to be broken up into packets by the Link Layer. Both the Host and the Controller shall support command and event packets, where the data portion (excluding header) contained in the packets is 255 octets in size. The HC_Total_Num_LE_ACL_Data_Packets return parameter contains the total number of HCI ACL Data Packets that can be stored in the data buffers of the Controller. The Host determines how the buffers are to be divided between different Connection Handles.
Note: The HC_LE_ACL_Data_Packet_Length return parameter does not include the length of the HCI Data Packet header.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.2)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
HC_LE_ACL_Data_Packet_Length | 2 | 0x0000 No dedicated LE Buffer - use Read_Buffer_Size command. 0x0001 - 0xFFFF Maximum length (in octets) of the data portion of each HCI ACL Data Packet that the Controller is able to accept. |
HC_Total_Num_LE_ACL_Data_Packets | 1 | 0x00 No dedicated LE Buffer - use Read_Buffer_Size command. 0x01 - 0xFF Total number of HCI ACL Data Packets that can be stored in the data buffers of the Controller. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_LOCAL_SUPPORTED_FEATURES

### Description

This command requests the list of the supported LE features for the Controller.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.3)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
LE_Features | 8 | Bit Mask List of LE features. See Core v5.0, Vol. 6, Part B, Section 4.6. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_RANDOM_ADDRESS

### Description

The LE_Set_Random_Address command is used by the Host to set the LE Random Device Address in the Controller (see [Vol 6] Part B, Section 1.3).
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.4)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Random_Address | 6 | Random Device Address. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_ADVERTISING_PARAMETERS

### Description

The LE_Set_Advertising_Parameters command is used by the Host to set the advertising parameters.
The Advertising_Interval_Min shall be less than or equal to the Advertising_Interval_Max.
The Advertising_Interval_Min and Advertising_Interval_Max should not be the same value to enable the Controller to determine the best advertising interval given other activities.
For high duty cycle directed advertising, i.e. when Advertising_Type is 0x01 (ADV_DIRECT_IND, high duty cycle), the Advertising_Interval_Min and Advertising_Interval_Max parameters are not used and shall be ignored.
The Advertising_Type is used to determine the packet type that is used for advertising when advertising is enabled.
The Advertising_Interval_Min and Advertising_Interval_Max shall not be set to less than 0x00A0 (100 ms) if the Advertising_Type is set to 0x02 (ADV_SCAN_IND) or 0x03 (ADV_NONCONN_IND). The Own_Address_Type determines if the advertising packets are identified with the Public Device Address of the device, or a Random Device Address as written by the LE_Set_Random_Address command.
If directed advertising is performed, i.e. when Advertising_Type is set to 0x01 (ADV_DIRECT_IND, high duty cycle) or 0x04 (ADV_DIRECT_IND, low duty cycle mode), then the Direct_Address_Type and Direct_Address shall be valid, otherwise they shall be ignored by the Controller and not used.
The Advertising_Channel_Map is a bit field that indicates the advertising channels that shall be used when transmitting advertising packets. At least one channel bit shall be set in the Advertising_Channel_Map parameter.
The Advertising_Filter_Policy parameter shall be ignored when directed advertising is enabled.
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.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.5)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Advertising_Interval_Min | 2 | Minimum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Advertising_Interval_Max | 2 | Maximum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Advertising_Type | 1 | Advertising type | 0x00: ADV_IND (Connectable undirected advertising) 0x01: ADV_DIRECT_IND, high duty cycle (Connectable high duty cycle directed advertising) 0x02: ADV_SCAN_IND (Scannable undirected advertising) 0x03: ADV_NONCONN_IND (Non connectable undirected advertising) 0x04: ADV_DIRECT_IND_LDC, low duty cycle (Connectable low duty cycle directed advertising)
Own_Address_Type | 1 | Own address type. 0x00: Public Device Address 0x01 Random Device Address 0x02: Controller generates Resolvable Private Address based on the local IRK from resolving list. If resolving list contains no matching entry, use public address. 0x03: Controller generates Resolvable Private Address based on the local IRK from resolving list. If resolving list contains no matching entry, use random address from LE_Set_Random_Address. | 0x00: Public Device Address 0x01: Random Device Address 0x02: Resolvable Private Address or Public Address 0x03: Resolvable Private Address or Random Address
Peer_Address_Type | 1 | The address type of the peer device. | 0x00: Public Device Address 0x01: Random Device Address
Peer_Address | 6 | Public Device Address, Random Device Address, Public Identity Address or Random (static) Identity Address of the device to be connected. |
Advertising_Channel_Map | 1 | Advertising channel map. Default: 00000111b (all channels enabled). | Bitmask of: 0x01: ch 37 0x02: ch 38 0x04: ch 39
Advertising_Filter_Policy | 1 | Advertising filter policy. | 0x00: Allow Scan Request from Any, Allow Connect Request from Any 0x01: Allow Scan Request from White List Only, Allow Connect Request from Any 0x02: Allow Scan Request from Any, Allow Connect Request from White List Only 0x03: Allow Scan Request from White List Only, Allow Connect Request from White List Only

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_ADVERTISING_CHANNEL_TX_POWER

### Description

The LE_Read_Advertising_Channel_Tx_Power command is used by the Host to read the transmit power level used for LE advertising channel packets.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.6)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Transmit_Power_Level | 1 | Size: 1 Octet (signed integer) Units: dBm Accuracy: +/- 4 dBm | -20 ... 10

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_ADVERTISING_DATA

### Description

The LE_Set_Advertising_Data command is used to set the data used in advertising packets that have a data field.
Only the significant part of the Advertising_Data is transmitted in the advertising packets, as defined in [Vol 3] Part C, Section 11.,
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.7)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Advertising_Data_Length | 1 | The number of significant octets in the following data field |
Advertising_Data | 31 | 31 octets of data formatted as defined in [Vol 3] Part C, Section 11. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_SCAN_RESPONSE_DATA

### Description

This command is used to provide data used in Scanning Packets that have a data field.
Only the significant part of the Scan_Response_Data is transmitted in the Scanning Packets, as defined in [Vol 3] Part C, Section 11.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.8)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Scan_Response_Data_Length | 1 | The number of significant octets in the following data field |
Scan_Response_Data | 31 | 31 octets of data formatted as defined in [Vol 3] Part C, Section 11. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_ADVERTISE_ENABLE

### Description

The LE_Set_Advertise_Enable command is used to request 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 an LE_Set_Advertise_Enable command with Advertising_Enable set to 0x00 (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.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.9)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Advertising_Enable | 1 | Enable/disable advertise. Default is 0 (disabled). | 0x00: Advertising is disabled 0x01: Advertising is enabled

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT
- HCI_LE_CONNECTION_COMPLETE_EVENT

## HCI_LE_SET_SCAN_PARAMETERS

### Description

The LE_Set_Scan_Parameters command is used to set the scan parameters.
The LE_Scan_Type parameter controls the type of scan to perform.
The LE_Scan_Interval and LE_Scan_Window parameters are recommendations from the Host on how long (LE_Scan_Window) and how frequently (LE_Scan_Interval) the Controller should scan (See [Vol 6] Part B, Section 4.4.3). The LE_Scan_Window parameter shall always be set to a value smaller or equal to the value set for the LE_Scan_Interval parameter. If they are set to the same value scanning should be run continuously.
The Own_Address_Type parameter determines the address used (Public or Random Device Address) when performing active scan.
The Host shall not issue this command when scanning is enabled in the Controller; if it is the Command Disallowed error code shall be used.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.10)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Type | 1 | Passive or active scanning. With active scanning SCAN_REQ packets are sent. | 0x00: Passive Scanning 0x01: Active scanning
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
Own_Address_Type | 1 | Own address type. 0x00: Public Device Address 0x01 Random Device Address 0x02: Controller generates Resolvable Private Address based on the local IRK from resolving list. If resolving list contains no matching entry, use public address. 0x03: Controller generates Resolvable Private Address based on the local IRK from resolving list. If resolving list contains no matching entry, use random address from LE_Set_Random_Address. | 0x00: Public Device Address 0x01: Random Device Address 0x02: Resolvable Private Address or Public Address 0x03: Resolvable Private Address or Random Address
Scanning_Filter_Policy | 1 | 0x00 Accept all advertisement packets. Directed advertising packets which are not addressed for this device shall be ignored. 0x01 Ignore advertisement packets from devices not in the White List Only. Directed advertising packets which are not addressed for this device shall be ignored 0x02 Accept all undirected advertisement packets. Directed advertisement packets where initiator address is a RPA and Directed advertisement packets addressed to this device shall be accepted. 0x03 Accept all undirected advertisement packets from devices that are in the White List.Directed advertisement packets where initiator address is RPA and Directed advertisement packets addressed to this device shall be accepted. | 0x00: Accept all 0x01: Ignore devices not in the White List 0x02: Accept all (use resolving list) 0x03: Ignore devices not in the White List (use resolving list)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_SCAN_ENABLE

### Description

The LE_Set_Scan_Enable command is used to start scanning. Scanning is used to discover advertising devices nearby.
The Filter_Duplicates parameter 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.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.11)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Enable | 1 | Enable/disable scan. Default is 0 (disabled). | 0x00: Scanning disabled 0x01: Scanning enabled
Filter_Duplicates | 1 | Enable/disable duplicate filtering. | 0x00: Duplicate filtering disabled 0x01: Duplicate filtering enabled

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT
- HCI_LE_ADVERTISING_REPORT_EVENT

## HCI_LE_CREATE_CONNECTION

### Description

The LE_Create_Connection command is used to create a Link Layer connection to a connectable advertiser.
The LE_Scan_Interval and LE_Scan_Window parameters are recommendations from the Host on how long (LE_Scan_Window) and how frequently (LE_Scan_Interval) the Controller should scan. The LE_Scan_Window parameter shall be set to a value smaller or equal to the value set for the LE_Scan_Interval parameter. If both are set to the same value, scanning should run continuously.
The Initiator_Filter_Policy is used to determine whether the White List is used.
If the White List is not used, the Peer_Address_Type and the Peer_Address parameters specify the address type and address of the advertising device to connect to.
The Link Layer shall set the address in the CONNECT_REQ packets to either the Public Device Address or the Random Device Addressed based on the Own_Address_Type parameter.
The Conn_Interval_Min and Conn_Interval_Max parameters define the minimum and maximum allowed connection interval. The Conn_Interval_Min parameter shall not be greater than the Conn_Interval_Max parameter.
The Conn_Latency parameter defines the maximum allowed connection latency (see [Vol 6] Part B, Section 4.5.1).
The Supervision_Timeout parameter defines the link supervision timeout for the connection. The Supervision_Timeout in milliseconds shall be larger than (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds. (See [Vol 6] Part B, Section 4.5.2).
The Minimum_CE_Length and Maximum_CE_Length parameters are informative parameters providing the Controller with the expected minimum and maximum length of the connection events. The Minimum_CE_Length parameter shall be less than or equal to the Maximum_CE_Length parameter.
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 Command Disallowed error code shall be used.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.12)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
Initiator_Filter_Policy | 1 | 0x00 White list is not used to determine which advertiser to connect to. Peer_Address_Type and Peer_Address shall be used. 0x01 White list is used to determine which advertiser to connect to. Peer_Address_Type and Peer_Address shall be ignored. | 0x00: White list not used 0x01: White list used
Peer_Address_Type | 1 | Address type 0x00 Public Device Address 0x01 Random Device Address 0x02 Public Identity Address (Corresponds to Resolved Private Address) 0x03 Random (Static) Identity Address (Corresponds to Resolved Private Address) | 0x00: Public Device Address 0x01: Random Device Address 0x02: Public Identity Address 0x03: Random (Static) Identity Address
Peer_Address | 6 | Public Device Address or Random Device Address of the device to be connected. |
Own_Address_Type | 1 | Own address type. 0x00: Public Device Address 0x01 Random Device Address 0x02: Controller generates Resolvable Private Address based on the local IRK from resolving list. If resolving list contains no matching entry, use public address. 0x03: Controller generates Resolvable Private Address based on the local IRK from resolving list. If resolving list contains no matching entry, use random address from LE_Set_Random_Address. | 0x00: Public Device Address 0x01: Random Device Address 0x02: Resolvable Private Address or Public Address 0x03: Resolvable Private Address or Random Address
Conn_Interval_Min | 2 | Minimum value for the connection event interval. This shall be less than or equal to Conn_Interval_Max. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Interval_Max | 2 | Maximum value for the connection event interval. This shall be greater than or equal to Conn_Interval_Min. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Supervision_Timeout | 2 | Supervision timeout for the LE Link. It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. Time = N * 10 msec. | 0x000A (100 ms) ... 0x0C80 (32000 ms)
Minimum_CE_Length | 2 | Information parameter about the minimum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
Maximum_CE_Length | 2 | Information parameter about the maximum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_CONNECTION_COMPLETE_EVENT

## HCI_LE_CREATE_CONNECTION_CANCEL

### Description

The LE_Create_Connection_Cancel command is used to cancel the LE_Create_Connection command. This command shall only be issued after the LE_Create_Connection command has been issued, a Command Status event has been received for the LE Create Connection command and before the LE Connection Complete event.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.13)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT
- HCI_LE_CONNECTION_COMPLETE_EVENT

## HCI_LE_READ_WHITE_LIST_SIZE

### Description

The LE_Read_White_List_Size command is used to read the total number of white list entries that can be stored in the Controller.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.14)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
White_List_Size | 1 | Total number of white list entries that can be stored in the Controller. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_CLEAR_WHITE_LIST

### Description

The LE_Clear_White_List command is used to clear 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 Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.15)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_ADD_DEVICE_TO_WHITE_LIST

### Description

The LE_Add_Device_To_White_List command is used to add 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 create connection command is outstanding.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.16)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Address_Type | 1 | Address type. | 0x00: Public Device Address 0x01: Random Device Address
Address | 6 | Public Device Address or Random Device Address of the device to be added to the white list. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_REMOVE_DEVICE_FROM_WHITE_LIST

### Description

The LE_Remove_Device_From_White_List command is used to remove 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 create connection command is outstanding.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.17)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Address_Type | 1 | Address type. | 0x00: Public Device Address 0x01: Random Device Address
Address | 6 | Public Device Address or Random Device Address of the device to be removed from the white list. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_CONNECTION_UPDATE

### Description

The LE_Connection_Update command is used to change the Link Layer connection parameters of a connection. This command is supported only on master side.
The Conn_Interval_Min and Conn_Interval_Max parameters are used to define the minimum and maximum allowed connection interval. The Conn_Interval_Min parameter shall not be greater than the Conn_Interval_Max parameter.
The Conn_Latency parameter shall define the maximum allowed connection latency.
The Supervision_Timeout parameter shall define the link supervision timeout for the LE link. The Supervision_Timeout in milliseconds shall be larger than (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds.
The Minimum_CE_Length and Maximum_CE_Length are information parameters providing the Controller with a hint about the expected minimum and maximum length of the connection events. The Minimum_CE_Length shall be less than or equal to the Maximum_CE_Length.
The actual parameter values selected by the Link Layer may be different from the parameter values provided by the Host through this command.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.18)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Conn_Interval_Min | 2 | Minimum value for the connection event interval. This shall be less than or equal to Conn_Interval_Max. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Interval_Max | 2 | Maximum value for the connection event interval. This shall be greater than or equal to Conn_Interval_Min. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Supervision_Timeout | 2 | Supervision timeout for the LE Link. It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. Time = N * 10 msec. | 0x000A (100 ms) ... 0x0C80 (32000 ms)
Minimum_CE_Length | 2 | Information parameter about the minimum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
Maximum_CE_Length | 2 | Information parameter about the maximum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_CONNECTION_UPDATE_COMPLETE_EVENT

## HCI_LE_SET_HOST_CHANNEL_CLASSIFICATION

### Description

The LE_Set_Host_Channel_Classification 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 (see [Vol 6] Part B, Section 4.5.8.1).
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 Master role.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.19)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Channel_Map | 5 | This parameter contains 37 1-bit fields. The nth such field (in the range 0 to 36) contains the value for the link layer channel index n. Channel n is bad = 0. Channel n is unknown = 1. The most significant bits are reserved and shall be set to 0. At least one channel shall be marked as unknown. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_CHANNEL_MAP

### Description

The LE_Read_Channel_Map command 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 Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.20)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
LE_Channel_Map | 5 | This parameter contains 37 1-bit fields. The nth such field (in the range 0 to 36) contains the value for the link layer channel index n. Channel n is unused = 0. Channel n is used = 1. The most significant bits are reserved and shall be set to 0. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_REMOTE_FEATURES

### Description

This command requests a list of the used LE features from the remote device.
This command shall return a list of the used LE features. For details see [Vol 6] Part B, Section 4.6.
This command may be issued on both the master and slave.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.21)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_READ_REMOTE_FEATURES_COMPLETE_EVENT

## HCI_LE_ENCRYPT

### Description

The LE_Encrypt command is used to request 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 (http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf).
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.22)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Key | 16 | 128 bit key for the encryption of the data given in the command. |
Plaintext_Data | 16 | 128 bit data block that is requested to be encrypted. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Encrypted_Data | 16 | 128 bit encrypted data block. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_RAND

### Description

The LE_Rand command is used to request the Controller to generate 8 octets of random data to be sent to the Host. The Random_Number shall be generated according to [Vol 2] Part H, Section 2 if the LE Feature (LL Encryption) is supported.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.23)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Random_Number | 8 | Random Number |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_START_ENCRYPTION

### Description

The LE_Start_Encryption command is used to authenticate 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 [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's role is Master.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.24)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Random_Number | 8 | 64 bit random number. |
Encrypted_Diversifier | 2 | 16 bit encrypted diversifier. |
Long_Term_Key | 16 | 128 bit long term key. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_ENCRYPTION_CHANGE_EVENT
- HCI_ENCRYPTION_KEY_REFRESH_COMPLETE_EVENT

## HCI_LE_LONG_TERM_KEY_REQUEST_REPLY

### Description

The LE_Long_Term_Key_Request_Reply command is used to reply 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. The Long_Term_Key is used as defined in [Vol 6] Part B, Section 5.1.3.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.25)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Long_Term_Key | 16 | 128 bit long term key. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_LONG_TERM_KEY_REQUESTED_NEGATIVE_REPLY

### Description

The LE_Long_Term_Key_Request_Negative_Reply command is used to reply 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 Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.26)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_SUPPORTED_STATES

### Description

The LE_Read_Supported_States command reads the states and state combinations that the link layer supports. See [Vol 6] Part B, Section 1.1.1.
LE_States is an 8-octet bit field. If a bit is set to 1 then this state or state combination is supported by the Controller. Multiple bits in LE_States may be set to 1 to indicate support for multiple state and state combinations.
All the Advertising type with the Initiate State combinations shall be set only if the corresponding Advertising types and Master Role combination are set.
All the Scanning types and the Initiate State combinations shall be set only if the corresponding Scanning types and Master Role combination are set.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.27)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
LE_States | 8 | State or state combination is supported by the Controller. See Core v5.0, Vol.2, part E, Ch. 7.8.27. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_DATA_LENGTH

### Description

The LE_Set_Data_Length command allows the Host to suggest maximum transmission packet size and maximum packet transmission time (connMaxTxOctets and connMaxTxTime - see Bluetooth Specification v5.0 [Vol 6] Part B, Section 4.5.10) to be used for a given connection. The Controller may use smaller or larger values based on local information.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
TxOctets | 2 | Preferred maximum number of payload octets that the local Controller should include in a single Link Layer packet on this connection. | 0x001B ... 0x00FB
TxTime | 2 | Preferred maximum number of microseconds that the local Controller should use to transmit a single Link Layer packet on this connection. | 0x0148 ... 0x4290

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH

### Description

The LE_Read_Suggested_Default_Data_Length command allows the Host to read the Host's suggested values (SuggestedMaxTxOctets and SuggestedMaxTxTime) for the Controller's maximum transmitted number of payload octets and maximum packet transmission time to be used for new connections (see Bluetooth Specification v5.0 [Vol 6] Part B, Section 4.5.10).

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
SuggestedMaxTxOctets | 2 | The Host's suggested value for the Controller's maximum transmitted number of payload octets to be used for new connections. | 0x001B ... 0x00FB
SuggestedMaxTxTime | 2 | The Host's suggested value for the Controller's maximum packet transmission time to be used for new connections. | 0x0148 ... 0x4290

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH

### Description

The LE_Write_Suggested_Default_Data_Length command allows the Host to specify its suggested values for the Controller's maximum transmission number of payload octets and maximum packet transmission time to be used for new connections. The Controller may use smaller or larger values for connInitialMaxTxOctets and connInitialMaxTxTime based on local information.
(see Bluetooth Specification [Vol 6] Part B, Section 4.5.10).

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
SuggestedMaxTxOctets | 2 | The Host's suggested value for the Controller's maximum transmitted number of payload octets to be used for new connections. | 0x001B ... 0x00FB
SuggestedMaxTxTime | 2 | The Host's suggested value for the Controller's maximum packet transmission time to be used for new connections. | 0x0148 ... 0x4290

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_LOCAL_P256_PUBLIC_KEY

### Description

The LE_Read_Local_P-256_Public_Key command is used to return the local P-256 public key from the Controller. The Controller shall generate a new P-256 public/private key pair upon receipt of this command.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.36)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_EVENT

## HCI_LE_GENERATE_DHKEY

### Description

The LE_Generate_DHKey command is used to initiate generation of a Diffie-Hellman key in the Controller for use over the LE transport. This command takes the remote P-256 public key as input. The Diffie-Hellman key generation uses the private key generated by LE_Read_Local_P256_Public_Key command.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.37)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Remote_P256_Public_Key | 64 | The remote P-256 public key in X, Y format: Octets 31-0: X co-ordinate Octets 63-32: Y co-ordinate Little Endian Format |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_GENERATE_DHKEY_COMPLETE_EVENT

## HCI_LE_ADD_DEVICE_TO_RESOLVING_LIST

### Description

The LE_Add_Device_To_Resolving_List command is used to add one device to the list of address translations used to resolve Resolvable Private Addresses in the Controller.
This command cannot be used when address translation is enabled in the Controller and:
- Advertising is enabled
- Scanning is enabled
- Create connection command is outstanding
This command can be used at any time when address translation is disabled in the Controller.
When a Controller cannot add a device to the resolving list because the list is full, it shall respond with error code 0x07 (Memory Capacity Exceeded).
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.38)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Peer_Identity_Address_Type | 1 | Identity address type. | 0x00: Public Identity Address 0x01: Random (static) Identity Address
Peer_Identity_Address | 6 | Public or Random (static) Identity address of the peer device |
Peer_IRK | 16 | IRK of the peer device |
Local_IRK | 16 | IRK of the local device |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_REMOVE_DEVICE_FROM_RESOLVING_LIST

### Description

The LE_Remove_Device_From_Resolving_List command is used to remove one device from the list of address translations used to resolve Resolvable Private Addresses in the controller.
This command cannot be used when address translation is enabled in the Controller and:
- Advertising is enabled
- Scanning is enabled
- Create connection command is outstanding
This command can be used at any time when address translation is disabled in the Controller.
When a Controller cannot remove a device from the resolving list because it is not found, it shall respond with error code 0x02 (Unknown Connection Identifier).
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.39)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Peer_Identity_Address_Type | 1 | Identity address type. | 0x00: Public Identity Address 0x01: Random (static) Identity Address
Peer_Identity_Address | 6 | Public or Random (static) Identity address of the peer device |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_CLEAR_RESOLVING_LIST

### Description

The LE_Clear_Resolving_List command is used to remove all devices from the list of address translations used to resolve Resolvable Private Addresses in the Controller.
This command cannot be used when address translation is enabled in the Controller and:
- Advertising is enabled
- Scanning is enabled
- Create connection command is outstanding
This command can be used at any time when address translation is disabled in the Controller.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.40)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_RESOLVING_LIST_SIZE

### Description

The LE_Read_Resolving_List_Size command is used to read the total number of address translation entries in the resolving list that can be stored in the Controller.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.41)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Resolving_List_Size | 1 | Number of address translation entries in the resolving list |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_PEER_RESOLVABLE_ADDRESS

### Description

The LE_Read_Peer_Resolvable_Address command is used to get the current peer Resolvable Private Address being used for the corresponding peer Public and Random (static) Identity Address. The peer's resolvable address being used may change after the command is called.
This command can be used at any time.
When a Controller cannot find a Resolvable Private Address associated with the Peer Identity Address, it shall respond with error code 0x02 (Unknown Connection Identifier).
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.42)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Peer_Identity_Address_Type | 1 | Identity address type. | 0x00: Public Identity Address 0x01: Random (static) Identity Address
Peer_Identity_Address | 6 | Public or Random (static) Identity address of the peer device |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Peer_Resolvable_Address | 6 | Resolvable Private Address being used by the peer device |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_LOCAL_RESOLVABLE_ADDRESS

### Description

The LE_Read_Local_Resolvable_Address command is used to get the current local Resolvable Private Address being used for the corresponding peer Identity Address. The local's resolvable address being used may change after the command is called.
This command can be used at any time.
When a Controller cannot find a Resolvable Private Address associated with the Peer Identity Address, it shall respond with error code 0x02 (Unknown Connection Identifier).
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.43)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Peer_Identity_Address_Type | 1 | Identity address type. | 0x00: Public Identity Address 0x01: Random (static) Identity Address
Peer_Identity_Address | 6 | Public or Random (static) Identity address of the peer device |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Local_Resolvable_Address | 6 | Resolvable Private Address being used by the local device |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_ADDRESS_RESOLUTION_ENABLE

### Description

The LE_Set_Address_Resolution_Enable command is used to enable resolution of Resolvable Private Addresses in the Controller. This causes the Controller to use the resolving list whenever the Controller receives a local or peer Resolvable Private Address.
This command can be used at any time except when:
- Advertising is enabled
- Scanning is enabled
- Create connection command is outstanding
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.44)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Address_Resolution_Enable | 1 | Enable/disable address resolution in the controller. 0x00: Address Resolution in controller disabled (default), 0x01: Address Resolution in controller enabled | 0x00: Address Resolution in controller disabled (default) 0x01: Address Resolution in controller enabled

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT

### Description

The LE_Set_Resolvable_Private_Address_Timeout command set the length of time the controller uses a Resolvable Private Address before a new resolvable private address is generated and starts being used. This timeout applies to all addresses generated by the controller.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.45)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
RPA_Timeout | 2 | RPA_Timeout measured in seconds. Range for N: 0x0001 - 0xA1B8 (1 sec - approximately 11.5 hours) Default: N= 0x0384 (900 secs or 15 minutes) |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_MAXIMUM_DATA_LENGTH

### Description

The LE_Read_Maximum_Data_Length command allows the Host to read the Controller's maximum supported payload octets and packet duration times for transmission and reception (supportedMaxTxOctets and supportedMaxTxTime, supportedMaxRxOctets, and supportedMaxRxTime, see Bluetooth Specification v5.0 [Vol 6] Part B, Section 4.5.10).

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
supportedMaxTxOctets | 2 | Maximum number of payload octets that the local Controller supports for transmission of a single Link Layer packet on a data connection. | 0x001B ... 0x00FB
supportedMaxTxTime | 2 | Maximum time, in microseconds, that the local Controller supports for transmission of a single Link Layer packet on a data connection. | 0x0148 ... 0x4290
supportedMaxRxOctets | 2 | Maximum number of payload octets that the local Controller supports for reception of a single Link Layer packet on a data connection. | 0x001B ... 0x00FB
supportedMaxRxTime | 2 | Maximum time, in microseconds, that the local Controller supports for reception of a single Link Layer packet on a data connection. | 0x0148 ... 0x4290

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_READ_PHY

### Description

The LE_Read_PHY command is used to read the current transmitter PHY and receiver PHY on the connection identified by the Connection_Handle. see Bluetooth Specification [vol2] part E Section 7.8.47

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
TX_PHY | 1 | Transmitter PHY in use | 0x01: The transmitter PHY for the connection is LE 1M 0x02: The transmitter PHY for the connection is LE 2M 0x03: The transmitter PHY for the connection is LE Coded (Not supported by STM32WB)
RX_PHY | 1 | Receiver PHY in use | 0x01: The receiver PHY for the connection is LE 1M 0x02: The receiver PHY for the connection is LE 2M 0x03: The receiver PHY for the connection is LE Coded (Not supported by STM32WB)

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_DEFAULT_PHY

### Description

The LE_Set_Default_PHY command allows the Host to specify its preferred values for the transmitter PHY and receiver PHY to be used for all subsequent connections over the LE transport.
The ALL_PHYS parameter is a bit field that allows the Host to specify, for each
direction, whether it has no preference among the PHYs that the Controller supports in a given direction or whether it has specified particular PHYs that it prefers in the TX_PHYS or RX_PHYS parameter.
The TX_PHYS parameter is a bit field that indicates the transmitter PHYs that the Host prefers the Controller to use. If the ALL_PHYS parameter specifies that the Host has no preference, the TX_PHYS parameter is ignored; otherwise at least one bit shall be set to 1.
The RX_PHYS parameter is a bit field that indicates the receiver PHYs that the Host prefers the Controller to use. If the ALL_PHYS parameter specifies that the Host has no preference, the RX_PHYS parameter is ignored; otherwise at least one bit shall be set to 1.
See Bluetooth Specification [Vol2] Part E Section 7.8.48

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
ALL_PHYS | 1 | Host preferences for TX PHY and RX PHY | 0x00 ... 0x03
TX_PHYS | 1 | Host preferences for TX PHY (no LE coded support) | 0x00 ... 0x03
RX_PHYS | 1 | Host preferences for RX PHY (no LE coded support) | 0x00 ... 0x03

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_SET_PHY

### Description

The LE_Set_PHY command is used to set the PHY preferences for the connection identified by the Connection_Handle. The Controller might not be able to make the change (e.g. because the peer does not support the requested PHY) or may decide that the current PHY is preferable.
The ALL_PHYS parameter is a bit field that allows the Host to specify, for each direction, whether it has no preference among the PHYs that the Controller supports in a given direction or whether it has specified particular PHYs that it prefers in the TX_PHYS or RX_PHYS parameter.
The TX_PHYS parameter is a bit field that indicates the transmitter PHYs that the Host prefers the Controller to use. If the ALL_PHYS parameter specifies that the Host has no preference, the TX_PHYS parameter is ignored; otherwise at least one bit shall be set to 1.
The RX_PHYS parameter is a bit field that indicates the receiver PHYs that the Host prefers the Controller to use. If the ALL_PHYS parameter specifies that the Host has no preference, the RX_PHYS parameter is ignored; otherwise at least one bit shall be set to 1.
If, for at least one direction, the Host has specified a preference and the current PHY is not one of those preferred, the Controller shall request a change. Otherwise the Controller may, but need not, request a change.
The PHY preferences provided by the LE Set PHY command override those provided via the LE Set Default PHY command (Section 7.8.48) or any preferences previously set using the LE Set PHY command on the same connection.
The PHY_options parameter is a bit field that allows the Host to specify options for PHYs. The default value for a new connection shall be all zero bits. The Controller may override any preferred coding for transmitting on the LE Coded PHY.
The Host may specify a preferred coding even if it prefers not to use the LE Coded transmitter PHY since the Controller may override the PHY preference.
see Bluetooth Specification v5.0 [Vol 6] Part B, Section 7.8.49

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
ALL_PHYS | 1 | Host preferences for TX PHY and RX PHY | 0x00 ... 0x03
TX_PHYS | 1 | Host preferences for TX PHY (no LE coded support) | 0x00 ... 0x03
RX_PHYS | 1 | Host preferences for RX PHY (no LE coded support) | 0x00 ... 0x03
PHY_options | 2 | Not Supported by STM32WB |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_PHY_UPDATE_COMPLETE_EVENT

## HCI TESTING commands

##

Command | Opcode | LO | SO | BO
--- | --- | --- | --- | ---
HCI_LE_RECEIVER_TEST | 0x201D | Y | Y |
HCI_LE_TRANSMITTER_TEST | 0x201E | Y | Y |
HCI_LE_TEST_END | 0x201F | Y | Y |
HCI_LE_ENHANCED_RECEIVER_TEST | 0x2033 | Y |  |
HCI_LE_ENHANCED_TRANSMITTER_TEST | 0x2034 | Y |  |

## HCI_LE_RECEIVER_TEST

### Description

This command is used to start a test where the DUT receives test reference packets at a fixed interval. The tester generates the test reference packets.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.28)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
RX_Frequency | 1 | N = (F - 2402) / 2 Frequency Range : 2402 MHz to 2480 MHz | 0x00 ... 0x27

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_TRANSMITTER_TEST

### Description

This command is used to start 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 Packet_Payload values 0x00, 0x01 and 0x02. An LE Controller may support other values of Packet_Payload.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.29)

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
TX_Frequency | 1 | N = (F - 2402) / 2 Frequency Range : 2402 MHz to 2480 MHz | 0x00 ... 0x27
Length_Of_Test_Data | 1 | Length in bytes of payload data in each packet. | 0x00 ... 0x25
Packet_Payload | 1 | Type of packet payload. | 0x00: Pseudo-Random bit sequence 9 0x01: Pattern of alternating bits '11110000' 0x02: Pattern of alternating bits '10101010' 0x03: Pseudo-Random bit sequence 15 0x04: Pattern of All '1' bits 0x05: Pattern of All '0' bits 0x06: Pattern of alternating bits '00001111' 0x07: Pattern of alternating bits '0101'

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_TEST_END

### Description

This command is used to stop any test which is in progress. The Number_Of_Packets for a transmitter test shall be reported as 0x0000. The Number_Of_Packets is an unsigned number and contains the number of received packets.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.8.30)

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Number_Of_Packets | 2 | Number of packets received |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_ENHANCED_RECEIVER_TEST

### Description

This command is used to start a test where the DUT receives test reference packets at a fixed interval. The tester generates the test reference packets.
see Bluetooth Specification v5.0 [Vol 6] Part B, Section 7.8.50

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
RX_Frequency | 1 | N = (F - 2402) / 2 Frequency Range : 2402 MHz to 2480 MHz | 0x00 ... 0x27
PHY | 1 | PHY to use for test packet | 0x00: Reserved for future use 0x01: Transmitter set to use the LE 1M PHY 0x02: Transmitter set to use the LE 2M PHY 0x03: Transmitter set to use the LE Coded PHY with S=8 data coding 0x04: Transmitter set to use the LE Coded PHY with S=2 data coding
Modulation_Index | 1 | Modulation index capability of the transmitter | 0x00: Assume transmitter will have a standard modulation index 0x01: Assume transmitter will have a stable modulation index

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## HCI_LE_ENHANCED_TRANSMITTER_TEST

### Description

This command is used to start 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_Enhanced Transmitter_Test command shall support Packet_Payload values 0x00, 0x01 and 0x02. An LE Controller supporting the LE Coded PHY shall also support Packet_Payload value 0x04 (not supported by STM32WB). An LE Controller may support other values of Packet_Payload.
see Bluetooth Specification v5.0 [Vol 6] Part B, Section 7.8.51

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
TX_Frequency | 1 | N = (F - 2402) / 2 Frequency Range : 2402 MHz to 2480 MHz | 0x00 ... 0x27
Length_Of_Test_Data | 1 | Length in bytes of payload data in each packet. | 0x00 ... 0x25
Packet_Payload | 1 | Type of packet payload. | 0x00: Pseudo-Random bit sequence 9 0x01: Pattern of alternating bits '11110000' 0x02: Pattern of alternating bits '10101010' 0x03: Pseudo-Random bit sequence 15 0x04: Pattern of All '1' bits 0x05: Pattern of All '0' bits 0x06: Pattern of alternating bits '00001111' 0x07: Pattern of alternating bits '0101'
PHY | 1 | PHY to use for test packet | 0x00: Reserved for future use 0x01: Transmitter set to use the LE 1M PHY 0x02: Transmitter set to use the LE 2M PHY 0x03: Transmitter set to use the LE Coded PHY with S=8 data coding 0x04: Transmitter set to use the LE Coded PHY with S=2 data coding

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI HAL commands

##

Command | Opcode | LO | SO | BO
--- | --- | --- | --- | ---
ACI_HAL_GET_FW_BUILD_NUMBER | 0xFC00 | Y | Y | Y
ACI_HAL_WRITE_CONFIG_DATA | 0xFC0C | Y | Y | Y
ACI_HAL_READ_CONFIG_DATA | 0xFC0D | Y | Y | Y
ACI_HAL_SET_TX_POWER_LEVEL | 0xFC0F | Y | Y | Y
ACI_HAL_LE_TX_TEST_PACKET_NUMBER | 0xFC14 | Y | Y |
ACI_HAL_TONE_START | 0xFC15 | Y | Y |
ACI_HAL_TONE_STOP | 0xFC16 | Y | Y |
ACI_HAL_GET_LINK_STATUS | 0xFC17 | Y |  |
ACI_HAL_SET_RADIO_ACTIVITY_MASK | 0xFC18 | Y | Y | Y
ACI_HAL_GET_ANCHOR_PERIOD | 0xFC19 | Y |  |
ACI_HAL_SET_EVENT_MASK | 0xFC1A |  |  |
ACI_HAL_SET_SMP_ENG_CONFIG | 0xFC1B |  | Y |
ACI_HAL_GET_PM_DEBUG_INFO | 0xFC1C | Y |  |
ACI_HAL_READ_RADIO_REG | 0xFC30 | Y | Y |
ACI_HAL_WRITE_RADIO_REG | 0xFC31 | Y | Y |
ACI_HAL_READ_RAW_RSSI | 0xFC32 | Y | Y |
ACI_HAL_RX_START | 0xFC33 | Y | Y |
ACI_HAL_RX_STOP | 0xFC34 | Y | Y |
ACI_HAL_STACK_RESET | 0xFC3B | Y | Y | Y

## ACI_HAL_GET_FW_BUILD_NUMBER

### Description

This command returns the build number associated with the firmware version currently running

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Build_Number | 2 | Build number of the firmware. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_WRITE_CONFIG_DATA

### Description

This command writes a value to a low level configure data structure. It is useful to setup directly some low level parameters for the system in the runtime.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Offset | 1 | Offset of the element in the configuration data structure which has to be written. | 0x00: CONFIG_DATA_PUBADDR_OFFSET; Bluetooth public address; 6 bytes 0x08: CONFIG_DATA_ER_OFFSET; Encryption root key used to derive LTK and CSRK; 16 bytes 0x18: CONFIG_DATA_IR_OFFSET; Identity root key used to derive LTK and CSRK; 16 bytes 0x2E: CONFIG_DATA_RANDOM_ADDRESS_WR; Static Random Address; 6 bytes
Length | 1 | Length of data to be written |
Value | Length | Data to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_READ_CONFIG_DATA

### Description

This command requests the value in the low level configure data structure.
The number of read bytes changes for different Offset.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Offset | 1 | Offset of the element in the configuration data structure which has to be read. | 0x00: CONFIG_DATA_PUBADDR_OFFSET; Bluetooth public address; 6 bytes 0x08: CONFIG_DATA_ER_OFFSET; Encryption root key used to derive LTK and CSRK; 16 bytes 0x18: CONFIG_DATA_IR_OFFSET Identity root key used to derive LTK and CSRK; 16 bytes 0x80: CONFIG_DATA_RANDOM_ADDRESS Static random address; 6 bytes (read-only)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Data_Length | 1 | Length of Data in octets |
Data | Data_Length | Data field associated with Offset parameter |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_SET_TX_POWER_LEVEL

### Description

This command sets the TX power level of the device. By controlling the PA_LEVEL, that determines the output power level (dBm) at the IC pin.
When the system starts up or reboots, the default TX power level will be used, which is the maximum value of 6 dBm. Once this command is given, the output power will be changed instantly, regardless if there is Bluetooth communication going on or not. For example, for debugging purpose, the device can be set to advertise all the time. And use this command to observe the signal strength changing.
The system will keep the last received TX power level from the command, i.e. the 2nd command overwrites the previous TX power level. The new TX power level remains until another Set TX Power command, or the system reboots.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
En_High_Power | 1 | Enable High Power mode - Deprecated and ignored on STM32WB | 0x00: Standard Power 0x01: High Power
PA_Level | 1 | Power amplifier output level. Output power is indicative and it depends on the PCB layout and associated components.Here the values are given at the IC pin | 0x00: -40 dBm 0x01: -20.85 dBm 0x02: -19.75 dBm 0x03: -18.85 dBm 0x04: -17.6 dBm 0x05: -16.5 dBm 0x06: -15.25 dBm 0x07: -14.1 dBm 0x08: -13.15 dBm 0x09: -12.05 dBm 0x0A: -10.9 dBm 0x0B: -9.9 dBm 0x0C: -8.85 dBm 0x0D: -7.8 dBm 0x0E: -6.9 dBm 0x0F: -5.9 dBm 0x10: -4.95 dBm 0x11: -4 dBm 0x12: -3.15 dBm 0x13: -2.45 dBm 0x14: -1.8 dBm 0x15: -1.3 dBm 0x16: -0.85 dBm 0x17: -0.5 dBm 0x18: -0.15 dBm 0x19: 0 dBm 0x1A: +1 dBm 0x1B: +2 dBm 0x1C: +3 dBm 0x1D: +4 dBm 0x1E: +5 dBm 0x1F: +6 dBm

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_LE_TX_TEST_PACKET_NUMBER

### Description

This command returns the number of packets sent in Direct Test Mode.
When the Direct TX test is started, a 32-bit counter is used to count how many packets have been transmitted.
This command can be used to check how many packets have been sent during the Direct TX test.
The counter starts from 0 and counts upwards. The counter can wrap and start from 0 again. The counter is not cleared until the next Direct TX test starts.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Number_Of_Packets | 4 | Number of packets sent during the last Direct TX test. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_TONE_START

### Description

This command starts a carrier frequency, i.e. a tone, on a specific channel. The frequency sine wave at the specific channel may be used for debugging purpose only. The channel ID is a parameter from 0x00 to 0x27 for the 40 BLE channels, e.g. 0x00 for 2.402 GHz, 0x01 for 2.404 GHz etc.
This command should not be used when normal Bluetooth activities are ongoing.
The tone should be stopped by ACI_HAL_TONE_STOP command.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
RF_Channel | 1 | BLE Channel ID, from 0x00 to 0x27 meaning (2.402 + 2*0xXX) GHz Device will continuously emit 0s, that means that the tone will be at the channel center frequency less the maximum frequency deviation (250kHz). | 0x00 ... 0x27
Freq_offset | 1 | Frequency Offset for tone channel | 0x00 ... 0xFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_TONE_STOP

### Description

This command is used to stop the previously started ACI_HAL_TONE_START command.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_GET_LINK_STATUS

### Description

This command returns the status of the 8 Bluetooth low energy links managed by the device

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Link_Status | 8 | Array of link status (8 links). Each link status is 1 byte. |
Link_Connection_Handle | 16 | Array of connection handles (2 bytes) for 8 links. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_SET_RADIO_ACTIVITY_MASK

### Description

This command set the bitmask associated to ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT.
Only the radio activities enabled in the mask will be reported to application by ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Radio_Activity_Mask | 2 | Bitmask of radio events | Bitmask of: 0x0001: Idle 0x0002: Advertising 0x0004: Connection event slave 0x0008: Scanning 0x0010: Connection request 0x0020: Connection event master 0x0040: TX test mode 0x0080: RX test mode

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT
- ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT

## ACI_HAL_GET_ANCHOR_PERIOD

### Description

This command returns information about the Anchor Period to help application in selecting slot timings when operating in multi-link scenarios.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Anchor_Period | 4 | Current anchor period. T = N * 0.625 ms. |
Max_Free_Slot | 4 | Maximum available time that can be allocated for a new slot. T = N * 0.625 ms. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_SET_EVENT_MASK

### Description

This command is used to enable/disable the generation of HAL events

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Event_Mask | 4 | Mask to enable/disable generation of HAL events | Bitmask of: 0x00000000: No events specified (Default) 0x00000001: ACI_HAL_SCAN_REQ_REPORT_EVENT

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_SET_SMP_ENG_CONFIG

### Description

This command is used to provide a specific engineering setup to the Security Manager Protocol Layer. It may be used during development/debug only!

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
SMP_Config | 4 | Mask to configure SMP engineering knobs | Bitmask of: 0x00000000: Default config (all reset) 0x00000001: Cheat Level 1 ON 0x00000002: RFU 0x00000003: Cheat Level 3 ON 0x00000004: RFU 0x00000005: Cheat Level 5 ON 0x00000006: Cheat Level 6 ON 0x00000007: Cheat Level 7 ON 0x00000010: DBG messages ON 0x00000100: Debug Public Key ON 0x00000107: Debug KEY On + DBG msg Off + CL=7 0x00000117: Debug KEY On + DBG msg On + CL=7

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_GET_PM_DEBUG_INFO

### Description

This command is used to retrieve TX, RX and total buffer count allocated for ACL packets.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Allocated_For_TX | 1 | MBlocks allocated for TXing |
Allocated_For_RX | 1 | MBlocks allocated for RXing |
Allocated_MBlocks | 1 | Overall allocated MBlocks |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_READ_RADIO_REG

### Description

This command Reads Register value from the RF module.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Register_Address | 1 | Address of the register to be read |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
reg_val | 1 | Register value |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_WRITE_RADIO_REG

### Description

This command writes Register value to the RF module.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Register_Address | 1 | Address of the register to be written |
Register_Value | 1 | Value to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_READ_RAW_RSSI

### Description

This command returns the raw value of the RSSI.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Value | 3 | RAW RSSI value |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_RX_START

### Description

This command does set up the RF to listen to a specific RF channel.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
RF_Channel | 1 | BLE Channel ID, from 0x00 to 0x27 meaning (2.402 + 2*0xXX) GHz Device will continuously emit 0s, that means that the tone will be at the channel center frequency less the maximum frequency deviation (250kHz). | 0x00 ... 0x27

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_RX_STOP

### Description

This command stop a previous ACI_HAL_RX_START command.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_HAL_STACK_RESET

### Description

This command is equivalent to HCI_RESET but ensures the sleep mode is entered immediately after its completion.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI GAP commands

##

Command | Opcode | LO | SO | BO
--- | --- | --- | --- | ---
ACI_GAP_SET_NON_DISCOVERABLE | 0xFC81 |  | Y |
ACI_GAP_SET_LIMITED_DISCOVERABLE | 0xFC82 |  | Y |
ACI_GAP_SET_DISCOVERABLE | 0xFC83 |  | Y |
ACI_GAP_SET_DIRECT_CONNECTABLE | 0xFC84 |  | Y |
ACI_GAP_SET_IO_CAPABILITY | 0xFC85 |  | Y |
ACI_GAP_SET_AUTHENTICATION_REQUIREMENT | 0xFC86 |  | Y |
ACI_GAP_SET_AUTHORIZATION_REQUIREMENT | 0xFC87 |  | Y |
ACI_GAP_PASS_KEY_RESP | 0xFC88 |  | Y |
ACI_GAP_AUTHORIZATION_RESP | 0xFC89 |  | Y |
ACI_GAP_INIT | 0xFC8A |  | Y |
ACI_GAP_SET_NON_CONNECTABLE | 0xFC8B |  | Y |
ACI_GAP_SET_UNDIRECTED_CONNECTABLE | 0xFC8C |  | Y |
ACI_GAP_SLAVE_SECURITY_REQ | 0xFC8D |  | Y |
ACI_GAP_UPDATE_ADV_DATA | 0xFC8E |  | Y |
ACI_GAP_DELETE_AD_TYPE | 0xFC8F |  | Y |
ACI_GAP_GET_SECURITY_LEVEL | 0xFC90 |  | Y |
ACI_GAP_SET_EVENT_MASK | 0xFC91 |  | Y |
ACI_GAP_CONFIGURE_WHITELIST | 0xFC92 |  | Y |
ACI_GAP_TERMINATE | 0xFC93 |  | Y |
ACI_GAP_CLEAR_SECURITY_DB | 0xFC94 |  | Y |
ACI_GAP_ALLOW_REBOND | 0xFC95 |  | Y |
ACI_GAP_START_LIMITED_DISCOVERY_PROC | 0xFC96 |  |  |
ACI_GAP_START_GENERAL_DISCOVERY_PROC | 0xFC97 |  |  |
ACI_GAP_START_NAME_DISCOVERY_PROC | 0xFC98 |  |  |
ACI_GAP_START_AUTO_CONNECTION_ESTABLISH_PROC | 0xFC99 |  |  |
ACI_GAP_START_GENERAL_CONNECTION_ESTABLISH_PROC | 0xFC9A |  |  |
ACI_GAP_START_SELECTIVE_CONNECTION_ESTABLISH_PROC | 0xFC9B |  |  |
ACI_GAP_CREATE_CONNECTION | 0xFC9C |  |  |
ACI_GAP_TERMINATE_GAP_PROC | 0xFC9D |  |  |
ACI_GAP_START_CONNECTION_UPDATE | 0xFC9E |  |  |
ACI_GAP_SEND_PAIRING_REQ | 0xFC9F |  |  |
ACI_GAP_RESOLVE_PRIVATE_ADDR | 0xFCA0 |  |  |
ACI_GAP_SET_BROADCAST_MODE | 0xFCA1 |  |  |
ACI_GAP_START_OBSERVATION_PROC | 0xFCA2 |  |  |
ACI_GAP_GET_BONDED_DEVICES | 0xFCA3 |  | Y |
ACI_GAP_IS_DEVICE_BONDED | 0xFCA4 |  | Y |
ACI_GAP_NUMERIC_COMPARISON_VALUE_CONFIRM_YESNO | 0xFCA5 |  | Y |
ACI_GAP_PASSKEY_INPUT | 0xFCA6 |  | Y |
ACI_GAP_GET_OOB_DATA | 0xFCA7 |  | Y |
ACI_GAP_SET_OOB_DATA | 0xFCA8 |  | Y |
ACI_GAP_ADD_DEVICES_TO_RESOLVING_LIST | 0xFCA9 |  | Y |
ACI_GAP_REMOVE_BONDED_DEVICE | 0xFCAA |  | Y |

## ACI_GAP_SET_NON_DISCOVERABLE

### Description

Put the device in non-discoverable mode. This command disables the LL advertising.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SET_LIMITED_DISCOVERABLE

### Description

Put the device in limited discoverable mode (as defined in Bluetooth Specification v.5.0, Vol. 3, Part C, section 9.2.3). The device will be discoverable for maximum period of TGAP (lim_adv_timeout) = 180 seconds (from errata). The advertising can be disabled at any time by issuing ACI_GAP_SET_NON_DISCOVERABLE command.
The Adv_Interval_Min and Adv_Interval_Max parameters are optional. If both are set to 0, the GAP will use default values for adv intervals for limited discoverable mode (250 ms and 500 ms respectively).
To allow a fast connection, the host can set Local_Name, Service_Uuid_List, Slave_Conn_Interval_Min and Slave_Conn_Interval_Max. If provided, these data will be inserted into the advertising packet payload as AD data. These parameters are optional in this command. These values can be set in advertised data using ACI_GAP_UPDATE_ADV_DATA command separately.
The total size of data in advertising packet cannot exceed 31 bytes.
With this command, the BLE Stack will also add automatically the following standard AD types:
- AD Flags
- Power Level
When advertising timeout happens (i.e. limited discovery period has elapsed), controller generates ACI_GAP_LIMITED_DISCOVERABLE_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Advertising_Type | 1 | Advertising type | 0x00: ADV_IND (Connectable undirected advertising) 0x02: ADV_SCAN_IND (Scannable undirected advertising) 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
Advertising_Interval_Min | 2 | Minimum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Advertising_Interval_Max | 2 | Maximum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Advertising_Filter_Policy | 1 | Advertising filter policy: not applicable (the value of Advertising_Filter_Policy parameter is not used inside the Stack) |
Local_Name_Length | 1 | Length of the local_name field in octets. If length is set to 0x00, Local_Name parameter is not used. |
Local_Name | Local_Name_Length | Local name of the device. First byte must be 0x08 for Shortened Local Name or 0x09 for Complete Local Name. No NULL character at the end. |
Service_Uuid_length | 1 | Length of the Service Uuid List in octets. If there is no service to be advertised, set this field to 0x00. |
Service_Uuid_List | Service_Uuid_length | This is the list of the UUIDs as defined in Volume 3, Section 11 of GAP Specification. First byte is the AD Type. See also Supplement to the Bluetooth Core 5.0 specification. |
Slave_Conn_Interval_Min | 2 | Slave connection interval minimum value suggested by Peripheral. If Slave_Conn_Interval_Min and Slave_Conn_Interval_Max are not 0x0000, Slave Connection Interval Range AD structure will be added in advertising data. Connection interval is defined in the following manner: connIntervalmin = Slave_Conn_Interval_Min x 1.25ms. | 0x0000 (NaN) 0xFFFF (NaN) : No specific minimum 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Slave_Conn_Interval_Max | 2 | Slave connection interval maximum value suggested by Peripheral. If Slave_Conn_Interval_Min and Slave_Conn_Interval_Max are not 0x0000, Slave Connection Interval Range AD structure will be added in advertising data. Connection interval is defined in the following manner: connIntervalmax = Slave_Conn_Interval_Max x 1.25ms | 0x0000 (NaN) 0xFFFF (NaN) : No specific maximum 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GAP_LIMITED_DISCOVERABLE_EVENT

## ACI_GAP_SET_DISCOVERABLE

### Description

Put the device in general discoverable mode (as defined in Bluetooth Specification v.5.0, Vol. 3, Part C, section 9.2.4). The device will be discoverable until the host issues the ACI_GAP_SET_NON_DISCOVERABLE command. The Adv_Interval_Min and Adv_Interval_Max parameters are optional. If both are set to 0, the GAP uses the default values for adv intervals for general discoverable mode.
When using connectable undirected advertising events:
- Adv_Interval_Min = 30 ms
- Adv_Interval_Max = 60 ms
When using non-connectable advertising events or scannable undirected advertising events:
- Adv_Interval_Min = 100 ms
- Adv_Interval_Max = 150 ms
Host can set the Local Name, a Service UUID list and the Slave Connection Interval Range.
If provided, these data will be inserted into the advertising packet payload as AD data.
These parameters are optional in this command. These values can be also set using ACI_GAP_UPDATE_ADV_DATA command separately.
The total size of data in advertising packet cannot exceed 31 bytes.
With this command, the BLE Stack will also add automatically the following standard AD types:
- AD Flags
- TX Power Level

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Advertising_Type | 1 | Advertising type | 0x00: ADV_IND (Connectable undirected advertising) 0x02: ADV_SCAN_IND (Scannable undirected advertising) 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
Advertising_Interval_Min | 2 | Minimum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Advertising_Interval_Max | 2 | Maximum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Advertising_Filter_Policy | 1 | Advertising filter policy: not applicable (the value of Advertising_Filter_Policy parameter is not used inside the Stack) |
Local_Name_Length | 1 | Length of the local_name field in octets. If length is set to 0x00, Local_Name parameter is not used. |
Local_Name | Local_Name_Length | Local name of the device. First byte must be 0x08 for Shortened Local Name or 0x09 for Complete Local Name. No NULL character at the end. |
Service_Uuid_length | 1 | Length of the Service Uuid List in octets. If there is no service to be advertised, set this field to 0x00. |
Service_Uuid_List | Service_Uuid_length | This is the list of the UUIDs as defined in Volume 3, Section 11 of GAP Specification. First byte is the AD Type. See also Supplement to the Bluetooth Core 5.0 specification. |
Slave_Conn_Interval_Min | 2 | Slave connection interval minimum value suggested by Peripheral. If Slave_Conn_Interval_Min and Slave_Conn_Interval_Max are not 0x0000, Slave Connection Interval Range AD structure will be added in advertising data. Connection interval is defined in the following manner: connIntervalmin = Slave_Conn_Interval_Min x 1.25ms. | 0x0000 (NaN) 0xFFFF (NaN) : No specific minimum 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Slave_Conn_Interval_Max | 2 | Slave connection interval maximum value suggested by Peripheral. If Slave_Conn_Interval_Min and Slave_Conn_Interval_Max are not 0x0000, Slave Connection Interval Range AD structure will be added in advertising data. Connection interval is defined in the following manner: connIntervalmax = Slave_Conn_Interval_Max x 1.25ms | 0x0000 (NaN) 0xFFFF (NaN) : No specific maximum 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SET_DIRECT_CONNECTABLE

### Description

Set the device in direct connectable mode (as defined in Bluetooth Specification v.5.0, Vol. 3, Part C, section 9.3.3). Device uses direct connectable mode to advertise using High Duty cycle advertisement events or Low Duty cycle advertisement events and the address as either what is specified in the Own Address Type parameter. The command specifies the type of the advertising used.
If the privacy is enabled, the Type parameter in reconnection address is used for advertising, otherwise the address of the type specified in OwnAddrType is used.
The device stays in directed connectable mode only for 1.28 seconds. If no connection is established within this duration, the device enters non discoverable mode and advertising has to be again enabled explicitly.
The controller generates a HCI_LE_CONNECTION_COMPLETE_EVENT event with the status set to HCI_ADVERTISING_TIMEOUT_ERR_CODE if the connection was not established and BLE_STATUS_SUCCESS (0x00) if the connection was successfully established.
If Host privacy is enabled this command returns BLE_STATUS_INVALID_PARAMS.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled)
Directed_Advertising_Type | 1 | Advertising type | 0x01: High Duty Cycle Directed Advertising 0x04: Low Duty Cycle Directed Advertising
Direct_Address_Type | 1 | The address type of the peer device. | 0x00: Public Device Address 0x01: Random Device Address
Direct_Address | 6 | Initiator Bluetooth address |
Advertising_Interval_Min | 2 | Minimum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Advertising_Interval_Max | 2 | Maximum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT
- HCI_LE_CONNECTION_COMPLETE_EVENT

## ACI_GAP_SET_IO_CAPABILITY

### Description

Set the IO capabilities of the device. This command has to be given only when the device is not in a connected state.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
IO_Capability | 1 | IO capability of the device. | 0x00: IO_CAP_DISPLAY_ONLY 0x01: IO_CAP_DISPLAY_YES_NO 0x02: IO_CAP_KEYBOARD_ONLY 0x03: IO_CAP_NO_INPUT_NO_OUTPUT 0x04: IO_CAP_KEYBOARD_DISPLAY

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SET_AUTHENTICATION_REQUIREMENT

### Description

Set the authentication requirements for the device. If the OOB_Enable is set to 0, the following 16 octets of OOB_Data will be ignored on reception. This command has to be given only when the device is not in a connected state.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Bonding_Mode | 1 | Bonding mode. Only if bonding is enabled (0x01), the bonding information is stored in flash | 0x00: No-bonding mode 0x01: Bonding mode
MITM_Mode | 1 | MITM mode. | 0x00: MITM protection not required 0x01: MITM protection required
SC_Support | 1 | LE Secure connections support | 0x00: Secure Connections Pairing not supported 0x01: Secure Connections Pairing supported but optional 0x02: Secure Connections Pairing supported and mandatory (SC Only Mode)
KeyPress_Notification_Support | 1 | Keypress notification support | 0x00: Keypress notification not supported 0x01: Keypress notification supported
Min_Encryption_Key_Size | 1 | Minimum encryption key size to be used during pairing |
Max_Encryption_Key_Size | 1 | Maximum encryption key size to be used during pairing |
Use_Fixed_Pin | 1 | Use or not fixed pin. If set to 0x00, then during the pairing process the application will not be requested for a pin (Fixed_Pin will be used). If set to 0x01, then during pairing process if a passkey is required the application will be notified | 0x00: use a fixed pin 0x01: do not use a fixed pin
Fixed_Pin | 4 | Fixed pin to be used during pairing if MIMT protection is enabled. Any random value between 0 to 999999 | 0 ... 999999
Identity_Address_Type | 1 | Identity address type. | 0x00: Public Identity Address 0x01: Random (static) Identity Address

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SET_AUTHORIZATION_REQUIREMENT

### Description

Set the authorization requirements of the device. This command has to be given when connected to a device if authorization is required to access services which require authorization.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Authorization_Enable | 1 | Enable the authorization in the device and when a remote device tries to read/write a characteristic with authorization requirements, the stack will send back an error response with "Insufficient authorization" error code. After pairing is complete an ACI_GAP_AUTHORIZATION_REQ_EVENT will be sent to the Host. | 0x00: Authorization not required 0x01: Authorization required

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_PASS_KEY_RESP

### Description

This command should be send by the host in response to ACI_GAP_PASS_KEY_REQ_EVENT event. The command parameter contains the pass key which will be used during the pairing process.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Pass_Key | 4 | Pass key that will be used during the pairing process. Must be a six-digit decimal number. | 0 ... 999999

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT
- ACI_GAP_PAIRING_COMPLETE_EVENT

## ACI_GAP_AUTHORIZATION_RESP

### Description

Authorize a device to access attributes. This command should be send by the host in response to ACI_GAP_AUTHORIZATION_REQ_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Authorize | 1 | Authorization response. | 0x01: Authorize 0x02: Reject

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_INIT

### Description

Initialize the GAP layer. Register the GAP service with the GATT.
All the standard GAP characteristics will also be added:
- Device Name
- Appearance
- Peripheral Preferred Connection Parameters (peripheral role only).
Note that if the Peripheral Preferred Connection Parameters characteristic is added, its handle is equal to the Appearance characteristic handle plus 2.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Role | 1 | Bitmap of allowed roles. | Bitmask of: 0x01: Peripheral 0x02: Broadcaster 0x04: Central 0x08: Observer
privacy_enabled | 1 | Specify if privacy is enabled or not and which one . | 0x00: Privacy disabled 0x01: Privacy host enabled 0x02: Privacy controller enabled
device_name_char_len | 1 | Length of the device name characteristic |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Service_Handle | 2 | Handle of the GAP service |
Dev_Name_Char_Handle | 2 | Device Name Characteristic handle |
Appearance_Char_Handle | 2 | Appearance Characteristic handle |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SET_NON_CONNECTABLE

### Description

Put the device into non connectable mode. This mode does not support connection. The privacy setting done in the ACI_GAP_INIT command plays a role in deciding the valid parameters for this command.
Advertiser filter policy is internally set to 0.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Advertising_Event_Type | 1 | Advertising type | 0x02: ADV_SCAN_IND (Scannable undirected advertising) 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SET_UNDIRECTED_CONNECTABLE

### Description

Put the device into undirected connectable mode.
If privacy is enabled in the device, a resolvable private address is generated and used as the advertiser's address. If not, the address of the type specified in own_addr_type is used for advertising.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Advertising_Interval_Min | 2 | Minimum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Advertising_Interval_Max | 2 | Maximum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if Host privacy (i.e. privacy 1.1) is enabled)
Adv_Filter_Policy | 1 | Advertising filter policy. | 0x00: Allow Scan Request from Any, Allow Connect Request from Any 0x03: Allow Scan Request from White List Only, Allow Connect Request from White List Only

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SLAVE_SECURITY_REQ

### Description

Send a slave security request to the master.
This command has to be issued to notify the master of the security requirements of the slave. The master may encrypt the link, initiate the pairing procedure, or reject the request.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GAP_SLAVE_SECURITY_INITIATED_EVENT

## ACI_GAP_UPDATE_ADV_DATA

### Description

This command can be used to update the advertising data for a particular AD type. If the AD type specified does not exist, then it is added to the advertising data. If the overall advertising data length is more than 31 octets after the update, then the command is rejected and the old data is retained.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
AdvDataLen | 1 | Length of AdvData in octets |
AdvData | AdvDataLen | Advertising data used by the device while advertising. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_DELETE_AD_TYPE

### Description

This command can be used to delete the specified AD type from the advertisement data if present.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
ADType | 1 | One of the AD types like in Bluetooth specification (see volume 3, Part C, 11.1) |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_GET_SECURITY_LEVEL

### Description

This command can be used to get the current security settings of the device.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Security_Mode | 1 | Security mode. | 0x01: Security Mode 1 0x02: Security Mode 2
Security_Level | 1 | Security Level. | 0x01: Security Level 1 0x02: Security Level 2 0x03: Security Level 3 0x04: Security Level 4

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SET_EVENT_MASK

### Description

It allows masking events from the GAP. The default configuration is all the events masked.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
GAP_Evt_Mask | 2 | GAP event mask. Default: 0xFFFF. | Bitmask of: 0x0000: No events 0x0001: ACI_GAP_LIMITED_DISCOVERABLE_EVENT 0x0002: ACI_GAP_PAIRING_COMPLETE_EVENT 0x0004: ACI_GAP_PASS_KEY_REQ_EVENT 0x0008: ACI_GAP_AUTHORIZATION_REQ_EVENT 0x0010: ACI_GAP_SLAVE_SECURITY_INITIATED_EVENT 0x0020: ACI_GAP_BOND_LOST_EVENT 0x0080: ACI_GAP_PROC_COMPLETE_EVENT 0x0100: ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT 0x0200: ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT 0x0400: ACI_L2CAP_PROC_TIMEOUT_EVENT 0x0800: ACI_GAP_ADDR_NOT_RESOLVED_EVENT

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_CONFIGURE_WHITELIST

### Description

Add addresses of bonded devices into the controller's whitelist.
The command returns an error if it was unable to add the bonded devices into the whitelist.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_TERMINATE

### Description

Command the controller to terminate the connection. A HCI_DISCONNECTION_COMPLETE_EVENT event is generated when the link is disconnected.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Reason | 1 | The reason for ending the connection. | 0x05: Authentication Failure 0x13: Remote User Terminated Connection 0x14: Remote Device Terminated Connection due to Low Resources 0x15: Remote Device Terminated Connection due to Power Off 0x1A: Unsupported Remote Feature 0x3B: Unacceptable Connection Parameters

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_DISCONNECTION_COMPLETE_EVENT

## ACI_GAP_CLEAR_SECURITY_DB

### Description

Clear the security database. All the devices in the security database are removed.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_ALLOW_REBOND

### Description

Allows the security manager to complete the pairing procedure and re-bond with the master. This command should be given by the application when it receives the ACI_GAP_BOND_LOST_EVENT if it wants the re-bonding to happen successfully. If this command is not given on receiving the event, the bonding procedure will timeout.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_START_LIMITED_DISCOVERY_PROC

### Description

Start the limited discovery procedure. The controller is commanded to start active scanning.
When this procedure is started, only the devices in limited discoverable mode are returned to the upper layers.
The procedure is terminated when either the upper layers issue a command to terminate the procedure by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the procedure code set to 0x01 or a timeout happens (the timeout value is fixed at 10.24 s.). When the procedure is terminated due to any of the above reasons, ACI_GAP_PROC_COMPLETE_EVENT event is returned with the procedure code set to 0x01.
The device found when the procedure is ongoing is returned to the upper layers through the event HCI_LE_ADVERTISING_REPORT_EVENT.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Filter_Duplicates | 1 | Enable/disable duplicate filtering. | 0x00: Duplicate filtering disabled 0x01: Duplicate filtering enabled

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_ADVERTISING_REPORT_EVENT
- ACI_GAP_PROC_COMPLETE_EVENT

## ACI_GAP_START_GENERAL_DISCOVERY_PROC

### Description

Start the general discovery procedure. The controller is commanded to start active scanning. The procedure is terminated when either the upper layers issue a command to terminate the procedure by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the procedure code set to 0x02 or a timeout happens (the timeout value is fixed at 10.24 s.). When the procedure is terminated due to any of the above reasons, ACI_GAP_PROC_COMPLETE_EVENT event is returned with the procedure code set to 0x02. The device found when the procedure is ongoing is returned to HCI_LE_ADVERTISING_REPORT_EVENT.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Filter_Duplicates | 1 | Enable/disable duplicate filtering. | 0x00: Duplicate filtering disabled 0x01: Duplicate filtering enabled

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_ADVERTISING_REPORT_EVENT
- ACI_GAP_PROC_COMPLETE_EVENT

## ACI_GAP_START_NAME_DISCOVERY_PROC

### Description

Start the name discovery procedure. A LE_Create_Connection call will be made to the controller by GAP with the initiator filter policy set to "ignore whitelist and process connectable advertising packets only for the specified device". Once a connection is established, GATT procedure is started to read the device name characteristic. When the read is completed (successfully or unsuccessfully), a ACI_GAP_PROC_COMPLETE_EVENT event is given to the upper layer. The event also contains the name of the device if the device name was read successfully.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
Peer_Address_Type | 1 | Address type. | 0x00: Public Device Address 0x01: Random Device Address
Peer_Address | 6 | Public Device Address or Random Device Address of the device to be connected. |
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Conn_Interval_Min | 2 | Minimum value for the connection event interval. This shall be less than or equal to Conn_Interval_Max. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Interval_Max | 2 | Maximum value for the connection event interval. This shall be greater than or equal to Conn_Interval_Min. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Supervision_Timeout | 2 | Supervision timeout for the LE Link. It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. Time = N * 10 msec. | 0x000A (100 ms) ... 0x0C80 (32000 ms)
Minimum_CE_Length | 2 | Information parameter about the minimum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
Maximum_CE_Length | 2 | Information parameter about the maximum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GAP_PROC_COMPLETE_EVENT

## ACI_GAP_START_AUTO_CONNECTION_ESTABLISH_PROC

### Description

Start the auto connection establishment procedure. The devices specified are added to the white list of the controller and a LE_Create_Connection call will be made to the controller by GAP with the initiator filter policy set to "use whitelist to determine which advertiser to connect to". When a command is issued to terminate the procedure by upper layer, a LE_Create_Connection_Cancel call will be made to the controller by GAP.
The procedure is terminated when either a connection is successfully established with one of the specified devices in the white list or the procedure is explicitly terminated by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the procedure code set to 0x08. A ACI_GAP_PROC_COMPLETE_EVENT event is returned with the procedure code set to 0x08.
If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Conn_Interval_Min | 2 | Minimum value for the connection event interval. This shall be less than or equal to Conn_Interval_Max. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Interval_Max | 2 | Maximum value for the connection event interval. This shall be greater than or equal to Conn_Interval_Min. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Supervision_Timeout | 2 | Supervision timeout for the LE Link. It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. Time = N * 10 msec. | 0x000A (100 ms) ... 0x0C80 (32000 ms)
Minimum_CE_Length | 2 | Information parameter about the minimum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
Maximum_CE_Length | 2 | Information parameter about the maximum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
Num_of_Whitelist_Entries | 1 | Number of devices that have to be added to the whitelist. |
Peer_Address_Type[i] | 1 | Address type. | 0x00: Public Device Address 0x01: Random Device Address
Peer_Address[i] | 6 | Public Device Address or Random Device Address of the device to be added to the white list. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GAP_PROC_COMPLETE_EVENT

## ACI_GAP_START_GENERAL_CONNECTION_ESTABLISH_PROC

### Description

Start a general connection establishment procedure. The host enables scanning in the controller with the scanner filter policy set to "accept all advertising packets" and from the scanning results, all the devices are sent to the upper layer using the event LE_Advertising_Report. The upper layer then has to select one of the devices to which it wants to connect by issuing the command ACI_GAP_CREATE_CONNECTION. If privacy is enabled, then either a private resolvable address or a non resolvable address, based on the address type specified in the command is set as the scanner address but the gap create connection always uses a private resolvable address if the general connection establishment procedure is active.
The procedure is terminated when a connection is established or the upper layer terminates the procedure by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the procedure code set to 0x10. On completion of the procedure a ACI_GAP_PROC_COMPLETE_EVENT event is generated with the procedure code set to 0x10.
If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Type | 1 | Passive or active scanning. With active scanning SCAN_REQ packets are sent. | 0x00: Passive Scanning 0x01: Active scanning
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Scanning_Filter_Policy | 1 | Scanning filter policy: 0x00 Accept all advertisement packets.Directed advertising packets which are not addressed for this device shall be ignored. 0x01 Ignore advertisement packets from devices not in the White List Only.Directed advertising packets which are not addressed for this device shall be ignored. 0x02 Accept all undirected advertisement packets (it is allowed only if controller privacy or host privacy is enabled).Directed advertisement packets where initiator address is a RPA and Directed advertisement packets addressed to this device shall be accepted. 0x03 Accept all undirected advertisement packets from devices that are in the White List.Directed advertisement packets where initiator address is RPA and Directed advertisement packets addressed to this device shall be accepted. NOTE: if controller privacy is enabled Scanning_Filter_Policy can only assume values 0x00 or 0x02; if Host privacy is enabled Scanning_Filter_Policy can only assume value 0x00. | 0x00: Accept all 0x01: Ignore devices not in the White List 0x02: Accept all (use resolving list) 0x03: Ignore devices not in the White List (use resolving list)
Filter_Duplicates | 1 | Enable/disable duplicate filtering. | 0x00: Duplicate filtering disabled 0x01: Duplicate filtering enabled

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GAP_PROC_COMPLETE_EVENT

## ACI_GAP_START_SELECTIVE_CONNECTION_ESTABLISH_PROC

### Description

Start a selective connection establishment procedure. The GAP adds the specified device addresses into white list and enables scanning in the controller with the scanner filter policy set to "accept packets only from devices in whitelist". All the devices found are sent to the upper layer by the event HCI_LE_ADVERTISING_REPORT_EVENT. The upper layer then has to select one of the devices to which it wants to connect by issuing the command ACI_GAP_CREATE_CONNECTION.
On completion of the procedure a ACI_GAP_PROC_COMPLETE_EVENT event is generated with the procedure code set to 0x20. The procedure is terminated when a connection is established or the upper layer terminates the procedure by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the procedure code set to 0x20.
If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Type | 1 | Passive or active scanning. With active scanning SCAN_REQ packets are sent. | 0x00: Passive Scanning 0x01: Active scanning
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Scanning_Filter_Policy | 1 | Scanning filter policy: 0x00 Accept all advertisement packets.Directed advertising packets which are not addressed for this device shall be ignored. 0x01 Ignore advertisement packets from devices not in the White List Only.Directed advertising packets which are not addressed for this device shall be ignored. 0x02 Accept all undirected advertisement packets (it is allowed only if controller privacy or host privacy is enabled).Directed advertisement packets where initiator address is a RPA and Directed advertisement packets addressed to this device shall be accepted. 0x03 Accept all undirected advertisement packets from devices that are in the White List.Directed advertisement packets where initiator address is RPA and Directed advertisement packets addressed to this device shall be accepted. NOTE: if controller privacy is enabled Scanning_Filter_Policy can only assume values 0x01 or 0x03; if Host privacy is enabled Scanning_Filter_Policy can only assume value 0x01. | 0x00: Accept all 0x01: Ignore devices not in the White List 0x02: Accept all (use resolving list) 0x03: Ignore devices not in the White List (use resolving list)
Filter_Duplicates | 1 | Enable/disable duplicate filtering. | 0x00: Duplicate filtering disabled 0x01: Duplicate filtering enabled
Num_of_Whitelist_Entries | 1 | Number of devices that have to be added to the whitelist. |
Peer_Address_Type[i] | 1 | Address type. | 0x00: Public Device Address 0x01: Random Device Address
Peer_Address[i] | 6 | Public Device Address or Random Device Address of the device to be added to the white list. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GAP_PROC_COMPLETE_EVENT

## ACI_GAP_CREATE_CONNECTION

### Description

Start the direct connection establishment procedure. A LE_Create_Connection call will be made to the controller by GAP with the initiator filter policy set to "ignore whitelist and process connectable advertising packets only for the specified device". The procedure can be terminated explicitly by the upper layer by issuing the command ACI_GAP_TERMINATE_GAP_PROC. When a command is issued to terminate the procedure by upper layer, a HCI_LE_CREATE_CONNECTION_CANCEL call will be made to the controller by GAP.
On termination of the procedure, a HCI_LE_CONNECTION_COMPLETE_EVENT event is returned. The procedure can be explicitly terminated by the upper layer by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the procedure_code set to 0x40.
If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
Peer_Address_Type | 1 | The address type of the peer device. | 0x00: Public Device Address 0x01: Random Device Address
Peer_Address | 6 | Public Device Address or Random Device Address of the device to be connected. |
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Conn_Interval_Min | 2 | Minimum value for the connection event interval. This shall be less than or equal to Conn_Interval_Max. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Interval_Max | 2 | Maximum value for the connection event interval. This shall be greater than or equal to Conn_Interval_Min. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Supervision_Timeout | 2 | Supervision timeout for the LE Link. It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. Time = N * 10 msec. | 0x000A (100 ms) ... 0x0C80 (32000 ms)
Minimum_CE_Length | 2 | Information parameter about the minimum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
Maximum_CE_Length | 2 | Information parameter about the maximum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_CONNECTION_COMPLETE_EVENT

## ACI_GAP_TERMINATE_GAP_PROC

### Description

Terminate the specified GATT procedure. An ACI_GAP_PROC_COMPLETE_EVENT event is returned with the procedure code set to the corresponding procedure.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Procedure_Code | 1 | GAP procedure bitmap. | 0x00: No events 0x01: GAP_LIMITED_DISCOVERY_PROC 0x02: GAP_GENERAL_DISCOVERY_PROC 0x04: GAP_NAME_DISCOVERY_PROC 0x08: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC 0x10: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC 0x20: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC 0x40: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC 0x80: GAP_OBSERVATION_PROC

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT
- ACI_GAP_PROC_COMPLETE_EVENT

## ACI_GAP_START_CONNECTION_UPDATE

### Description

Start the connection update procedure (only when role is Master). A HCI_LE_CONNECTION_UPDATE is called.
On completion of the procedure, an HCI_LE_CONNECTION_UPDATE_COMPLETE_EVENT event is returned to the upper layer.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Conn_Interval_Min | 2 | Minimum value for the connection event interval. This shall be less than or equal to Conn_Interval_Max. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Interval_Max | 2 | Maximum value for the connection event interval. This shall be greater than or equal to Conn_Interval_Min. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Supervision_Timeout | 2 | Supervision timeout for the LE Link. It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. Time = N * 10 msec. | 0x000A (100 ms) ... 0x0C80 (32000 ms)
Minimum_CE_Length | 2 | Information parameter about the minimum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
Maximum_CE_Length | 2 | Information parameter about the maximum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_CONNECTION_UPDATE_COMPLETE_EVENT

## ACI_GAP_SEND_PAIRING_REQ

### Description

Send the SM pairing request to start a pairing process. The authentication requirements and IO capabilities should be set before issuing this command using the ACI_GAP_SET_IO_CAPABILITY and ACI_GAP_SET_AUTHENTICATION_REQUIREMENT commands.
A ACI_GAP_PAIRING_COMPLETE_EVENT event is returned after the pairing process is completed.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Force_Rebond | 1 | If 1, Pairing request will be sent even if the device was previously bonded, otherwise pairing request is not sent. | 0x00: NO 0x01: YES

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GAP_PAIRING_COMPLETE_EVENT

## ACI_GAP_RESOLVE_PRIVATE_ADDR

### Description

This command tries to resolve the address provided with the IRKs present in its database. If the address is resolved successfully with any one of the IRKs present in the database, it returns success and also the corresponding public/static random address stored with the IRK in the database.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Address | 6 | Address to be resolved |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Actual_Address | 6 | The public or static random address of the peer device, distributed during pairing phase. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SET_BROADCAST_MODE

### Description

This command puts the device into broadcast mode. A privacy enabled device uses either a resolvable private address or a non-resolvable private address as specified in the Own_Addr_Type parameter of the command.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Advertising_Interval_Min | 2 | Minimum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Advertising_Interval_Max | 2 | Maximum advertising interval. Time = N * 0.625 msec. | 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
Advertising_Type | 1 | Advertising type | 0x02: ADV_SCAN_IND (Scannable undirected advertising) 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
Own_Address_Type | 1 | If Privacy is disabled, then the address can be public or static random. If Privacy is enabled, then the address can be a resolvable private address or a non-resolvable private address. | 0x00: Public address 0x01: Static random address 0x02: Resolvable private address 0x03: Non-resolvable private address
Adv_Data_Length | 1 | Length of the advertising data in the advertising packet. |
Adv_Data | Adv_Data_Length | Advertising data used by the device while advertising. |
Num_of_Whitelist_Entries | 1 | Number of devices that have to be added to the whitelist. |
Peer_Address_Type[i] | 1 | Address type. | 0x00: Public Device Address 0x01: Random Device Address
Peer_Address[i] | 6 | Public Device Address or Random Device Address of the device to be added to the white list. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_START_OBSERVATION_PROC

### Description

Starts an Observation procedure, when the device is in Observer Role. The host enables scanning in the controller. The advertising reports are sent to the upper layer using standard LE Advertising Report Event. (See Bluetooth Core v5.0, Vol. 2, part E, Ch. 7.7.65.2, LE Advertising Report Event).
If controller privacy is enabled and the peer device (advertiser) is in the resolving list then the link layer will generate a RPA, if it is not then the RPA/NRPA generated by the Host will be used.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
LE_Scan_Interval | 2 | This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Window | 2 | Amount of time for the duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval. Time = N * 0.625 msec. | 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
LE_Scan_Type | 1 | Passive or active scanning. With active scanning SCAN_REQ packets are sent. | 0x00: Passive Scanning 0x01: Active scanning
Own_Address_Type | 1 | Own address type | 0x00: Public Device Address (only if privacy is disabled) 0x01: Random Device Address (only if privacy is disabled) 0x02: Resolvable Private Address (only if privacy is enabled) 0x03: Non Resolvable Private Address (only if privacy is enabled)
Filter_Duplicates | 1 | Enable/disable duplicate filtering. | 0x00: Duplicate filtering disabled 0x01: Duplicate filtering enabled
Scanning_Filter_Policy | 1 | Scanning filter policy: 0x00 Accept all advertisement packets (it is allowed only if controller privacy is enabled).Directed advertising packets which are not addressed for this device shall be ignored. 0x01 Ignore advertisement packets from devices not in the White List Only.Directed advertising packets which are not addressed for this device shall be ignored. 0x02 Accept all undirected advertisement packets (it is allowed only if controller privacy or host privacy is enabled).Directed advertisement packets where initiator address is a RPA and Directed advertisement packets addressed to this device shall be accepted. 0x03 Accept all undirected advertisement packets from devices that are in the White List.Directed advertisement packets where initiator address is RPA and Directed advertisement packets addressed to this device shall be accepted. NOTE: If Host privacy is enabled Scanning_Filter_Policy can only take values 0x00 or 0x01; | 0x00: Accept all 0x01: Ignore devices not in the White List 0x02: Accept all (use resolving list) 0x03: Ignore devices not in the White List (use resolving list)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- HCI_LE_ADVERTISING_REPORT_EVENT

## ACI_GAP_GET_BONDED_DEVICES

### Description

This command gets the list of the devices which are bonded. It returns the number of addresses and the corresponding address types and values.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Num_of_Addresses | 1 | The number of bonded devices |
Address_Type[i] | 1 | Address type. | 0x00: Public Device Address 0x01: Random Device Address
Address[i] | 6 | Public Device Address or Random Device Address of the device to be added to the white list. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_IS_DEVICE_BONDED

### Description

The command finds whether the device, whose address is specified in the command, is bonded. If the device is using a resolvable private address and it has been bonded, then the command will return BLE_STATUS_SUCCESS.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Peer_Address_Type | 1 | Address type. | 0x00: Public Device Address 0x01: Random Device Address
Peer_Address | 6 | Address used by the peer device while advertising |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_NUMERIC_COMPARISON_VALUE_CONFIRM_YESNO

### Description

This command allows the User to validate/confirm or not the Numeric Comparison value showed through the ACI_GAP_Numeric_Comparison_Value_Event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Confirm_Yes_No | 1 | 0 : The Numeric Values showed on both local and peer device are different! 1 : The Numeric Values showed on both local and peer device are equal! | 0x00: No 0x01: YES

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_PASSKEY_INPUT

### Description

This command permits to signal to the Stack the input type detected during Passkey input.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Input_Type | 1 | Passkey input type detected | 0x00: Passkey entry started 0x01: Passkey digit entered 0x02: Passkey digit erased 0x03: Passkey cleared 0x04: Passkey entry completed

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_GET_OOB_DATA

### Description

This command is sent by the User to get (i.e. to extract from the Stack) the OOB data generated by the Stack itself.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
OOB_Data_Type | 1 | OOB Data type | 0x00: TK (LP v.4.1) 0x01: Random (SC v.4.2) 0x02: Confirm (SC v.4.2)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Address_Type | 1 | Identity address type. | 0x00: Public Identity Address 0x01: Random (static) Identity Address
Address | 6 | Public or Random (static) address of this device |
OOB_Data_Type | 1 | OOB Data type | 0x00: TK (LP v.4.1) 0x01: Random (SC v.4.2) 0x02: Confirm (SC v.4.2)
OOB_Data_Len | 1 | Length of OOB Data |
OOB_Data | 16 | Local Pairing Data intended to the remote device to be sent via OOB. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_SET_OOB_DATA

### Description

This command is sent (by the User) to input the OOB data arrived via OOB communication.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Device_Type | 1 | OOB Device type | 0x00: Local device 0x01: Remote device
Address_Type | 1 | Identity address type. | 0x00: Public Identity Address 0x01: Random (static) Identity Address
Address | 6 | Public or Random (static) address of the peer device |
OOB_Data_Type | 1 | OOB Data type | 0x00: TK (LP v.4.1) 0x01: Random (SC v.4.2) 0x02: Confirm (SC v.4.2)
OOB_Data_Len | 1 | Length of OOB Data |
OOB_Data | 16 | Pairing Data received through OOB from remote device |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_ADD_DEVICES_TO_RESOLVING_LIST

### Description

This command is used to add one device to the list of address translations used to resolve Resolvable Private Addresses in the Controller.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Num_of_Resolving_list_Entries | 1 | Number of devices that have to be added to the resolving list. |
Peer_Identity_Address_Type[i] | 1 | Identity address type. | 0x00: Public Identity Address 0x01: Random (static) Identity Address
Peer_Identity_Address[i] | 6 | Public or Random (static) Identity address of the peer device |
Clear_Resolving_List | 1 | Clear the resolving list |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GAP_REMOVE_BONDED_DEVICE

### Description

This command is used to remove a specified device from bonding table

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Peer_Identity_Address_Type | 1 | Identity address type. | 0x00: Public Identity Address 0x01: Random (static) Identity Address
Peer_Identity_Address | 6 | Public or Random (static) Identity address of the peer device |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI GATT/ATT commands

##

Command | Opcode | LO | SO | BO
--- | --- | --- | --- | ---
ACI_GATT_INIT | 0xFD01 |  | Y |
ACI_GATT_ADD_SERVICE | 0xFD02 |  | Y |
ACI_GATT_INCLUDE_SERVICE | 0xFD03 |  | Y |
ACI_GATT_ADD_CHAR | 0xFD04 |  | Y |
ACI_GATT_ADD_CHAR_DESC | 0xFD05 |  | Y |
ACI_GATT_UPDATE_CHAR_VALUE | 0xFD06 |  | Y |
ACI_GATT_DEL_CHAR | 0xFD07 |  | Y |
ACI_GATT_DEL_SERVICE | 0xFD08 |  | Y |
ACI_GATT_DEL_INCLUDE_SERVICE | 0xFD09 |  | Y |
ACI_GATT_SET_EVENT_MASK | 0xFD0A |  | Y |
ACI_GATT_EXCHANGE_CONFIG | 0xFD0B |  |  |
ACI_ATT_FIND_INFO_REQ | 0xFD0C |  |  |
ACI_ATT_FIND_BY_TYPE_VALUE_REQ | 0xFD0D |  |  |
ACI_ATT_READ_BY_TYPE_REQ | 0xFD0E |  |  |
ACI_ATT_READ_BY_GROUP_TYPE_REQ | 0xFD0F |  |  |
ACI_ATT_PREPARE_WRITE_REQ | 0xFD10 |  |  |
ACI_ATT_EXECUTE_WRITE_REQ | 0xFD11 |  |  |
ACI_GATT_DISC_ALL_PRIMARY_SERVICES | 0xFD12 |  |  |
ACI_GATT_DISC_PRIMARY_SERVICE_BY_UUID | 0xFD13 |  |  |
ACI_GATT_FIND_INCLUDED_SERVICES | 0xFD14 |  |  |
ACI_GATT_DISC_ALL_CHAR_OF_SERVICE | 0xFD15 |  |  |
ACI_GATT_DISC_CHAR_BY_UUID | 0xFD16 |  |  |
ACI_GATT_DISC_ALL_CHAR_DESC | 0xFD17 |  |  |
ACI_GATT_READ_CHAR_VALUE | 0xFD18 |  |  |
ACI_GATT_READ_USING_CHAR_UUID | 0xFD19 |  |  |
ACI_GATT_READ_LONG_CHAR_VALUE | 0xFD1A |  |  |
ACI_GATT_READ_MULTIPLE_CHAR_VALUE | 0xFD1B |  |  |
ACI_GATT_WRITE_CHAR_VALUE | 0xFD1C |  |  |
ACI_GATT_WRITE_LONG_CHAR_VALUE | 0xFD1D |  |  |
ACI_GATT_WRITE_CHAR_RELIABLE | 0xFD1E |  |  |
ACI_GATT_WRITE_LONG_CHAR_DESC | 0xFD1F |  |  |
ACI_GATT_READ_LONG_CHAR_DESC | 0xFD20 |  |  |
ACI_GATT_WRITE_CHAR_DESC | 0xFD21 |  |  |
ACI_GATT_READ_CHAR_DESC | 0xFD22 |  |  |
ACI_GATT_WRITE_WITHOUT_RESP | 0xFD23 |  |  |
ACI_GATT_SIGNED_WRITE_WITHOUT_RESP | 0xFD24 |  |  |
ACI_GATT_CONFIRM_INDICATION | 0xFD25 |  |  |
ACI_GATT_WRITE_RESP | 0xFD26 |  | Y |
ACI_GATT_ALLOW_READ | 0xFD27 |  | Y |
ACI_GATT_SET_SECURITY_PERMISSION | 0xFD28 |  | Y |
ACI_GATT_SET_DESC_VALUE | 0xFD29 |  | Y |
ACI_GATT_READ_HANDLE_VALUE | 0xFD2A |  | Y |
ACI_GATT_UPDATE_CHAR_VALUE_EXT | 0xFD2C |  | Y |
ACI_GATT_DENY_READ | 0xFD2D |  | Y |
ACI_GATT_SET_ACCESS_PERMISSION | 0xFD2E |  | Y |

## ACI_GATT_INIT

### Description

Initialize the GATT layer for server and client roles. It adds also the GATT service with Service Changed Characteristic.
Until this command is issued the GATT channel does not process any commands even if the connection is opened. This command has to be given before using any of the GAP features.

### Input parameters

None

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_ADD_SERVICE

### Description

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 parameter. 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. Service declaration is taken from the service pool.
The attributes for characteristics and descriptors are allocated from the attribute pool.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Service_UUID_Type | 1 | UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID |
Service_UUID | 2 or 16 | 16-bit UUID or 128-bit UUID |
Service_Type | 1 | Service type. | 0x01: Primary Service 0x02: Secondary Service
Max_Attribute_Records | 1 | Maximum number of attribute records that can be added to this service |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Service_Handle | 2 | Handle of the Service. When this service is added, a handle is allocated by the server for this service. Server also allocates a range of handles for this service from serviceHandle to <serviceHandle + max_attr_records - 1> |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_INCLUDE_SERVICE

### Description

Include a service given by Include_Start_Handle and Include_End_Handle to another service given by Service_Handle. Attribute server creates an INCLUDE definition attribute and return the handle of this attribute in Included_handle.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Service_Handle | 2 | Handle of the Service to which another service has to be included. |
Include_Start_Handle | 2 | Start Handle of the Service which has to be included in service |
Include_End_Handle | 2 | End Handle of the Service which has to be included in service |
Include_UUID_Type | 1 | UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID |
Include_UUID | 2 or 16 | 16-bit UUID or 128-bit UUID |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Include_Handle | 2 | Handle of the include declaration |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_ADD_CHAR

### Description

Add a characteristic to a service.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Service_Handle | 2 | Handle of the Service to which the characteristic will be added |
Char_UUID_Type | 1 | UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID |
Char_UUID | 2 or 16 | 16-bit UUID or 128-bit UUID |
Char_Value_Length | 2 | Maximum length of the characteristic value. |
Char_Properties | 1 | Characteristic Properties (Volume 3, Part G, section 3.3.1.1 of Bluetooth Specification 5.0) | Bitmask of: 0x00: CHAR_PROP_NONE 0x01: CHAR_PROP_BROADCAST (Broadcast) 0x02: CHAR_PROP_READ (Read) 0x04: CHAR_PROP_WRITE_WITHOUT_RESP (Write w/o resp) 0x08: CHAR_PROP_WRITE (Write) 0x10: CHAR_PROP_NOTIFY (Notify) 0x20: CHAR_PROP_INDICATE (Indicate) 0x40: CHAR_PROP_SIGNED_WRITE (Authenticated Signed Writes) 0x80: CHAR_PROP_EXT (Extended Properties)
Security_Permissions | 1 | Security permission flags. | Bitmask of: 0x00: None 0x01: AUTHEN_READ (Need authentication to read) 0x02: AUTHOR_READ (Need authorization to read) 0x04: ENCRY_READ (Need encryption to read) 0x08: AUTHEN_WRITE (need authentication to write) 0x10: AUTHOR_WRITE (need authorization to write) 0x20: ENCRY_WRITE (need encryption to write)
GATT_Evt_Mask | 1 | GATT event mask. | Bitmask of: 0x00: GATT_DONT_NOTIFY_EVENTS 0x01: GATT_NOTIFY_ATTRIBUTE_WRITE 0x02: GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP 0x04: GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP
Enc_Key_Size | 1 | Minimum encryption key size required to read the characteristic. | 0x07 ... 0x10
Is_Variable | 1 | Specify if the characteristic value has a fixed length or a variable length. | 0x00: Fixed length 0x01: Variable length

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Char_Handle | 2 | Handle of the characteristic that has been added (it is the handle of the characteristic declaration). The attribute that holds the characteristic value is allocated at the next handle, followed by the Client Characteristic Configuration descriptor if the characteristic has CHAR_PROP_NOTIFY or CHAR_PROP_INDICATE properties. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_ADD_CHAR_DESC

### Description

Add a characteristic descriptor to a service.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Service_Handle | 2 | Handle of service to which the characteristic belongs |
Char_Handle | 2 | Handle of the characteristic to which description has to be added |
Char_Desc_Uuid_Type | 1 | UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID |
Char_Desc_Uuid | 2 or 16 | 16-bit UUID or 128-bit UUID |
Char_Desc_Value_Max_Len | 1 | The maximum length of the descriptor value |
Char_Desc_Value_Length | 1 | Current Length of the characteristic descriptor value |
Char_Desc_Value | Char_Desc_Value_Length | Value of the characteristic description |
Security_Permissions | 1 | Security permission flags. | Bitmask of: 0x00: None 0x01: AUTHEN_READ (Need authentication to read) 0x02: AUTHOR_READ (Need authorization to read) 0x04: ENCRY_READ (Need encryption to read) 0x08: AUTHEN_WRITE (need authentication to write) 0x10: AUTHOR_WRITE (need authorization to write) 0x20: ENCRY_WRITE (need encryption to write)
Access_Permissions | 1 | Access permission | Bitmask of: 0x00: None 0x01: READ 0x02: WRITE 0x04: WRITE_WO_RESP 0x08: SIGNED_WRITE
GATT_Evt_Mask | 1 | GATT event mask. | Bitmask of: 0x00: GATT_DONT_NOTIFY_EVENTS 0x01: GATT_NOTIFY_ATTRIBUTE_WRITE 0x02: GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP 0x04: GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP
Enc_Key_Size | 1 | Minimum encryption key size required to read the characteristic. | 0x07 ... 0x10
Is_Variable | 1 | Specify if the characteristic value has a fixed length or a variable length. | 0x00: Fixed length 0x01: Variable length

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Char_Desc_Handle | 2 | Handle of the characteristic descriptor |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_UPDATE_CHAR_VALUE

### Description

Update a characteristic value in a service. If notifications (or indications) are enabled on that characteristic, a notification (or indication) is sent to the client after sending this command. The command is queued into the STM32WB command queue.
If the buffer is full, because previous commands could not be still processed, the function will return BLE_STATUS_INSUFFICIENT_RESOURCES. This will happen if notifications (or indications) are enabled and the application calls ACI_GATT_UPDATE_CHAR_VALUE at an higher rate than what is allowed by the link.
Throughput on BLE link depends on connection interval and connection length parameters (decided by the master, see aci_l2cap_connection_parameter_update_request() for more info on how to suggest new connection parameters from a slave). If the application does not want to lose notifications because STM32WB buffer becomes full, it has to retry again till the function returns BLE_STATUS_SUCCESS or any other error code.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Service_Handle | 2 | Handle of service to which the characteristic belongs |
Char_Handle | 2 | Handle of the characteristic declaration |
Val_Offset | 1 | The offset from which the attribute value has to be updated. If this is set to 0 and the attribute value is of variable length, then the length of the attribute will be set to the Char_Value_Length. If the Val_Offset is set to a value greater than 0, then the length of the attribute will be set to the maximum length as specified for the attribute while adding the characteristic. |
Char_Value_Length | 1 | Length of the characteristic value in octets |
Char_Value | Char_Value_Length | Characteristic value |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_DEL_CHAR

### Description

Delete the specified characteristic from the service.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Serv_Handle | 2 | Handle of service to which the characteristic belongs |
Char_Handle | 2 | Handle of the characteristic which has to be deleted |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_DEL_SERVICE

### Description

Delete the specified service from the GATT server database.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Serv_Handle | 2 | Handle of the service to be deleted |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_DEL_INCLUDE_SERVICE

### Description

Delete the Include definition from the service.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Serv_Handle | 2 | Handle of the service to which the include service belongs |
Include_Handle | 2 | Handle of the included service which has to be deleted |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_SET_EVENT_MASK

### Description

Mask events from the GATT. The default configuration is all the events masked.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
GATT_Evt_Mask | 4 | GATT/ATT event mask. | 0x00000001: ACI_GATT_ATTRIBUTE_MODIFIED_EVENT 0x00000002: ACI_GATT_PROC_TIMEOUT_EVENT 0x00000004: ACI_ATT_EXCHANGE_MTU_RESP_EVENT 0x00000008: ACI_ATT_FIND_INFO_RESP_EVENT 0x00000010: ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT 0x00000020: ACI_ATT_READ_BY_TYPE_RESP_EVENT 0x00000040: ACI_ATT_READ_RESP_EVENT 0x00000080: ACI_ATT_READ_BLOB_RESP_EVENT 0x00000100: ACI_ATT_READ_MULTIPLE_RESP_EVENT 0x00000200: ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT 0x00000800: ACI_ATT_PREPARE_WRITE_RESP_EVENT 0x00001000: ACI_ATT_EXEC_WRITE_RESP_EVENT 0x00002000: ACI_GATT_INDICATION_EVENT 0x00004000: ACI_GATT_NOTIFICATION_EVENT 0x00008000: ACI_GATT_ERROR_RESP_EVENT 0x00010000: ACI_GATT_PROC_COMPLETE_EVENT 0x00020000: ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT 0x00040000: ACI_GATT_TX_POOL_AVAILABLE_EVENT 0x00100000: ACI_GATT_READ_EXT_EVENT 0x00200000: ACI_GATT_INDICATION_EXT_EVENT 0x00400000: ACI_GATT_NOTIFICATION_EXT_EVENT

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_EXCHANGE_CONFIG

### Description

Perform an ATT MTU exchange procedure.
When the ATT MTU exchange procedure is completed, a ACI_ATT_EXCHANGE_MTU_RESP_EVENT event is generated. A ACI_GATT_PROC_COMPLETE_EVENT event is also generated to indicate the end of the procedure.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_EXCHANGE_MTU_RESP_EVENT

## ACI_ATT_FIND_INFO_REQ

### Description

Send a Find Information Request.
This command is used to obtain the mapping of attribute handles with their associated types. The responses of the procedure are given through the ACI_ATT_FIND_INFO_RESP_EVENT event. The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Start_Handle | 2 | First requested handle number |
End_Handle | 2 | Last requested handle number |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_FIND_INFO_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_ATT_FIND_BY_TYPE_VALUE_REQ

### Description

Send a Find By Type Value Request
The Find By Type Value Request is used to obtain the handles of attributes that have a given 16-bit UUID attribute type and a given attribute value.
The responses of the procedure are given through the ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT event.
The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Start_Handle | 2 | First requested handle number |
End_Handle | 2 | Last requested handle number |
UUID | 2 | 2 octet UUID to find (little-endian) |
Attribute_Val_Length | 1 | Length of attribute value (maximum value is ATT_MTU - 7). |
Attribute_Val | Attribute_Val_Length | Attribute value to find |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_ATT_READ_BY_TYPE_REQ

### Description

Send a Read By Type Request.
The Read By Type Request is used to obtain the values of attributes where the attribute type is known but the handle is not known.
The responses are given through the ACI_ATT_READ_BY_TYPE_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Start_Handle | 2 | First requested handle number |
End_Handle | 2 | Last requested handle number |
UUID_Type | 1 | UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID |
UUID | 2 or 16 | 16-bit UUID or 128-bit UUID |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_BY_TYPE_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_ATT_READ_BY_GROUP_TYPE_REQ

### Description

Send 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".
The responses of the procedure are given through the ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT event.
The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Start_Handle | 2 | First requested handle number |
End_Handle | 2 | Last requested handle number |
UUID_Type | 1 | UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID |
UUID | 2 or 16 | 16-bit UUID or 128-bit UUID |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_ATT_PREPARE_WRITE_REQ

### Description

Send a Prepare Write Request.
The Prepare Write Request is used to request the server to prepare to write the value of an attribute.
The responses of the procedure are given through the ACI_ATT_PREPARE_WRITE_RESP_EVENT event.
The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the attribute to be written |
Val_Offset | 2 | The offset of the first octet to be written |
Attribute_Val_Length | 1 | Length of attribute value (maximum value is ATT_MTU - 5). |
Attribute_Val | Attribute_Val_Length | The value of the attribute to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_PREPARE_WRITE_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_ATT_EXECUTE_WRITE_REQ

### Description

Send an Execute Write Request.
The Execute Write Request is used to request the server to write or cancel the write of all the prepared values currently held in the prepare queue from this client.
The result of the procedure is given through the ACI_ATT_EXEC_WRITE_RESP_EVENT event.
The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Execute | 1 | Execute or cancel writes. | 0x00: Cancel all prepared writes 0x01: Immediately write all pending prepared values

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_EXEC_WRITE_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_DISC_ALL_PRIMARY_SERVICES

### Description

Start the GATT client procedure to discover all primary services on the server.
The responses of the procedure are given through the ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_DISC_PRIMARY_SERVICE_BY_UUID

### Description

Start the procedure to discover the primary services of the specified UUID on the server.
The responses of the procedure are given through the ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT event.
The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
UUID_Type | 1 | UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID |
UUID | 2 or 16 | 16-bit UUID or 128-bit UUID |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_FIND_INCLUDED_SERVICES

### Description

Start the procedure to find all included services.
The responses of the procedure are given through the ACI_ATT_READ_BY_TYPE_RESP_EVENT event.
The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Start_Handle | 2 | Start attribute handle of the service |
End_Handle | 2 | End attribute handle of the service |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_BY_TYPE_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_DISC_ALL_CHAR_OF_SERVICE

### Description

Start the procedure to discover all the characteristics of a given service.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. Before procedure completion the response packets are given through ACI_ATT_READ_BY_TYPE_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Start_Handle | 2 | Start attribute handle of the service |
End_Handle | 2 | End attribute handle of the service |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_BY_TYPE_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_DISC_CHAR_BY_UUID

### Description

Start the procedure to discover all the characteristics specified by a UUID.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. Before procedure completion the response packets are given through ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Start_Handle | 2 | Start attribute handle of the service |
End_Handle | 2 | End attribute handle of the service |
UUID_Type | 1 | UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID |
UUID | 2 or 16 | 16-bit UUID or 128-bit UUID |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_DISC_ALL_CHAR_DESC

### Description

Start the procedure to discover all characteristic descriptors on the server.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. Before procedure completion the response packets are given through ACI_ATT_FIND_INFO_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Char_Handle | 2 | Handle of the characteristic value |
End_Handle | 2 | End handle of the characteristic |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_FIND_INFO_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_READ_CHAR_VALUE

### Description

Start the procedure to read the attribute value.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. Before procedure completion the response packet is given through ACI_ATT_READ_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the characteristic value to be read |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_READ_USING_CHAR_UUID

### Description

This command sends a Read By Type Request packet to the server in order to read the value attribute of the characteristics specified by the UUID.
When the procedure is completed, an ACI_GATT_PROC_COMPLETE_EVENT event is generated. Before procedure completion, the response packet is given through one ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT event per reported attribute.
Note: the number of bytes of a value reported by ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT event can not exceed BLE_EVT_MAX_PARAM_LEN - 7 i.e. 248 bytes for default value of BLE_EVT_MAX_PARAM_LEN.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Start_Handle | 2 | Starting handle of the range to be searched |
End_Handle | 2 | End handle of the range to be searched |
UUID_Type | 1 | UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID |
UUID | 2 or 16 | 16-bit UUID or 128-bit UUID |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_READ_LONG_CHAR_VALUE

### Description

Start the procedure to read a long characteristic value.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. Before procedure completion the response packets are given through ACI_ATT_READ_BLOB_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the characteristic value to be read |
Val_Offset | 2 | Offset from which the value needs to be read |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_BLOB_RESP_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_READ_MULTIPLE_CHAR_VALUE

### Description

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.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. Before procedure completion the response packets are given through ACI_ATT_READ_MULTIPLE_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Number_of_Handles | 1 | The number of handles for which the value has to be read |
Handle[i] | 2 | The handles for which the attribute value has to be read |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_MULTIPLE_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_WRITE_CHAR_VALUE

### Description

Start the procedure to write a characteristic value.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the characteristic value to be written |
Attribute_Val_Length | 1 | Length of the value to be written |
Attribute_Val | Attribute_Val_Length | Value to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GATT_ERROR_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_WRITE_LONG_CHAR_VALUE

### Description

Start the procedure to write a long characteristic value.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. During the procedure, ACI_ATT_PREPARE_WRITE_RESP_EVENT and ACI_ATT_EXEC_WRITE_RESP_EVENT events are raised.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the characteristic value to be written |
Val_Offset | 2 | Offset at which the attribute has to be written |
Attribute_Val_Length | 1 | Length of the value to be written |
Attribute_Val | Attribute_Val_Length | Value to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT
- ACI_ATT_PREPARE_WRITE_RESP_EVENT
- ACI_ATT_EXEC_WRITE_RESP_EVENT

## ACI_GATT_WRITE_CHAR_RELIABLE

### Description

Start the procedure to write a characteristic reliably.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. During the procedure, ACI_ATT_PREPARE_WRITE_RESP_EVENT and ACI_ATT_EXEC_WRITE_RESP_EVENT events are raised.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the attribute to be written |
Val_Offset | 2 | Offset at which the attribute has to be written |
Attribute_Val_Length | 1 | Length of the value to be written |
Attribute_Val | Attribute_Val_Length | Value to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT
- ACI_ATT_PREPARE_WRITE_RESP_EVENT
- ACI_ATT_EXEC_WRITE_RESP_EVENT

## ACI_GATT_WRITE_LONG_CHAR_DESC

### Description

Start the procedure to write a long characteristic descriptor.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. During the procedure, ACI_ATT_PREPARE_WRITE_RESP_EVENT and ACI_ATT_EXEC_WRITE_RESP_EVENT events are raised.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the attribute to be written |
Val_Offset | 2 | Offset at which the attribute has to be written |
Attribute_Val_Length | 1 | Length of the value to be written |
Attribute_Val | Attribute_Val_Length | Value to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT
- ACI_ATT_PREPARE_WRITE_RESP_EVENT
- ACI_ATT_EXEC_WRITE_RESP_EVENT

## ACI_GATT_READ_LONG_CHAR_DESC

### Description

Start the procedure to read a long characteristic value.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated. Before procedure completion the response packets are given through ACI_ATT_READ_BLOB_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the characteristic descriptor |
Val_Offset | 2 | Offset from which the value needs to be read |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_BLOB_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_WRITE_CHAR_DESC

### Description

Start the procedure to write a characteristic descriptor.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the attribute to be written |
Attribute_Val_Length | 1 | Length of the value to be written |
Attribute_Val | Attribute_Val_Length | Value to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_READ_CHAR_DESC

### Description

Start the procedure to read the descriptor specified.
When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is generated.
Before procedure completion the response packet is given through ACI_ATT_READ_RESP_EVENT event.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the descriptor to be read |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_ATT_READ_RESP_EVENT
- ACI_GATT_PROC_COMPLETE_EVENT

## ACI_GATT_WRITE_WITHOUT_RESP

### Description

Start the procedure to write a characteristic value without waiting for any response from the server. No events are generated after this command is executed. The length of the value to be written must not exceed (ATT_MTU - 3); it must also not exceed (BLE_EVT_MAX_PARAM_LEN - 5) i.e. 250 for BLE_EVT_MAX_PARAM_LEN default value.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the characteristic value to be written |
Attribute_Val_Length | 1 | Length of the value to be written |
Attribute_Val | Attribute_Val_Length | Value to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_SIGNED_WRITE_WITHOUT_RESP

### Description

Start a signed write without response from the server.
The procedure is used 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. The length of the value to be written must not exceed (ATT_MTU - 15); it must also not exceed (BLE_EVT_MAX_PARAM_LEN - 5) i.e. 250 for BLE_EVT_MAX_PARAM_LEN default value.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the characteristic value to be written |
Attribute_Val_Length | 1 | Length of the value to be written |
Attribute_Val | Attribute_Val_Length | Value to be written |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_CONFIRM_INDICATION

### Description

Allow application to confirm indication. This command has to be sent when the application receives the event ACI_GATT_INDICATION_EVENT.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_WRITE_RESP

### Description

Allow or reject a write request from a client.
This command has to be sent by the application when it receives the
ACI_GATT_WRITE_PERMIT_REQ_EVENT. If the write can be allowed, then the status and error code has to be set to 0. If the write cannot be allowed, then the status has to be set to 1 and the error code has to be set to the error code that has to be passed to the client.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Attr_Handle | 2 | Handle of the attribute that was passed in the event ACI_GATT_WRITE_PERMIT_REQ_EVENT |
Write_status | 1 | If the value can be written or not. | 0x00: The value can be written to the attribute specified by attr_handle 0x01: The value cannot be written to the attribute specified by the attr_handle
Error_Code | 1 | The error code that has to be passed to the client in case the write has to be rejected |
Attribute_Val_Length | 1 | Length of the value to be written as passed in the event ACI_GATT_WRITE_PERMIT_REQ_EVENT |
Attribute_Val | Attribute_Val_Length | Value as passed in the event ACI_GATT_WRITE_PERMIT_REQ_EVENT |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_ALLOW_READ

### Description

Allow 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
ACI_GATT_READ_PERMIT_REQ_EVENT or ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT. 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 ACI_GATT_UPDATE_CHAR_VALUE and then give this command. The application should perform the required operations within 30 seconds. Otherwise the GATT procedure will be timeout.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_SET_SECURITY_PERMISSION

### Description

This command sets the security permission for the attribute handle specified. Currently the setting of security permission is allowed only for client configuration descriptor.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Serv_Handle | 2 | Handle of the service which contains the attribute whose security permission has to be modified |
Attr_Handle | 2 | Handle of the attribute whose security permission has to be modified |
Security_Permissions | 1 | Security permission flags. | Bitmask of: 0x00: None 0x01: AUTHEN_READ (Need authentication to read) 0x02: AUTHOR_READ (Need authorization to read) 0x04: ENCRY_READ (Need encryption to read) 0x08: AUTHEN_WRITE (need authentication to write) 0x10: AUTHOR_WRITE (need authorization to write) 0x20: ENCRY_WRITE (need encryption to write)

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_SET_DESC_VALUE

### Description

This command sets the value of the descriptor specified by charDescHandle.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Serv_Handle | 2 | Handle of the service which contains the characteristic descriptor |
Char_Handle | 2 | Handle of the characteristic which contains the descriptor |
Char_Desc_Handle | 2 | Handle of the descriptor whose value has to be set |
Val_Offset | 2 | Offset from which the descriptor value has to be updated |
Char_Desc_Value_Length | 1 | Length of the descriptor value |
Char_Desc_Value | Char_Desc_Value_Length | Descriptor value |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_READ_HANDLE_VALUE

### Description

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

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Attr_Handle | 2 | Handle of the attribute to read |
Offset | 2 | Offset from which the value needs to be read |
Value_Length_Requested | 2 | Maximum number of octets to be returned as attribute value |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Length | 2 | Length of the attribute value |
Value_Length | 2 | Length in octets of the Value parameter |
Value | Value_Length | Attribute value |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_UPDATE_CHAR_VALUE_EXT

### Description

This command is a more flexible version of ACI_GATT_UPDATE_CHAR_VALUE to support update of long attribute up to 512 bytes and indicate selectively the generation of Indication/Notification.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Conn_Handle_To_Notify | 2 | Connection handle to notify. Notify all subscribed clients if equal to 0x0000 |
Service_Handle | 2 | Handle of service to which the characteristic belongs |
Char_Handle | 2 | Handle of the characteristic declaration |
Update_Type | 1 | Allow Notification or Indication generation, if enabled in the client characteristic configuration descriptor | Bitmask of: 0x00: Do not notify 0x01: Notification 0x02: Indication
Char_Length | 2 | Total length of the characteristic value. In case of a variable size characteristic, this field specifies the new length of the characteristic value after the update; in case of fixed length characteristic this field is ignored. |
Value_Offset | 2 | The offset from which the attribute value has to be updated. |
Value_Length | 1 | Length of the Value parameter in octets |
Value | Value_Length | Updated characteristic value |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_DENY_READ

### Description

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 ACI_GATT_READ_PERMIT_REQ_EVENT or ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT.
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 ACI_GATT_DENY_READ or ACI_GATT_ALLOW_READ command within 30 seconds from the reception of the ACI_GATT_READ_PERMIT_REQ_EVENT or ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT events; otherwise the GATT procedure issues a timeout.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Error_Code | 1 | Error code for the command | 0x08: Insufficient Authorization 0x80 ... 0x9F: Application Error

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI_GATT_SET_ACCESS_PERMISSION

### Description

This command sets the access permission for the attribute handle specified.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Serv_Handle | 2 | Handle of the service which contains the attribute whose access permission has to be modified |
Attr_Handle | 2 | Handle of the attribute whose security permission has to be modified |
Access_Permissions | 1 | Access permission | Bitmask of: 0x00: None 0x01: READ 0x02: WRITE 0x04: WRITE_WO_RESP 0x08: SIGNED_WRITE

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

## ACI L2CAP commands

##

Command | Opcode | LO | SO | BO
--- | --- | --- | --- | ---
ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_REQ | 0xFD81 |  | Y |
ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_RESP | 0xFD82 |  |  |

## ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_REQ

### Description

Send an L2CAP connection parameter update request from the slave to the master.
An ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT event is raised when the master responds to the request (accepts or rejects).

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Conn_Interval_Min | 2 | Minimum value for the connection event interval. This shall be less than or equal to Conn_Interval_Max. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Interval_Max | 2 | Maximum value for the connection event interval. This shall be greater than or equal to Conn_Interval_Min. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Slave_latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Timeout_Multiplier | 2 | Defines connection timeout parameter in the following manner: Timeout Multiplier * 10ms. |

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_STATUS_EVENT
- ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT

## ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_RESP

### Description

Accept or reject a connection update. This command should be sent in response to a ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT event from the controller. The accept parameter has to be set if the connection parameters given in the event are acceptable.

### Input parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Conn_Interval_Min | 2 | Minimum value for the connection event interval. This shall be less than or equal to Conn_Interval_Max. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Interval_Max | 2 | Maximum value for the connection event interval. This shall be greater than or equal to Conn_Interval_Min. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Slave_latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Timeout_Multiplier | 2 | Defines connection timeout parameter in the following manner: Timeout Multiplier * 10ms. |
Minimum_CE_Length | 2 | Information parameter about the minimum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
Maximum_CE_Length | 2 | Information parameter about the maximum length of connection needed for this LE connection. Time = N * 0.625 msec. | 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
Identifier | 1 | Identifier received in ACI_L2CAP_Connection_Update_Req event. |
Accept | 1 | Specify if connection update parameters are acceptable or not. | 0x00: Reject 0x01: Accept

### Output parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |

### Events generated

- HCI_COMMAND_COMPLETE_EVENT

# HCI/ACI events

HCI events

HCI LE meta events

ACI GAP events

ACI GATT/ATT events

ACI L2CAP events

ACI HAL events

Note: in the event tables, a "Y" in the "LO" (resp. "SO" or "BO") column, means that the corresponding event applies to the "Link Layer Only" (resp. "Slave Only" or "Beacon Only") variant of the BLE stack.

## HCI events

##

Event name | Event code | LO | SO | BO
--- | --- | --- | --- | ---
HCI_DISCONNECTION_COMPLETE_EVENT | 0x05 | Y | Y |
HCI_ENCRYPTION_CHANGE_EVENT | 0x08 | Y | Y |
HCI_READ_REMOTE_VERSION_INFORMATION_COMPLETE_EVENT | 0x0C | Y | Y |
HCI_HARDWARE_ERROR_EVENT | 0x10 | Y | Y | Y
HCI_NUMBER_OF_COMPLETED_PACKETS_EVENT | 0x13 | Y |  |
HCI_ENCRYPTION_KEY_REFRESH_COMPLETE_EVENT | 0x30 | Y | Y |
HCI_COMMAND_COMPLETE_EVENT | 0x0E | Y | Y | Y
HCI_COMMAND_STATUS_EVENT | 0x0F | Y | Y | Y

## HCI_DISCONNECTION_COMPLETE_EVENT

### Description

The Disconnection Complete event occurs when a connection is terminated.
The status parameter indicates if the disconnection was successful or not. The reason parameter indicates the reason for the disconnection if the disconnection was successful. If the disconnection was not successful, the value of the reason parameter can be ignored by the Host. For example, this can be the case if the Host has issued the Disconnect command and there was a parameter error, or the command was not presently allowed, or a Connection_Handle that didn't correspond to a connection was given.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection_Handle which was disconnected. | 0x0000 ... 0x0EFF
Reason | 1 | Reason for disconnection (see Bluetooth Core Specification [Vol 2] Part D, Error Codes). |

## HCI_ENCRYPTION_CHANGE_EVENT

### Description

The Encryption Change event is used to indicate that the change of the encryption mode has been completed. The Connection_Handle will be a Connection_Handle for an ACL connection. The Encryption_Enabled event parameter specifies the new Encryption_Enabled parameter for the Connection_Handle specified by the Connection_Handle event parameter. This event will occur on both devices to notify the Hosts when Encryption has changed for the specified Connection_Handle between two devices. Note: This event shall not be generated if encryption is paused or resumed; during a role switch, for example.
The meaning of the Encryption_Enabled parameter depends on whether the Host has indicated support for Secure Connections in the Secure_Connections_Host_Support parameter. When Secure_Connections_Host_Support is 'disabled' or the Connection_Handle refers to an LE link, the Controller shall only use Encryption_Enabled values 0x00 (OFF) and 0x01 (ON).
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.7.8)

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Encryption_Enabled | 1 | Link Level Encryption. | 0x00: Link Level Encryption OFF 0x01: Link Level Encryption is ON with AES-CCM

## HCI_READ_REMOTE_VERSION_INFORMATION_COMPLETE_EVENT

### Description

The Read Remote Version Information Complete event is used to indicate the completion of the process obtaining the version information of the remote Controller specified by the Connection_Handle event parameter. The Connection_Handle shall be for an ACL connection.
The Version event parameter defines the specification version of the LE Controller.
The Manufacturer_Name event parameter indicates the manufacturer of the remote Controller. The Subversion event parameter is controlled by the manufacturer and is implementation dependent. The Subversion event parameter defines the various revisions that each version of the Bluetooth hardware will go through as design processes change and errors are fixed. This allows the software to determine what Bluetooth hardware is being used and, if necessary, to work around various bugs in the hardware.
When the Connection_Handle is associated with an LE-U logical link, the Version event parameter shall be Link Layer VersNr parameter, the Manufacturer_Name event parameter shall be the CompId parameter, and the Subversion event parameter shall be the SubVersNr parameter.
(See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.7.12)

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF
Version | 1 | Version of the Current LMP in the remote Controller |
Manufacturer_Name | 2 | Manufacturer Name of the remote Controller |
Subversion | 2 | Subversion of the LMP in the remote Controller |

## HCI_HARDWARE_ERROR_EVENT

### Description

The Hardware Error event is used to indicate some implementation specific type of hardware failure for the controller. This event is used to notify the Host that a hardware failure has occurred in the Controller.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Hardware_Code | 1 | Hardware Error Event code. Error code 0 is not used. Error code 1 is bluecore act2 error detected. Error code 2 is bluecore time overrun error detected. Error code 3 is internal FIFO full. | 0x00: Not used 0x01: event_act2 error 0x02: event_time_overrun error 0x03: event_fifo_full error

## HCI_NUMBER_OF_COMPLETED_PACKETS_EVENT

### Description

The Number Of Completed Packets event is used by the Controller to indicate to the Host how many HCI Data Packets have been completed (transmitted or flushed) for each Connection_Handle since the previous Number Of Completed Packets event was sent to the Host. This means that the corresponding buffer space has been freed in the Controller. Based on this information, and the HC_Total_Num_ACL_Data_Packets and HC_Total_Num_Synchronous_Data_Packets return parameter of the Read_Buffer_Size command, the Host can determine for which Connection_Handles the following HCI Data Packets should be sent to the Controller. The Number Of Completed Packets event must not be sent before the corresponding Connection Complete event. While the Controller has HCI data packets in its buffer, it must keep sending the Number Of Completed Packets event to the Host at least periodically, until it finally reports that all the pending ACL Data Packets have been transmitted or flushed.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Number_of_Handles | 1 | The number of Connection_Handles and Num_HCI_Data_Packets parameters pairs contained in this event |
Connection_Handle[i] | 2 | Connection handle |
HC_Num_Of_Completed_Packets[i] | 2 | The number of HCI Data Packets that have been completed (transmitted or flushed) for the associated Connection_Handle since the previous time the event was returned. |

## HCI_ENCRYPTION_KEY_REFRESH_COMPLETE_EVENT

### Description

The Encryption Key Refresh Complete event is used to indicate to the Host that the encryption key was refreshed on the given Connection_Handle any time encryption is paused and then resumed.
If the Encryption Key Refresh Complete event was generated due to an encryption pause and resume operation embedded within a change connection link key procedure, the Encryption Key Refresh Complete event shall be sent prior to the Change Connection Link Key Complete event.
If the Encryption Key Refresh Complete event was generated due to an encryption pause and resume operation embedded within a role switch procedure, the Encryption Key Refresh Complete event shall be sent prior to the Role Change event.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle for which the command is given. | 0x0000 ... 0x0EFF

## HCI_COMMAND_COMPLETE_EVENT

### Description

The Command Complete event is used by the Controller for most commands to transmit return status of a command and the other event parameters that are specified for the issued HCI command.
The Num_HCI_Command_Packets event parameter allows the Controller to indicate the number of HCI command packets the Host can send to the Controller.
If the Controller requires the Host to stop sending commands, the Num_HCI_Command_Packets event parameter will be set to zero. To indicate to the Host that the Controller is ready to receive HCI command packets, the Controller generates a Command Complete event with the Command_Opcode 0x0000, and the Num_HCI_Command_Packets event parameter is set to 1 or more. See each command for the parameters that are returned by this event.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Num_HCI_Command_Packets | 1 | The Number of HCI command packets which are allowed to be sent to the Controller from the Host. |
Command_Opcode | 2 | Opcode of the command which caused this event. |
Return_Parameters | variable | This is the return parameter(s) for the command specified in the Command_Opcode event parameter. See each command's definition for the list of return parameters associated with that command. |

## HCI_COMMAND_STATUS_EVENT

### Description

The Command Status event is used to indicate that the command described by the Command_Opcode parameter has been received, and that the Controller is currently performing the task for this command. This event is needed to provide mechanisms for asynchronous operation, which makes it possible to prevent the Host from waiting for a command to finish. If the command cannot begin to execute (a parameter error may have occurred, or the command may currently not be allowed), the Status event parameter will contain the corresponding error code, and no complete event will follow since the command was not started. The Num_HCI_Command_Packets event parameter allows the Controller to indicate the number of HCI command packets the Host can send to the Controller. If the Controller requires the Host to stop sending commands, the Num_HCI_Command_Packets event parameter will be set to zero. To indicate to the Host that the Controller is ready to receive HCI command packets, the Controller generates a Command Status event with Status 0x00 and Command_Opcode 0x0000, and the Num_HCI_Command_Packets event parameter is set to 1 or more.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Num_HCI_Command_Packets | 1 | The Number of HCI command packets which are allowed to be sent to the Controller from the Host. |
Command_Opcode | 2 | Opcode of the command which caused this event. |

## HCI LE meta events

##

Event name | LE subevent code | LO | SO | BO
--- | --- | --- | --- | ---
HCI_LE_CONNECTION_COMPLETE_EVENT | 0x01 | Y | Y |
HCI_LE_ADVERTISING_REPORT_EVENT | 0x02 | Y |  | Y
HCI_LE_CONNECTION_UPDATE_COMPLETE_EVENT | 0x03 | Y | Y |
HCI_LE_READ_REMOTE_FEATURES_COMPLETE_EVENT | 0x04 | Y | Y |
HCI_LE_LONG_TERM_KEY_REQUEST_EVENT | 0x05 | Y | Y |
HCI_LE_DATA_LENGTH_CHANGE_EVENT | 0x07 | Y | Y |
HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_EVENT | 0x08 | Y | Y |
HCI_LE_GENERATE_DHKEY_COMPLETE_EVENT | 0x09 | Y | Y |
HCI_LE_ENHANCED_CONNECTION_COMPLETE_EVENT | 0x0A | Y | Y |
HCI_LE_DIRECT_ADVERTISING_REPORT_EVENT | 0x0B | Y |  | Y
HCI_LE_PHY_UPDATE_COMPLETE_EVENT | 0x0C | Y |  |

## HCI_LE_CONNECTION_COMPLETE_EVENT

### Description

The LE Connection Complete event indicates to both of the Hosts forming the connection that a new connection has been created. Upon the creation of the connection a Connection_Handle shall be assigned by the Controller, and passed to the Host in this event. If the connection establishment fails this event shall be provided to the Host that had issued the LE_Create_Connection command.
This event indicates to the Host which issued a LE_Create_Connection command and received a Command Status event if the connection establishment failed or was successful.
The Master_Clock_Accuracy parameter is only valid for a slave. On a master, this parameter shall be set to 0x00. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.1

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle to be used to identify the connection with the peer device. | 0x0000 ... 0x0EFF
Role | 1 | Role of the local device in the connection. | 0x00: Master 0x01: Slave
Peer_Address_Type | 1 | The address type of the peer device. | 0x00: Public Device Address 0x01: Random Device Address
Peer_Address | 6 | Public Device Address or Random Device Address of the peer device |
Conn_Interval | 2 | Connection interval used on this connection. Time = N * 1.25 msec | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Supervision_Timeout | 2 | Supervision timeout for the LE Link. It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. Time = N * 10 msec. | 0x000A (100 ms) ... 0x0C80 (32000 ms)
Master_Clock_Accuracy | 1 | Master clock accuracy. Only valid for a slave. | 0x00: 500 ppm 0x01: 250 ppm 0x02: 150 ppm 0x03: 100 ppm 0x04: 75 ppm 0x05: 50 ppm 0x06: 30 ppm 0x07: 20 ppm

## HCI_LE_ADVERTISING_REPORT_EVENT

### Description

The LE Advertising Report event indicates that a device or multiple devices have responded to an active scan or received some information during a passive scan. The Controller may queue these advertising reports and send information from multiple devices in one LE Advertising Report event (see Bluetooth spec 5.0 vol 2 [part E] 7.7.65.2). In the current BLE stack version, only one report is sent per event (Num_Reports = 1).

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Num_Reports | 1 | Number of responses in this event. | 0x01
Event_Type[i] | 1 | Type of advertising report event: ADV_IND: Connectable undirected advertising', ADV_DIRECT_IND: Connectable directed advertising, ADV_SCAN_IND: Scannable undirected advertising, ADV_NONCONN_IND: Non connectable undirected advertising, SCAN_RSP: Scan response. | 0x00: ADV_IND 0x01: ADV_DIRECT_IND 0x02: ADV_SCAN_IND 0x03: ADV_NONCONN_IND 0x04: SCAN_RSP
Address_Type[i] | 1 | Address type 0x00 Public Device Address 0x01 Random Device Address 0x02 Public Identity Address (Corresponds to Resolved Private Address) 0x03 Random (Static) Identity Address (Corresponds to Resolved Private Address) | 0x00: Public Device Address 0x01: Random Device Address 0x02: Public Identity Address 0x03: Random (Static) Identity Address
Address[i] | 6 | Public Device Address or Random Device Address of the device to be connected. |
Length_Data[i] | 1 | Length of the Data[i] field for each device which responded. | 0 ... 31
Data[i] | Length_Data[i] | Length_Data[i] octets of advertising or scan response data formatted as defined in [Vol 3] Part C, Section 8. |
RSSI[i] | 1 | N Size: 1 Octet (signed integer) Units: dBm | 127: RSSI not available -127 ... 20

## HCI_LE_CONNECTION_UPDATE_COMPLETE_EVENT

### Description

The LE Connection Update Complete event is used to indicate that the Controller process to update the connection has completed.
On a slave, if no connection parameters are updated, then this event shall not be issued.
On a master, this event shall be issued if the Connection_Update command was sent. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.3

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle to be used to identify the connection with the peer device. | 0x0000 ... 0x0EFF
Conn_Interval | 2 | Connection interval used on this connection. Time = N * 1.25 msec | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Supervision_Timeout | 2 | Supervision timeout for the LE Link. It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. Time = N * 10 msec. | 0x000A (100 ms) ... 0x0C80 (32000 ms)

## HCI_LE_READ_REMOTE_FEATURES_COMPLETE_EVENT

### Description

The LE Read Remote Features Complete event is used to indicate the completion of the process of the Controller obtaining the used features of the remote Bluetooth device specified by the Connection_Handle event parameter.
See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.4

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle to be used to identify the connection with the peer device. | 0x0000 ... 0x0EFF
LE_Features | 8 | Bit Mask List of used LE features. For details see LE Link Layer specification. |

## HCI_LE_LONG_TERM_KEY_REQUEST_EVENT

### Description

The LE Long Term Key Request event indicates that the master device is attempting to encrypt or re-encrypt the link and is requesting the Long Term Key from the Host.
(See [Vol 6] Part B, Section 5.1.3)and Bluetooth spec 5.0 vol 2 [part E] 7.7.65.5

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle to be used to identify the connection with the peer device. | 0x0000 ... 0x0EFF
Random_Number | 8 | 64-bit random number |
Encrypted_Diversifier | 2 | 16-bit encrypted diversifier |

## HCI_LE_DATA_LENGTH_CHANGE_EVENT

### Description

The LE Data Length Change event notifies the Host of a change to either the maximum Payload length or the maximum transmission time of packets in either direction. The values reported are the maximum that will actually be used on the connection following the change, except that on the LE Coded PHY a packet taking up to 2704 us to transmit may be sent even though the corresponding parameter has a lower value.
See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.7

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle to be used to identify the connection with the peer device. | 0x0000 ... 0x0EFF
MaxTxOctets | 2 | The maximum number of payload octets in a Link Layer packet that the local Controller will send on this connection (connEffectiveMaxTxOctets defined in [Vol 6] Part B, Section 4.5.10). | 0x001B ... 0x00FB
MaxTxTime | 2 | The maximum time that the local Controller will take to send a Link Layer packet on this connection (connEffectiveMaxTxTime defined in [Vol 6] Part B, Section 4.5.10). | 0x0148 ... 0x4290
MaxRxOctets | 2 | The maximum number of payload octets in a Link Layer packet that the local Controller expects to receive on this connection (connEffectiveMaxRxOctets defined in [Vol 6] Part B, Section 4.5.10). | 0x001B ... 0x00FB
MaxRxTime | 2 | The maximum time that the local Controller expects to take to receive a Link Layer packet on this connection (connEffectiveMaxRxTime defined in [Vol 6] Part B, Section 4.5.10). | 0x0148 ... 0x4290

## HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_EVENT

### Description

This event is generated when local P-256 key generation is complete.
See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.8

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Local_P256_Public_Key | 64 | Local P-256 public key. |

## HCI_LE_GENERATE_DHKEY_COMPLETE_EVENT

### Description

This event indicates that LE Diffie Hellman key generation has been completed by the Controller.
See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.9

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
DHKey | 32 | Diffie Hellman Key |

## HCI_LE_ENHANCED_CONNECTION_COMPLETE_EVENT

### Description

The LE Enhanced Connection Complete event indicates to both of the Hosts forming the connection that a new connection has been created. Upon the creation of the connection a Connection_Handle shall be assigned by the Controller, and passed to the Host in this event. If the connection establishment fails, this event shall be provided to the Host that had issued the LE_Create_Connection command.
If this event is unmasked and LE Connection Complete event is unmasked, only the LE Enhanced Connection Complete event is sent when a new connection has been completed.
This event indicates to the Host that issued a LE_Create_Connection command and received a Command Status event if the connection establishment failed or was successful.
The Master_Clock_Accuracy parameter is only valid for a slave. On a master, this parameter shall be set to 0x00.
See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.10

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle to be used to identify the connection with the peer device. | 0x0000 ... 0x0EFF
Role | 1 | Role of the local device in the connection. | 0x00: Master 0x01: Slave
Peer_Address_Type | 1 | Address type 0x00 Public Device Address 0x01 Random Device Address 0x02 Public Identity Address (Corresponds to Resolved Private Address) 0x03 Random (Static) Identity Address (Corresponds to Resolved Private Address) | 0x00: Public Device Address 0x01: Random Device Address 0x02: Public Identity Address 0x03: Random (Static) Identity Address
Peer_Address | 6 | Public Device Address, Random Device Address, Public Identity Address or Random (static) Identity Address of the device to be connected. |
Local_Resolvable_Private_Address | 6 | Resolvable Private Address being used by the local device for this connection. This is only valid when the Own_Address_Type is set to 0x02 or 0x03. For other Own_Address_Type values, the Controller shall return all zeros. |
Peer_Resolvable_Private_Address | 6 | Resolvable Private Address being used by the peer device for this connection. This is only valid for Peer_Address_Type 0x02 and 0x03. For other Peer_Address_Type values, the Controller shall return all zeros. |
Conn_Interval | 2 | Connection interval used on this connection. Time = N * 1.25 msec | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Conn_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Supervision_Timeout | 2 | Supervision timeout for the LE Link. It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. Time = N * 10 msec. | 0x000A (100 ms) ... 0x0C80 (32000 ms)
Master_Clock_Accuracy | 1 | Master clock accuracy. Only valid for a slave. | 0x00: 500 ppm 0x01: 250 ppm 0x02: 150 ppm 0x03: 100 ppm 0x04: 75 ppm 0x05: 50 ppm 0x06: 30 ppm 0x07: 20 ppm

## HCI_LE_DIRECT_ADVERTISING_REPORT_EVENT

### Description

The LE Direct Advertising Report event indicates that directed advertisements have been received where the advertiser is using a resolvable private address for the InitA field in the ADV_DIRECT_IND PDU and the Scanning_Filter_Policy is equal to 0x02 or 0x03, see HCI_LE_Set_Scan_Parameters.
Direct_Address_Type and Direct_Addres is the address the directed advertisements are being directed to. Address_Type and Address is the address of the advertiser sending the directed advertisements.
See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.11.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Num_Reports | 1 | Number of responses in this event. | 0x01
Event_Type[i] | 1 | Advertising type | 0x01: Connectable directed advertising (ADV_DIRECT_IND)
Address_Type[i] | 1 | Address type 0x00 Public Device Address 0x01 Random Device Address 0x02 Public Identity Address (Corresponds to Resolved Private Address) 0x03 Random (Static) Identity Address (Corresponds to Resolved Private Address) | 0x00: Public Device Address 0x01: Random Device Address 0x02: Public Identity Address 0x03: Random (Static) Identity Address
Address[i] | 6 | Public Device Address, Random Device Address, Public Identity Address or Random (static) Identity Address of the advertising device. |
Direct_Address_Type[i] | 1 | 0x01 Random Device Address | 0x01: Random Device Address
Direct_Address[i] | 6 | Random Device Address |
RSSI[i] | 1 | N Size: 1 Octet (signed integer) Units: dBm | 127: RSSI not available -127 ... 20

## HCI_LE_PHY_UPDATE_COMPLETE_EVENT

### Description

The LE PHY Update Complete Event is used to indicate that the Controller has changed the transmitter PHY or receiver PHY in use.
If the Controller changes the transmitter PHY, the receiver PHY, or both PHYs, this event shall be issued.
If an LE_Set_PHY command was sent and the Controller determines that neither PHY will change as a result, it issues this event immediately.
See See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.12.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Status | 1 | Status error code. |
Connection_Handle | 2 | Connection handle to be used to identify the connection with the peer device. | 0x0000 ... 0x0EFF
TX_PHY | 1 | Transmitter PHY in use | 0x01: The transmitter PHY for the connection is LE 1M 0x02: The transmitter PHY for the connection is LE 2M 0x03: The transmitter PHY for the connection is LE Coded (Not supported by STM32WB)
RX_PHY | 1 | Receiver PHY in use | 0x01: The receiver PHY for the connection is LE 1M 0x02: The receiver PHY for the connection is LE 2M 0x03: The receiver PHY for the connection is LE Coded (Not supported by STM32WB)

## ACI GAP events

##

Event name | Vendor specific subevent code | LO | SO | BO
--- | --- | --- | --- | ---
ACI_GAP_LIMITED_DISCOVERABLE_EVENT | 0x0400 |  | Y |
ACI_GAP_PAIRING_COMPLETE_EVENT | 0x0401 |  | Y |
ACI_GAP_PASS_KEY_REQ_EVENT | 0x0402 |  | Y |
ACI_GAP_AUTHORIZATION_REQ_EVENT | 0x0403 |  | Y |
ACI_GAP_SLAVE_SECURITY_INITIATED_EVENT | 0x0404 |  | Y |
ACI_GAP_BOND_LOST_EVENT | 0x0405 |  | Y |
ACI_GAP_PROC_COMPLETE_EVENT | 0x0407 |  | Y |
ACI_GAP_ADDR_NOT_RESOLVED_EVENT | 0x0408 |  | Y |
ACI_GAP_NUMERIC_COMPARISON_VALUE_EVENT | 0x0409 |  | Y |
ACI_GAP_KEYPRESS_NOTIFICATION_EVENT | 0x040A |  | Y |

## ACI_GAP_LIMITED_DISCOVERABLE_EVENT

### Description

This event is generated by the controller when the limited discoverable mode ends due to timeout. The timeout is 180 seconds.

### Event parameters

None

## ACI_GAP_PAIRING_COMPLETE_EVENT

### Description

This event is generated when the pairing process has completed successfully or a pairing procedure timeout has occurred or the pairing has failed. This is to notify the application that we have paired with a remote device so that it can take further actions or to notify that a timeout has occurred so that the upper layer can decide to disconnect the link.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle on which the pairing procedure completed |
Status | 1 | Pairing status | 0x00: Success 0x01: SMP timeout 0x02: Pairing failed 0x03: Encryption failed
Reason | 1 | Pairing reason error code (valid in case of pairing failed status) | 0x02: OOB_NOT_AVAILABLE 0x03: AUTH_REQ_CANNOT_BE_MET 0x04: CONFIRM_VALUE_FAILED 0x05: PAIRING_NOT_SUPPORTED 0x06: INSUFF_ENCRYPTION_KEY_SIZE 0x07: CMD_NOT_SUPPORTED 0x08: UNSPECIFIED_REASON 0x09: VERY_EARLY_NEXT_ATTEMPT 0x0A: SM_INVALID_PARAMS 0x0B: SMP_SC_DHKEY_CHECK_FAILED 0x0C: SMP_SC_NUMCOMPARISON_FAILED

## ACI_GAP_PASS_KEY_REQ_EVENT

### Description

This event is generated by the Security manager to the application when a passkey is required for pairing. When this event is received, the application has to respond with the ACI_GAP_PASS_KEY_RESP command.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the passkey has been requested. |

## ACI_GAP_AUTHORIZATION_REQ_EVENT

### Description

This event is generated by the Security manager to the application when the application has set that authorization is required for reading/writing of attributes. This event will be generated as soon as the pairing is complete. When this event is received, ACI_GAP_AUTHORIZATION_RESP command should be used to respond by the application.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which authorization has been requested. |

## ACI_GAP_SLAVE_SECURITY_INITIATED_EVENT

### Description

This event is generated when the slave security request is successfully sent to the master.

### Event parameters

None

## ACI_GAP_BOND_LOST_EVENT

### Description

This event is generated when a pairing request is issued in response to a slave security request from a master which has previously bonded with the slave. When this event is received, the upper layer has to issue the command ACI_GAP_ALLOW_REBOND in order to allow the slave to continue the pairing process with the master.

### Event parameters

None

## ACI_GAP_PROC_COMPLETE_EVENT

### Description

This event is sent by the GAP to the upper layers when a procedure previously started has been terminated by the upper layer or has completed for any other reason

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Procedure_Code | 1 | Terminated procedure. | 0x01: GAP_LIMITED_DISCOVERY_PROC 0x02: GAP_GENERAL_DISCOVERY_PROC 0x04: GAP_NAME_DISCOVERY_PROC 0x08: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC 0x10: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC 0x20: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC 0x40: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC 0x80: GAP_OBSERVATION_PROC
Status | 1 | Status error code. |
Data_Length | 1 | Length of Data in octets |
Data | Data_Length | Procedure Specific Data: - For Name Discovery Procedure: the name of the peer device if the procedure completed successfully. |

## ACI_GAP_ADDR_NOT_RESOLVED_EVENT

### Description

This event is sent only by a privacy enabled Peripheral. The event is sent to the upper layers when the peripheral is unsuccessful in resolving the resolvable address of the peer device after connecting to it.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle for which the private address could not be resolved with any of the stored IRK's. |

## ACI_GAP_NUMERIC_COMPARISON_VALUE_EVENT

### Description

This event is sent only during SC v.4.2 Pairing, when Numeric Comparison Association model is selected, in order to show the Numeric Value generated, and to ask for Confirmation to the User. When this event is received, the application has to respond with the ACI_GAP_NUMERIC_COMPARISON_RESP command.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the underlying Pairing |
Numeric_Value | 4 |  |

## ACI_GAP_KEYPRESS_NOTIFICATION_EVENT

### Description

This event is sent only during SC v.4.2 Pairing, when Keypress Notifications are supported, in order to show the input type signalled by the peer device, having Keyboard only I/O capabilities. When this event is received, no action is required to the User.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the underlying Pairing |
Notification_Type | 1 | Type of Keypress input notified/signaled by peer device (having Keyboard only I/O capabilities |

## ACI GATT/ATT events

##

Event name | Vendor specific subevent code | LO | SO | BO
--- | --- | --- | --- | ---
ACI_GATT_ATTRIBUTE_MODIFIED_EVENT | 0x0C01 |  | Y |
ACI_GATT_PROC_TIMEOUT_EVENT | 0x0C02 |  | Y |
ACI_ATT_EXCHANGE_MTU_RESP_EVENT | 0x0C03 |  | Y |
ACI_ATT_FIND_INFO_RESP_EVENT | 0x0C04 |  |  |
ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT | 0x0C05 |  |  |
ACI_ATT_READ_BY_TYPE_RESP_EVENT | 0x0C06 |  |  |
ACI_ATT_READ_RESP_EVENT | 0x0C07 |  |  |
ACI_ATT_READ_BLOB_RESP_EVENT | 0x0C08 |  |  |
ACI_ATT_READ_MULTIPLE_RESP_EVENT | 0x0C09 |  |  |
ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT | 0x0C0A |  |  |
ACI_ATT_PREPARE_WRITE_RESP_EVENT | 0x0C0C |  |  |
ACI_ATT_EXEC_WRITE_RESP_EVENT | 0x0C0D |  |  |
ACI_GATT_INDICATION_EVENT | 0x0C0E |  |  |
ACI_GATT_NOTIFICATION_EVENT | 0x0C0F |  |  |
ACI_GATT_PROC_COMPLETE_EVENT | 0x0C10 |  | Y |
ACI_GATT_ERROR_RESP_EVENT | 0x0C11 |  |  |
ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT | 0x0C12 |  |  |
ACI_GATT_WRITE_PERMIT_REQ_EVENT | 0x0C13 |  | Y |
ACI_GATT_READ_PERMIT_REQ_EVENT | 0x0C14 |  | Y |
ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT | 0x0C15 |  | Y |
ACI_GATT_TX_POOL_AVAILABLE_EVENT | 0x0C16 |  | Y |
ACI_GATT_SERVER_CONFIRMATION_EVENT | 0x0C17 |  | Y |
ACI_GATT_PREPARE_WRITE_PERMIT_REQ_EVENT | 0x0C18 |  | Y |
ACI_GATT_READ_EXT_EVENT | 0x0C1D |  |  |
ACI_GATT_INDICATION_EXT_EVENT | 0x0C1E |  |  |
ACI_GATT_NOTIFICATION_EXT_EVENT | 0x0C1F |  |  |

## ACI_GATT_ATTRIBUTE_MODIFIED_EVENT

### Description

This event is generated to the application by the GATT server when a client modifies any attribute on the server, as consequence of one of the following GATT procedures:
- write without response
- signed write without response
- write characteristic value
- write long characteristic value
- reliable write.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | The connection handle which modified the attribute. |
Attr_Handle | 2 | Handle of the attribute that was modified. |
Offset | 2 | Bits 14-0: offset from which the write has been performed by the peer device. Bit 15 is used as flag: when set to 1 it indicates that more data are to come (fragmented event in case of long attribute data). |
Attr_Data_Length | 2 | Length of Attr_Data in octets |
Attr_Data | Attr_Data_Length | The modified value |

## ACI_GATT_PROC_TIMEOUT_EVENT

### Description

This event is generated by the client/server to the application on a GATT timeout (30 seconds). This is a critical event that should not happen during normal operating conditions. It is an indication of either a major disruption in the communication link or a mistake in the application which does not provide a reply to GATT procedures. After this event, the GATT channel is closed and no more GATT communication can be performed. The applications is exptected to issue an ACI_GAP_TERMINATE to disconnect from the peer device. It is important to leave an 100 ms blank window before sending the ACI_GAP_TERMINATE, since immediately after this event, system could save important information in non volatile memory.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle on which the GATT procedure has timed out |

## ACI_ATT_EXCHANGE_MTU_RESP_EVENT

### Description

This event is generated in response to an Exchange MTU request. See ACI_GATT_EXCHANGE_CONFIG.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Server_RX_MTU | 2 | Attribute server receive MTU size |

## ACI_ATT_FIND_INFO_RESP_EVENT

### Description

This event is generated in response to a Find Information Request. See ACI_ATT_FIND_INFO_REQ and Find Information Response in Bluetooth Core v5.0 spec. This event is also generated in response to ACI_GATT_DISC_ALL_CHAR_DESC

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Format | 1 | Format of the hanndle-uuid pairs |
Event_Data_Length | 1 | Length of Handle_UUID_Pair in octets |
Handle_UUID_Pair | Event_Data_Length | A sequence of handle-uuid pairs. if format=1, each pair is:[2 octets for handle, 2 octets for UUIDs], if format=2, each pair is:[2 octets for handle, 16 octets for UUIDs] |

## ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT

### Description

This event is generated in response to a ACI_ATT_FIND_BY_TYPE_VALUE_REQ

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Num_of_Handle_Pair | 1 | Number of attribute, group handle pairs |
Found_Attribute_Handle[i] | 2 | Found Attribute handle |
Group_End_Handle[i] | 2 | Group End handle |

## ACI_ATT_READ_BY_TYPE_RESP_EVENT

### Description

This event is generated in response to a ACI_ATT_READ_BY_TYPE_REQ. See ACI_GATT_FIND_INCLUDED_SERVICES and ACI_GATT_DISC_ALL_CHAR_DESC.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Handle_Value_Pair_Length | 1 | The size of each attribute handle-value pair |
Data_Length | 1 | Length of Handle_Value_Pair_Data in octets |
Handle_Value_Pair_Data | Data_Length | Attribute Data List as defined in Bluetooth Core v5.0 spec. A sequence of handle-value pairs: [2 octets for Attribute Handle, (Handle_Value_Pair_Length - 2 octets) for Attribute Value] |

## ACI_ATT_READ_RESP_EVENT

### Description

This event is generated in response to a Read Request. See ACI_GATT_READ_CHAR_VALUE.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Event_Data_Length | 1 | Length of following data |
Attribute_Value | Event_Data_Length | The value of the attribute. |

## ACI_ATT_READ_BLOB_RESP_EVENT

### Description

This event can be generated during a read long characteristic value procedure. See ACI_GATT_READ_LONG_CHAR_VALUE.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Event_Data_Length | 1 | Length of following data |
Attribute_Value | Event_Data_Length | Part of the attribute value. |

## ACI_ATT_READ_MULTIPLE_RESP_EVENT

### Description

This event is generated in response to a Read Multiple Request.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Event_Data_Length | 1 | Length of following data |
Set_Of_Values | Event_Data_Length | A set of two or more values. A concatenation of attribute values for each of the attribute handles in the request in the order that they were requested. |

## ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT

### Description

This event is generated in response to a Read By Group Type Request. See ACI_GATT_DISC_ALL_PRIMARY_SERVICES.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Attribute_Data_Length | 1 | The size of each attribute data |
Data_Length | 1 | Length of Attribute_Data_List in octets |
Attribute_Data_List | Data_Length | Attribute Data List as defined in Bluetooth Core v5.0 spec. A sequence of attribute handle, end group handle, attribute value tuples: [2 octets for Attribute Handle, 2 octets End Group Handle, (Attribute_Data_Length - 4 octets) for Attribute Value] |

## ACI_ATT_PREPARE_WRITE_RESP_EVENT

### Description

This event is generated in response to a ACI_ATT_PREPARE_WRITE_REQ.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Attribute_Handle | 2 | The handle of the attribute to be written |
Offset | 2 | The offset of the first octet to be written. |
Part_Attribute_Value_Length | 1 | Length of Part_Attribute_Value in octets |
Part_Attribute_Value | Part_Attribute_Value_Length | The value of the attribute to be written |

## ACI_ATT_EXEC_WRITE_RESP_EVENT

### Description

This event is generated in response to an Execute Write Request.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF

## ACI_GATT_INDICATION_EVENT

### Description

This event is generated when an indication is received from the server.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Attribute_Handle | 2 | The handle of the attribute |
Attribute_Value_Length | 1 | Length of Attribute_Value in octets |
Attribute_Value | Attribute_Value_Length | The current value of the attribute |

## ACI_GATT_NOTIFICATION_EVENT

### Description

This event is generated when a notification is received from the server.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Attribute_Handle | 2 | The handle of the attribute |
Attribute_Value_Length | 1 | Length of Attribute_Value in octets |
Attribute_Value | Attribute_Value_Length | The current value of the attribute |

## ACI_GATT_PROC_COMPLETE_EVENT

### Description

This event is generated when a GATT client procedure completes either with error or successfully.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Error_Code | 1 | Indicates whether the procedure completed with an error or was successful (see "Status error codes" section) |

## ACI_GATT_ERROR_RESP_EVENT

### Description

This event is generated when an Error Response is received from the server. The error response can be given by the server at the end of one of the GATT discovery procedures. This does not mean that the procedure ended with an error, but this error event is part of the procedure itself.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Req_Opcode | 1 | The request that generated this error response |
Attribute_Handle | 2 | The attribute handle that generated this error response |
Error_Code | 1 | The reason why the request has generated an error response (ATT error codes) | 0x01: Invalid handle 0x02: Read not permitted 0x03: Write not permitted 0x04: Invalid PDU 0x05: Insufficient authentication 0x06: Request not supported 0x07: Invalid offset 0x08: Insufficient authorization 0x09: Prepare queue full 0x0A: Attribute not found 0x0B: Attribute not long 0x0C: Insufficient encryption key size 0x0D: Invalid attribute value length 0x0E: Unlikely error 0x0F: Insufficient encryption 0x10: Unsupported group type 0x11: Insufficient resources

## ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT

### Description

This event can be generated during a "Discover Characteristics By UUID" procedure or a "Read using Characteristic UUID" procedure.
The attribute value will be a service declaration as defined in Bluetooth Core v5.0.spec (vol.3, Part G, ch. 3.3.1), when a "Discover Characteristics By UUID" has been started. It will be the value of the Characteristic if a* "Read using Characteristic UUID" has been performed.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Attribute_Handle | 2 | The handle of the attribute |
Attribute_Value_Length | 1 | Length of Attribute_Value in octets |
Attribute_Value | Attribute_Value_Length | The attribute value will be a service declaration as defined in Bluetooth Core v5.0 (vol.3, Part G, ch. 3.3.1), when a "Discover Characteristics By UUID" has been started. It will be the value of the Characteristic if a "Read using Characteristic UUID" has been performed. |

## ACI_GATT_WRITE_PERMIT_REQ_EVENT

### Description

This event is given to the application when a write request, write command or signed write command is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added.
When this event is received, the application has to check whether the value being requested for write can be allowed to be written and respond with the command ACI_GATT_WRITE_RESP.
The details of the parameters of the command can be found. Based on the response from the application, the attribute value will be modified by the stack. If the write is rejected by the application, then the value of the attribute will not be modified. In case of a write REQ, an error response will be sent to the client, with the error code as specified by the application.
In case of write/signed write commands, no response is sent to the client but the attribute is not modified.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Handle of the connection on which there was the request to write the attribute |
Attribute_Handle | 2 | The handle of the attribute |
Data_Length | 1 | Length of Data field |
Data | Data_Length | The data that the client has requested to write |

## ACI_GATT_READ_PERMIT_REQ_EVENT

### Description

This event is given to the application when a read request or read blob request is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added.
On receiving this event, the application can update the value of the handle if it desires and when done, it has to send the ACI_GATT_ALLOW_READ command to indicate to the stack that it can send the response to the client.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Attribute_Handle | 2 | The handle of the attribute |
Offset | 2 | Contains the offset from which the read has been requested |

## ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT

### Description

This event is given to the application when a read multiple request or read by type request is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added.
On receiving this event, the application can update the values of the handles if it desires and when done, it has to send the ACI_GATT_ALLOW_READ command to indicate to the stack that it can send the response to the client.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Handle of the connection which requested to read the attribute |
Number_of_Handles | 1 |  |
Handle[i] | 2 |  |

## ACI_GATT_TX_POOL_AVAILABLE_EVENT

### Description

Each time BLE stack raises the error code BLE_STATUS_INSUFFICIENT_RESOURCES (0x64), the ACI_GATT_TX_POOL_AVAILABLE_EVENT event is generated as soon as there are at least two buffers available for notifications or write commands.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the request |
Available_Buffers | 2 | Number of buffers available |

## ACI_GATT_SERVER_CONFIRMATION_EVENT

### Description

This event is generated when the client has sent the confirmation to a previously sent indication

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the event |

## ACI_GATT_PREPARE_WRITE_PERMIT_REQ_EVENT

### Description

This event is given to the application when a prepare write request is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added.
When this event is received, the application has to check whether the value being requested for write can be allowed to be written and respond with the command ACI_GATT_WRITE_RESP. Based on the response from the application, the attribute value will be modified by the stack.
If the write is rejected by the application, then the value of the attribute will not be modified and an error response will be sent to the client, with the error code as specified by the application.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Handle of the connection on which there was the request to write the attribute |
Attribute_Handle | 2 | The handle of the attribute |
Offset | 2 | The offset from which the prepare write has been requested |
Data_Length | 1 | Length of Data field |
Data | Data_Length | The data that the client has requested to write |

## ACI_GATT_READ_EXT_EVENT

### Description

When it is enabled with ACI_GATT_SET_EVENT_MASK, this event is generated instead of ACI_ATT_READ_RESP_EVENT / ACI_ATT_READ_BLOB_RESP_EVENT / ACI_ATT_READ_MULTIPLE_RESP_EVENT.
This event should be used instead of those events when ATT_MTU > (BLE_EVT_MAX_PARAM_LEN - 4) i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN default value.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Offset | 2 | Bits 14-0: offset in octets from which Attribute_Value data starts. Bit 15 is used as flag: when set to 1 it indicates that more data are to come (fragmented event in case of long attribute data). |
Event_Data_Length | 2 | Length of following data |
Attribute_Value | Event_Data_Length | The value of the attribute(s). |

## ACI_GATT_INDICATION_EXT_EVENT

### Description

When it is enabled with ACI_GATT_SET_EVENT_MASK and when an indication is received from the server, this event is generated instead of ACI_GATT_INDICATION_EVENT.
This event should be used instead of ACI_GATT_INDICATION_EVENT when ATT_MTU > (BLE_EVT_MAX_PARAM_LEN - 4) i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN default value.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Attribute_Handle | 2 | The handle of the attribute |
Offset | 2 | Bits 14-0: offset in octets from which Attribute_Value data starts. Bit 15 is used as flag: when set to 1 it indicates that more data are to come (fragmented event in case of long attribute data). |
Attribute_Value_Length | 2 | Length of Attribute_Value in octets |
Attribute_Value | Attribute_Value_Length | The current value of the attribute |

## ACI_GATT_NOTIFICATION_EXT_EVENT

### Description

When it is enabled with ACI_GATT_SET_EVENT_MASK and when a notification is received from the server, this event is generated instead of ACI_GATT_NOTIFICATION_EVENT.
This event should be used instead of ACI_GATT_NOTIFICATION_EVENT when ATT_MTU > (BLE_EVT_MAX_PARAM_LEN - 4) i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN default value.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle related to the response. | 0x0000 ... 0x0EFF
Attribute_Handle | 2 | The handle of the attribute |
Offset | 2 | Bits 14-0: offset in octets from which Attribute_Value data starts. Bit 15 is used as flag: when set to 1 it indicates that more data are to come (fragmented event in case of long attribute data). |
Attribute_Value_Length | 2 | Length of Attribute_Value in octets |
Attribute_Value | Attribute_Value_Length | The current value of the attribute |

## ACI L2CAP events

##

Event name | Vendor specific subevent code | LO | SO | BO
--- | --- | --- | --- | ---
ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT | 0x0800 |  | Y |
ACI_L2CAP_PROC_TIMEOUT_EVENT | 0x0801 |  | Y |
ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT | 0x0802 |  |  |
ACI_L2CAP_COMMAND_REJECT_EVENT | 0x080A |  | Y |

## ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT

### Description

This event is generated when the master responds to the connection update request packet with a connection update response packet.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle referring to the COS Channel where the Disconnection has been received. |
Result | 2 |  |

## ACI_L2CAP_PROC_TIMEOUT_EVENT

### Description

This event is generated when the master does not respond to the connection update request packet with a connection update response packet or a command reject packet within 30 seconds.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Handle of the connection related to this L2CAP procedure. |
Data_Length | 1 | Length of following data |
Data | Data_Length |  |

## ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT

### Description

The event is given by the L2CAP layer when a connection update request is received from the slave. The upper layer which receives this event has to respond by sending a ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_RESP command.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Handle of the connection related to this L2CAP procedure. |
Identifier | 1 | This is the identifier which associate the request to the response. |
L2CAP_Length | 2 | Length of the L2CAP connection update request. |
Interval_Min | 2 | Minimum value for the connection event interval. This shall be less than or equal to Conn_Interval_Max. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Interval_Max | 2 | Maximum value for the connection event interval. This shall be greater than or equal to Conn_Interval_Min. Time = N * 1.25 msec. | 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
Slave_Latency | 2 | Slave latency for the connection in number of connection events. | 0x0000 ... 0x01F3
Timeout_Multiplier | 2 | Defines connection timeout parameter in the following manner: Timeout Multiplier * 10ms. |

## ACI_L2CAP_COMMAND_REJECT_EVENT

### Description

This event is generated when the master responds to the connection update request packet with a command reject packet.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Connection_Handle | 2 | Connection handle referring to the COS Channel where the Disconnection has been received. |
Identifier | 1 | This is the identifier which associate the request to the response. |
Reason | 2 | Reason |
Data_Length | 1 | Length of following data |
Data | Data_Length | Data field associated with Reason |

## ACI HAL events

##

Event name | Vendor specific subevent code | LO | SO | BO
--- | --- | --- | --- | ---
ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT | 0x0004 | Y | Y | Y
ACI_HAL_SCAN_REQ_REPORT_EVENT | 0x0005 |  |  |
ACI_HAL_FW_ERROR_EVENT | 0x0006 |  | Y |

## ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT

### Description

This event is generated when the device completes a radio activity and provide information when a new radio acitivity will be performed.
Informtation provided includes type of radio activity and absolute time in system ticks when a new radio acitivity is schedule, if any. Application can use this information to schedule user activities synchronous to selected radio activitities. A command ACI_HAL_SET_RADIO_ACTIVITY_MASK is provided to enable radio activity events of user interests, by default no events are enabled.
User should take into account that enablinng radio events in application with intense radio activity could lead to a fairly high rate of events generated.
Application use cases includes synchronizing notification with connection interval, switiching antenna at the end of advertising or performing flash erase operation while radio is idle.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
Last_State | 1 | Completed radio events | 0x00: Idle 0x01: Advertising 0x02: Connection event slave 0x03: Scanning 0x04: Connection request 0x05: Connection event slave 0x06: TX test mode 0x07: RX test mode
Next_State | 1 | Incoming radio events | 0x00: Idle 0x01: Advertising 0x02: Connection event slave 0x03: Scanning 0x04: Connection request 0x05: Connection event slave 0x06: TX test mode 0x07: RX test mode
Next_State_SysTime | 4 | 32bit absolute current time expressed in internal time units. |

## ACI_HAL_SCAN_REQ_REPORT_EVENT

### Description

This event is reported to the application after a scan request is received and a scan reponse is scheduled to be transmitted.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
RSSI | 1 | N Size: 1 Octet (signed integer) Units: dBm | 127: RSSI not available -127 ... 20
Peer_Address_Type | 1 | Address type 0x00 Public Device Address 0x01 Random Device Address 0x02 Public Identity Address (Corresponds to Resolved Private Address) 0x03 Random (Static) Identity Address (Corresponds to Resolved Private Address) | 0x00: Public Device Address 0x01: Random Device Address 0x02: Public Identity Address 0x03: Random (Static) Identity Address
Peer_Address | 6 | Public Device Address or Random Device Address of the peer device |

## ACI_HAL_FW_ERROR_EVENT

### Description

This event is generated to report firmware error information.

### Event parameters

Parameter | Size | Description | Possible values
--- | --- | --- | ---
FW_Error_Type | 1 | FW Error type | 0x01: L2CAP recombination failure 0x02: GATT unexpected peer message 0x03: NVM level warning
Data_Length | 1 | Length of Data in octets |
Data | Data_Length | The error event info |

# Status error codes

Status error codes are used for the return status of all commands. Only the codes from 0 to 0x3E are used for HCI commands (see Core Specification v5.0, Vol. 2, part D), while more codes are defined for ACI commands (see table below).

##

Status error code | Description
--- | ---
0x00 | Success
0x01 | Unknown HCI Command
0x02 | Unknown Connection Identifier
0x03 | Hardware Failure
0x05 | Authentication Failure
0x06 | PIN or Key Missing
0x07 | Memory Capacity Exceeded
0x08 | Connection Timeout
0x09 | Connection Limit Exceeded
0x0B | ACL Connection Already Exists
0x0C | Command Disallowed
0x0D | Connection Rejected Due To Limited Resources
0x0E | Connection Rejected Due To Security Reasons
0x0F | Connection Rejected due to Unacceptable BD_ADDR
0x10 | Connection Accept Timeout Exceeded
0x11 | Unsupported Feature Or Parameter Value
0x12 | Invalid HCI Command Parameters
0x13 | Remote User Terminated Connection
0x14 | Remote Device Terminated Connection due to Low Resources
0x15 | Remote Device Terminated Connection due to Power Off
0x16 | Connection Terminated By Local Host
0x17 | Repeated Attempts
0x18 | Pairing Not Allowed
0x19 | Unknown LMP PDU
0x1A | Unsupported Remote Feature / Unsupported LMP Feature
0x1E | Invalid LMP Parameters
0x1F | Unspecified Error
0x20 | Unsupported LMP Parameter Value
0x21 | Role Change Not Allowed
0x22 | LMP Response Timeout / LL Response Timeout
0x23 | LMP Error Transaction Collision
0x24 | LMP PDU Not Allowed
0x25 | Encryption Mode Not Acceptable
0x26 | Link Key cannot be Changed
0x28 | Instant Passed
0x29 | Pairing With Unit Key Not Supported
0x2A | Different Transaction Collision
0x2E | Channel Assessment Not Supported
0x2F | Insufficient Security
0x30 | Parameter Out Of Mandatory Range
0x32 | Role Switch Pending
0x34 | Reserved Slot Violation
0x35 | Role Switch Failed
0x37 | Secure Simple Pairing Not Supported by Host
0x38 | Host Busy - Pairing
0x39 | Connection Rejected due to No Suitable Channel Found
0x3A | Controller Busy
0x3B | Unacceptable Connection Interval
0x3C | Directed Advertising Timeout
0x3D | Connection Terminated Due to MIC Failure
0x3E | Connection Failed to be Established
0x40 | Unknown connection identifier at SMP level
0x41 | Failed
0x42 | Invalid parameters
0x43 | Busy
0x45 | Pending
0x46 | Not allowed
0x47 | Host error
0x48 | Out of memory
0x50 | Invalid CID
0x59 | Device in blacklist
0x5A | CSRK not found
0x5B | IRK not found
0x5C | Device not found in DB
0x5D | Security DB full
0x5E | Device not bonded
0x5F | Insufficient encryption key size
0x60 | Invalid handle
0x61 | Out of handles
0x62 | Invalid operation
0x63 | Characteristic already exist
0x64 | Insufficient resources
0x65 | Security permission error
0x70 | Address not resolved
0x82 | No valid slot
0x83 | Short window
0x84 | New interval failed
0x85 | Too large interval
0x86 | Slot length failed