BLE UART example

Fork of Nucleo_BLE_BlueNRG by ST Americas mbed Team

Committer:
sjallouli
Date:
Fri Dec 19 18:56:07 2014 +0000
Revision:
0:a948f5f3904c
BLE_BlueNRG for Nucleo board

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sjallouli 0:a948f5f3904c 1 /******************** (C) COPYRIGHT 2013 STMicroelectronics ********************
sjallouli 0:a948f5f3904c 2 * File Name : bluenrg_hci_internal.h
sjallouli 0:a948f5f3904c 3 * Author : AMS - HEA&RF BU
sjallouli 0:a948f5f3904c 4 * Version : V1.0.0
sjallouli 0:a948f5f3904c 5 * Date : 4-Oct-2013
sjallouli 0:a948f5f3904c 6 * Description : Header file with ACI definitions for BlueNRG FW6.0 and
sjallouli 0:a948f5f3904c 7 * above.
sjallouli 0:a948f5f3904c 8 ********************************************************************************
sjallouli 0:a948f5f3904c 9 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
sjallouli 0:a948f5f3904c 10 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
sjallouli 0:a948f5f3904c 11 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
sjallouli 0:a948f5f3904c 12 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
sjallouli 0:a948f5f3904c 13 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
sjallouli 0:a948f5f3904c 14 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
sjallouli 0:a948f5f3904c 15 *******************************************************************************/
sjallouli 0:a948f5f3904c 16
sjallouli 0:a948f5f3904c 17 #ifndef __BLUENRG_HCI_INTERNAL_H_
sjallouli 0:a948f5f3904c 18 #define __BLUENRG_HCI_INTERNAL_H_
sjallouli 0:a948f5f3904c 19
sjallouli 0:a948f5f3904c 20 #include "compiler.h"
sjallouli 0:a948f5f3904c 21 #include "bluenrg_hci.h"
sjallouli 0:a948f5f3904c 22
sjallouli 0:a948f5f3904c 23 #define OCF_HAL_WRITE_CONFIG_DATA 0x000C
sjallouli 0:a948f5f3904c 24
sjallouli 0:a948f5f3904c 25 /* Offsets and lengths for configuration values */
sjallouli 0:a948f5f3904c 26 #define CONFIG_DATA_PUBADDR_OFFSET (0x00)
sjallouli 0:a948f5f3904c 27 #define CONFIG_DATA_DIV_OFFSET (0x06)
sjallouli 0:a948f5f3904c 28 #define CONFIG_DATA_ER_OFFSET (0x08)
sjallouli 0:a948f5f3904c 29 #define CONFIG_DATA_IR_OFFSET (0x18)
sjallouli 0:a948f5f3904c 30
sjallouli 0:a948f5f3904c 31 #define CONFIG_DATA_PUBADDR_LEN (0x06)
sjallouli 0:a948f5f3904c 32 #define CONFIG_DATA_DIV_LEN (0x02)
sjallouli 0:a948f5f3904c 33 #define CONFIG_DATA_ER_LEN (0x10)
sjallouli 0:a948f5f3904c 34 #define CONFIG_DATA_IR_LEN (0x10)
sjallouli 0:a948f5f3904c 35
sjallouli 0:a948f5f3904c 36 #define OCF_HAL_SET_TX_POWER_LEVEL 0x000F
sjallouli 0:a948f5f3904c 37 typedef struct __packed _hal_set_tx_power_level_cp{
sjallouli 0:a948f5f3904c 38 uint8_t en_high_power;
sjallouli 0:a948f5f3904c 39 uint8_t pa_level;
sjallouli 0:a948f5f3904c 40 } PACKED hal_set_tx_power_level_cp;
sjallouli 0:a948f5f3904c 41 #define HAL_SET_TX_POWER_LEVEL_CP_SIZE 2
sjallouli 0:a948f5f3904c 42
sjallouli 0:a948f5f3904c 43 #define OCF_HAL_TONE_START 0x0015
sjallouli 0:a948f5f3904c 44 typedef struct __packed _hal_tone_start_cp{
sjallouli 0:a948f5f3904c 45 uint8_t rf_channel;
sjallouli 0:a948f5f3904c 46 } PACKED hal_tone_start_cp;
sjallouli 0:a948f5f3904c 47 #define HAL_TONE_START_CP_SIZE 1
sjallouli 0:a948f5f3904c 48
sjallouli 0:a948f5f3904c 49 #define OCF_UPDATER_START 0x0020
sjallouli 0:a948f5f3904c 50 #define OCF_UPDATER_REBOOT 0x0021
sjallouli 0:a948f5f3904c 51
sjallouli 0:a948f5f3904c 52 #define OCF_GET_UPDATER_VERSION 0x0022
sjallouli 0:a948f5f3904c 53 typedef struct __packed _get_updater_version_rp{
sjallouli 0:a948f5f3904c 54 uint8_t status;
sjallouli 0:a948f5f3904c 55 uint8_t version;
sjallouli 0:a948f5f3904c 56 } PACKED get_updater_version_rp;
sjallouli 0:a948f5f3904c 57 #define GET_UPDATER_VERSION_RP_SIZE 2
sjallouli 0:a948f5f3904c 58
sjallouli 0:a948f5f3904c 59 #define OCF_GET_UPDATER_BUFSIZE 0x0023
sjallouli 0:a948f5f3904c 60 typedef struct __packed _get_updater_bufsize_rp{
sjallouli 0:a948f5f3904c 61 uint8_t status;
sjallouli 0:a948f5f3904c 62 uint8_t buffer_size;
sjallouli 0:a948f5f3904c 63 } PACKED get_updater_bufsize_rp;
sjallouli 0:a948f5f3904c 64 #define GET_UPDATER_BUFSIZE_RP_SIZE 2
sjallouli 0:a948f5f3904c 65
sjallouli 0:a948f5f3904c 66 #define OCF_UPDATER_ERASE_BLUE_FLAG 0x0024
sjallouli 0:a948f5f3904c 67
sjallouli 0:a948f5f3904c 68 #define OCF_UPDATER_RESET_BLUE_FLAG 0x0025
sjallouli 0:a948f5f3904c 69
sjallouli 0:a948f5f3904c 70 #define OCF_UPDATER_ERASE_SECTOR 0x0026
sjallouli 0:a948f5f3904c 71 typedef struct __packed _updater_erase_sector_cp{
sjallouli 0:a948f5f3904c 72 uint32_t address;
sjallouli 0:a948f5f3904c 73 } PACKED updater_erase_sector_cp;
sjallouli 0:a948f5f3904c 74 #define UPDATER_ERASE_SECTOR_CP_SIZE 4
sjallouli 0:a948f5f3904c 75
sjallouli 0:a948f5f3904c 76 #define OCF_UPDATER_PROG_DATA_BLOCK 0x0027
sjallouli 0:a948f5f3904c 77 /* Variable length parameters */
sjallouli 0:a948f5f3904c 78
sjallouli 0:a948f5f3904c 79 #define OCF_UPDATER_READ_DATA_BLOCK 0x0028
sjallouli 0:a948f5f3904c 80 typedef struct __packed _updater_read_data_block_cp{
sjallouli 0:a948f5f3904c 81 uint32_t address;
sjallouli 0:a948f5f3904c 82 uint16_t data_len;
sjallouli 0:a948f5f3904c 83 } PACKED updater_read_data_block_cp;
sjallouli 0:a948f5f3904c 84 #define UPDATER_READ_DATA_BLOCK_CP_SIZE 6
sjallouli 0:a948f5f3904c 85 typedef struct __packed _updater_read_data_block_rp{
sjallouli 0:a948f5f3904c 86 uint8_t status;
sjallouli 0:a948f5f3904c 87 uint8_t data[0];
sjallouli 0:a948f5f3904c 88 } PACKED updater_read_data_block_rp;
sjallouli 0:a948f5f3904c 89 #define GET_UPDATER_BUFSIZE_RP_SIZE 2
sjallouli 0:a948f5f3904c 90
sjallouli 0:a948f5f3904c 91 #define OCF_UPDATER_CALC_CRC 0x0029
sjallouli 0:a948f5f3904c 92 typedef struct __packed _updater_calc_crc_cp{
sjallouli 0:a948f5f3904c 93 uint32_t address;
sjallouli 0:a948f5f3904c 94 uint8_t num_sectors;
sjallouli 0:a948f5f3904c 95 } PACKED updater_calc_crc_cp;
sjallouli 0:a948f5f3904c 96 #define UPDATER_CALC_CRC_CP_SIZE 5
sjallouli 0:a948f5f3904c 97 typedef struct __packed _updater_calc_crc_rp{
sjallouli 0:a948f5f3904c 98 uint8_t status;
sjallouli 0:a948f5f3904c 99 uint32_t crc;
sjallouli 0:a948f5f3904c 100 } PACKED updater_calc_crc_rp;
sjallouli 0:a948f5f3904c 101 #define UPDATER_CALC_CRC_RP_SIZE 5
sjallouli 0:a948f5f3904c 102
sjallouli 0:a948f5f3904c 103 #define OCF_UPDATER_HW_VERSION 0x002A
sjallouli 0:a948f5f3904c 104 typedef struct __packed _updater_hw_version_rp{
sjallouli 0:a948f5f3904c 105 uint8_t status;
sjallouli 0:a948f5f3904c 106 uint8_t version;
sjallouli 0:a948f5f3904c 107 } PACKED updater_hw_version_rp;
sjallouli 0:a948f5f3904c 108 #define UPDATER_HW_VERSION_RP_SIZE 2
sjallouli 0:a948f5f3904c 109
sjallouli 0:a948f5f3904c 110 #define OCF_GAP_SET_NON_DISCOVERABLE 0x0081
sjallouli 0:a948f5f3904c 111
sjallouli 0:a948f5f3904c 112 #define OCF_GAP_SET_LIMITED_DISCOVERABLE 0x0082
sjallouli 0:a948f5f3904c 113
sjallouli 0:a948f5f3904c 114 #define OCF_GAP_SET_DISCOVERABLE 0x0083
sjallouli 0:a948f5f3904c 115
sjallouli 0:a948f5f3904c 116 #define OCF_GAP_SET_DIRECT_CONNECTABLE 0x0084
sjallouli 0:a948f5f3904c 117 typedef struct __packed _gap_set_direct_conectable_cp{
sjallouli 0:a948f5f3904c 118 uint8_t own_bdaddr_type;
sjallouli 0:a948f5f3904c 119 uint8_t direct_bdaddr_type;
sjallouli 0:a948f5f3904c 120 tBDAddr direct_bdaddr;
sjallouli 0:a948f5f3904c 121 } PACKED gap_set_direct_conectable_cp;
sjallouli 0:a948f5f3904c 122 #define GAP_SET_DIRECT_CONNECTABLE_CP_SIZE 8
sjallouli 0:a948f5f3904c 123
sjallouli 0:a948f5f3904c 124 #define OCF_GAP_SET_IO_CAPABILITY 0x0085
sjallouli 0:a948f5f3904c 125 typedef struct __packed _gap_set_io_capability_cp{
sjallouli 0:a948f5f3904c 126 uint8_t io_capability;
sjallouli 0:a948f5f3904c 127 } PACKED gap_set_io_capability_cp;
sjallouli 0:a948f5f3904c 128 #define GAP_SET_IO_CAPABILITY_CP_SIZE 1
sjallouli 0:a948f5f3904c 129
sjallouli 0:a948f5f3904c 130 #define OCF_GAP_SET_AUTH_REQUIREMENT 0x0086
sjallouli 0:a948f5f3904c 131 typedef struct __packed _gap_set_auth_requirement_cp{
sjallouli 0:a948f5f3904c 132 uint8_t mitm_mode;
sjallouli 0:a948f5f3904c 133 uint8_t oob_enable;
sjallouli 0:a948f5f3904c 134 uint8_t oob_data[16];
sjallouli 0:a948f5f3904c 135 uint8_t min_encryption_key_size;
sjallouli 0:a948f5f3904c 136 uint8_t max_encryption_key_size;
sjallouli 0:a948f5f3904c 137 uint8_t use_fixed_pin;
sjallouli 0:a948f5f3904c 138 uint32_t fixed_pin;
sjallouli 0:a948f5f3904c 139 uint8_t bonding_mode;
sjallouli 0:a948f5f3904c 140 } PACKED gap_set_auth_requirement_cp;
sjallouli 0:a948f5f3904c 141 #define GAP_SET_AUTH_REQUIREMENT_CP_SIZE 26
sjallouli 0:a948f5f3904c 142
sjallouli 0:a948f5f3904c 143 #define OCF_GAP_SET_AUTHOR_REQUIREMENT 0x0087
sjallouli 0:a948f5f3904c 144 typedef struct __packed _gap_set_author_requirement_cp{
sjallouli 0:a948f5f3904c 145 uint8_t authorization_enable;
sjallouli 0:a948f5f3904c 146 } PACKED gap_set_author_requirement_cp;
sjallouli 0:a948f5f3904c 147 #define GAP_SET_AUTHOR_REQUIREMENT_CP_SIZE 1
sjallouli 0:a948f5f3904c 148
sjallouli 0:a948f5f3904c 149 #define OCF_GAP_PASSKEY_RESPONSE 0x0088
sjallouli 0:a948f5f3904c 150 typedef struct __packed _gap_passkey_response_cp{
sjallouli 0:a948f5f3904c 151 uint32_t passkey;
sjallouli 0:a948f5f3904c 152 } PACKED gap_passkey_response_cp;
sjallouli 0:a948f5f3904c 153 #define GAP_PASSKEY_RESPONSE_CP_SIZE 4
sjallouli 0:a948f5f3904c 154
sjallouli 0:a948f5f3904c 155 #define OCF_GAP_AUTHORIZATION_RESPONSE 0x0089
sjallouli 0:a948f5f3904c 156 typedef struct __packed _gap_authorization_response_cp{
sjallouli 0:a948f5f3904c 157 uint8_t authorize;
sjallouli 0:a948f5f3904c 158 } PACKED gap_authorization_response_cp;
sjallouli 0:a948f5f3904c 159 #define GAP_AUTHORIZATION_RESPONSE_CP_SIZE 1
sjallouli 0:a948f5f3904c 160
sjallouli 0:a948f5f3904c 161 #define OCF_GAP_INIT 0x008A
sjallouli 0:a948f5f3904c 162 typedef struct __packed _gap_init_cp{
sjallouli 0:a948f5f3904c 163 uint8_t role;
sjallouli 0:a948f5f3904c 164 } PACKED gap_init_cp;
sjallouli 0:a948f5f3904c 165 #define GAP_INIT_CP_SIZE 1
sjallouli 0:a948f5f3904c 166 typedef struct __packed _gap_init_rp{
sjallouli 0:a948f5f3904c 167 uint8_t status;
sjallouli 0:a948f5f3904c 168 uint16_t service_handle;
sjallouli 0:a948f5f3904c 169 uint16_t dev_name_char_handle;
sjallouli 0:a948f5f3904c 170 uint16_t appearance_char_handle;
sjallouli 0:a948f5f3904c 171 } PACKED gap_init_rp;
sjallouli 0:a948f5f3904c 172 #define GAP_INIT_RP_SIZE 7
sjallouli 0:a948f5f3904c 173
sjallouli 0:a948f5f3904c 174 #define OCF_GAP_SET_NON_CONNECTABLE 0x008B
sjallouli 0:a948f5f3904c 175 typedef struct __packed _gap_set_non_connectable_cp{
sjallouli 0:a948f5f3904c 176 uint8_t advertising_event_type;
sjallouli 0:a948f5f3904c 177 } PACKED gap_set_non_connectable_cp;
sjallouli 0:a948f5f3904c 178 #define GAP_SET_NON_CONNECTABLE_CP_SIZE 1
sjallouli 0:a948f5f3904c 179
sjallouli 0:a948f5f3904c 180 #define OCF_GAP_SET_UNDIRECTED_CONNECTABLE 0x008C
sjallouli 0:a948f5f3904c 181 typedef struct __packed _gap_set_undirected_connectable_cp{
sjallouli 0:a948f5f3904c 182 uint8_t adv_filter_policy;
sjallouli 0:a948f5f3904c 183 uint8_t own_addr_type;
sjallouli 0:a948f5f3904c 184 } PACKED gap_set_undirected_connectable_cp;
sjallouli 0:a948f5f3904c 185 #define GAP_SET_UNDIRECTED_CONNECTABLE_CP_SIZE 2
sjallouli 0:a948f5f3904c 186
sjallouli 0:a948f5f3904c 187 #define OCF_GAP_SLAVE_SECURITY_REQUEST 0x008D
sjallouli 0:a948f5f3904c 188 typedef struct __packed _gap_slave_security_request_cp{
sjallouli 0:a948f5f3904c 189 uint8_t bonding;
sjallouli 0:a948f5f3904c 190 uint8_t mitm_protection;
sjallouli 0:a948f5f3904c 191 } PACKED gap_slave_security_request_cp;
sjallouli 0:a948f5f3904c 192 #define GAP_SLAVE_SECURITY_REQUEST_CP_SIZE 2
sjallouli 0:a948f5f3904c 193
sjallouli 0:a948f5f3904c 194 #define OCF_GAP_UPDATE_ADV_DATA 0x008E
sjallouli 0:a948f5f3904c 195
sjallouli 0:a948f5f3904c 196 #define OCF_GAP_DELETE_AD_TYPE 0x008F
sjallouli 0:a948f5f3904c 197 typedef struct __packed _gap_delete_ad_type_cp{
sjallouli 0:a948f5f3904c 198 uint8_t ad_type;
sjallouli 0:a948f5f3904c 199 } PACKED gap_delete_ad_type_cp;
sjallouli 0:a948f5f3904c 200 #define GAP_DELETE_AD_TYPE_CP_SIZE 1
sjallouli 0:a948f5f3904c 201
sjallouli 0:a948f5f3904c 202 #define OCF_GAP_GET_SECURITY_LEVEL 0x0090
sjallouli 0:a948f5f3904c 203 typedef struct __packed _gap_get_security_level_rp{
sjallouli 0:a948f5f3904c 204 uint8_t status;
sjallouli 0:a948f5f3904c 205 uint8_t mitm_protection;
sjallouli 0:a948f5f3904c 206 uint8_t bonding;
sjallouli 0:a948f5f3904c 207 uint8_t oob_data;
sjallouli 0:a948f5f3904c 208 uint8_t passkey_required;
sjallouli 0:a948f5f3904c 209 } PACKED gap_get_security_level_rp;
sjallouli 0:a948f5f3904c 210 #define GAP_GET_SECURITY_LEVEL_RP_SIZE 5
sjallouli 0:a948f5f3904c 211
sjallouli 0:a948f5f3904c 212 #define OCF_GAP_SET_EVT_MASK 0x0091
sjallouli 0:a948f5f3904c 213 typedef struct __packed _gap_set_evt_mask_cp{
sjallouli 0:a948f5f3904c 214 uint16_t evt_mask;
sjallouli 0:a948f5f3904c 215 } PACKED gap_set_evt_mask_cp;
sjallouli 0:a948f5f3904c 216 #define GAP_SET_EVT_MASK_CP_SIZE 2
sjallouli 0:a948f5f3904c 217
sjallouli 0:a948f5f3904c 218 #define OCF_GAP_CONFIGURE_WHITELIST 0x0092
sjallouli 0:a948f5f3904c 219
sjallouli 0:a948f5f3904c 220 #define OCF_GAP_TERMINATE 0x0093
sjallouli 0:a948f5f3904c 221 typedef struct __packed _gap_terminate_cp{
sjallouli 0:a948f5f3904c 222 uint16_t handle;
sjallouli 0:a948f5f3904c 223 uint8_t reason;
sjallouli 0:a948f5f3904c 224 } PACKED gap_terminate_cp;
sjallouli 0:a948f5f3904c 225 #define GAP_TERMINATE_CP_SIZE 3
sjallouli 0:a948f5f3904c 226
sjallouli 0:a948f5f3904c 227 #define OCF_GAP_CLEAR_SECURITY_DB 0x0094
sjallouli 0:a948f5f3904c 228
sjallouli 0:a948f5f3904c 229 #define OCF_GAP_ALLOW_REBOND_DB 0x0095
sjallouli 0:a948f5f3904c 230
sjallouli 0:a948f5f3904c 231 #define OCF_GAP_START_LIMITED_DISCOVERY_PROC 0x0096
sjallouli 0:a948f5f3904c 232 typedef struct __packed _gap_start_limited_discovery_proc_cp{
sjallouli 0:a948f5f3904c 233 uint16_t scanInterval;
sjallouli 0:a948f5f3904c 234 uint16_t scanWindow;
sjallouli 0:a948f5f3904c 235 uint8_t own_address_type;
sjallouli 0:a948f5f3904c 236 uint8_t filterDuplicates;
sjallouli 0:a948f5f3904c 237 } PACKED gap_start_limited_discovery_proc_cp;
sjallouli 0:a948f5f3904c 238 #define GAP_START_LIMITED_DISCOVERY_PROC_CP_SIZE 6
sjallouli 0:a948f5f3904c 239
sjallouli 0:a948f5f3904c 240 #define OCF_GAP_START_GENERAL_DISCOVERY_PROC 0x0097
sjallouli 0:a948f5f3904c 241 typedef struct __packed _gap_start_general_discovery_proc_cp{
sjallouli 0:a948f5f3904c 242 uint16_t scanInterval;
sjallouli 0:a948f5f3904c 243 uint16_t scanWindow;
sjallouli 0:a948f5f3904c 244 uint8_t own_address_type;
sjallouli 0:a948f5f3904c 245 uint8_t filterDuplicates;
sjallouli 0:a948f5f3904c 246 } PACKED gap_start_general_discovery_proc_cp;
sjallouli 0:a948f5f3904c 247 #define GAP_START_GENERAL_DISCOVERY_PROC_CP_SIZE 6
sjallouli 0:a948f5f3904c 248
sjallouli 0:a948f5f3904c 249 #define OCF_GAP_START_AUTO_CONN_ESTABLISHMENT 0x0099
sjallouli 0:a948f5f3904c 250
sjallouli 0:a948f5f3904c 251 #define OCF_GAP_CREATE_CONNECTION 0x009C
sjallouli 0:a948f5f3904c 252 typedef struct __packed _gap_create_connection_cp{
sjallouli 0:a948f5f3904c 253 uint16_t scanInterval;
sjallouli 0:a948f5f3904c 254 uint16_t scanWindow;
sjallouli 0:a948f5f3904c 255 uint8_t peer_bdaddr_type;
sjallouli 0:a948f5f3904c 256 tBDAddr peer_bdaddr;
sjallouli 0:a948f5f3904c 257 uint8_t own_bdaddr_type;
sjallouli 0:a948f5f3904c 258 uint16_t conn_min_interval;
sjallouli 0:a948f5f3904c 259 uint16_t conn_max_interval;
sjallouli 0:a948f5f3904c 260 uint16_t conn_latency;
sjallouli 0:a948f5f3904c 261 uint16_t supervision_timeout;
sjallouli 0:a948f5f3904c 262 uint16_t min_conn_length;
sjallouli 0:a948f5f3904c 263 uint16_t max_conn_length;
sjallouli 0:a948f5f3904c 264 } PACKED gap_create_connection_cp;
sjallouli 0:a948f5f3904c 265 #define GAP_CREATE_CONNECTION_CP_SIZE 24
sjallouli 0:a948f5f3904c 266
sjallouli 0:a948f5f3904c 267 #define OCF_GAP_TERMINATE_GAP_PROCEDURE 0x009D
sjallouli 0:a948f5f3904c 268
sjallouli 0:a948f5f3904c 269 #define OCF_GATT_INIT 0x0101
sjallouli 0:a948f5f3904c 270
sjallouli 0:a948f5f3904c 271 #define OCF_GATT_ADD_SERV 0x0102
sjallouli 0:a948f5f3904c 272 typedef struct __packed _gatt_add_serv_rp{
sjallouli 0:a948f5f3904c 273 uint8_t status;
sjallouli 0:a948f5f3904c 274 uint16_t handle;
sjallouli 0:a948f5f3904c 275 } PACKED gatt_add_serv_rp;
sjallouli 0:a948f5f3904c 276 #define GATT_ADD_SERV_RP_SIZE 3
sjallouli 0:a948f5f3904c 277
sjallouli 0:a948f5f3904c 278 #define OCF_GATT_INCLUDE_SERV 0x0103
sjallouli 0:a948f5f3904c 279 typedef struct __packed _gatt_include_serv_rp{
sjallouli 0:a948f5f3904c 280 uint8_t status;
sjallouli 0:a948f5f3904c 281 uint16_t handle;
sjallouli 0:a948f5f3904c 282 } PACKED gatt_include_serv_rp;
sjallouli 0:a948f5f3904c 283 #define GATT_INCLUDE_SERV_RP_SIZE 3
sjallouli 0:a948f5f3904c 284
sjallouli 0:a948f5f3904c 285 #define OCF_GATT_ADD_CHAR 0x0104
sjallouli 0:a948f5f3904c 286 typedef struct __packed _gatt_add_char_rp{
sjallouli 0:a948f5f3904c 287 uint8_t status;
sjallouli 0:a948f5f3904c 288 uint16_t handle;
sjallouli 0:a948f5f3904c 289 } PACKED gatt_add_char_rp;
sjallouli 0:a948f5f3904c 290 #define GATT_ADD_CHAR_RP_SIZE 3
sjallouli 0:a948f5f3904c 291
sjallouli 0:a948f5f3904c 292 #define OCF_GATT_ADD_CHAR_DESC 0x0105
sjallouli 0:a948f5f3904c 293 typedef struct __packed _gatt_add_char_desc_rp{
sjallouli 0:a948f5f3904c 294 uint8_t status;
sjallouli 0:a948f5f3904c 295 uint16_t handle;
sjallouli 0:a948f5f3904c 296 } PACKED gatt_add_char_desc_rp;
sjallouli 0:a948f5f3904c 297 #define GATT_ADD_CHAR_DESC_RP_SIZE 3
sjallouli 0:a948f5f3904c 298
sjallouli 0:a948f5f3904c 299 #define OCF_GATT_UPD_CHAR_VAL 0x0106
sjallouli 0:a948f5f3904c 300
sjallouli 0:a948f5f3904c 301 #define OCF_GATT_DEL_CHAR 0x0107
sjallouli 0:a948f5f3904c 302 typedef struct __packed _gatt_del_char_cp{
sjallouli 0:a948f5f3904c 303 uint16_t service_handle;
sjallouli 0:a948f5f3904c 304 uint16_t char_handle;
sjallouli 0:a948f5f3904c 305 } PACKED gatt_del_char_cp;
sjallouli 0:a948f5f3904c 306 #define GATT_DEL_CHAR_CP_SIZE 4
sjallouli 0:a948f5f3904c 307
sjallouli 0:a948f5f3904c 308 #define OCF_GATT_DEL_SERV 0x0108
sjallouli 0:a948f5f3904c 309 typedef struct __packed _gatt_del_serv_cp{
sjallouli 0:a948f5f3904c 310 uint16_t service_handle;
sjallouli 0:a948f5f3904c 311 } PACKED gatt_del_serv_cp;
sjallouli 0:a948f5f3904c 312 #define GATT_DEL_SERV_CP_SIZE 2
sjallouli 0:a948f5f3904c 313
sjallouli 0:a948f5f3904c 314 #define OCF_GATT_DEL_INC_SERV 0x0109
sjallouli 0:a948f5f3904c 315 typedef struct __packed _gatt_del_inc_serv_cp{
sjallouli 0:a948f5f3904c 316 uint16_t service_handle;
sjallouli 0:a948f5f3904c 317 uint16_t inc_serv_handle;
sjallouli 0:a948f5f3904c 318 } PACKED gatt_del_inc_serv_cp;
sjallouli 0:a948f5f3904c 319 #define GATT_DEL_INC_SERV_CP_SIZE 4
sjallouli 0:a948f5f3904c 320
sjallouli 0:a948f5f3904c 321 #define OCF_GATT_SET_EVT_MASK 0x010A
sjallouli 0:a948f5f3904c 322 typedef struct __packed _gatt_set_evt_mask_cp{
sjallouli 0:a948f5f3904c 323 uint32_t evt_mask;
sjallouli 0:a948f5f3904c 324 } PACKED gatt_set_evt_mask_cp;
sjallouli 0:a948f5f3904c 325 #define GATT_SET_EVT_MASK_CP_SIZE 4
sjallouli 0:a948f5f3904c 326
sjallouli 0:a948f5f3904c 327 #define OCF_GATT_DISC_ALL_PRIM_SERVICES 0X0112
sjallouli 0:a948f5f3904c 328 typedef struct __packed _gatt_disc_all_prim_serivces_cp{
sjallouli 0:a948f5f3904c 329 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 330 } PACKED gatt_disc_all_prim_services_cp;
sjallouli 0:a948f5f3904c 331 #define GATT_DISC_ALL_PRIM_SERVICES_CP_SIZE 2
sjallouli 0:a948f5f3904c 332
sjallouli 0:a948f5f3904c 333 #define OCF_GATT_FIND_INCLUDED_SERVICES 0X0114
sjallouli 0:a948f5f3904c 334 typedef struct __packed _gatt_disc_find_included_services_cp{
sjallouli 0:a948f5f3904c 335 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 336 uint16_t start_handle;
sjallouli 0:a948f5f3904c 337 uint16_t end_handle;
sjallouli 0:a948f5f3904c 338 } PACKED gatt_find_included_services_cp;
sjallouli 0:a948f5f3904c 339 #define GATT_FIND_INCLUDED_SERVICES_CP_SIZE 6
sjallouli 0:a948f5f3904c 340
sjallouli 0:a948f5f3904c 341 #define OCF_GATT_DISC_ALL_CHARAC_OF_SERV 0X0115
sjallouli 0:a948f5f3904c 342 typedef struct __packed _gatt_disc_all_charac_of_serv_cp{
sjallouli 0:a948f5f3904c 343 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 344 uint16_t start_attr_handle;
sjallouli 0:a948f5f3904c 345 uint16_t end_attr_handle;
sjallouli 0:a948f5f3904c 346 } PACKED gatt_disc_all_charac_of_serv_cp;
sjallouli 0:a948f5f3904c 347 #define GATT_DISC_ALL_CHARAC_OF_SERV_CP_SIZE 6
sjallouli 0:a948f5f3904c 348
sjallouli 0:a948f5f3904c 349 #define OCF_GATT_DISC_ALL_CHARAC_DESCRIPTORS 0X0117
sjallouli 0:a948f5f3904c 350 typedef struct __packed _gatt_disc_all_charac_descriptors_cp{
sjallouli 0:a948f5f3904c 351 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 352 uint16_t char_val_handle;
sjallouli 0:a948f5f3904c 353 uint16_t char_end_handle;
sjallouli 0:a948f5f3904c 354 } PACKED gatt_disc_all_charac_descriptors_cp;
sjallouli 0:a948f5f3904c 355 #define GATT_DISC_ALL_CHARAC_DESCRIPTORS_CP_SIZE 6
sjallouli 0:a948f5f3904c 356
sjallouli 0:a948f5f3904c 357 #define OCF_GATT_READ_CHARAC_VAL 0x0118
sjallouli 0:a948f5f3904c 358 typedef struct __packed _gatt_read_charac_val_cp{
sjallouli 0:a948f5f3904c 359 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 360 uint16_t attr_handle;
sjallouli 0:a948f5f3904c 361 } PACKED gatt_read_charac_val_cp;
sjallouli 0:a948f5f3904c 362 #define GATT_READ_CHARAC_VAL_CP_SIZE 4
sjallouli 0:a948f5f3904c 363
sjallouli 0:a948f5f3904c 364 #define OCF_GATT_READ_LONG_CHARAC_VAL 0x011A
sjallouli 0:a948f5f3904c 365 typedef struct __packed _gatt_read_long_charac_val_cp{
sjallouli 0:a948f5f3904c 366 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 367 uint16_t attr_handle;
sjallouli 0:a948f5f3904c 368 uint16_t val_offset;
sjallouli 0:a948f5f3904c 369 } PACKED gatt_read_long_charac_val_cp;
sjallouli 0:a948f5f3904c 370 #define GATT_READ_LONG_CHARAC_VAL_CP_SIZE 6
sjallouli 0:a948f5f3904c 371
sjallouli 0:a948f5f3904c 372 #define OCF_GATT_WRITE_CHAR_VALUE 0x011C
sjallouli 0:a948f5f3904c 373 #define OCF_GATT_WRITE_CHAR_DESCRIPTOR 0x0121
sjallouli 0:a948f5f3904c 374
sjallouli 0:a948f5f3904c 375 #define OCF_GATT_READ_CHAR_DESCRIPTOR 0x0122
sjallouli 0:a948f5f3904c 376
sjallouli 0:a948f5f3904c 377 #define OCF_GATT_WRITE_WITHOUT_RESPONSE 0x0123
sjallouli 0:a948f5f3904c 378
sjallouli 0:a948f5f3904c 379 #define OCF_GATT_SIGNED_WRITE_WITHOUT_RESPONSE 0x0124
sjallouli 0:a948f5f3904c 380
sjallouli 0:a948f5f3904c 381 #define OCF_GATT_CONFIRM_INDICATION 0x0125
sjallouli 0:a948f5f3904c 382
sjallouli 0:a948f5f3904c 383 #define OCF_GATT_WRITE_RESPONSE 0x0126
sjallouli 0:a948f5f3904c 384
sjallouli 0:a948f5f3904c 385 #define OCF_GATT_ALLOW_READ 0x0127
sjallouli 0:a948f5f3904c 386 typedef struct __packed _gatt_allow_read_cp{
sjallouli 0:a948f5f3904c 387 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 388 } PACKED gatt_allow_read_cp;
sjallouli 0:a948f5f3904c 389 #define GATT_ALLOW_READ_CP_SIZE 2
sjallouli 0:a948f5f3904c 390
sjallouli 0:a948f5f3904c 391 #define OCF_GATT_SET_DESC_VAL 0x0129
sjallouli 0:a948f5f3904c 392
sjallouli 0:a948f5f3904c 393 #define OCF_L2CAP_CONN_PARAM_UPD_REQ 0x0181
sjallouli 0:a948f5f3904c 394 typedef struct __packed _l2cap_conn_param_upd_cp{
sjallouli 0:a948f5f3904c 395 uint16_t handle;
sjallouli 0:a948f5f3904c 396 uint16_t interval_min;
sjallouli 0:a948f5f3904c 397 uint16_t interval_max;
sjallouli 0:a948f5f3904c 398 uint16_t slave_latency;
sjallouli 0:a948f5f3904c 399 uint16_t timeout_multiplier;
sjallouli 0:a948f5f3904c 400 } PACKED l2cap_conn_param_upd_cp;
sjallouli 0:a948f5f3904c 401 #define L2CAP_CONN_PARAM_UPD_REQ_CP_SIZE 10
sjallouli 0:a948f5f3904c 402
sjallouli 0:a948f5f3904c 403
sjallouli 0:a948f5f3904c 404 /*------------- Events -------------*/
sjallouli 0:a948f5f3904c 405
sjallouli 0:a948f5f3904c 406 #define EVT_VENDOR 0xFF /* The event code in the hci_event_pckt structure */
sjallouli 0:a948f5f3904c 407 typedef struct __packed _evt_blue_aci{
sjallouli 0:a948f5f3904c 408 uint16_t ecode;
sjallouli 0:a948f5f3904c 409 uint8_t data[0];
sjallouli 0:a948f5f3904c 410 } PACKED evt_blue_aci;
sjallouli 0:a948f5f3904c 411
sjallouli 0:a948f5f3904c 412 /* HCI vendor specific event */
sjallouli 0:a948f5f3904c 413 #define EVT_BLUE_INITIALIZED (0x0001)
sjallouli 0:a948f5f3904c 414
sjallouli 0:a948f5f3904c 415 /* GAP Vendor specific event codes */
sjallouli 0:a948f5f3904c 416 #define EVT_BLUE_GAP_SET_LIMITED_DISCOVERABLE (0x0400)
sjallouli 0:a948f5f3904c 417 #define EVT_BLUE_GAP_PAIRING_CMPLT (0x0401)
sjallouli 0:a948f5f3904c 418 #define EVT_BLUE_GAP_PASS_KEY_REQUEST (0x0402)
sjallouli 0:a948f5f3904c 419 #define EVT_BLUE_GAP_AUTHORIZATION_REQUEST (0x0403)
sjallouli 0:a948f5f3904c 420 #define EVT_BLUE_GAP_SLAVE_SECURITY_INITIATED (0X0404)
sjallouli 0:a948f5f3904c 421 #define EVT_BLUE_GAP_DEVICE_FOUND (0x0406)
sjallouli 0:a948f5f3904c 422 typedef struct __packed _evt_gap_device_found{
sjallouli 0:a948f5f3904c 423 uint8_t peer_address_type;
sjallouli 0:a948f5f3904c 424 uint8_t peer_address[6];
sjallouli 0:a948f5f3904c 425 } PACKED evt_gap_device_found;
sjallouli 0:a948f5f3904c 426 #define EVT_BLUE_GAP_PROCEDURE_COMPLETE (0x0407)
sjallouli 0:a948f5f3904c 427 typedef struct __packed _evt_gap_procedure_complete{
sjallouli 0:a948f5f3904c 428 uint8_t procedure_code;
sjallouli 0:a948f5f3904c 429 uint8_t status;
sjallouli 0:a948f5f3904c 430 uint8_t data[0];
sjallouli 0:a948f5f3904c 431 } PACKED evt_gap_procedure_complete;
sjallouli 0:a948f5f3904c 432
sjallouli 0:a948f5f3904c 433 /* L2CAP vendor specific event codes */
sjallouli 0:a948f5f3904c 434 #define EVT_BLUE_L2CAP_CONN_UPD_RESP (0x0800)
sjallouli 0:a948f5f3904c 435 typedef struct __packed _evt_l2cap_conn_param_upd_resp{
sjallouli 0:a948f5f3904c 436 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 437 uint8_t packet_length;
sjallouli 0:a948f5f3904c 438 uint8_t code;
sjallouli 0:a948f5f3904c 439 uint8_t id;
sjallouli 0:a948f5f3904c 440 uint16_t l2c_lenght;
sjallouli 0:a948f5f3904c 441 uint16_t result;
sjallouli 0:a948f5f3904c 442 } PACKED evt_l2cap_conn_param_upd_resp;
sjallouli 0:a948f5f3904c 443 #define EVT_L2CAP_CONN_PARAM_UPD_RESP_SIZE 9
sjallouli 0:a948f5f3904c 444
sjallouli 0:a948f5f3904c 445 #define EVT_BLUE_L2CAP_PROCEDURE_TIMEOUT (0x0801)
sjallouli 0:a948f5f3904c 446
sjallouli 0:a948f5f3904c 447
sjallouli 0:a948f5f3904c 448 /* vendor specific debug events */
sjallouli 0:a948f5f3904c 449 #define EVT_BLUE_DEBUG (0x1000)
sjallouli 0:a948f5f3904c 450
sjallouli 0:a948f5f3904c 451 /* GATT vendor specific event codes */
sjallouli 0:a948f5f3904c 452 #define EVT_BLUE_GATT_ATTRIBUTE_MODIFIED (0x0C01)
sjallouli 0:a948f5f3904c 453 typedef struct __packed _evt_gatt_attr_modified{
sjallouli 0:a948f5f3904c 454 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 455 uint16_t attr_handle;
sjallouli 0:a948f5f3904c 456 uint8_t data_length;
sjallouli 0:a948f5f3904c 457 uint8_t att_data[0];
sjallouli 0:a948f5f3904c 458 } PACKED evt_gatt_attr_modified;
sjallouli 0:a948f5f3904c 459
sjallouli 0:a948f5f3904c 460 #define EVT_BLUE_GATT_PROCEDURE_TIMEOUT (0x0C02)
sjallouli 0:a948f5f3904c 461 #define EVT_BLUE_EXCHANGE_MTU_RESP (0x0C03)
sjallouli 0:a948f5f3904c 462 #define EVT_BLUE_ATT_FIND_INFORMATION_RESP (0x0C04)
sjallouli 0:a948f5f3904c 463 typedef struct __packed _evt_att_find_information_resp{
sjallouli 0:a948f5f3904c 464 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 465 uint8_t event_data_length;
sjallouli 0:a948f5f3904c 466 uint8_t format;
sjallouli 0:a948f5f3904c 467 uint8_t handle_uuid_pair[0];
sjallouli 0:a948f5f3904c 468 } PACKED evt_att_find_information_resp;
sjallouli 0:a948f5f3904c 469
sjallouli 0:a948f5f3904c 470 #define EVT_BLUE_ATT_FIND_BY_TYPE_VAL_RESP (0x0C05)
sjallouli 0:a948f5f3904c 471 #define EVT_BLUE_ATT_READ_BY_TYPE_RESP (0x0C06)
sjallouli 0:a948f5f3904c 472 typedef struct __packed _evt_att_read_by_type_resp{
sjallouli 0:a948f5f3904c 473 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 474 uint8_t event_data_length;
sjallouli 0:a948f5f3904c 475 uint8_t handle_value_pair_length;
sjallouli 0:a948f5f3904c 476 uint8_t handle_value_pair[0];
sjallouli 0:a948f5f3904c 477 } PACKED evt_att_read_by_type_resp;
sjallouli 0:a948f5f3904c 478
sjallouli 0:a948f5f3904c 479 #define EVT_BLUE_ATT_READ_RESP (0x0C07)
sjallouli 0:a948f5f3904c 480 #define EVT_BLUE_ATT_READ_BLOB_RESP (0x0C08)
sjallouli 0:a948f5f3904c 481 #define EVT_BLUE_ATT_READ_MULTIPLE_RESP (0x0C09)
sjallouli 0:a948f5f3904c 482 #define EVT_BLUE_ATT_READ_BY_GROUP_RESP (0x0C0A)
sjallouli 0:a948f5f3904c 483 typedef struct __packed _evt_att_read_by_group_resp{
sjallouli 0:a948f5f3904c 484 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 485 uint8_t event_data_length;
sjallouli 0:a948f5f3904c 486 uint8_t handle_value_pair_length;
sjallouli 0:a948f5f3904c 487 uint8_t handle_value_pair[0];
sjallouli 0:a948f5f3904c 488 } PACKED evt_att_read_by_group_resp;
sjallouli 0:a948f5f3904c 489
sjallouli 0:a948f5f3904c 490 #define EVT_BLUE_ATT_WRITE_RESP (0x0C0B)
sjallouli 0:a948f5f3904c 491 #define EVT_BLUE_ATT_PREPARE_WRITE_RESP (0x0C0C)
sjallouli 0:a948f5f3904c 492 #define EVT_BLUE_ATT_EXEC_WRITE_RESP (0x0C0D)
sjallouli 0:a948f5f3904c 493 #define EVT_BLUE_GATT_INDICATION (0x0C0E)
sjallouli 0:a948f5f3904c 494 #define EVT_BLUE_GATT_NOTIFICATION (0x0C0F)
sjallouli 0:a948f5f3904c 495 typedef struct __packed _evt_gatt_notification{
sjallouli 0:a948f5f3904c 496 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 497 uint8_t data_length; // Lenght of attribute value + handle.
sjallouli 0:a948f5f3904c 498 uint16_t attr_handle;
sjallouli 0:a948f5f3904c 499 uint8_t attr_value[0];
sjallouli 0:a948f5f3904c 500 } PACKED evt_gatt_attr_notification;
sjallouli 0:a948f5f3904c 501
sjallouli 0:a948f5f3904c 502 #define EVT_BLUE_GATT_PROCEDURE_COMPLETE (0x0C10)
sjallouli 0:a948f5f3904c 503 typedef struct __packed _evt_gatt_procedure_complete{
sjallouli 0:a948f5f3904c 504 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 505 uint8_t data_length;
sjallouli 0:a948f5f3904c 506 uint8_t data[0];
sjallouli 0:a948f5f3904c 507 } PACKED evt_gatt_procedure_complete;
sjallouli 0:a948f5f3904c 508
sjallouli 0:a948f5f3904c 509 #define EVT_BLUE_GATT_ERROR_RESP (0x0C11)
sjallouli 0:a948f5f3904c 510 #define EVT_BLUE_GATT_DISC_READ_CHAR_BY_UUID_RESP (0x0C12)
sjallouli 0:a948f5f3904c 511 #define EVT_BLUE_GATT_WRITE_PERMIT_REQ (0x0C13)
sjallouli 0:a948f5f3904c 512 typedef struct __packed _evt_gatt_write_permit_req{
sjallouli 0:a948f5f3904c 513 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 514 uint16_t attr_handle;
sjallouli 0:a948f5f3904c 515 uint8_t data_length;
sjallouli 0:a948f5f3904c 516 uint8_t offset_data[0];
sjallouli 0:a948f5f3904c 517 } PACKED evt_gatt_write_permit_req;
sjallouli 0:a948f5f3904c 518
sjallouli 0:a948f5f3904c 519 #define EVT_BLUE_GATT_READ_PERMIT_REQ (0x0C14)
sjallouli 0:a948f5f3904c 520 typedef struct __packed _evt_gatt_read_permit_req{
sjallouli 0:a948f5f3904c 521 uint16_t conn_handle;
sjallouli 0:a948f5f3904c 522 uint16_t attr_handle;
sjallouli 0:a948f5f3904c 523 uint8_t data_length;
sjallouli 0:a948f5f3904c 524 uint8_t offset_data[0];
sjallouli 0:a948f5f3904c 525 } PACKED evt_gatt_read_permit_req;
sjallouli 0:a948f5f3904c 526
sjallouli 0:a948f5f3904c 527 #define EVT_BLUE_GATT_READ_MULTI_PERMIT_REQ (0x0C15)
sjallouli 0:a948f5f3904c 528
sjallouli 0:a948f5f3904c 529
sjallouli 0:a948f5f3904c 530
sjallouli 0:a948f5f3904c 531 #endif /* __BLUENRG_HCI_INTERNAL_H_ */