BLE UART example
Fork of Nucleo_BLE_BlueNRG by
hci/inc/bluenrg_gap.h@3:104f1bba39ca, 2016-01-03 (annotated)
- Committer:
- sjallouli
- Date:
- Sun Jan 03 16:05:38 2016 +0000
- Revision:
- 3:104f1bba39ca
- Parent:
- 0:a948f5f3904c
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sjallouli | 0:a948f5f3904c | 1 | /******************** (C) COPYRIGHT 2012 STMicroelectronics ******************** |
sjallouli | 0:a948f5f3904c | 2 | * File Name : gap.h |
sjallouli | 0:a948f5f3904c | 3 | * Author : AMS - HEA&RF BU |
sjallouli | 0:a948f5f3904c | 4 | * Version : V1.0.0 |
sjallouli | 0:a948f5f3904c | 5 | * Date : 19-July-2012 |
sjallouli | 0:a948f5f3904c | 6 | * Description : Header file for BlueNRG's GAP layer. |
sjallouli | 0:a948f5f3904c | 7 | ******************************************************************************** |
sjallouli | 0:a948f5f3904c | 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
sjallouli | 0:a948f5f3904c | 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
sjallouli | 0:a948f5f3904c | 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
sjallouli | 0:a948f5f3904c | 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
sjallouli | 0:a948f5f3904c | 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
sjallouli | 0:a948f5f3904c | 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
sjallouli | 0:a948f5f3904c | 14 | *******************************************************************************/ |
sjallouli | 0:a948f5f3904c | 15 | #ifndef __GAP_HCI_H__ |
sjallouli | 0:a948f5f3904c | 16 | #define __GAP_HCI_H__ |
sjallouli | 0:a948f5f3904c | 17 | |
sjallouli | 0:a948f5f3904c | 18 | #include <link_layer.h> |
sjallouli | 0:a948f5f3904c | 19 | |
sjallouli | 0:a948f5f3904c | 20 | /*----------------GAP UUIDs--------------------------*/ |
sjallouli | 0:a948f5f3904c | 21 | #define GAP_SERVICE_UUID (0x1800) |
sjallouli | 0:a948f5f3904c | 22 | #define DEVICE_NAME_UUID (0x2A00) |
sjallouli | 0:a948f5f3904c | 23 | #define APPEARANCE_UUID (0x2A01) |
sjallouli | 0:a948f5f3904c | 24 | #define PERIPHERAL_PRIVACY_FLAG_UUID (0x2A02) |
sjallouli | 0:a948f5f3904c | 25 | #define RECONNECTION_ADDR_UUID (0x2A03) |
sjallouli | 0:a948f5f3904c | 26 | #define PERIPHERAL_PREFERRED_CONN_PARAMS_UUID (0x2A04) |
sjallouli | 0:a948f5f3904c | 27 | |
sjallouli | 0:a948f5f3904c | 28 | /*----------------Characteristic value lengths--------------*/ |
sjallouli | 0:a948f5f3904c | 29 | #define DEVICE_NAME_CHARACTERISTIC_LEN (8) |
sjallouli | 0:a948f5f3904c | 30 | #define APPEARANCE_CHARACTERISTIC_LEN (2) |
sjallouli | 0:a948f5f3904c | 31 | #define PERIPHERAL_PRIVACY_CHARACTERISTIC_LEN (1) |
sjallouli | 0:a948f5f3904c | 32 | #define RECONNECTION_ADDR_CHARACTERISTIC_LEN (6) |
sjallouli | 0:a948f5f3904c | 33 | #define PERIPHERAL_PREF_CONN_PARAMS_CHARACTERISTIC_LEN (8) |
sjallouli | 0:a948f5f3904c | 34 | |
sjallouli | 0:a948f5f3904c | 35 | /*------------- AD types for adv data and scan response data ----------------*/ |
sjallouli | 0:a948f5f3904c | 36 | |
sjallouli | 0:a948f5f3904c | 37 | /* FLAGS AD type */ |
sjallouli | 0:a948f5f3904c | 38 | #define AD_TYPE_FLAGS (0x01) |
sjallouli | 0:a948f5f3904c | 39 | /* flag bits */ |
sjallouli | 0:a948f5f3904c | 40 | #define FLAG_BIT_LE_LIMITED_DISCOVERABLE_MODE (0x01) |
sjallouli | 0:a948f5f3904c | 41 | #define FLAG_BIT_LE_GENERAL_DISCOVERABLE_MODE (0x02) |
sjallouli | 0:a948f5f3904c | 42 | #define FLAG_BIT_BR_EDR_NOT_SUPPORTED (0x04) |
sjallouli | 0:a948f5f3904c | 43 | #define FLAG_BIT_LE_BR_EDR_CONTROLLER (0x08)/* single device supports BR/EDR and LE controller */ |
sjallouli | 0:a948f5f3904c | 44 | #define FLAG_BIT_LE_BR_EDR_HOST (0x10)/* single device supports BR/EDR and LE host */ |
sjallouli | 0:a948f5f3904c | 45 | |
sjallouli | 0:a948f5f3904c | 46 | /* SERVICE UUID AD types */ |
sjallouli | 0:a948f5f3904c | 47 | #define AD_TYPE_16_BIT_SERV_UUID (0x02) |
sjallouli | 0:a948f5f3904c | 48 | #define AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST (0x03) |
sjallouli | 0:a948f5f3904c | 49 | #define AD_TYPE_32_BIT_SERV_UUID (0x04) |
sjallouli | 0:a948f5f3904c | 50 | #define AD_TYPE_32_BIT_SERV_UUID_CMPLT_LIST (0x05) |
sjallouli | 0:a948f5f3904c | 51 | #define AD_TYPE_128_BIT_SERV_UUID (0x06) |
sjallouli | 0:a948f5f3904c | 52 | #define AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST (0x07) |
sjallouli | 0:a948f5f3904c | 53 | |
sjallouli | 0:a948f5f3904c | 54 | /* LOCAL NAME AD types */ |
sjallouli | 0:a948f5f3904c | 55 | #define AD_TYPE_SHORTENED_LOCAL_NAME (0x08) |
sjallouli | 0:a948f5f3904c | 56 | #define AD_TYPE_COMPLETE_LOCAL_NAME (0x09) |
sjallouli | 0:a948f5f3904c | 57 | |
sjallouli | 0:a948f5f3904c | 58 | /* TX power level AD type*/ |
sjallouli | 0:a948f5f3904c | 59 | #define AD_TYPE_TX_POWER_LEVEL (0x0A) |
sjallouli | 0:a948f5f3904c | 60 | |
sjallouli | 0:a948f5f3904c | 61 | /* security manager TK value AD type */ |
sjallouli | 0:a948f5f3904c | 62 | #define AD_TYPE_SEC_MGR_TK_VALUE (0x10) |
sjallouli | 0:a948f5f3904c | 63 | |
sjallouli | 0:a948f5f3904c | 64 | /* security manager OOB flags */ |
sjallouli | 0:a948f5f3904c | 65 | #define AD_TYPE_SEC_MGR_OOB_FLAGS (0x11) |
sjallouli | 0:a948f5f3904c | 66 | |
sjallouli | 0:a948f5f3904c | 67 | /* slave connection interval AD type */ |
sjallouli | 0:a948f5f3904c | 68 | #define AD_TYPE_SLAVE_CONN_INTERVAL (0x12) |
sjallouli | 0:a948f5f3904c | 69 | |
sjallouli | 0:a948f5f3904c | 70 | /* service solicitation UUID list Ad types*/ |
sjallouli | 0:a948f5f3904c | 71 | #define AD_TYPE_SERV_SOLICIT_16_BIT_UUID_LIST (0x14) |
sjallouli | 0:a948f5f3904c | 72 | #define AD_TYPE_SERV_SOLICIT_32_BIT_UUID_LIST (0x15) |
sjallouli | 0:a948f5f3904c | 73 | |
sjallouli | 0:a948f5f3904c | 74 | /* service data AD type */ |
sjallouli | 0:a948f5f3904c | 75 | #define AD_TYPE_SERVICE_DATA (0x16) |
sjallouli | 0:a948f5f3904c | 76 | |
sjallouli | 0:a948f5f3904c | 77 | /* manufaturer specific data AD type */ |
sjallouli | 0:a948f5f3904c | 78 | #define AD_TYPE_MANUFACTURER_SPECIFIC_DATA (0xFF) |
sjallouli | 0:a948f5f3904c | 79 | |
sjallouli | 0:a948f5f3904c | 80 | #define MAX_ADV_DATA_LEN (31) |
sjallouli | 0:a948f5f3904c | 81 | |
sjallouli | 0:a948f5f3904c | 82 | #define DEVICE_NAME_LEN (7) |
sjallouli | 0:a948f5f3904c | 83 | #define BD_ADDR_SIZE (6) |
sjallouli | 0:a948f5f3904c | 84 | |
sjallouli | 0:a948f5f3904c | 85 | /* privacy flag values */ |
sjallouli | 0:a948f5f3904c | 86 | #define PRIVACY_ENABLED (0x01) |
sjallouli | 0:a948f5f3904c | 87 | #define PRIVACY_DISABLED (0x00) |
sjallouli | 0:a948f5f3904c | 88 | |
sjallouli | 0:a948f5f3904c | 89 | /* conection intervals in terms of 625 micro sec */ |
sjallouli | 0:a948f5f3904c | 90 | #define DIR_CONN_ADV_INT_MIN (0x190)/*250ms*/ |
sjallouli | 0:a948f5f3904c | 91 | #define DIR_CONN_ADV_INT_MAX (0x320)/*500ms*/ |
sjallouli | 0:a948f5f3904c | 92 | #define UNDIR_CONN_ADV_INT_MIN (0x800)/*1.28s*/ |
sjallouli | 0:a948f5f3904c | 93 | #define UNDIR_CONN_ADV_INT_MAX (0x1000)/*2.56s*/ |
sjallouli | 0:a948f5f3904c | 94 | #define LIM_DISC_ADV_INT_MIN (0x190)/*250ms*/ |
sjallouli | 0:a948f5f3904c | 95 | #define LIM_DISC_ADV_INT_MAX (0x320)/*500ms*/ |
sjallouli | 0:a948f5f3904c | 96 | #define GEN_DISC_ADV_INT_MIN (0x800)/*1.28s*/ |
sjallouli | 0:a948f5f3904c | 97 | #define GEN_DISC_ADV_INT_MAX (0x1000)/*2.56s*/ |
sjallouli | 0:a948f5f3904c | 98 | |
sjallouli | 0:a948f5f3904c | 99 | /* time out values */ |
sjallouli | 0:a948f5f3904c | 100 | #define LIM_DISC_MODE_TIMEOUT (180000)/* 180 seconds. according to the errata published */ |
sjallouli | 0:a948f5f3904c | 101 | #define PRIVATE_ADDR_INT_TIMEOUT (900000)/* 15 minutes */ |
sjallouli | 0:a948f5f3904c | 102 | |
sjallouli | 0:a948f5f3904c | 103 | typedef tHalUint8 tGapRole; |
sjallouli | 0:a948f5f3904c | 104 | #define GAP_PERIPHERAL_ROLE (0x01) |
sjallouli | 0:a948f5f3904c | 105 | #define GAP_BROADCASTER_ROLE (0x02) |
sjallouli | 0:a948f5f3904c | 106 | #define GAP_CENTRAL_ROLE (0x03) |
sjallouli | 0:a948f5f3904c | 107 | #define GAP_OBSERVER_ROLE (0x04) |
sjallouli | 0:a948f5f3904c | 108 | |
sjallouli | 0:a948f5f3904c | 109 | typedef tHalUint8 tGapMode; |
sjallouli | 0:a948f5f3904c | 110 | #define GAP_NON_DISC_MODE (0x01) |
sjallouli | 0:a948f5f3904c | 111 | #define GAP_LIM_DISC_MODE (0x02) |
sjallouli | 0:a948f5f3904c | 112 | #define GAP_GEN_DISC_MODE (0x04) |
sjallouli | 0:a948f5f3904c | 113 | #define GAP_NON_CONN_MODE (0x08) |
sjallouli | 0:a948f5f3904c | 114 | #define GAP_DIRECT_CONN_MODE (0x10) |
sjallouli | 0:a948f5f3904c | 115 | #define GAP_UNDIRECTED_CONN_MODE (0x20) |
sjallouli | 0:a948f5f3904c | 116 | |
sjallouli | 0:a948f5f3904c | 117 | /* SECURITY MANAGER OOB FLAGS */ |
sjallouli | 0:a948f5f3904c | 118 | #define SM_OOB_FLAGS_FIELD (0x01) |
sjallouli | 0:a948f5f3904c | 119 | #define SM_OOB_LE_SUPPORTED (0x02) |
sjallouli | 0:a948f5f3904c | 120 | #define SM_OOB_SIMULTANEOUS_LE_BREDR (0x04) |
sjallouli | 0:a948f5f3904c | 121 | #define SM_OOB_ADDR_TYPE (0x08) |
sjallouli | 0:a948f5f3904c | 122 | |
sjallouli | 0:a948f5f3904c | 123 | |
sjallouli | 0:a948f5f3904c | 124 | #endif /* __GAP_H__ */ |