Added support for obtaining BLE device name by parsing advertising data.

Fork of BLE_BlueNRG by Mridupawan Das

Committer:
mridup
Date:
Wed Jul 16 04:59:51 2014 +0000
Revision:
0:309c845d289d
Child:
2:a2b623661316
Full BlueNRG library

Who changed what in which revision?

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