1 /******************************************************************************* 2 * @file rsi_ble.h 3 ******************************************************************************* 4 * # License 5 * <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b> 6 ******************************************************************************* 7 * 8 * SPDX-License-Identifier: Zlib 9 * 10 * The licensor of this software is Silicon Laboratories Inc. 11 * 12 * This software is provided 'as-is', without any express or implied 13 * warranty. In no event will the authors be held liable for any damages 14 * arising from the use of this software. 15 * 16 * Permission is granted to anyone to use this software for any purpose, 17 * including commercial applications, and to alter it and redistribute it 18 * freely, subject to the following restrictions: 19 * 20 * 1. The origin of this software must not be misrepresented; you must not 21 * claim that you wrote the original software. If you use this software 22 * in a product, an acknowledgment in the product documentation would be 23 * appreciated but is not required. 24 * 2. Altered source versions must be plainly marked as such, and must not be 25 * misrepresented as being the original software. 26 * 3. This notice may not be removed or altered from any source distribution. 27 * 28 ******************************************************************************/ 29 30 #ifndef RSI_BLE_H 31 #define RSI_BLE_H 32 33 #include "rsi_ble_apis.h" 34 #include "sl_common.h" 35 36 /****************************************************** 37 * * Macros 38 * ******************************************************/ 39 /** @addtogroup BT_BLE_CONSTANTS 40 * @{ 41 */ 42 43 /// Represents the BLE state when there is no active connection. 44 #define RSI_BLE_STATE_NONE 0x00 45 /// Represents the BLE state when the device is connected. 46 #define RSI_BLE_STATE_CONNECTION 0x01 47 /// Represents the BLE state when the device is disconnected 48 #define RSI_BLE_STATE_DSICONNECT 0x02 49 /// Defines the maximum number of request list entries in BLE. 50 #define RSI_BLE_MAX_REQ_LIST 0x05 51 /// Indicates that legacy BLE commands are used (BIT 0). 52 #define RSI_BLE_LEGACY_CMD_USED (1 << 0) //BIT(0) 53 /// Indicates that advertising extension commands are used (BIT 1). 54 #define RSI_BLE_ADV_EXT_CMD_USED (1 << 1) //BIT(1) 55 /// Command to check BLE status (BIT 15). 56 #define RSI_BLE_CHECK_CMD (1 << 15) //BIT(15) 57 /// Indicates that the buffer is available. 58 #define SI_LE_BUFFER_AVL 0 59 /// Indicates that the buffer is full. 60 #define SI_LE_BUFFER_FULL 1 61 /// Indicates that the buffer operation is in progress. 62 #define SI_LE_BUFFER_IN_PROGRESS 2 63 /// Vendor-specific RF type command opcode. 64 #define BLE_VENDOR_RF_TYPE_CMD_OPCODE 0xFC14 65 /// BLE_VENDOR_ACCEPTLIST_USING_ADV_DATA_PAYLOAD. 66 #define BLE_VENDOR_ACCEPTLIST_USING_ADV_DATA_PAYLOAD 0xFC1B 67 /// Defines the maximum number of GAP extension callbacks. 68 #define RSI_BLE_MAX_NUM_GAP_EXT_CALLBACKS 2 69 /// Defines the maximum number of advertising extension event callbacks. 70 #define RSI_BLE_MAX_NUM_ADV_EXT_EVENT_CALLBACKS 0x08 71 /// Advertising extension reporting is disabled. 72 #define BLE_AE_REPORTING_DISABLED 0x01 73 /// Advertising extension reporting is enabled. 74 #define BLE_AE_REPORTING_ENABLED 0x00 75 /// Enables periodic duplicate filtering. 76 #define BLE_AE_PERODIC_DUPLICATE_FILTERING_ENABLED 0x01 77 /// Disables periodic duplicate filtering. 78 #define BLE_AE_PERODIC_DUPLICATE_FILTERING_DISABLED 0x00 79 /// Periodic list usage flag. 80 #define BLE_AE_PERIODIC_LIST_USED 0x01 81 82 /****************************************************** 83 * * Constants 84 * ******************************************************/ 85 86 /****************************************************** 87 * * Enumerations 88 * ******************************************************/ 89 /// Enumeration for BLE advertising extension command request codes 90 typedef enum RSI_BLE_CMD_AE_opcode_e { 91 RSI_BLE_GET_AE_MAX_NO_OF_ADV_SETS = 0x0001, 92 RSI_BLE_GET_AE_MAX_ADV_DATA_LEN = 0x0002, 93 RSI_BLE_SET_AE_SET_RANDOM_ADDR = 0x0003, 94 RSI_BLE_SET_AE_PARAMS = 0x0004, 95 RSI_BLE_SET_AE_DATA = 0x0005, 96 RSI_BLE_SET_AE_ENABLE = 0x006, 97 RSI_BLE_ADV_SET_CLEAR_OR_REMOVE = 0x0007, 98 RSI_BLE_SET_AE_PERIODIC_ADV_PARAMS = 0x0008, 99 RSI_BLE_SET_AE_PERIODIC_ADV_ENABLE = 0x0009, 100 RSI_BLE_SET_AE_SCAN_PARAMS = 0x000A, 101 RSI_BLE_SET_AE_SCAN_ENABLE = 0x000B, 102 RSI_BLE_SET_AE_PERIODIC_SYNC = 0x000C, 103 RSI_BLE_AE_DEV_TO_PERIODIC_LIST = 0x000D, 104 RSI_BLE_AE_READ_PERIODIC_LIST_SIZE = 0x000E, 105 RSI_BLE_AE_EXTENDED_CREATE_CONNECT = 0x000F, 106 } RSI_BLE_CMD_AE_opcode_t; 107 108 /// Enumeration for BLE command request codes 109 typedef enum rsi_ble_cmd_request_e { 110 RSI_BLE_REQ_HCI_RAW = 0x0050, 111 RSI_BLE_REQ_ADV = 0x0075, 112 RSI_BLE_REQ_SCAN = 0x0076, 113 RSI_BLE_REQ_CONN = 0x0077, 114 RSI_BLE_REQ_DISCONNECT = 0x0078, 115 RSI_BLE_GET_DEV_STATE = 0x0079, 116 RSI_BLE_CMD_CONN_PARAMS_UPDATE = 0x007A, 117 RSI_BLE_REQ_START_ENCRYPTION = 0x007B, 118 RSI_BLE_REQ_SMP_PAIR = 0x007C, 119 RSI_BLE_SMP_PAIR_RESPONSE = 0x007D, 120 RSI_BLE_SMP_PASSKEY = 0x007E, 121 RSI_BLE_REQ_PROFILES = 0x007F, 122 RSI_BLE_REQ_PROFILE = 0x0080, 123 RSI_BLE_REQ_CHAR_SERVICES = 0x0081, 124 RSI_BLE_REQ_INC_SERVICES = 0x0082, 125 RSI_BLE_REQ_READ_BY_UUID = 0x0083, 126 RSI_BLE_REQ_DESC = 0x0084, 127 RSI_BLE_REQ_READ_VAL = 0x0085, 128 RSI_BLE_REQ_MULTIPLE_READ = 0x0086, 129 RSI_BLE_REQ_LONG_READ = 0x0087, 130 RSI_BLE_REQ_WRITE = 0x0088, 131 RSI_BLE_REQ_WRITE_NO_ACK = 0x0089, 132 RSI_BLE_REQ_LONG_WRITE = 0x008A, 133 RSI_BLE_REQ_PREPARE_WRITE = 0x008B, 134 RSI_BLE_REQ_EXECUTE_WRITE = 0x008C, 135 RSI_BLE_ADD_SERVICE = 0x0092, 136 RSI_BLE_ADD_ATTRIBUTE = 0x0093, 137 RSI_BLE_SET_LOCAL_ATT_VALUE = 0x0094, 138 RSI_BLE_GET_LOCAL_ATT_VALUE = 0x0095, 139 RSI_BLE_CMD_NOTIFY = 0x0096, 140 RSI_BLE_CMD_INDICATE = 0x0097, 141 RSI_BLE_SET_ADVERTISE_DATA = 0x009C, 142 RSI_BLE_GET_LE_PING = 0x00A1, 143 RSI_BLE_SET_LE_PING = 0x00A2, 144 RSI_BLE_SET_RANDOM_ADDRESS = 0x00A3, 145 RSI_BLE_ENCRYPT = 0x00A4, 146 RSI_BLE_CMD_READ_RESP = 0x00A5, 147 RSI_BLE_SET_SCAN_RESPONSE_DATA = 0x00A8, 148 RSI_BLE_LE_ACCEPT_LIST = 0x00AA, 149 RSI_BLE_CMD_REMOVE_SERVICE = 0x00AB, 150 RSI_BLE_CMD_REMOVE_ATTRIBUTE = 0x00AC, 151 RSI_BLE_PROCESS_RESOLV_LIST = 0x00AD, 152 RSI_BLE_GET_RESOLVING_LIST_SIZE = 0x00AE, 153 RSI_BLE_SET_ADDRESS_RESOLUTION_ENABLE = 0x00AF, 154 RSI_BLE_REQ_READ_PHY = 0x00B0, 155 RSI_BLE_REQ_SET_PHY = 0x00B1, 156 RSI_BLE_SET_DATA_LEN = 0x00B2, 157 RSI_BLE_READ_MAX_DATA_LEN = 0X00B3, 158 RSI_BLE_SET_PRIVACY_MODE = 0x00B4, 159 RSI_BLE_CBFC_CONN_REQ = 0x00B5, 160 RSI_BLE_CBFC_CONN_RESP = 0x00B6, 161 RSI_BLE_CBFC_TX_DATA = 0x00B7, 162 RSI_BLE_CBFC_DISCONN = 0x00B8, 163 RSI_BLE_LE_LTK_REQ_REPLY = 0X00BA, 164 RSI_BLE_RX_TEST_MODE = 0x00BB, 165 RSI_BLE_TX_TEST_MODE = 0x00BC, 166 RSI_BLE_END_TEST_MODE = 0x00BD, 167 RSI_BLE_PER_TX_MODE = 0x00BF, 168 RSI_BLE_PER_RX_MODE = 0x00C0, 169 RSI_BLE_CMD_ATT_ERROR = 0x00C1, 170 RSI_BLE_REQ_PROFILES_ASYNC = 0x00F2, 171 RSI_BLE_REQ_PROFILE_ASYNC = 0x00F3, 172 RSI_BLE_GET_CHARSERVICES_ASYNC = 0x00F4, 173 RSI_BLE_GET_INCLUDESERVICES_ASYNC = 0x00F5, 174 RSI_BLE_READCHARVALUEBYUUID_ASYNC = 0x00F6, 175 RSI_BLE_GET_ATTRIBUTE_ASYNC = 0x00F7, 176 RSI_BLE_GET_DESCRIPTORVALUE_ASYNC = 0x00F8, 177 RSI_BLE_GET_MULTIPLEVALUES_ASYNC = 0x00F9, 178 RSI_BLE_GET_LONGDESCVALUES_ASYNC = 0x00FA, 179 RSI_BLE_SET_DESCVALUE_ASYNC = 0x00FB, 180 RSI_BLE_SET_PREPAREWRITE_ASYNC = 0x00FC, 181 RSI_BLE_EXECUTE_LONGDESCWRITE_ASYNC = 0x00FD, 182 RSI_BLE_SET_SMP_PAIRING_CAPABILITY_DATA = 0x0101, 183 RSI_BLE_CONN_PARAM_RESP_CMD = 0x0105, 184 RSI_BLE_CMD_INDICATE_CONFIRMATION = 0x0106, 185 RSI_BLE_MTU_EXCHANGE_REQUEST = 0x0107, 186 RSI_BLE_CMD_SET_WWO_RESP_NOTIFY_BUF_INFO = 0x0108, 187 RSI_BLE_CMD_WRITE_RESP = 0x010A, 188 RSI_BLE_CMD_PREPARE_WRITE_RESP = 0x010B, 189 RSI_BLE_CMD_SET_LOCAL_IRK = 0x010C, 190 RSI_BLE_REQ_SMP_PAIRING_FAILED = 0x0111, 191 RSI_BLE_CMD_SET_PROP_PROTOCOL_BLE_BANDEDGE_TXPOWER = 0x012A, 192 RSI_BLE_CMD_MTU_EXCHANGE_RESP = 0x012B, 193 RSI_BLE_CMD_SET_BLE_TX_POWER = 0x012D, 194 RSI_BLE_CMD_INDICATE_SYNC = 0x016F, 195 RSI_BLE_CMD_AE = 0x0171, 196 RSI_BLE_CMD_READ_TRANSMIT_POWER = 0x0172, 197 RSI_BLE_CMD_READ_RF_PATH_COMP = 0x0173, 198 RSI_BLE_CMD_WRITE_RF_PATH_COMP = 0x0174, 199 RSI_BLE_REQ_CONN_ENHANCE = 0x1FFF, // Please add new cmd ids above this cmd id. 200 } rsi_ble_cmd_request_t; 201 202 /// Enumeration for BLE command response codes 203 typedef enum rsi_ble_cmd_resp_e { 204 RSI_BLE_RSP_ADVERTISE = 0x0075, 205 RSI_BLE_RSP_SCAN = 0x0076, 206 RSI_BLE_RSP_CONNECT = 0x0077, 207 RSI_BLE_RSP_DISCONNECT = 0x0078, 208 RSI_BLE_RSP_QUERY_DEVICE_STATE = 0x0079, 209 RSI_BLE_RSP_CONN_PARAMS_UPDATE = 0x007A, 210 RSI_BLE_RSP_START_ENCRYPTION = 0x007B, 211 RSI_BLE_RSP_SMP_PAIR = 0x007C, 212 RSI_BLE_RSP_SMP_PAIR_RESPONSE = 0x007D, 213 RSI_BLE_RSP_SMP_PASSKEY = 0x007E, 214 RSI_BLE_RSP_PROFILES = 0x007F, 215 RSI_BLE_RSP_PROFILE = 0x0080, 216 RSI_BLE_RSP_CHAR_SERVICES = 0x0081, 217 RSI_BLE_RSP_INC_SERVICES = 0x0082, 218 RSI_BLE_RSP_READ_BY_UUID = 0x0083, 219 RSI_BLE_RSP_DESC = 0x0084, 220 RSI_BLE_RSP_READ_VAL = 0x0085, 221 RSI_BLE_RSP_MULTIPLE_READ = 0x0086, 222 RSI_BLE_RSP_LONG_READ = 0x0087, 223 RSI_BLE_RSP_WRITE = 0x0088, 224 RSI_BLE_RSP_WRITE_NO_ACK = 0x0089, 225 RSI_BLE_RSP_LONG_WRITE = 0x008A, 226 RSI_BLE_RSP_PREPARE_WRITE = 0x008B, 227 RSI_BLE_RSP_EXECUTE_WRITE = 0x008C, 228 RSI_BLE_RSP_INIT = 0x008D, 229 RSI_BLE_RSP_DEINIT = 0x008E, 230 RSI_BLE_RSP_SET_ANTENNA = 0x008F, 231 RSI_BLE_RSP_ADD_SERVICE = 0x0092, 232 RSI_BLE_RSP_ADD_ATTRIBUTE = 0x0093, 233 RSI_BLE_RSP_SET_LOCAL_ATT_VALUE = 0x0094, 234 RSI_BLE_RSP_GET_LOCAL_ATT_VALUE = 0x0095, 235 RSI_BLE_RSP_NOTIFY = 0x0096, 236 RSI_BLE_RSP_GET_LE_PING = 0x00A1, 237 RSI_BLE_RSP_SET_LE_PING = 0x00A2, 238 RSI_BLE_RSP_SET_RANDOM_ADDRESS = 0x00A3, 239 RSI_BLE_RSP_ENCRYPT = 0x00A4, 240 RSI_BLE_RSP_READ_RESP = 0x00A5, 241 RSI_BLE_RSP_LE_ACCEPT_LIST = 0x00AA, 242 RSI_BLE_RSP_REMOVE_SERVICE = 0x00AB, 243 RSI_BLE_RSP_REMOVE_ATTRIBUTE = 0x00AC, 244 RSI_BLE_RSP_PROCESS_RESOLV_LIST = 0x00AD, 245 RSI_BLE_RSP_GET_RESOLVING_LIST_SIZE = 0x00AE, 246 RSI_BLE_RSP_SET_ADDRESS_RESOLUTION_ENABLE = 0x00AF, 247 RSI_BLE_RSP_READ_PHY = 0x00B0, 248 RSI_BLE_RSP_SET_PHY = 0x00B1, 249 RSI_BLE_RSP_SET_DATA_LEN = 0x00B2, 250 RSI_BLE_RSP_READ_MAX_DATA_LEN = 0X00B3, 251 RSI_BLE_RSP_PRIVACY_MODE = 0x00B4, 252 RSI_BLE_RSP_CBFC_CONN_REQ = 0x00B5, 253 RSI_BLE_RSP_CBFC_CONN_RESP = 0x00B6, 254 RSI_BLE_RSP_CBFC_TX_DATA = 0x00B7, 255 RSI_BLE_RSP_CBFC_DISCONN = 0x00B8, 256 257 RSI_BLE_RSP_LE_LTK_REQ_REPLY = 0X00BA, 258 RSI_BLE_RSP_RX_TEST_MODE = 0x00BB, 259 RSI_BLE_RSP_TX_TEST_MODE = 0x00BC, 260 RSI_BLE_RSP_END_TEST_MODE = 0x00BD, 261 RSI_BLE_RSP_PER_TX_MODE = 0x00BE, 262 RSI_BLE_RSP_PER_RX_MODE = 0x00BF, 263 264 RSI_BLE_RSP_ATT_ERROR = 0x00C1, 265 266 RSI_BLE_RSP_PROFILES_ASYNC = 0x00F2, 267 RSI_BLE_RSP_PROFILE_ASYNC = 0x00F3, 268 RSI_BLE_RSP_GET_CHARSERVICES_ASYNC = 0x00F4, 269 RSI_BLE_RSP_GET_INCLUDESERVICES_ASYNC = 0x00F5, 270 RSI_BLE_RSP_READCHARVALUEBYUUID_ASYNC = 0x00F6, 271 RSI_BLE_RSP_GET_ATTRIBUTE_ASYNC = 0x00F7, 272 RSI_BLE_RSP_GET_DESCRIPTORVALUE_ASYNC = 0x00F8, 273 RSI_BLE_RSP_GET_MULTIPLEVALUES_ASYNC = 0x00F9, 274 RSI_BLE_RSP_GET_LONGDESCVALUES_ASYNC = 0x00FA, 275 RSI_BLE_RSP_SET_DESCVALUE_ASYNC = 0x00FB, 276 RSI_BLE_RSP_SET_PREPAREWRITE_ASYNC = 0x00FC, 277 RSI_BLE_RSP_EXECUTE_LONGDESCWRITE_ASYNC = 0x00FD, 278 279 RSI_BLE_RSP_SET_SMP_PAIRING_CAPABILITY_DATA = 0x0101, 280 RSI_BLE_RSP_CONN_PARAM_RESP = 0x0105, 281 RSI_BLE_RSP_INDICATE_CONFIRMATION = 0x0106, 282 RSI_BLE_RSP_MTU_EXCHANGE_REQUEST = 0x0107, 283 RSI_BLE_RSP_SET_WWO_RESP_NOTIFY_BUF_INFO = 0x0108, 284 RSI_BLE_RSP_SET_LOCAL_IRK = 0x010C, 285 RSI_BLE_RSP_SMP_PAIRING_FAILED = 0x0111, 286 RSI_BLE_RSP_SET_PROP_PROTOCOL_BLE_BANDEDGE_TXPOWER = 0x012A, 287 RSI_BLE_RSP_MTU_EXCHANGE_RESP = 0x012B, 288 RSI_BLE_RSP_SET_BLE_TX_POWER = 0x012D, 289 290 RSI_BLE_RSP_AE = 0x0171, 291 RSI_BLE_RSP_READ_TRANSMIT_POWER = 0x0172, 292 RSI_BLE_RSP_READ_RF_PATH_COMP = 0x0173, 293 RSI_BLE_RSP_WRITE_RF_PATH_COMP = 0x0174, 294 } rsi_ble_cmd_resp_t; 295 296 /// Enumeration for BLE event codes 297 typedef enum rsi_ble_event_e { 298 RSI_BLE_EVENT_DISCONNECT = 0x1006, 299 RSI_BLE_EVENT_GATT_ERROR_RESPONSE = 0x1500, 300 RSI_BLE_EVENT_GATT_DESC_VAL_RESPONSE = 0x1501, 301 RSI_BLE_EVENT_GATT_PRIMARY_SERVICE_BY_UUID = 0x1502, 302 RSI_BLE_EVENT_GATT_READ_CHAR_SERVS = 0x1503, //read by type: read char, include serivces and read value by uuid. 303 RSI_BLE_EVENT_GATT_READ_INC_SERVS = 0x1504, //read by type: read char, include serivces and read value by uuid. 304 RSI_BLE_EVENT_GATT_READ_VAL_BY_UUID = 0x1505, //read by type: read char, include serivces and read value by uuid. 305 RSI_BLE_EVENT_GATT_READ_RESP = 0x1506, 306 RSI_BLE_EVENT_GATT_READ_BLOB_RESP = 0x1507, 307 RSI_BLE_EVENT_GATT_READ_MULTIPLE_RESP = 0x1508, 308 RSI_BLE_EVENT_GATT_PRIMARY_SERVICE_LIST = 0x1509, 309 RSI_BLE_EVENT_GATT_WRITE_RESP = 0x150A, 310 RSI_BLE_EVENT_GATT_PREPARE_WRITE_RESP = 0x150B, 311 RSI_BLE_EVENT_GATT_EXECUTE_WRITE_RESP = 0x150C, 312 RSI_BLE_EVENT_GATT_INDICATE_CONFIRMATION = 0x150D, 313 RSI_BLE_EVENT_ADV_REPORT = 0x150E, 314 RSI_BLE_EVENT_CONN_STATUS = 0x150F, 315 RSI_BLE_EVENT_SMP_REQUEST = 0x1510, 316 RSI_BLE_EVENT_SMP_RESPONSE = 0x1511, 317 RSI_BLE_EVENT_SMP_PASSKEY = 0x1512, 318 RSI_BLE_EVENT_SMP_FAILED = 0x1513, 319 RSI_BLE_EVENT_GATT_NOTIFICATION = 0x1514, 320 RSI_BLE_EVENT_GATT_INDICATION = 0x1515, 321 RSI_BLE_EVENT_ENCRYPT_STARTED = 0x1516, 322 RSI_BLE_EVENT_GATT_WRITE = 0x1517, 323 RSI_BLE_EVENT_LE_PING_TIME_EXPIRED = 0x1518, 324 RSI_BLE_EVENT_PREPARE_WRITE = 0x1519, 325 RSI_BLE_EVENT_EXECUTE_WRITE = 0x151A, 326 RSI_BLE_EVENT_READ_REQ = 0x151B, 327 RSI_BLE_EVENT_MTU = 0x151C, 328 RSI_BLE_EVENT_SMP_PASSKEY_DISPLAY_EVENT = 0x151D, 329 RSI_BLE_EVENT_PHY_UPDATE_COMPLETE = 0x151E, 330 RSI_BLE_EVENT_DATA_LENGTH_UPDATE_COMPLETE = 0x151F, 331 RSI_BLE_EVENT_SC_PASSKEY = 0x1520, 332 RSI_BLE_EVENT_ENHANCE_CONN_STATUS = 0x1521, 333 RSI_BLE_EVENT_DIRECTED_ADV_REPORT = 0x1522, 334 RSI_BLE_EVENT_SECURITY_KEYS = 0x1523, 335 RSI_BLE_EVENT_PSM_CONN_REQ = 0x1524, 336 RSI_BLE_EVENT_PSM_CONN_COMPLETE = 0x1525, 337 RSI_BLE_EVENT_PSM_RX_DATA = 0x1526, 338 RSI_BLE_EVENT_PSM_DISCONNECT = 0x1527, 339 RSI_BLE_EVENT_LE_LTK_REQUEST = 0x152A, 340 RSI_BLE_EVENT_CONN_UPDATE_COMPLETE = 0x152B, 341 RSI_BLE_EVENT_REMOTE_FEATURES = 0x152C, 342 RSI_BLE_EVENT_LE_MORE_DATA_REQ = 0x152D, 343 RSI_BLE_EVENT_REMOTE_CONN_PARAMS_REQUEST = 0x153C, 344 RSI_BLE_EVENT_CLI_SMP_RESPONSE = 0x153D, 345 RSI_BLE_EVENT_CHIP_MEMORY_STATS = 0x1530, 346 RSI_BLE_EVENT_SC_METHOD = 0x1540, 347 RSI_BLE_EVENT_MTU_EXCHANGE_INFORMATION = 0x1541, 348 RSI_BLE_EVENT_CTKD = 0x1542, 349 RSI_BLE_EVENT_REMOTE_DEVICE_INFORMATION = 0x1543, 350 RSI_BLE_EVENT_AE_ADVERTISING_REPORT = 0x1544, 351 RSI_BLE_EVENT_PER_ADV_SYNC_ESTBL = 0x1545, 352 RSI_BLE_EVENT_PER_ADV_REPORT = 0x1546, 353 RSI_BLE_EVENT_PER_ADV_SYNC_LOST = 0x1547, 354 RSI_BLE_EVENT_SCAN_TIMEOUT = 0x1548, 355 RSI_BLE_EVENT_ADV_SET_TERMINATED = 0x1549, 356 RSI_BLE_EVENT_SCAN_REQ_RECVD = 0x154a, 357 RSI_BLE_EVENT_RCP_DATA_RCVD = 0x15FF, 358 } rsi_ble_event_t; 359 360 /// Enumerations for smp failure error 361 typedef enum { 362 RSI_SMP_PAIRING_NOT_SUPPORTED = 0x05, 363 RSI_SMP_UNSPECIFIED_REASON = 0x08, 364 RSI_SMP_REPEATED_ATTEMPTS = 0x09, 365 } smp_failure_error; 366 367 /// Enumerations for call back types 368 typedef enum rsi_ble_callback_id_e { 369 RSI_BLE_ON_CTKD = 1, 370 RSI_BLE_ON_ADV_EXT_ADVERTISE_REPORT_EVENT = 2, 371 RSI_BLE_ON_ADV_EXT_PERIODIC_ADV_SYNC_ESTBL_EVENT = 3, 372 RSI_BLE_ON_ADV_EXT_PERIODIC_ADVERTISE_REPORT_EVENT = 4, 373 RSI_BLE_ON_ADV_EXT_PERIODIC_ADV_SYNC_LOST_EVENT = 5, 374 RSI_BLE_ON_ADV_EXT_SCAN_TIMEOUT_EVENT = 6, 375 RSI_BLE_ON_ADV_EXT_ADVERTISE_SET_TERMINATED_EVENT = 7, 376 RSI_BLE_ON_ADV_EXT_SCAN_REQUEST_RECEIVED_EVENT = 8, 377 } rsi_ble_callback_id_t; 378 /** @} */ 379 /******************************************************** 380 * * Structure Definitions 381 * ******************************************************/ 382 /** @addtogroup BT_BLE_TYPES 383 * @{ */ 384 385 // GAP command structures 386 387 /** 388 * @brief Structure representing the BLE request to set a random address. 389 * 390 * This structure is used to define the parameters for the BLE request to set a random address, 391 * including the random address of the device to be set. 392 */ 393 typedef struct rsi_ble_req_rand_s { 394 /** Random address of the device to be set */ 395 uint8_t rand_addr[RSI_DEV_ADDR_LEN]; 396 } rsi_ble_req_rand_t; 397 398 // Advertising command structure 399 /** 400 * @brief Structure representing a BLE advertising request. 401 */ 402 typedef struct rsi_ble_req_adv_s { 403 /** Advertising Status 404 - 405 406 0 - disable 407 - 408 1 - enable*/ 409 uint8_t status; 410 /** Advertising type used during advertising 411 - 412 413 1. Advertising will be visible(discoverable) to all the devices. Scanning/Connection is also accepted from all devices. 414 - 415 416 #define UNDIR_CONN 0x80 417 - 418 419 2. Advertising will be visible(discoverable) to the particular device mentioned in RSI_BLE_ADV_DIR_ADDR only. 420 - 421 422 Scanning and Connection will be accepted from that device only. 423 - 424 425 #define DIR_CONN 0x81 426 - 427 428 3. Advertising will be visible(discoverable) to all the devices. Scanning will be accepted from all the devices. 429 - 430 431 Connection will be not be accepted from any device. 432 - 433 434 #define UNDIR_SCAN 0x82 435 - 436 437 4. Advertising will be visible(discoverable) to all the devices. Scanning and Connection will not be accepted from any device. 438 - 439 440 #define UNDIR_NON_CONN 0x83 441 - 442 443 5. Advertising will be visible(discoverable) to the particular device mentioned in RSI_BLE_ADV_DIR_ADDR only. 444 - 445 446 Scanning and Connection will be accepted from that device only. 447 - 448 449 #define DIR_CONN_LOW_DUTY_CYCLE 0x84 */ 450 uint8_t adv_type; 451 /** Advertising filter type 452 - 453 454 #define ALLOW_SCAN_REQ_ANY_CONN_REQ_ANY 0x00 455 - 456 457 #define ALLOW_SCAN_REQ_ACCEPT_LIST_CONN_REQ_ANY 0x01 458 - 459 460 #define ALLOW_SCAN_REQ_ANY_CONN_REQ_ACCEPT_LIST 0x02 461 - 462 463 #define ALLOW_SCAN_REQ_ACCEPT_LIST_CONN_REQ_ACCEPT_LIST 0x03 */ 464 uint8_t filter_type; 465 /** Address type of the device to which directed advertising has to be done 466 - 467 468 #define LE_PUBLIC_ADDRESS 0x00 469 - 470 471 #define LE_RANDOM_ADDRESS 0x01 472 - 473 474 #define LE_RESOLVABLE_PUBLIC_ADDRESS 0x02 475 - 476 477 #define LE_RESOLVABLE_RANDOM_ADDRESS 0x03 */ 478 uint8_t direct_addr_type; 479 /** Address of the device to which directed advertising has to be done */ 480 uint8_t direct_addr[RSI_DEV_ADDR_LEN]; 481 482 /** Advertising interval min 0x0020 to 0x4000 */ 483 uint16_t adv_int_min; 484 485 /** Advertising interval max 0x0020 to 0x4000 */ 486 uint16_t adv_int_max; 487 488 /** Address of the local device. 489 - 490 491 #define LE_PUBLIC_ADDRESS 0x00 492 - 493 494 #define LE_RANDOM_ADDRESS 0x01 495 - 496 497 #define LE_RESOLVABLE_PUBLIC_ADDRESS 0x02 498 - 499 500 #define LE_RESOLVABLE_RANDOM_ADDRESS 0x03 */ 501 uint8_t own_addr_type; 502 503 /** Advertising channel map. 504 - 505 506 #define RSI_BLE_ADV_CHANNEL_MAP 0x01 or 0x03 or 0x07 */ 507 uint8_t adv_channel_map; 508 } rsi_ble_req_adv_t; 509 510 // Advertising data command structure 511 512 /** 513 * @brief Structure representing the BLE request to set advertising data. 514 * 515 * This structure is used to define the parameters for the BLE request to set advertising data, 516 * including the advertising data length and the advertising data itself. 517 */ 518 typedef struct rsi_ble_req_adv_data_s { 519 /** Advertising data length */ 520 uint8_t data_len; 521 /** Advertising data */ 522 uint8_t adv_data[31]; 523 } rsi_ble_req_adv_data_t; 524 525 /** 526 * @brief Structure representing the BLE request to manage the accept list using a payload. 527 * 528 * This structure is used to define the parameters for the BLE request to manage the accept list, 529 * including the operation code, enable flag, total length of the payload, data compare index, 530 * length of the data to compare, and the advertising data payload. 531 */ 532 typedef struct rsi_ble_req_acceptlist_using_payload_s { 533 /** Operation code for the request */ 534 uint8_t opcode[2]; 535 /** Enable or disable the accept list */ 536 uint8_t enable; 537 /** Total length of the payload */ 538 uint8_t total_len; 539 /** Index for comparing data */ 540 uint8_t data_compare_index; 541 /** Length of the data to compare */ 542 uint8_t len_for_compare_data; 543 /** Advertising data payload */ 544 uint8_t adv_data_payload[31]; 545 } rsi_ble_req_acceptlist_using_payload_t; 546 547 /** @addtogroup BT_BLE_CONSTANTS 548 * @{ 549 */ 550 /// BLE protocol identifier. 551 #define BLE_PROTOCOL 0x01 552 /// Proprietary protocol identifier. 553 #define PROP_PROTOCOL 0x02 554 /// Advertising role identifier. 555 #define ADV_ROLE 0x01 556 /// Scanning and central role identifier. 557 #define SCAN_AND_CENTRAL_ROLE 0x02 558 #ifndef PERIPHERAL_ROLE 559 /// Peripheral role identifier. 560 #define PERIPHERAL_ROLE 0x03 561 #endif 562 /// Connection role identifier. 563 #define CONN_ROLE 0x04 564 /** @} */ 565 566 // Set BLE tx power cmd_ix=0x012D 567 568 /** 569 * @brief Structure representing the BLE request to set the transmission power. 570 * 571 * This structure is used to define the parameters for the BLE request to set the transmission power, 572 * including the transmission power value. 573 */ 574 typedef struct rsi_ble_set_ble_tx_power_s { 575 /** Transmission power value */ 576 int8_t tx_power; 577 } rsi_ble_set_ble_tx_power_t; 578 579 //Scan response data command structure 580 581 /** 582 * @brief Structure representing the set scan response data for the BLE scan request. 583 * 584 * This structure is used to define the parameters to set scan response data for the BLE scan request, 585 * including the scan response data length. 586 */ 587 typedef struct rsi_ble_req_scanrsp_data_s { 588 /** Scan response data length */ 589 uint8_t data_len; 590 /** Scan response data */ 591 uint8_t scanrsp_data[31]; 592 } rsi_ble_req_scanrsp_data_t; 593 594 //Scan command structure 595 /** 596 * @brief Structure representing a BLE scan request. 597 */ 598 typedef struct rsi_ble_req_scan_s { 599 600 /** Scanning Status 601 - 602 603 0 - disable 604 - 605 1 - enable*/ 606 uint8_t status; 607 608 /** Scanning type 609 - 610 611 SCAN_TYPE_ACTIVE 0x01 612 - 613 614 SCAN_TYPE_PASSIVE 0x00 */ 615 uint8_t scan_type; 616 617 /** To filter incoming advertising reports 618 - 619 620 FILTERING_DISABLED = 0 (default) 621 - 622 623 ACCEPTLIST_FILTERING = 1 624 @note In order to allow only acceptlisted devices, need to add bd_addr 625 into acceptlist by calling @ref rsi_ble_addto_acceptlist() API */ 626 uint8_t filter_type; 627 628 /** Address type of the local device 629 - 630 631 #define LE_PUBLIC_ADDRESS 0x00 632 - 633 634 #define LE_RANDOM_ADDRESS 0x01 635 - 636 637 #define LE_RESOLVABLE_PUBLIC_ADDRESS 0x02 638 - 639 640 #define LE_RESOLVABLE_RANDOM_ADDRESS 0x03 */ 641 uint8_t own_addr_type; 642 643 /** Scan interval 644 - 645 646 This is defined as the time interval from when the Controller started 647 its last LE scan until it begins the subsequent LE scan. 648 - 649 650 Range: 0x0004 to 0x4000 */ 651 uint16_t scan_int; 652 653 /** Scan window 654 - 655 656 The duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval 657 - 658 659 Range: 0x0004 to 0x4000 */ 660 uint16_t scan_win; 661 662 } rsi_ble_req_scan_t; 663 664 //ENCRYPT COMMAND STRUCTURE 665 666 /** 667 * @brief Structure representing the BLE encryption request. 668 * 669 * This structure is used to define the parameters for the BLE encryption request, 670 * including the encryption key and the data to be encrypted. 671 */ 672 typedef struct rsi_ble_encrypt_s { 673 /** Encryption key (16 bytes) */ 674 uint8_t key[16]; 675 /** Data to be encrypted (16 bytes) */ 676 uint8_t data[16]; 677 } rsi_ble_encrypt_t; 678 679 /** 680 * @brief Structure representing a data packet. 681 * 682 * This structure is used to define the parameters for a data packet, 683 * including an array to hold the data packet, up to 1024 bytes. 684 */ 685 typedef struct rsi_data_packet_s { 686 /** Array to hold the data packet, up to 1024 bytes */ 687 uint8_t data[1024]; 688 } rsi_data_packet_t; 689 690 //accept list structure 691 692 /** 693 * @brief Structure representing the BLE accept list. 694 * 695 * This structure is used to define the parameters for the BLE accept list, 696 * including the operation to add or delete the address, the device address, and the address type. 697 */ 698 typedef struct rsi_ble_accept_list_s { 699 /** Bit used to add or delete the address from/to the allow list */ 700 uint8_t addordeltowhitlist; 701 /** Address of the device */ 702 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 703 /** Address type */ 704 uint8_t bdaddressType; 705 } rsi_ble_accept_list_t; 706 707 //Connect command structure 708 709 /** 710 * @brief Structure representing the BLE connection request. 711 * 712 * This structure is used to define the parameters for a BLE connection request, 713 * including the address type and address of the device to connect, scan interval, scan window, 714 * connection interval, connection latency, and supervision timeout. 715 */ 716 typedef struct rsi_ble_req_conn_s { 717 /** Address type of the device to connect */ 718 uint8_t dev_addr_type; 719 /** Address of the device to connect */ 720 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 721 /** Scan interval */ 722 uint16_t le_scan_interval; 723 /** Scan window */ 724 uint16_t le_scan_window; 725 /** Minimum connection interval */ 726 uint16_t conn_interval_min; 727 /** Maximum connection interval */ 728 uint16_t conn_interval_max; 729 /** Connection latency */ 730 uint16_t conn_latency; 731 /** Supervision timeout */ 732 uint16_t supervision_tout; 733 } rsi_ble_req_conn_t; 734 735 /** 736 * @brief Structure representing the BLE enhanced connection request. 737 * 738 * This structure is used to define the parameters for a BLE enhanced connection request, 739 * including the address type and address of the device to connect, filter policy, own address type, 740 * scan interval, scan window, connection interval, connection latency, supervision timeout, 741 * and connection event length. 742 */ 743 typedef struct rsi_ble_req_enhance_conn_s { 744 /** Address type of the device to connect */ 745 uint8_t dev_addr_type; 746 /** Address of the device to connect */ 747 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 748 /** Filter policy */ 749 uint8_t filter_policy; 750 /** Own address type */ 751 uint8_t own_addr_type; 752 /** Scan interval */ 753 uint16_t le_scan_interval; 754 /** Scan window */ 755 uint16_t le_scan_window; 756 /** Minimum connection interval */ 757 uint16_t conn_interval_min; 758 /** Maximum connection interval */ 759 uint16_t conn_interval_max; 760 /** Connection latency */ 761 uint16_t conn_latency; 762 /** Supervision timeout */ 763 uint16_t supervision_tout; 764 /** Minimum connection event length */ 765 uint16_t min_ce_length; 766 /** Maximum connection event length */ 767 uint16_t max_ce_length; 768 } rsi_ble_req_enhance_conn_t; 769 770 //Disconnect command structure 771 772 /** 773 * @brief Structure representing the BLE request to disconnect. 774 * 775 * This structure is used to define the parameters for the BLE request to disconnect, 776 * including the device address and the type of disconnect operation. 777 */ 778 typedef struct rsi_ble_req_disconnect_s { 779 /** Address of the device to disconnect */ 780 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 781 /** @addtogroup BT_BLE_CONSTANTS 782 * @{ 783 */ 784 785 /// Indicates compatibility mode for BLE operations. 786 #define COMPATABILITY 0 787 /// Command to cancel an ongoing BLE connection attempt. 788 #define BLE_CONNECT_CANCEL 1 789 /// Command to disconnect an established BLE connection. 790 #define BLE_DISCONNECT 2 791 /** @} */ 792 /** Type of the disconnect operation */ 793 uint8_t type; 794 } rsi_ble_req_disconnect_t; 795 796 //SMP protocol structures 797 798 //start encryption cmd structures 799 800 /** 801 * @brief Structure representing the BLE start encryption request. 802 * 803 * This structure is used to define the parameters for a BLE start encryption request, 804 * including the address of the connected device, the remote device's Encrypted Diversifier (EDIV) value, 805 * Random (RAND) value, and Long Term Key (LTK) value. 806 */ 807 typedef struct rsi_ble_start_encryption_s { 808 /** Address of the connected device */ 809 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 810 /** Remote device EDIV value */ 811 uint16_t ediv; 812 /** Remote device RAND value */ 813 uint8_t rand[8]; 814 /** Remote device LTK value */ 815 uint8_t ltk[16]; 816 } rsi_ble_strat_encryption_t; 817 818 //SMP Pair Request command structure = 0x007C 819 820 /** 821 * @brief Structure representing the BLE Security Manager Protocol (SMP) pairing request. 822 * 823 * This structure is used to define the parameters for a BLE SMP pairing request, 824 * including the device address, IO capability, and MITM (Man-In-The-Middle) protection requirement. 825 */ 826 typedef struct rsi_ble_req_smp_pair_s { 827 /** Device address for the pairing request */ 828 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 829 /** IO capability of the device */ 830 uint8_t io_capability; 831 /** MITM (Man-In-The-Middle) protection requirement */ 832 uint8_t mitm_req; 833 } rsi_ble_req_smp_pair_t; 834 835 //SMP Response command structure = 0x007D 836 837 /** 838 * @brief Structure representing the BLE Security Manager Protocol (SMP) response. 839 * 840 * This structure is used to define the parameters for a BLE SMP response, 841 * including the device address, IO capability, and Man-In-The-Middle (MITM) protection requirement. 842 */ 843 typedef struct rsi_ble_smp_response_s { 844 /** Device address for the SMP response */ 845 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 846 /** IO capability of the device */ 847 uint8_t io_capability; 848 /** MITM protection requirement */ 849 uint8_t mitm_req; 850 } rsi_ble_smp_response_t; 851 852 //SMP Passkey command structure, cmd_ix - 0x007E 853 854 /** 855 * @brief Structure representing the BLE SMP (Security Manager Protocol) passkey. 856 * 857 * This structure is used to define the parameters for a BLE SMP passkey, 858 * including the device address, reserved bytes for future use, and the passkey used for pairing. 859 */ 860 typedef struct rsi_ble_smp_passkey_s { 861 /** Address of the device */ 862 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 863 /** Reserved for future use (2 bytes) */ 864 uint8_t reserved[2]; 865 /** Passkey used for pairing */ 866 uint32_t passkey; 867 } rsi_ble_smp_passkey_t; 868 869 //LE ping get auth payload timeout command structure, cmd_ix - 0x00A1 870 871 /** 872 * @brief Structure representing the BLE command to get the LE ping timeout. 873 * 874 * This structure is used to define the parameters for a BLE command to get the LE ping timeout, 875 * including the remote device address. 876 */ 877 typedef struct rsi_ble_get_le_ping_timeout_s { 878 /** Remote device address (6 bytes) */ 879 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 880 } rsi_ble_get_le_ping_timeout_t; 881 882 //LE ping get auth payload timeout command structure, cmd_ix - 0x00A2 883 /** 884 * @brief Structure representing the BLE response for getting LE ping timeout. 885 * 886 * This structure is used to define the parameters for the BLE response to get the LE ping timeout, 887 * including the address of the connected device and the LE ping timeout value. 888 */ 889 typedef struct rsi_ble_rsp_get_le_ping_timeout_s { 890 /** Address of the connected device */ 891 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 892 /** LE ping timeout value */ 893 uint16_t time_out; 894 } rsi_ble_rsp_get_le_ping_timeout_t; 895 896 //LE ping get auth payload timeout command structure, cmd_ix - 0x00A2 897 /** 898 * @brief Structure representing the BLE request to set LE ping timeout. 899 * 900 * This structure is used to define the parameters for a BLE request to set the LE ping timeout, 901 * including the address of the connected device and the LE ping timeout value to be set. 902 */ 903 typedef struct rsi_ble_set_le_ping_timeout_s { 904 /** Address of the connected device */ 905 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 906 /** LE ping timeout value to be set */ 907 uint16_t time_out; 908 } rsi_ble_set_le_ping_timeout_t; 909 910 /** 911 * @brief Structure representing the BLE resolving list entry. 912 * 913 * This structure is used to define the parameters for a BLE resolving list entry, 914 * including the type of process (e.g., add, remove, clear), the address type and address of the remote device, 915 * and the Identity Resolving Keys (IRKs) of both the peer and local devices. 916 */ 917 typedef struct rsi_ble_resolvlist_s { 918 /** Type of process (e.g., add, remove, clear) */ 919 uint8_t process_type; 920 /** Address type of the remote device */ 921 uint8_t remote_dev_addr_type; 922 /** Address of the remote device */ 923 uint8_t remote_dev_addr[RSI_DEV_ADDR_LEN]; 924 /** Identity Resolving Key (IRK) of the peer device */ 925 uint8_t peer_irk[16]; 926 /** Identity Resolving Key (IRK) of the local device */ 927 uint8_t local_irk[16]; 928 } rsi_ble_resolvlist_t; 929 930 //LE Get resolvlist size command structure, cmd_ix - 0x00AE 931 932 /** 933 * @brief Structure representing the BLE request to get the size of the resolving list. 934 * 935 * This structure is used to define the parameter for a BLE request to get the size of the resolving list. 936 */ 937 typedef struct rsi_ble_get_resolving_list_size_s { 938 /** Size of the resolving list */ 939 uint8_t size; 940 } rsi_ble_get_resolving_list_size_t; 941 942 /** 943 * @brief Structure representing the BLE request to enable or disable address resolution. 944 * 945 * This structure is used to define the parameters for a BLE request to enable or disable address resolution, 946 * including the enable flag, reserved field for future use, and the timeout value for address resolution. 947 */ 948 typedef struct rsi_ble_set_addr_resolution_enable_s { 949 /** Enable or disable address resolution */ 950 uint8_t enable; 951 /** Reserved for future use */ 952 uint8_t reserved; 953 /** Timeout value for address resolution */ 954 uint16_t tout; 955 } rsi_ble_set_addr_resolution_enable_t; 956 957 //LE conn params update command structure, cmd_ix - 0x007A 958 959 /** 960 * @brief Structure representing the BLE command to update connection parameters. 961 * 962 * This structure is used to define the parameters for a BLE command to update connection parameters, 963 * including the address of the connected device, minimum and maximum connection intervals, 964 * peripheral latency, and supervision timeout. 965 */ 966 typedef struct rsi_ble_cmd_conn_params_update_s { 967 /** Address of the connected device */ 968 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 969 /** Minimum connection interval */ 970 uint16_t min_interval; 971 /** Maximum connection interval */ 972 uint16_t max_interval; 973 /** Peripheral latency */ 974 uint16_t latency; 975 /** Supervision timeout */ 976 uint16_t timeout; 977 } rsi_ble_cmd_conn_params_update_t; 978 979 //LE read phy request command structure, cmd_ix - 0x00B0 980 981 /** 982 * @brief Structure representing the BLE request to read PHY. 983 * 984 * This structure is used to define the parameter for a BLE request to read the PHY, 985 * including the address of the connected device. 986 */ 987 typedef struct rsi_ble_req_read_phy_s { 988 /** Address of the connected device */ 989 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 990 } rsi_ble_req_read_phy_t; 991 992 //LE set phy command response structure, cmd_ix - 0x00B1 993 994 /** 995 * @brief Structure representing the BLE request to set PHY. 996 * 997 * This structure is used to define the parameters for a BLE request to set the PHY, 998 * including the address of the connected device, all PHYs preference, preferred TX PHY, 999 * preferred RX PHY, reserved field for future use, and PHY options. 1000 */ 1001 typedef struct rsi_ble_set_phy_s { 1002 /** Address of the connected device */ 1003 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1004 /** All PHYs preference */ 1005 uint8_t all_phy; 1006 /** Preferred TX PHY */ 1007 uint8_t tx_phy; 1008 /** Preferred RX PHY */ 1009 uint8_t rx_phy; 1010 /** Reserved for future use */ 1011 uint8_t reserved; 1012 /** PHY options */ 1013 uint16_t phy_options; 1014 } rsi_ble_set_phy_t; 1015 1016 //LE set data length command response structure, cmd_ix - 0x00B2 1017 1018 /** 1019 * @brief Structure representing the BLE request to set data length. 1020 * 1021 * This structure is used to define the parameters for a BLE request to set the data length, 1022 * including the address of the connected device, the maximum number of payload octets that the local device will send, 1023 * and the maximum time that the local device will take to send the payload. 1024 */ 1025 typedef struct rsi_ble_setdatalength_s { 1026 /** Address of the connected device */ 1027 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1028 /** Maximum number of payload octets that the local device will send */ 1029 uint16_t txoctets; 1030 /** Maximum time that the local device will take to send the payload */ 1031 uint16_t txtime; 1032 } rsi_ble_setdatalength_t; 1033 1034 //LE set privacy mode command structure, cmd_ix - 0x00B4 1035 1036 /** 1037 * @brief Structure representing the BLE request to set privacy mode. 1038 * 1039 * This structure is used to define the parameters for a BLE request to set the privacy mode, 1040 * including the address type and address of the remote device, and the privacy mode to be set. 1041 */ 1042 typedef struct rsi_ble_set_privacy_mode_s { 1043 /** Address type of the remote device */ 1044 uint8_t remote_dev_addr_type; 1045 /** Address of the remote device */ 1046 uint8_t remote_dev_addr[RSI_DEV_ADDR_LEN]; 1047 /** Privacy mode to be set */ 1048 uint8_t privacy_mode; 1049 } rsi_ble_set_privacy_mode_t; 1050 1051 //LE cbfc connection req command structure, cmd_ix - 0x00B5 1052 1053 /** 1054 * @brief Structure representing the BLE Credit Based Flow Control (CBFC) connection request. 1055 * 1056 * This structure is used to define the parameters for a BLE CBFC connection request, 1057 * including the address of the remote device and the Protocol/Service Multiplexer (PSM) value. 1058 */ 1059 typedef struct rsi_ble_cbfc_conn_req_s { 1060 /** Address of the remote device */ 1061 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1062 /** Protocol/Service Multiplexer (PSM) value */ 1063 uint8_t psm; 1064 } rsi_ble_cbfc_conn_req_t; 1065 1066 //LE cbfc connection resp command structure, cmd_ix - 0x00B6 1067 1068 /** 1069 * @brief Structure representing the BLE Credit Based Flow Control (CBFC) connection response. 1070 * 1071 * This structure is used to define the parameters for a BLE CBFC connection response, 1072 * including the address of the remote device, the Local Channel Identifier (LCID), and the result of the connection request. 1073 */ 1074 typedef struct rsi_ble_cbfc_conn_resp_s { 1075 /** Address of the remote device */ 1076 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1077 /** Local Channel Identifier (LCID) */ 1078 uint16_t lcid; 1079 /** Result of the connection request */ 1080 uint8_t result; 1081 } rsi_ble_cbfc_conn_resp_t; 1082 1083 //LE cbfc data TX command structure, cmd_ix - 0x00B7 1084 1085 /** 1086 * @brief Structure representing the BLE Credit Based Flow Control (CBFC) data transmission. 1087 * 1088 * This structure is used to define the parameters for a BLE CBFC data transmission, 1089 * including the address of the remote device, the Local Channel Identifier (LCID), 1090 * the length of the data to be transmitted, and the data to be transmitted. 1091 */ 1092 typedef struct rsi_ble_cbfc_data_tx_s { 1093 /** Address of the remote device */ 1094 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1095 /** Local Channel Identifier (LCID) */ 1096 uint16_t lcid; 1097 /** Length of the data to be transmitted */ 1098 uint16_t len; 1099 /** Data to be transmitted */ 1100 uint8_t data[RSI_DEV_ATT_LEN]; 1101 } rsi_ble_cbfc_data_tx_t; 1102 1103 //LE cbfc disconn command structure, cmd_ix - 0x00B8 1104 1105 /** 1106 * @brief Structure representing the BLE CBFC (Credit Based Flow Control) disconnection. 1107 * 1108 * This structure is used to define the parameters for a BLE CBFC disconnection, 1109 * including the address of the remote device and the Local Channel Identifier (LCID). 1110 */ 1111 typedef struct rsi_ble_cbfc_disconn_s { 1112 /** Address of the remote device */ 1113 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1114 /** Local Channel Identifier (LCID) */ 1115 uint16_t lcid; 1116 } rsi_ble_cbfc_disconn_t; 1117 1118 //LE RX text mode (cmd), cmd_ix = 0x00BB 1119 1120 /** 1121 * @brief Structure representing the BLE RX test mode parameters. 1122 * 1123 * This structure is used to define the parameters for a BLE RX test mode, 1124 * including the RX channel, PHY, and modulation type to be used for the test. 1125 */ 1126 typedef struct rsi_ble_rx_test_mode_s { 1127 /** RX channel to be used for the test */ 1128 uint8_t rx_channel; 1129 /** PHY to be used for the test */ 1130 uint8_t phy; 1131 /** Modulation type to be used for the test */ 1132 uint8_t modulation; 1133 } rsi_ble_rx_test_mode_t; 1134 1135 //LE TX test mode (cmd), cmd_ix = 0x00BC 1136 /** 1137 * @brief Structure representing the BLE TX test mode parameters. 1138 * 1139 * This structure is used to define the parameters for a BLE TX test mode, 1140 * including the TX channel, PHY, length of the data to be transmitted, and data mode to be used for the test. 1141 */ 1142 typedef struct rsi_ble_tx_test_mode_s { 1143 /** TX channel to be used for the test */ 1144 uint8_t tx_channel; 1145 /** PHY to be used for the test */ 1146 uint8_t phy; 1147 /** Length of the data to be transmitted */ 1148 uint8_t tx_len; 1149 /** Data mode to be used for the test */ 1150 uint8_t tx_data_mode; 1151 } rsi_ble_tx_test_mode_t; 1152 1153 //LE End test mode (cmd), cmd_ix = 0x00BD 1154 1155 /** 1156 * @brief Structure representing the BLE end test mode parameters. 1157 * 1158 * This structure is used to define the parameter for a BLE end test mode. 1159 * Number of TX / RX packets received are displayed when test is stopped. 1160 */ 1161 typedef struct rsi_ble_end_test_mode_s { 1162 /** Number of TX / RX packets received when test is stopped */ 1163 uint16_t num_of_pkts; 1164 } rsi_ble_end_test_mode_t; 1165 1166 /** 1167 * @brief Structure representing the BLE request to set LE Long Term Key (LTK) request reply. 1168 * 1169 * This structure is used to define the parameters for a BLE request to set the LE LTK request reply, 1170 * including the address of the remote device, the type of reply (e.g., positive or negative), 1171 * and the local Long Term Key (LTK). 1172 */ 1173 typedef struct rsi_ble_set_le_ltkreqreply_s { 1174 /** Address of the remote device */ 1175 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1176 /** Type of reply (e.g., positive or negative) */ 1177 uint8_t replytype; 1178 /** Local Long Term Key (LTK) (16 bytes) */ 1179 uint8_t localltk[16]; 1180 } rsi_ble_set_le_ltkreqreply_t; 1181 1182 //SMP Pairing Failed (cmd), cmd_ix = 0x0111 1183 1184 /** 1185 * @brief Structure representing the BLE Security Manager Protocol (SMP) pairing failure request. 1186 * 1187 * This structure is used to define the parameters for a BLE SMP pairing failure request, 1188 * including the address of the remote device and the reason for the pairing failure. 1189 */ 1190 typedef struct rsi_ble_req_smp_pair_failed_s { 1191 /** Address of the remote device */ 1192 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1193 /** Reason for the pairing failure */ 1194 uint8_t reason; 1195 } rsi_ble_req_smp_pair_failed_t; 1196 1197 // GATT structures 1198 1199 // GATT Profiles list request structure 1200 1201 /** 1202 * @brief Structure representing the BLE request for profiles list. 1203 * 1204 * This structure is used to define the parameters for a BLE request to get the profiles list, 1205 * including the remote device address, the handle from which the profiles search will start, 1206 * and the handle at which the profiles search will stop. 1207 */ 1208 typedef struct rsi_ble_req_profiles_list_s { 1209 /** Remote device address */ 1210 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1211 /** Profiles search will start from this handle */ 1212 uint16_t start_handle; 1213 /** Profiles search will stop at this handle */ 1214 uint16_t end_handle; 1215 } rsi_ble_req_profiles_list_t; 1216 1217 // GATT Profile request structure 1218 1219 /** 1220 * @brief Structure representing the BLE request for a specific profile. 1221 * 1222 * This structure is used to define the parameters for a BLE request to get a specific profile, 1223 * including the remote device address, reserved bytes for future use, and the profile UUID. 1224 */ 1225 typedef struct rsi_ble_req_profile_s { 1226 /** Remote device address */ 1227 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1228 /** Reserved for future use */ 1229 uint8_t reserved[2]; 1230 /** Profile UUID (20 bytes) */ 1231 uuid_t profile_uuid; 1232 } rsi_ble_req_profile_t; 1233 1234 // GATT Profile response structure 1235 //profile_descriptors_t; 1236 1237 // GATT multiple characteristic services request structure 1238 1239 /** 1240 * @brief Structure representing the BLE request for characteristic services. 1241 * 1242 * This structure is used to define the parameters for a BLE request to get characteristic services, 1243 * including the remote device address, the handle from which the search will start, 1244 * and the handle at which the search will end. 1245 */ 1246 typedef struct rsi_ble_req_char_services_s { 1247 /** Remote device address */ 1248 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1249 /** Search will start from this handle */ 1250 uint8_t start_handle[2]; 1251 /** Search will end at this handle */ 1252 uint8_t end_handle[2]; 1253 } rsi_ble_req_char_services_t; 1254 1255 // GATT include service query request structure 1256 1257 /** 1258 * @brief Structure representing the BLE request for included services. 1259 * 1260 * This structure is used to define the parameters for a BLE request to get included services, 1261 * including the remote device address, the handle from which the search will start, 1262 * and the handle at which the search will end. 1263 */ 1264 typedef struct rsi_ble_req_inc_services_s { 1265 /** Remote device address */ 1266 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1267 /** Search will start from this handle */ 1268 uint8_t start_handle[2]; 1269 /** Search will end at this handle */ 1270 uint8_t end_handle[2]; 1271 } rsi_ble_req_inc_services_t; 1272 1273 // GATT read value by UUID request structure 1274 1275 /** 1276 * @brief Structure representing the BLE request for characteristic value by UUID. 1277 * 1278 * This structure is used to define the parameters for a BLE request to get a characteristic value by UUID, 1279 * including the remote device address, the handle from which the search will start, 1280 * the handle at which the search will end, reserved bytes for future use, and the search UUID value. 1281 */ 1282 typedef struct rsi_ble_req_char_val_by_uuid_s { 1283 /** Remote device address */ 1284 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1285 /** Search will start from this handle */ 1286 uint8_t start_handle[2]; 1287 /** Search will end at this handle */ 1288 uint8_t end_handle[2]; 1289 /** Reserved for future use */ 1290 uint8_t reserved[2]; 1291 /** Search UUID value (20 bytes) */ 1292 uuid_t char_uuid; 1293 } rsi_ble_req_char_val_by_uuid_t; 1294 1295 // GATT read value by UUID response structure 1296 //rsi_ble_resp_att_value_t 1297 1298 // GATT multiple attribute descriptors request structure 1299 1300 /** 1301 * @brief Structure representing the BLE request for attribute descriptors. 1302 * 1303 * This structure is used to define the parameters for a BLE request to get attribute descriptors, 1304 * including the remote device address, the handle from which the search will start, 1305 * and the handle at which the search will end. 1306 */ 1307 typedef struct rsi_ble_req_att_descs_s { 1308 /** Remote device address */ 1309 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1310 /** Search will start from this handle */ 1311 uint8_t start_handle[2]; 1312 /** Search will end at this handle */ 1313 uint8_t end_handle[2]; 1314 } rsi_ble_req_att_descs_t; 1315 1316 // GATT attribute value request structure 1317 /** 1318 * @brief Structure representing the BLE request for attribute value. 1319 * 1320 * This structure is used to define the parameters for a BLE request to get an attribute value, 1321 * including the remote device address and the attribute handle. 1322 */ 1323 typedef struct rsi_ble_req_att_value_s { 1324 /** Remote device address */ 1325 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1326 /** Attribute handle */ 1327 uint8_t handle[2]; 1328 } rsi_ble_req_att_value_t; 1329 1330 // GATT multiple attribute values request structure 1331 1332 /** 1333 * @brief Structure representing the BLE request for multiple attribute values. 1334 * 1335 * This structure is used to define the parameters for a BLE request to get multiple attribute values, 1336 * including the remote device address, the number of attribute handles, reserved bytes for future use, 1337 * and the list of attribute handles. 1338 */ 1339 typedef struct rsi_ble_req_multiple_att_val_s { 1340 /** Remote device address */ 1341 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1342 /** Number of attribute handles */ 1343 uint8_t num_of_handles; 1344 /** Reserved for future use */ 1345 uint8_t reserved; 1346 /** List of attribute handles */ 1347 uint16_t handles[RSI_BLE_MAX_RESP_LIST]; 1348 } rsi_ble_req_multi_att_values_t; 1349 1350 // GATT multiple attribute values response structure 1351 //rsi_ble_resp_att_value_t 1352 1353 // GATT long attribute value request structure 1354 1355 /** 1356 * @brief Structure representing the BLE request for a long attribute value. 1357 * 1358 * This structure is used to define the parameters for a BLE request to get a long attribute value, 1359 * including the remote device address, the attribute handle, and the attribute value offset. 1360 */ 1361 typedef struct rsi_ble_req_long_att_value_s { 1362 /** Remote device address */ 1363 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1364 /** Attribute handle */ 1365 uint16_t handle; 1366 /** Attribute value offset */ 1367 uint16_t offset; 1368 } rsi_ble_req_long_att_value_t; 1369 1370 // GATT long attribute value response structure 1371 //rsi_ble_resp_att_value_t 1372 1373 // GATT write attribute value request structure 1374 1375 /** 1376 * @brief Structure representing the BLE request to set an attribute value. 1377 * 1378 * This structure is used to define the parameters for a BLE request to set an attribute value, 1379 * including the remote device address, the attribute handle, the length of the attribute value, 1380 * and the attribute value itself. The module will receive the acknowledgement from the remote device. 1381 * 1382 */ 1383 typedef struct rsi_ble_set_att_val_s { 1384 /** Remote device address */ 1385 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1386 /** Attribute handle */ 1387 uint8_t handle[2]; 1388 /** Length of the attribute value */ 1389 uint8_t length; 1390 /** Attribute value */ 1391 uint8_t att_value[RSI_DEV_ATT_LEN]; 1392 } rsi_ble_set_att_value_t; 1393 // GATT write attribute value without ack request structure 1394 1395 /** 1396 * @brief Structure representing the BLE command to set an attribute value. 1397 * 1398 * This structure is used to define the parameters for a BLE command to set an attribute value, 1399 * including the remote device address, the attribute handle, the length of the attribute value, 1400 * and the attribute value itself. The module won't receive the acknowledgement from the remote device. 1401 */ 1402 typedef struct rsi_ble_set_att_cmd_s { 1403 /** Remote device address */ 1404 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1405 /** Attribute handle */ 1406 uint8_t handle[2]; 1407 /** Length of the attribute value */ 1408 uint8_t length; 1409 /** Attribute value */ 1410 uint8_t att_value[RSI_DEV_ATT_LEN]; 1411 } rsi_ble_set_att_cmd_t; 1412 1413 // GATT write long attribute value request structure 1414 1415 /** 1416 * @brief Structure representing the BLE command to set a long attribute value. 1417 * 1418 * This structure is used to define the parameters for a BLE command to set a long attribute value, 1419 * including the remote device address, the attribute handle, the attribute value offset, 1420 * the length of the attribute value, and the attribute value itself. 1421 */ 1422 typedef struct rsi_ble_set_long_att_val_s { 1423 /** Remote device address */ 1424 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1425 /** Attribute handle */ 1426 uint8_t handle[2]; 1427 /** Attribute value offset */ 1428 uint8_t offset[2]; 1429 /** Length of the attribute value */ 1430 uint8_t length; 1431 /** Attribute value */ 1432 uint8_t att_value[RSI_DEV_ATT_LEN]; 1433 } rsi_ble_set_long_att_value_t; 1434 1435 // GATT prepare write value request structure 1436 1437 /** 1438 * @brief Structure representing the BLE request to prepare a write operation. 1439 * 1440 * This structure is used to define the parameters for a BLE request to prepare a write operation, 1441 * including the remote device address, the attribute handle, the attribute value offset, 1442 * the length of the attribute value, and the attribute value itself. 1443 */ 1444 typedef struct rsi_ble_req_prepare_write_s { 1445 /** Remote device address */ 1446 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1447 /** Attribute handle */ 1448 uint8_t handle[2]; 1449 /** Attribute value offset */ 1450 uint8_t offset[2]; 1451 /** Length of the attribute value */ 1452 uint8_t length; 1453 /** Attribute value */ 1454 uint8_t att_value[RSI_DEV_ATT_LEN]; 1455 } rsi_ble_req_prepare_write_t; 1456 1457 // GATT execute write request structure 1458 1459 /** 1460 * @brief Structure representing the BLE request to execute a write operation. 1461 * 1462 * This structure is used to define the parameters for a BLE request to execute a write operation, 1463 * including the remote device address and the execute flag indicating whether to write or not. 1464 */ 1465 typedef struct rsi_ble_req_execute_write_s { 1466 /** Remote device address */ 1467 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1468 /** Execute flag (write/don't write) */ 1469 uint8_t flag; 1470 } rsi_ble_req_execute_write_t; 1471 1472 //RSI_BLE_CONN_PARAM_RESP_CMD, cmd_id: 0x0105 1473 1474 /** 1475 * @brief Structure representing the BLE command response for connection parameters. 1476 * 1477 * This structure is used to define the parameters for a BLE command response to a connection parameter request, 1478 * including the remote device address and the status indicating whether to accept or reject the request. 1479 */ 1480 typedef struct rsi_ble_cmd_conn_param_resp { 1481 /** Remote device address */ 1482 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1483 /** Accept or reject the remote connection parameter request */ 1484 uint8_t status; 1485 } rsi_ble_cmd_conn_param_resp_t; 1486 1487 //GATT Events 1488 1489 //GATT Service 1490 // add new GATT service request structure 1491 1492 /** 1493 * @brief Structure representing the BLE request to add a service. 1494 * 1495 * This structure is used to define the parameters for a BLE request to add a service, 1496 * including the service UUID, the number of attributes in the service, 1497 * and the total size of the attributes' values (data). 1498 */ 1499 typedef struct rsi_ble_req_add_serv_s { 1500 /** Service UUID */ 1501 uuid_t service_uuid; 1502 /** Number of attributes in the service */ 1503 uint8_t num_of_attributes; 1504 /** Total size of the attributes' values (data) */ 1505 uint8_t total_att_datasize; 1506 } rsi_ble_req_add_serv_t; 1507 1508 // write or change local attribute value request structure 1509 1510 /** 1511 * @brief Structure representing the BLE command to set a local attribute value. 1512 * 1513 * This structure is used to define the parameters for a BLE command to set a local attribute value, 1514 * including the attribute handle, the length of the attribute value, and the attribute value itself. 1515 */ 1516 typedef struct rsi_ble_set_local_att_value_s { 1517 /** Attribute handle */ 1518 uint16_t handle; 1519 /** Attribute value length */ 1520 uint16_t data_len; 1521 /** Attribute value (data) */ 1522 uint8_t data[RSI_DEV_ATT_LEN]; 1523 } rsi_ble_set_local_att_value_t; 1524 1525 // write or change local attribute value request structure 1526 1527 /** 1528 * @brief Structure representing the BLE notification for an attribute value. 1529 * 1530 * This structure is used to define the parameters for a BLE notification of an attribute value, 1531 * including the remote device address, the attribute handle, the length of the attribute value, 1532 * and the attribute value itself. 1533 */ 1534 typedef struct rsi_ble_notify_att_value_s { 1535 /** Remote device address */ 1536 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1537 /** Attribute handle */ 1538 uint16_t handle; 1539 /** Attribute value length */ 1540 uint16_t data_len; 1541 /** Attribute value (data) */ 1542 uint8_t data[RSI_DEV_ATT_LEN]; 1543 } rsi_ble_notify_att_value_t; 1544 1545 // set wo_resp and notify buffer info 1546 1547 /** 1548 * @brief Structure representing the BLE configuration for write without response notification buffer. 1549 * 1550 * This structure is used to define the parameters for configuring the buffer for write without response notifications, 1551 * including the remote device address, the buffer configuration mode, and the buffer count. 1552 */ 1553 typedef struct rsi_ble_set_wo_resp_notify_buf_info_s { 1554 /** Remote device address */ 1555 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1556 /** Buffer config mode: 0 for small buffer mode, 1 for big buffer mode */ 1557 uint8_t buf_mode; 1558 /** Buffer count */ 1559 uint8_t buf_count; 1560 } rsi_ble_set_wo_resp_notify_buf_info_t; 1561 1562 // indicate confirmation structure 1563 1564 /** 1565 * @brief Structure representing the BLE indication confirmation. 1566 * 1567 * This structure is used to define the parameters for a BLE indication confirmation, 1568 * including the remote device address. 1569 */ 1570 typedef struct rsi_ble_indicate_confirm_s { 1571 /** Remote device address */ 1572 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1573 } rsi_ble_indicate_confirm_t; 1574 1575 // read local attribute value request structure 1576 1577 /** 1578 * @brief Structure representing the BLE request to get a local attribute value. 1579 * 1580 * This structure is used to define the parameters for a BLE request to get a local attribute value, 1581 * including the attribute handle. 1582 */ 1583 typedef struct rsi_ble_get_local_att_value_s { 1584 /** Attribute handle */ 1585 uint16_t handle; 1586 } rsi_ble_get_local_att_value_t; 1587 1588 /** 1589 * @brief Structure representing the BLE GATT read response. 1590 * 1591 * This structure is used to define the parameters for a BLE GATT read response, 1592 * including the remote device address, the type of the read response, reserved field for future use, 1593 * the length of the attribute value, and the attribute value itself. 1594 */ 1595 typedef struct rsi_ble_gatt_read_response_s { 1596 /** Remote device address */ 1597 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1598 /** Type of the read response */ 1599 uint8_t type; 1600 /** Reserved for future use */ 1601 uint8_t reserved; 1602 /** Attribute value length */ 1603 uint16_t data_len; 1604 /** Attribute value (data) */ 1605 uint8_t data[RSI_DEV_ATT_LEN]; 1606 } rsi_ble_gatt_read_response_t; 1607 1608 // Att write/ execute write response cmd = 0x010A 1609 1610 /** 1611 * @brief Structure representing the BLE GATT write response. 1612 * 1613 * This structure is used to define the parameters for a BLE GATT write response, 1614 * including the remote device address and the response type. 1615 */ 1616 typedef struct rsi_ble_gatt_write_response_s { 1617 /** Remote device address */ 1618 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1619 /** Response type */ 1620 uint8_t type; 1621 } rsi_ble_gatt_write_response_t; 1622 1623 // Att prepare write response cmd = 0x010B 1624 1625 /** 1626 * @brief Structure representing the BLE GATT prepare write response. 1627 * 1628 * This structure is used to define the parameters for a BLE GATT prepare write response, 1629 * including the remote device address, the attribute handle, the attribute value offset, 1630 * the length of the attribute value, and the attribute value itself. 1631 */ 1632 typedef struct rsi_ble_gatt_prepare_write_response_s { 1633 /** Remote device address */ 1634 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1635 /** Attribute handle */ 1636 uint16_t handle; 1637 /** Attribute value offset */ 1638 uint16_t offset; 1639 /** Attribute value length */ 1640 uint16_t data_len; 1641 /** Attribute value (data) */ 1642 uint8_t data[RSI_DEV_ATT_LEN]; 1643 } rsi_ble_gatt_prepare_write_response_t; 1644 1645 /** 1646 * @brief Structure representing the BLE command to set the local Identity Resolving Key (IRK). 1647 * 1648 * This structure is used to define the parameters for a BLE command to set the local IRK, 1649 * including the local device IRK. 1650 */ 1651 typedef struct rsi_ble_set_local_irk_s { 1652 /** Local device IRK (16 bytes) */ 1653 uint8_t irk[16]; 1654 } rsi_ble_set_local_irk_t; 1655 1656 // BLE GAP extended callback ids 1657 /** @addtogroup BT_BLE_CONSTANTS 1658 * @{ 1659 */ 1660 1661 /** 1662 * 1663 * @brief Enumeration representing the BLE GAP extended callback types. 1664 * 1665 * This enumeration defines the possible callback types for the BLE GAP extended feature. 1666 * 1667 */ 1668 typedef enum rsi_ble_gap_extended_callbacks_s { 1669 /** Callback type for remote device information events */ 1670 RSI_BLE_ON_REMOTE_DEVICE_INFORMATION = 1, 1671 /** Callback type for RCP (Remote Control Protocol) events */ 1672 RSI_BLE_ON_RCP_EVENT = 2, 1673 } rsi_ble_gap_extended_callbacks_t; 1674 //attribute codes 1675 /// Attribute Protocol (ATT) Exchange MTU request. 1676 #define RSI_BLE_ATT_EXCHANGE_MTU_REQUEST 0x02 1677 /// Attribute Protocol (ATT) Find Information request. 1678 #define RSI_BLE_ATT_FIND_INFORMATION_REQUEST 0x04 1679 /// Attribute Protocol (ATT) Find By Type Value request. 1680 #define RSI_BLE_ATT_FIND_BY_TYPE_VALUE_REQUEST 0x06 1681 /// Attribute Protocol (ATT) Read By Type request. 1682 #define RSI_BLE_ATT_READ_BY_TYPE_REQUEST 0x08 1683 /// Attribute Protocol (ATT) Read request. 1684 #define RSI_BLE_ATT_READ_REQUEST 0x0A 1685 /// Attribute Protocol (ATT) Read Blob request. 1686 #define RSI_BLE_ATT_READ_BLOB_REQUEST 0x0C 1687 /// Attribute Protocol (ATT) Read Multiple request. 1688 #define RSI_BLE_ATT_READ_MULTIPLE_REQUEST 0x0E 1689 /// Attribute Protocol (ATT) Read By Group Type request. 1690 #define RSI_BLE_ATT_READ_BY_GROUP_TYPE_REQUEST 0x10 1691 /// Attribute Protocol (ATT) Write request. 1692 #define RSI_BLE_ATT_WRITE_REQUEST 0x12 1693 /// Attribute Protocol (ATT) Prepare Write request. 1694 #define RSI_BLE_ATT_PREPARE_WRITE_REQUEST 0x16 1695 /// Attribute Protocol (ATT) Execute Write request. 1696 #define RSI_BLE_ATT_EXECUTE_WRITE_REQUEST 0x18 1697 /** @} */ 1698 1699 // Att error response cmd = 0x00C1 1700 1701 /** 1702 * @brief Structure representing the BLE attribute error response. 1703 * 1704 * This structure is used to define the parameters for a BLE event 1705 * that involves an error response for an attribute operation from a remote device. 1706 */ 1707 typedef struct rsi_ble_att_error_response_s { 1708 /** Address of the remote device */ 1709 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1710 /** The request opcode for the BLE operation */ 1711 uint8_t req_opcode; 1712 /** The attribute handle for the Bluetooth Low Energy (BLE) device */ 1713 uint16_t att_handle; 1714 /** The error code for the operation */ 1715 uint8_t err_code; 1716 } rsi_ble_att_error_response_t; 1717 1718 /** 1719 * @brief Structure representing the BLE GATT remove service request. 1720 * 1721 * This structure is used to define the parameters for a BLE event 1722 * that involves removing a GATT service from a remote device. 1723 */ 1724 typedef struct rsi_ble_gatt_remove_serv_s { 1725 /** Service handler */ 1726 uint32_t serv_hndler; 1727 } rsi_ble_gatt_remove_serv_t; 1728 1729 /** 1730 * @brief Structure representing the BLE GATT command to remove an attribute. 1731 * 1732 * This structure is used to define the parameters for a BLE GATT command to remove an attribute, 1733 * including the service handler and the attribute handle. 1734 */ 1735 typedef struct rsi_ble_gatt_remove_att_s { 1736 /** Service handler */ 1737 uint32_t serv_hndler; 1738 /** Attribute handle */ 1739 uint16_t att_hndl; 1740 } rsi_ble_gatt_remove_att_t; 1741 1742 // rf type command structure 1743 1744 /** 1745 * @brief Structure representing the BLE vendor-specific RF type command. 1746 * 1747 * This structure is used to define the parameters for a BLE vendor-specific RF type command, 1748 * including the opcode and the BLE power index. 1749 */ 1750 typedef struct rsi_ble_vendor_rf_type_s { 1751 /** Opcode */ 1752 uint8_t opcode[2]; 1753 /** BLE power index */ 1754 uint8_t ble_power_index; 1755 } rsi_ble_vendor_rf_type_t; 1756 1757 // rf type command structure 1758 1759 /** 1760 * @brief Structure representing the BLE MTU exchange request. 1761 * 1762 * This structure is used to define the parameters for a BLE MTU exchange request, 1763 * including the remote device address and the requested MTU size. 1764 */ 1765 typedef struct rsi_ble_mtu_exchange_s { 1766 /** Remote device address */ 1767 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1768 /** Requested MTU size */ 1769 uint16_t req_mtu_size; 1770 } rsi_ble_mtu_exchange_t; 1771 1772 // mtu exchange resp command structure 1773 1774 /** 1775 * @brief Structure representing the BLE MTU exchange response. 1776 * 1777 * This structure is used to define the parameters for a BLE MTU exchange response, 1778 * including the Bluetooth device address of the peer device and the requested MTU size from the peer device. 1779 */ 1780 typedef struct rsi_ble_mtu_exchange_resp_s { 1781 /** The Bluetooth device address of the peer device */ 1782 uint8_t dev_addr[RSI_DEV_ADDR_LEN]; 1783 /** The requested MTU size from the peer device */ 1784 uint16_t req_mtu_size; 1785 } rsi_ble_mtu_exchange_resp_t; 1786 1787 /** 1788 * @brief Structure representing the BLE Advertising Extensions (AE) command to get the supported number of advertising sets. 1789 * 1790 * This structure is used to define the parameters for a BLE AE command to get the supported number of advertising sets, 1791 * including a reserved field. 1792 */ 1793 typedef struct rsi_ble_ae_get_supported_no_of_adv_sets_s { 1794 /** Reserved field */ 1795 uint16_t reserved; 1796 } SL_ATTRIBUTE_PACKED rsi_ble_ae_get_supported_no_of_adv_sets_t; 1797 1798 /** 1799 * @brief Structure representing the BLE Advertising Extensions (AE) command to read the supported maximum advertising data. 1800 * 1801 * This structure is used to define the parameters for a BLE AE command to read the supported maximum advertising data, 1802 * including a reserved field for future use or alignment. 1803 */ 1804 typedef struct rsi_ble_ae_read_supported_max_adv_data_s { 1805 /** Reserved field for future use or alignment */ 1806 uint16_t reserved; 1807 } SL_ATTRIBUTE_PACKED rsi_ble_ae_read_supported_max_adv_data_t; 1808 1809 // AE Set Random Address (cmd), cmd_ix = 1810 1811 /** 1812 * @brief Structure representing the BLE Advertising Extensions (AE) command to set a random address. 1813 * 1814 * This structure is used to define the parameters for a BLE AE command to set a random address, 1815 * including the advertising handle and the random address. 1816 */ 1817 typedef struct rsi_ble_ae_set_random_address_s { 1818 /** Advertising_Handle, used to identify an advertising set, Range: 0x00 to 0xEF */ 1819 uint8_t adv_handle; 1820 /** Random_Address, The Random Address may be of either Static Address or Private Address */ 1821 uint8_t addr[RSI_DEV_ADDR_LEN]; 1822 } SL_ATTRIBUTE_PACKED rsi_ble_ae_set_random_address_t; 1823 1824 //! AE Advertising Params 1825 typedef struct ae_adv_params_s { 1826 /** uint8_t, Advertising Handle, Used to identify an Advertising set , Range : 0x00 to 0xEF */ 1827 uint8_t adv_handle; 1828 /** 1829 * uint16_t, Advertising Event Properties, indicates the properties of Advertising Event 1830 * --------------------------------------------------------------------------------------------------------- 1831 * | Bit Number | Parameter Description | 1832 * ----------------------|----------------------------------------------------------------------------------- 1833 * | 0 | Connectable Advertising | 1834 * | 1 | Scannable Advertising | 1835 * | 2 | Direct Advertising | 1836 * | 3 | High Duty cycle Directed Connectable advertising (≤ 3.75 ms Advertising interval)| 1837 * | 4 | Use legacy advertising PDUs | 1838 * | 5 | Omit advertiser's address from all PDUs("anonymous advertising") | 1839 * | 6 | Include Tx Power in the extended header of at least one advertising PDU | 1840 * */ 1841 uint16_t adv_event_prop; 1842 /** uint32_t, Primary Advertising Interval Minimum, Minimum advertising interval for undirected and low duty cycle directed advertising */ 1843 uint32_t primary_adv_intterval_min : 24; 1844 /** uint32_t, Primary Advertising Interval Maximum, Maximum advertising interval for undirected and low duty cycle directed advertising 1845 primary_adv_intterval_min <= primary_adv_intterval_max */ 1846 uint32_t primary_adv_intterval_max : 24; 1847 /** uint8_t, Primary Advertising Channel Map, It specifies on which channel it shall advertise 1848 Bit Number Parameter Description 1849 0 Channel 37 shall be used 1850 1 Channel 38 Shall be used 1851 2 Channel 39 shall be used 1852 */ 1853 uint8_t primary_adv_chnl_map; 1854 /** 1855 uint8_t, Own_Address_type, Indicates the type of the Address 1856 0x00 - Public Device Address 1857 0x01 - Random Device Address 1858 0x02 - Controller generates the Resolvable Private Address based on the local 1859 IRK from the resolving list. If the resolving list contains no matching 1860 entry, use the public address 1861 0x03 - Controller generates the Resolvable Private Address based on the local 1862 IRK from the resolving list. If the resolving list contains no matching 1863 entry, use the random address from LE_Set_Advertising_Set_Random_Address 1864 */ 1865 uint8_t own_addr_type; 1866 /** uint8_t, Peer_Address_Type, Specifies Peer Address Type 1867 0x00 - Public Device Address or Public Identity Address 1868 0x01 - Random Device Address or Random (static) Identity Address 1869 */ 1870 uint8_t peer_addr_type; 1871 /** uint8[6], Peer_Device_Address, Address of the Peer_Address_Type */ 1872 uint8_t peer_dev_addr[RSI_DEV_ADDR_LEN]; 1873 /** uint8_t, Advertising_Filter_Policy 1874 0x00 - Process scan and connection requests from all devices (i.e., the Filter Accept List is not in use) 1875 0x01 - Process connection requests from all devices and scan requests only from devices that are in the Filter Accept List. 1876 0x02 - Process scan requests from all devices and connection requests only from devices that are in the Filter Accept List. 1877 0x03 - Process scan and connection requests only from devices in the Filter Accept List. 1878 */ 1879 uint8_t adv_filter_policy; 1880 /** uint8_t Advertising_TX_Power, Advertising TX Power ranges from -127 to +20 and units are in dBm */ 1881 uint8_t adv_tx_power; 1882 /** uint8_t Primary_Advertising_PHY, This parameter specifies the PHY used for the periodic advertising. 1883 0x01 - Advertiser PHY is LE 1M 1884 0x03 - Advertiser PHY is LE Coded 1885 */ 1886 uint8_t primary_adv_phy; 1887 /** uint8_t Secondary_Advertising_Max_Skip 1888 0x00 AUX_ADV_IND shall be sent prior to the next advertising event 1889 0x01 to 0xFF Maximum advertising events the Controller can skip before sending the AUX_ADV_IND packets on the secondary advertising physical channel 1890 */ 1891 uint8_t sec_adv_max_skip; 1892 /** uint8_t Secondary_Advertising_PHY, This parameter specifies the PHY used for the periodic advertising. 1893 0x01 - Advertiser PHY is LE 1M 1894 0x02 - Advertiser PHY is LE 2M 1895 0x03 - Advertiser PHY is LE Coded 1896 */ 1897 uint8_t sec_adv_phy; 1898 /** uint8_t Advertising_Sid, Value of the Advertising SID subfield in the ADI field of the PDU, Range : 0x00 to 0x0F */ 1899 uint8_t adv_sid; 1900 /** uint8_t Scan Request Notification Enable 1901 0x00 Scan request notifications disabled 1902 0x01 Scan request notifications enabled 1903 */ 1904 uint8_t scan_req_notify_enable; 1905 1906 } SL_ATTRIBUTE_PACKED rsi_ble_ae_adv_params_t; 1907 1908 // AE adv,scan_rsp and periodic data 1909 1910 /** 1911 * @brief Structure representing the AE (Application Event) data for BLE. 1912 */ 1913 typedef struct rsi_ble_ae_data_s { 1914 1915 /** @addtogroup BT_BLE_CONSTANTS 1916 * @{ 1917 */ 1918 1919 /// Advertising Extension (AE) advertising data. 1920 #define AE_ADV_DATA 0x01 1921 /// Advertising Extension (AE) scan response data. 1922 #define AE_SCAN_RSP_DATA 0x02 1923 /** @} */ 1924 /** uint8_t AE_ADV_DATA_TYPE 1, AE_PERIODIC_ADV_DATA_TYPE 2, AE_SCAN_RSP_DATA_TYPE 3 */ 1925 uint8_t type; 1926 /** uint8_t Advertising Handle, used to identify an Advertising set, Ranges from 0x00 to 0xEF */ 1927 uint8_t adv_handle; 1928 /** uint8_t Operation 1929 0x00 - Intermediate fragment of fragmented extended advertising data 1930 0x01 - First fragment of fragmented extended advertising data 1931 0x02 - Last fragment of fragmented extended advertising data 1932 0x03 - Complete extended advertising data 1933 0x04 - Unchanged data (just update the Advertising DID) 1934 */ 1935 uint8_t operation; 1936 /** 1937 uint8_t Fragment_Preference, Specifies the controller on where to fragment the Host advertising Data 1938 0x00 - The Controller may fragment all Host advertising data 1939 0x01 - The Controller should not fragment or should minimize fragmentation of Host advertising data 1940 */ 1941 uint8_t frag_pref; 1942 /** uint8_t Data Length, Specifies Advertising_Data_Length , This parameter ranges from 0 to 251 */ 1943 uint8_t data_len; 1944 /** uint8_t Data ,Specifies Advertising_Data. */ 1945 uint8_t data[0xC8]; //FIXME 1946 } SL_ATTRIBUTE_PACKED rsi_ble_ae_data_t; 1947 1948 //! AE Advertising enable 1949 typedef struct rsi_ble_ae_adv_enabel_s { 1950 /** 1951 uint8_t Enable, This parameter specifies whether to disable or Enable Advertising 1952 0x00 - Advertising is disabled 1953 0x01 - Advertising is Enabled 1954 */ 1955 uint8_t enable; 1956 /** 1957 uint8_t Num_of_Sets , Indicates the number of Advertising sets to be disabled or enabled for Advertising 1958 0x00 - Disable all advertising sets 1959 0x01 to 0x3F - Number of advertising sets to enable or disable 1960 */ 1961 uint8_t no_of_sets; 1962 /** uint8_t Advertising_Handle, used to identify Advertising set, Ranges from 0x00 to 0xEF */ 1963 uint8_t adv_handle; 1964 /** 1965 uint16_t Duration, specifies the duration to continue advertising 1966 0x00 - No Advertising 1967 0x0001 to 0xFFFF , Advertising Duration 1968 */ 1969 uint16_t duration; 1970 /** uint8_t Maximum Extended Advertising Events, It specifies the Maximum number of extended advertising events the Controller shall 1971 attempt to send prior to terminating the extended advertising */ 1972 uint8_t max_ae_events; 1973 } SL_ATTRIBUTE_PACKED rsi_ble_ae_adv_enable_t; 1974 1975 //AE adv set clear/remove 1976 1977 /** 1978 * @brief Structure for Advertising Event (AE) Advertisement (ADV) Set, Clear, or Remove. 1979 */ 1980 typedef struct rsi_ble_ae_adv_set_clear_or_remove_s { 1981 1982 /** 1983 type - Specifies whether to remove or clear the advertising sets. 1984 {1} - clear 1985 {2} - remove 1986 */ 1987 uint8_t type; 1988 /** uint8_t Advertising_Handle, used to identify Advertising set, Ranges from 0x00 to 0xEF */ 1989 uint8_t adv_handle; 1990 } SL_ATTRIBUTE_PACKED rsi_ble_ae_adv_set_clear_or_remove_t; 1991 1992 //AE periodic adv params 1993 1994 /** 1995 * @brief Structure representing the parameters for periodic advertising in BLE. 1996 */ 1997 typedef struct ae_periodic_adv_params { 1998 1999 /** uint8_t, Advertising Handle , this parameter identifies the advertising set whose periodic advertising parameters are being configured 2000 * Rang : 0x00 to 0xEF */ 2001 uint8_t adv_handle; 2002 /** uint16_t, Minimum Interval,Minimum advertising interval for periodic advertising.Range: 0x0006 to 0xFFFF */ 2003 uint16_t min_interval; 2004 /**uint16_t, Maximum Interval,Maximum advertising interval for periodic advertising.Range: 0x0006 to 0xFFFF */ 2005 uint16_t max_interval; 2006 /** uint16_t, Periodic Advertising Properties, this parameter indicates which fields should be included in the advertising packet 2007 * Bit Number, 6: Include TxPower in the advertising PDU 2008 * All other Values - Reserved For future use */ 2009 uint16_t properties; 2010 } SL_ATTRIBUTE_PACKED rsi_ble_ae_periodic_adv_params_t; 2011 2012 //AE periodic adv enable 2013 2014 /** 2015 * @brief Structure representing the enable/disable state of periodic advertising. 2016 */ 2017 typedef struct ae_periodic_adv_enable { 2018 2019 /** uint8_t, enable, If this parameter is set Periodic Advertising starts 2020 * 0 - Enable Periodic Advertising 2021 * 1 - Include the ADI field in AUX_SYNC_IND PDUs 2022 */ 2023 uint8_t enable; 2024 /** uint8_t, Advertising Handle, Used to identify an advertising set 2025 * Range : 0x00 to 0xEF 2026 */ 2027 uint8_t adv_handle; 2028 } SL_ATTRIBUTE_PACKED rsi_ble_ae_periodic_adv_enable_t; 2029 2030 /** 2031 * @brief Structure representing the scan parameters for Active Energy (AE) scanning. 2032 */ 2033 typedef struct ae_scan_params_s { 2034 /** uint8_t, Scan Type, this parameter specifies the type of scan to perform 2035 * 0x00 - Passive Scanning. No scan request PDUs shall be sent. 2036 * 0x01 - Active Scanning. Scan request PDUs may be sent. 2037 */ 2038 uint8_t ScanType; 2039 /** uint16_t, Scan Interval, this parameter is a recommendation from the Host on how frequently the Controller should scan 2040 * Range : 0x0004 to 0xFFFF */ 2041 uint16_t ScanInterval; 2042 /** uint16_t, Scan Window, this parameter is a recommendation from the Host on how long the Controller should scan 2043 * Range : 0x0004 to 0xFFFF */ 2044 uint16_t ScanWindow; 2045 } SL_ATTRIBUTE_PACKED ae_scan_params_t; 2046 2047 //AE set sacn params 2048 /** @addtogroup BT_BLE_CONSTANTS 2049 * @{ 2050 */ 2051 /// Indicates the number of supported scanning physical channels. 2052 #define SUPPORTED_SCNNING_PHYS 2 2053 /** @} */ 2054 /** 2055 * @brief Structure to set the scan parameters for BLE Active Scanning. 2056 */ 2057 typedef struct rsi_ble_ae_set_scan_params_s { 2058 2059 /** unit8_t,The Own Address Type parameter indicates the type of address being used in the scan request packets 2060 * Value Parameter Description 2061 * 0x00 Public Device Address 2062 * 0x01 Random Device Address 2063 * 0x02 Controller generates the Resolvable Private Address based on the local IRK from the resolving list. 2064 * If the resolving list contains no matching entry, then use the public address. 2065 * 0x03 Controller generates the Resolvable Private Address based on the local IRK from the resolving list. 2066 * If the resolving list contains no matching entry, then use the random address from LE_Set_Random_Address. 2067 * All other values Reserved for future use 2068 * 2069 */ 2070 uint8_t own_addr_type; 2071 /** uint8_t, It is used to determine whether the Filter Accept List is used 2072 * 2073 * 0x00 Basic unfiltered scanning filter policy 2074 * 0x01 Basic filtered scanning filter policy 2075 * 0x02 Extended unfiltered scanning filter policy 2076 * 0x03 Extended filtered scanning filter policy 2077 * All other values Reserved for future use 2078 */ 2079 uint8_t scanning_filter_policy; 2080 /** uint8_t, The Scanning_PHYs parameter indicates the PHY(s) on which the advertising packets should be 2081 received on the primary advertising physical channel. 2082 * 2083 * 0 Scan advertisements on the LE 1M PHY 2084 * 2 Scan advertisements on the LE Coded PHY 2085 * All other bits Reserved for future use 2086 */ 2087 uint8_t scanning_phys; 2088 /** ScanParams is an array of variable of structure ae_scan_params_s */ 2089 ae_scan_params_t ScanParams[SUPPORTED_SCNNING_PHYS]; 2090 } SL_ATTRIBUTE_PACKED rsi_ble_ae_set_scan_params_t; 2091 2092 //AE set scan enable 2093 2094 /** 2095 * @brief Structure to configure BLE scanning parameters. 2096 * 2097 * This structure is used to set various parameters for enabling or disabling scanning 2098 * in the module. It allows the configuration of scan enablement, 2099 * duplicate filtering, scan duration, and scan period. 2100 */ 2101 typedef struct rsi_ble_ae_set_scan_enable_s { 2102 2103 /** uint8_t, Enable, this Parameter determines whether scanning is enabled or disabled 2104 * 2105 * 0x00 Scanning disabled 2106 * 0x01 Scanning enabled 2107 * All other values Reserved for future use 2108 */ 2109 uint8_t enable; 2110 /** uint8_t, Filter duplicates, this parameter controls whether the Link Layer should filter out duplicate advertising reports 2111 * to the Host or if the Link Layer should generate advertising reports for each packet received 2112 * 2113 * 0x00 Duplicate Filtering Disabled 2114 * 0x01 Duplicate Filtering Enabled 2115 * 0x02 Duplicate filtering enabled, reset for each scan period 2116 * All other Values Reserved for future use 2117 */ 2118 uint8_t filter_duplicates; 2119 /** uint16_t, Duration, The duration of a scan period refers to the time spent scanning on both the primary and secondary advertising physical channels 2120 * Range : 0x0001 to 0xFFFF 2121 */ 2122 uint16_t duration; 2123 /** uint16_t, Period , Time interval from when the Controller started its last Scan_Duration until it begins the subsequent Scan_Duration 2124 * Range : 0x0001 to 0xFFFF 2125 */ 2126 uint16_t period; 2127 } SL_ATTRIBUTE_PACKED rsi_ble_ae_set_scan_enable_t; 2128 2129 /** 2130 * 2131 * @brief Structure representing the parameters for setting periodic advertising and creating synchronization. 2132 * This structure is used in BLE operations to configure periodic advertising and create synchronization. 2133 */ 2134 typedef struct rsi_ble_ae_set_periodic_adv_create_sync_s { 2135 2136 /** uint8_t, Options field, The Options parameter is used to determine whether the Periodic Advertiser List is used 2137 2138 Bit_NUmber parameter description 2139 2140 * 0 0: Use the Advertising_SID, Advertiser_Address_Type, and Advertiser_Address parameters to determine which advertiser to listen to 2141 1: Use the Periodic Advertiser List to determine which advertiser to listen to. 2142 2143 * 1 0: Reporting initially enabled 2144 1: Reporting initially disabled 2145 2146 * 2 0: Duplicate filtering initially disabled 2147 1: Duplicate filtering initially enabled 2148 2149 All other bits Reserved for future use **/ 2150 uint8_t options; 2151 /** uint8_t, Advertising SID subfield in the ADI field used to identify the Periodic Advertising. 2152 * Range : 0x00 to 0x0F, All other bits - Reserved for future use 2153 */ 2154 uint8_t adv_sid; 2155 /** uint8_t, Advertiser Address Type, this parameter indicates the type of address being used in the connection request packets 2156 * 2157 * 0x00 Public Device Address or Public Identity Address 2158 * 0x01 Random Device Address or Random (static) Identity Address 2159 * All other values Reserved for future use 2160 */ 2161 uint8_t adv_addr_type; 2162 /** uint8_t, Advertiser Address[6]*/ 2163 uint8_t adv_addr[RSI_DEV_ADDR_LEN]; 2164 /** uint16_t, Skip,The maximum number of periodic advertising events that can be skipped after a successful receive 2165 * Range : 0x0000 to 0x01F3 */ 2166 uint16_t skip; 2167 /** uint16_t, Sync Timeout, Synchronization timeout for the periodic advertising train 2168 * Range : 0x000A to 0x4000 */ 2169 uint16_t sync_timeout; 2170 /** Reserved for future use */ 2171 uint8_t reserved; 2172 } SL_ATTRIBUTE_PACKED rsi_ble_ae_set_periodic_adv_create_sync_t; 2173 /** 2174 * 2175 * @brief Structure to set periodic advertising and terminate synchronization. 2176 */ 2177 typedef struct rsi_ble_ae_set_periodic_adv_terminate_sync_s { 2178 2179 /** uint16_t, Sync Handle, identifies the periodic Advertising Train 2180 * Range : 0x0000 to 0x0EFF*/ 2181 uint16_t sync_handle; 2182 } SL_ATTRIBUTE_PACKED rsi_ble_ae_set_periodic_adv_terminate_sync_t; 2183 2184 //AE set periodic sync(create/terminate or cancel) params 2185 /** 2186 * @brief Structure representing the BLE Advertising Extension(AE) set periodic synchronization. 2187 * 2188 * This structure is used to define the parameters for setting periodic synchronization 2189 * for Advertising Extension in a BLE device. 2190 */ 2191 typedef struct rsi_ble_ae_set_periodic_sync_s { 2192 /** @addtogroup BT_BLE_CONSTANTS 2193 * @{ 2194 */ 2195 2196 /// Command to create a periodic synchronization for Advertising Extension. 2197 #define BLE_AE_PERIODIC_SYNC_CREATE 0x01 2198 /// Command to cancel the creation of a periodic synchronization for Advertising Extension. 2199 #define BLE_AE_PERIODIC_SYNC_CREATE_CANCEL 0x02 2200 /// Command to terminate a periodic synchronization for Advertising Extension. 2201 #define BLE_AE_PERIODIC_SYNC_TERMINATE 0x03 2202 /** @} */ 2203 uint8_t type; ///< Type of the periodic synchronization command. 2204 union { 2205 rsi_ble_ae_set_periodic_adv_create_sync_t create_sync; ///< Parameters for creating periodic synchronization. 2206 rsi_ble_ae_set_periodic_adv_terminate_sync_t 2207 terminate_sync; ///< Parameters for terminating periodic synchronization. 2208 } SL_ATTRIBUTE_PACKED sync_type; ///< Union for periodic synchronization parameters. 2209 } SL_ATTRIBUTE_PACKED rsi_ble_ae_set_periodic_sync_t; 2210 //#pragma pack(pop) 2211 // AE add/remove/clear dev to/from periodic adv list 2212 2213 /** 2214 * @brief Structure representing the AE (Advertising extension) device to periodic list. 2215 */ 2216 typedef struct rsi_ble_ae_dev_to_periodic_list_s { 2217 2218 /** uint8_t, Type 2219 * Type Values Description 2220 * 1 Adding Device to Periodic Advertising list 2221 * 2 Removing Device from Periodic Advertising list 2222 * 3 Clearing Periodic Advertising List 2223 */ 2224 uint8_t type; 2225 /** uint8_t, Advertiser Address Type, this parameter indicates the type of address being used in the connection request packets 2226 * 2227 * 0x00 Public Device Address or Public Identity Address 2228 * 0x01 Random Device Address or Random (static) Identity Address 2229 * All other values Reserved for future use 2230 */ 2231 uint8_t adv_addr_type; 2232 /** uint8_t, Advertiser Address[6]*/ 2233 uint8_t adv_addr[RSI_DEV_ADDR_LEN]; 2234 /** uint8_t, Advertising_Sid, Value of the Advertising SID subfield in the ADI field of the PDU, Range : 0x00 to 0x0F*/ 2235 uint8_t adv_sid; 2236 } SL_ATTRIBUTE_PACKED rsi_ble_ae_dev_to_periodic_list_t; 2237 2238 /** 2239 * @brief Structure representing connection initiation parameters. 2240 * 2241 * This structure is used to define various parameters required for initiating a BLE 2242 * connection. It includes parameters for scan intervals, scan window, connection 2243 * intervals, peripheral latency, supervision timeout, and minimum and maximum length of the connection events. 2244 */ 2245 typedef struct rsi_ble_initiation_params_s { 2246 2247 /** uint16_t, ScanInterval, It is the Time interval from when the Controller started its last scan until it begins the subsequent scan on the primary 2248 * advertising physical channel. Range : 0x0004 to 0xFFFF */ 2249 uint16_t ScanInterval; 2250 /** uint16_t, Scan Window parameter is a recommendation from the host on how long the controller should scan. 2251 * Range : 0x0004 to 0xFFFF */ 2252 uint16_t ScanWindow; 2253 /** uint16_t, Connection interval minimum parameter defines the minimum allowed connection interval. 2254 * Range: 0x0006 to 0x0C80 */ 2255 uint16_t ConnIntervalMin; 2256 /** uint16_t, Connection interval maximum parameter defines the maximum allowed connection interval. 2257 * Range: 0x0006 to 0x0C80*/ 2258 uint16_t ConnIntervalMax; 2259 /** uint16_t, Peripheral Latency or Maximum Latency parameter defines the maximum allowed Peripheral latency. 2260 * Range: 0x0000 to 0x01F3 */ 2261 uint16_t ConnLatency; 2262 /** uint16_t, Connection Timeout or Supervision Timeout parameter defines the link supervision timeout for the connection. 2263 * Range: 0x000A to 0x0C80*/ 2264 uint16_t ConnSTO; //SuperVisionTimeout 2265 /** uint16_t,The Min CE Length parameter provide the Controller with the expected minimum length of the connection events. 2266 * Range: 0x0000 to 0xFFFF */ 2267 uint16_t MinCELen; 2268 /** uint16_t,The Max CE Length parameter provide the controller with the expected maximum length of the connection events. 2269 * Range: 0x0000 to 0xFFFF */ 2270 uint16_t MaxCELen; 2271 } SL_ATTRIBUTE_PACKED rsi_ble_initiation_params_t; 2272 2273 // AE extended create connect 2274 2275 /** 2276 * @brief Structure representing the extended create connect command for BLE AE. 2277 */ 2278 typedef struct rsi_ble_ae_extended_create_connect_s { 2279 2280 /** uint8_t, Initiator Filter Policy,It is used to determine whether the Filter Accept List is used 2281 * Value Parameter Description 2282 * 0x00 Filter Accept List is not used to determine which advertiser to connect to Peer_Address_Type and Peer_Address shall be used. 2283 * 0x01 Filter Accept List is used to determine which advertiser to connect to Peer_Address_Type and Peer_Address shall be ignored. 2284 * All other values Reserved for future use 2285 */ 2286 uint8_t initiator_filter_policy; 2287 /** uint8_t, Own Address Type, this parameter indicates the type of address being used in the connection request packets 2288 * 2289 * Value Parameter Description 2290 * 0x00 Public Device Address 2291 * 0x01 Random Device Address 2292 * 0x02 Controller generates the Resolvable Private Address based on the local IRK from the resolving list. 2293 * If the resolving list contains no matching entry, then use the public address. 2294 * 0x03 Controller generates the Resolvable Private Address based on the local IRK from the resolving list. 2295 * If the resolving list contains no matching entry, then use the random address from the most recent successful 2296 * HCI_LE_Set_Random_Address command. 2297 * All other values Reserved for future use 2298 */ 2299 uint8_t own_addr_type; 2300 /** uint8_t, Remote Address Type or Peer Address Type, this parameter indicates the type of address used in the 2301 connectable advertisement sent by the peer 2302 * Value Parameter Description 2303 * 0x00 Public Device Address or Public Identity Address 2304 * 0x01 Random Device Address or Random (static) Identity Address 2305 * All other values Reserved for future use 2306 */ 2307 uint8_t remote_addr_type; 2308 /** uint8_t, Remote Address or Peer Address, this parameter indicates the Peer’s Public Device Address, 2309 Random (static) Device Address, Non-Resolvable Private Address, or Resolvable Private Address depending on the Peer_Address_Type parameter */ 2310 uint8_t remote_addr[RSI_DEV_ADDR_LEN]; 2311 /** uint8_t, Initiating PHYs, this parameter indicates the PHY(s) on which the advertising packets should be received on the 2312 primary advertising physical channel and the PHYs for which connection parameters have been specified 2313 * Bit number Parameter Description 2314 * 0 Scan connectable advertisements on the LE 1M PHY. Connection parameters for the LE 1M PHY are provided. 2315 * 1 Connection parameters for the LE 2M PHY are provided. 2316 * 2 Scan connectable advertisements on the LE Coded PHY. Connection parameters for the LE Coded PHY are provided. 2317 * All other bits Reserved for future use 2318 */ 2319 uint8_t init_phys; 2320 /** init_params is an array of Variable of Structure rsi_ble_initiation_params_s */ 2321 rsi_ble_initiation_params_t init_params[3]; 2322 } SL_ATTRIBUTE_PACKED rsi_ble_ae_extended_create_connect_t; 2323 2324 // LE Read Transmit Power 2325 /** 2326 * @brief Structure representing the BLE transmit power. 2327 */ 2328 typedef struct rsi_ble_tx_pwr_s { 2329 /** int8_t, Minimum TX Power, Range: -127 to +20 */ 2330 int8_t min_tx_pwr; 2331 /** int8_t, Maximum TX Power, Range: -127 to +20 */ 2332 int8_t max_tx_pwr; 2333 } SL_ATTRIBUTE_PACKED rsi_ble_tx_pwr_t; 2334 2335 // Query Rf Path Compensation 2336 2337 /** 2338 * @brief Structure to hold the information for querying RF path compensation. 2339 */ 2340 typedef struct rsi_ble_query_rf_path_comp_s { 2341 2342 /** int16_t, RF TX Path Compensation Value, Range: -128.0 dB (0xFB00) to 128.0 dB (0x0500) */ 2343 int16_t tx_path_value; 2344 /** int16_t, RF RX Path Compensation Value, Range: -128.0 dB (0xFB00) to 128.0 dB (0x0500) */ 2345 int16_t rx_path_value; 2346 } SL_ATTRIBUTE_PACKED rsi_ble_query_rf_path_comp_t; 2347 2348 // write Rf Path Compensation 2349 /** 2350 * @brief Structure representing the parameters for writing RF path compensation values. 2351 */ 2352 typedef struct rsi_ble_write_rf_path_comp_s { 2353 /** int16_t, RF TX Path Compensation Value, Range: -128.0 dB (0xFB00) to 128.0 dB (0x0500) */ 2354 int16_t tx_path_value; 2355 /** int16_t, RF RX Path Compensation Value, Range: -128.0 dB (0xFB00) to 128.0 dB (0x0500)*/ 2356 int16_t rx_path_value; 2357 } SL_ATTRIBUTE_PACKED rsi_ble_write_rf_path_comp_t; 2358 2359 /** 2360 * @brief Structure representing the BLE Advertising Extensions (AE) Protocol Data Unit (PDU). 2361 * 2362 * This structure is used to define the BLE Advertising Extensions PDU. 2363 * It contains a command sub-opcode and a union of various possible PDU types related to 2364 * advertising, scanning, and connection parameters. 2365 * 2366 */ 2367 typedef struct rsi_ble_ae_pdu { 2368 /** Command sub-opcode */ 2369 uint16_t cmd_sub_opcode; 2370 2371 /** Union of various possible PDU types */ 2372 union { 2373 /** Supported number of advertising sets */ 2374 rsi_ble_ae_get_supported_no_of_adv_sets_t ae_supported_no_of_sets; 2375 /** Supported maximum advertising data */ 2376 rsi_ble_ae_read_supported_max_adv_data_t ae_supported_max_data; 2377 /** Set random address */ 2378 rsi_ble_ae_set_random_address_t ae_random_address; 2379 /** Advertising parameters */ 2380 rsi_ble_ae_adv_params_t ae_adv_params; 2381 /** Advertising or scan response data */ 2382 rsi_ble_ae_data_t ae_adv_or_scn_rsp_data; 2383 /** Advertising enable */ 2384 rsi_ble_ae_adv_enable_t ae_adv_enable; 2385 /** Advertising set clear or remove */ 2386 rsi_ble_ae_adv_set_clear_or_remove_t ae_adv_set_clear_or_remove; 2387 /** Periodic advertising parameters */ 2388 rsi_ble_ae_periodic_adv_params_t ae_periodic_adv_params; 2389 /** Periodic advertising enable */ 2390 rsi_ble_ae_periodic_adv_enable_t ae_periodic_adv_enable; 2391 /** Scan parameters */ 2392 rsi_ble_ae_set_scan_params_t ae_scan_params; 2393 /** Scan enable */ 2394 rsi_ble_ae_set_scan_enable_t ae_scan_enable; 2395 /** Periodic sync settings */ 2396 rsi_ble_ae_set_periodic_sync_t ae_periodic_sync; 2397 /** Device to periodic list */ 2398 rsi_ble_ae_dev_to_periodic_list_t dev_to_periodic_list; 2399 /** Extended create connection */ 2400 rsi_ble_ae_extended_create_connect_t extended_create_conn; 2401 } SL_ATTRIBUTE_PACKED pdu_type; 2402 } SL_ATTRIBUTE_PACKED rsi_ble_ae_pdu_t; 2403 2404 /** @} */ 2405 2406 /** 2407 * \addtogroup rsi_ble_cb_s_group rsi_ble_cb_s Driver BLE control block 2408 * @brief Driver BLE control block group 2409 * 2410 * @ingroup BT_BLE_TYPES 2411 * @{ 2412 */ 2413 2414 /** 2415 * @brief Structure representing the BLE control block. 2416 * 2417 * This structure contains various callback functions for handling BLE events, 2418 * including GAP, SMP, GATT, L2CAP, and AE events. 2419 */ 2420 struct rsi_ble_cb_s { 2421 2422 /** 2423 * \addtogroup gap_callbacks_group GAP Callbacks Group 2424 * @brief Group for GAP callbacks. 2425 * @ingroup rsi_ble_cb_s_group 2426 * @{ 2427 */ 2428 2429 /** 2430 * @brief Advertising report event callback. 2431 */ 2432 rsi_ble_on_adv_report_event_t ble_on_adv_report_event; 2433 2434 /** 2435 * @brief Connection status event callback. 2436 */ 2437 rsi_ble_on_connect_t ble_on_conn_status_event; 2438 2439 /** 2440 * @brief Disconnect event callback. 2441 */ 2442 rsi_ble_on_disconnect_t ble_on_disconnect_event; 2443 2444 /** 2445 * @brief LE ping payload timeout event callback. 2446 */ 2447 rsi_ble_on_le_ping_payload_timeout_t ble_on_le_ping_time_expired_event; 2448 2449 /** 2450 * @brief PHY update complete event callback. 2451 */ 2452 rsi_ble_on_phy_update_complete_t ble_on_phy_update_complete_event; 2453 2454 /** 2455 * @brief Data length update event callback. 2456 */ 2457 rsi_ble_on_data_length_update_t rsi_ble_on_data_length_update_event; 2458 2459 /** 2460 * @brief Enhanced connection status event callback. 2461 */ 2462 rsi_ble_on_enhance_connect_t ble_on_enhance_conn_status_event; 2463 2464 /** 2465 * @brief Directed advertising report event callback. 2466 */ 2467 rsi_ble_on_directed_adv_report_event_t ble_on_directed_adv_report_event; 2468 2469 /** 2470 * @brief Connection update complete event callback. 2471 */ 2472 rsi_ble_on_conn_update_complete_t ble_on_conn_update_complete_event; 2473 2474 /** 2475 * @brief Remote connection parameters request event callback. 2476 */ 2477 rsi_ble_on_remote_conn_params_request_t ble_on_remote_conn_params_request_event; 2478 2479 /** @} */ // end of gap_callbacks_group 2480 2481 /** 2482 * \addtogroup gap_extended_callbacks_group GAP Extended Callbacks Group 2483 * @brief Group for GAP Extended callbacks. 2484 * @ingroup rsi_ble_cb_s_group 2485 * @{ 2486 */ 2487 /** 2488 * @brief Remote device info event callback. 2489 */ 2490 rsi_ble_on_remote_device_info_t ble_on_remote_device_info_event; 2491 2492 /** 2493 * @brief Remote features event callback. 2494 */ 2495 rsi_ble_on_remote_features_t ble_on_remote_features_event; 2496 2497 /** 2498 * @brief LE more data request event callback. 2499 */ 2500 rsi_ble_on_le_more_data_req_t ble_on_le_more_data_req_event; 2501 2502 /** @} */ // end of gap_extended_callbacks_group 2503 2504 /** 2505 * \addtogroup smp_callbacks_group SMP Callbacks Group 2506 * @brief Group for SMP callbacks. 2507 * @ingroup rsi_ble_cb_s_group 2508 * @{ 2509 */ 2510 /** 2511 * @brief SMP request event callback. 2512 */ 2513 rsi_ble_on_smp_request_t ble_on_smp_request_event; 2514 2515 /** 2516 * @brief SMP response event callback. 2517 */ 2518 rsi_ble_on_smp_response_t ble_on_smp_response_event; 2519 2520 /** 2521 * @brief SMP passkey event callback. 2522 */ 2523 rsi_ble_on_smp_passkey_t ble_on_smp_passkey_event; 2524 2525 /** 2526 * @brief SMP failed event callback. 2527 */ 2528 rsi_ble_on_smp_failed_t ble_on_smp_fail_event; 2529 2530 /** 2531 * @brief SMP encryption started event callback. 2532 */ 2533 rsi_ble_on_encrypt_started_t ble_on_smp_encrypt_started; 2534 2535 /** 2536 * @brief SMP passkey display event callback. 2537 */ 2538 rsi_ble_on_smp_passkey_display_t ble_on_smp_passkey_display; 2539 2540 /** 2541 * @brief Secure connections passkey event callback. 2542 */ 2543 rsi_ble_on_sc_passkey_t ble_on_sc_passkey; 2544 2545 /** 2546 * @brief LE LTK request event callback. 2547 */ 2548 rsi_ble_on_le_ltk_req_event_t ble_on_le_ltk_req_event; 2549 2550 /** 2551 * @brief LE security keys event callback. 2552 */ 2553 rsi_ble_on_le_security_keys_t ble_on_le_security_keys_event; 2554 2555 /** 2556 * @brief Client SMP response event callback. 2557 */ 2558 rsi_ble_on_smp_response_t ble_on_cli_smp_response_event; 2559 2560 /** 2561 * @brief Secure connections method event callback. 2562 */ 2563 rsi_ble_on_sc_method_t ble_on_sc_method_event; 2564 2565 /** @} */ // end of smp_callbacks_group 2566 2567 /** 2568 * \addtogroup gatt_callbacks_group GATT Callbacks Group 2569 * @brief Group for GATT callbacks. 2570 * @ingroup rsi_ble_cb_s_group 2571 * @{ 2572 */ 2573 /** 2574 * @brief Profiles list response callback. 2575 */ 2576 rsi_ble_on_profiles_list_resp_t ble_on_profiles_list_resp; 2577 2578 /** 2579 * @brief Profile response callback. 2580 */ 2581 rsi_ble_on_profile_resp_t ble_on_profile_resp; 2582 2583 /** 2584 * @brief Characteristic services response callback. 2585 */ 2586 rsi_ble_on_char_services_resp_t ble_on_char_services_resp; 2587 2588 /** 2589 * @brief Included services response callback. 2590 */ 2591 rsi_ble_on_inc_services_resp_t ble_on_inc_services_resp; 2592 2593 /** 2594 * @brief Attribute description response callback. 2595 */ 2596 rsi_ble_on_att_desc_resp_t ble_on_att_desc_resp; 2597 2598 /** 2599 * @brief Read response callback. 2600 */ 2601 rsi_ble_on_read_resp_t ble_on_read_resp; 2602 2603 /** 2604 * @brief Write response callback. 2605 */ 2606 rsi_ble_on_write_resp_t ble_on_write_resp; 2607 2608 /** 2609 * @brief GATT write event callback. 2610 */ 2611 rsi_ble_on_gatt_write_event_t ble_on_gatt_events; 2612 2613 /** 2614 * @brief Prepare write event callback. 2615 */ 2616 rsi_ble_on_gatt_prepare_write_event_t ble_on_prepare_write_event; 2617 2618 /** 2619 * @brief Execute write event callback. 2620 */ 2621 rsi_ble_on_execute_write_event_t ble_on_execute_write_event; 2622 2623 /** 2624 * @brief Read request event callback. 2625 */ 2626 rsi_ble_on_read_req_event_t ble_on_read_req_event; 2627 2628 /** 2629 * @brief MTU event callback. 2630 */ 2631 rsi_ble_on_mtu_event_t ble_on_mtu_event; 2632 2633 /** 2634 * @brief GATT error response event callback. 2635 */ 2636 rsi_ble_on_gatt_error_resp_t ble_on_gatt_error_resp_event; 2637 2638 /** 2639 * @brief GATT descriptor value response event callback. 2640 */ 2641 rsi_ble_on_gatt_desc_val_event_t ble_on_gatt_desc_val_resp_event; 2642 2643 /** 2644 * @brief Profiles list event callback. 2645 */ 2646 rsi_ble_on_event_profiles_list_t ble_on_profiles_list_event; 2647 2648 /** 2649 * @brief Profile by UUID event callback. 2650 */ 2651 rsi_ble_on_event_profile_by_uuid_t ble_on_profile_by_uuid_event; 2652 2653 /** 2654 * @brief Read by characteristic services event callback. 2655 */ 2656 rsi_ble_on_event_read_by_char_services_t ble_on_read_by_char_services_event; 2657 2658 /** 2659 * @brief Read by included services event callback. 2660 */ 2661 rsi_ble_on_event_read_by_inc_services_t ble_on_read_by_inc_services_event; 2662 2663 /** 2664 * @brief Read attribute value event callback. 2665 */ 2666 rsi_ble_on_event_read_att_value_t ble_on_read_att_value_event; 2667 2668 /** 2669 * @brief Read response event callback. 2670 */ 2671 rsi_ble_on_event_read_resp_t ble_on_read_resp_event; 2672 2673 /** 2674 * @brief Write response event callback. 2675 */ 2676 rsi_ble_on_event_write_resp_t ble_on_write_resp_event; 2677 2678 /** 2679 * @brief Indicate confirmation event callback. 2680 */ 2681 rsi_ble_on_event_indicate_confirmation_t ble_on_indicate_confirmation_event; 2682 2683 /** 2684 * @brief Prepare write response event callback. 2685 */ 2686 rsi_ble_on_event_prepare_write_resp_t ble_on_prepare_write_resp_event; 2687 2688 /** @} */ // end of gatt_callbacks_group 2689 2690 /** 2691 * \addtogroup gatt_extended_callbacks_group GATT Extended Callbacks Group 2692 * @brief Group for GATT extended callbacks. 2693 * @ingroup rsi_ble_cb_s_group 2694 * @{ 2695 */ 2696 2697 /** 2698 * @brief MTU exchange info event callback. 2699 * @note extended 2700 */ 2701 rsi_ble_on_mtu_exchange_info_t ble_on_mtu_exchange_info_event; 2702 2703 /** @} */ // end of gatt_extended_callbacks_group 2704 2705 /** 2706 * \addtogroup l2cap_callbacks_group L2CAP Callbacks Group 2707 * @brief Group for L2CAP callbacks. 2708 * @ingroup rsi_ble_cb_s_group 2709 * @{ 2710 */ 2711 /** 2712 * @brief CBFC connection request event callback. 2713 */ 2714 rsi_ble_on_cbfc_conn_req_event_t ble_on_cbfc_conn_req_event; 2715 2716 /** 2717 * @brief CBFC connection complete event callback. 2718 */ 2719 rsi_ble_on_cbfc_conn_complete_event_t ble_on_cbfc_conn_complete_event; 2720 2721 /** 2722 * @brief CBFC receive data event callback. 2723 */ 2724 rsi_ble_on_cbfc_rx_data_event_t ble_on_cbfc_rx_data_event; 2725 2726 /** 2727 * @brief CBFC disconnect event callback. 2728 */ 2729 rsi_ble_on_cbfc_disconn_event_t ble_on_cbfc_disconn_event; 2730 2731 /** @} */ // end of l2cap_callbacks_group 2732 2733 /** 2734 * \addtogroup chip_memory_status_callbacks_group Chip Memory Status Callbacks Group 2735 * @brief Group for Chip memory status callbacks. 2736 * @ingroup rsi_ble_cb_s_group 2737 * @{ 2738 */ 2739 2740 /** 2741 * @brief Chip memory status event callback. 2742 * @note rsi_ble_on_chip_memory_status_callbacks_register 2743 */ 2744 chip_ble_buffers_stats_handler_t ble_on_chip_memory_status_event; 2745 2746 /** @} */ // end of chip_memory_status_callbacks_group 2747 2748 /** 2749 * \addtogroup ae_callbacks_group AE Callbacks Group 2750 * @brief Group for AE callbacks. 2751 * @ingroup rsi_ble_cb_s_group 2752 * @{ 2753 */ 2754 /** 2755 * @brief AE report complete event callback. 2756 */ 2757 rsi_ble_ae_report_complete_t ble_ae_report_complete_event; 2758 2759 /** 2760 * @brief AE periodic advertising sync established event callback. 2761 */ 2762 rsi_ble_ae_per_adv_sync_estbl_t ble_ae_per_adv_sync_estbl_event; 2763 2764 /** 2765 * @brief AE periodic advertising report event callback. 2766 */ 2767 rsi_ble_ae_per_adv_report_t ble_ae_per_adv_report_event; 2768 2769 /** 2770 * @brief AE periodic advertising sync lost event callback. 2771 */ 2772 rsi_ble_ae_per_adv_sync_lost_t ble_ae_per_adv_sync_lost_event; 2773 2774 /** 2775 * @brief AE scan timeout event callback. 2776 */ 2777 rsi_ble_ae_scan_timeout_t ble_ae_scan_timeout_event; 2778 2779 /** 2780 * @brief AE advertising set terminated event callback. 2781 */ 2782 rsi_ble_ae_adv_set_terminated_t ble_ae_adv_set_terminated_event; 2783 2784 /** 2785 * @brief AE scan request received event callback. 2786 */ 2787 rsi_ble_ae_scan_req_recvd_t ble_ae_scan_req_recvd_event; 2788 2789 /** 2790 * @brief RCP response received event callback. 2791 * 2792 */ 2793 rsi_ble_on_rcp_resp_rcvd_t ble_on_rcp_resp_rcvd_event; 2794 2795 /** @} */ // end of ae_callbacks_group 2796 }; 2797 2798 /** @} */ // end of rsi_ble_cb_s_group 2799 2800 /****************************************************** 2801 * * BLE internal function declarations 2802 * ******************************************************/ 2803 void rsi_ble_callbacks_handler(rsi_bt_cb_t *ble_cb, uint16_t rsp_type, uint8_t *payload, uint16_t payload_length); 2804 2805 #endif 2806