TI BLE Stack API Documentation  2.03.08
gap.h
1 /******************************************************************************
2 
3  @file gap.h
4 
5  @brief BLE GAP API
6 
7  This file contains the interface to the GAP.
8 
9  \image html HighLevelGAP.PNG
10 
11  \htmlinclude GAPDesc.html
12 
13  \image html CentralDeviceDiscoveryProcess.PNG
14 
15  A central device can scan for advertising peripheral and broadcaster
16  devices. The Observer process is similar to the central process except
17  that will not receive the SCAN_RSP data. <BR><BR>
18  The central device will initialize the device, then ask for a device
19  discovery. The GAP will setup the link layer to scan and it will
20  filter incoming advertisements and SCAN_RSPs based on the type of
21  device discovery parameters passed in when GAP_DeviceDiscoveryRequest()
22  was called. Then, when the scan is complete, it will return an array of
23  devices that pass through its filter. <BR><BR>
24 
25  \image html CentralLinkEstablishmentProcess.PNG
26 
27  After the Device Discovery Process, the central device can establish a
28  connection with a peripheral device by calling
29  GAP_EstablishLinkRequest(). When the link has been established the GAP
30  will send back the @ref GAP_LINK_ESTABLISHED_EVENT
31  [GAP_LinkEstablished]. <BR><BR>
32 
33  \image html CentralPairingProcess.PNG
34 
35  After a link is established, the central device can initiate a pairing
36  process to either encrypt the link or exchange keys for bonding.
37  <BR><BR><BR><BR><BR><BR>
38 
39  Group: WCS, BTS
40  $Target Device: DEVICES $
41 
42  ******************************************************************************
43  $License: TISD 2009 $
44  ******************************************************************************
45  $Release Name: PACKAGE NAME $
46  $Release Date: PACKAGE RELEASE DATE $
47  *****************************************************************************/
48 
49 
50 #ifndef GAP_H
51 #define GAP_H
52 
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57 
58 /*-------------------------------------------------------------------
59  * INCLUDES
60  */
61 #include "bcomdef.h"
62 #include "osal.h"
63 #include "sm.h"
64 
65 /*-------------------------------------------------------------------
66  * MACROS
67  */
68 
69 /*-------------------------------------------------------------------
70  * CONSTANTS
71  */
72 
80 #define GAP_DEVICE_INIT_DONE_EVENT 0x00
81 #define GAP_DEVICE_DISCOVERY_EVENT 0x01
82 #define GAP_ADV_DATA_UPDATE_DONE_EVENT 0x02
83 #define GAP_MAKE_DISCOVERABLE_DONE_EVENT 0x03
84 #define GAP_END_DISCOVERABLE_DONE_EVENT 0x04
85 #define GAP_LINK_ESTABLISHED_EVENT 0x05
86 #define GAP_LINK_TERMINATED_EVENT 0x06
87 #define GAP_LINK_PARAM_UPDATE_EVENT 0x07
88 #define GAP_RANDOM_ADDR_CHANGED_EVENT 0x08
89 #define GAP_SIGNATURE_UPDATED_EVENT 0x09
90 #define GAP_AUTHENTICATION_COMPLETE_EVENT 0x0A
91 #define GAP_PASSKEY_NEEDED_EVENT 0x0B
92 #define GAP_SLAVE_REQUESTED_SECURITY_EVENT 0x0C
93 #define GAP_DEVICE_INFO_EVENT 0x0D
94 #define GAP_BOND_COMPLETE_EVENT 0x0E
95 #define GAP_PAIRING_REQ_EVENT 0x0F
96 #define GAP_AUTHENTICATION_FAILURE_EVT 0x10
97 #define GAP_UPDATE_LINK_PARAM_REQ_EVENT 0x11
98 
104 #define GAP_CONNHANDLE_INIT 0xFFFE
105 #define GAP_CONNHANDLE_ALL 0xFFFF
106 
112 #define GAP_PROFILE_BROADCASTER 0x01
113 #define GAP_PROFILE_OBSERVER 0x02
114 #define GAP_PROFILE_PERIPHERAL 0x04
115 #define GAP_PROFILE_CENTRAL 0x08
116 
123 // Timers
124 #define TGAP_GEN_DISC_ADV_MIN 0
125 #define TGAP_LIM_ADV_TIMEOUT 1
126 #define TGAP_GEN_DISC_SCAN 2
127 #define TGAP_LIM_DISC_SCAN 3
128 #define TGAP_CONN_EST_ADV_TIMEOUT 4
129 #define TGAP_CONN_PARAM_TIMEOUT 5
130 
131 // Constants
132 #define TGAP_LIM_DISC_ADV_INT_MIN 6
133 #define TGAP_LIM_DISC_ADV_INT_MAX 7
134 #define TGAP_GEN_DISC_ADV_INT_MIN 8
135 #define TGAP_GEN_DISC_ADV_INT_MAX 9
136 #define TGAP_CONN_ADV_INT_MIN 10
137 #define TGAP_CONN_ADV_INT_MAX 11
138 #define TGAP_CONN_SCAN_INT 12
139 #define TGAP_CONN_SCAN_WIND 13
140 #define TGAP_CONN_HIGH_SCAN_INT 14
141 #define TGAP_CONN_HIGH_SCAN_WIND 15
142 #define TGAP_GEN_DISC_SCAN_INT 16
143 #define TGAP_GEN_DISC_SCAN_WIND 17
144 #define TGAP_LIM_DISC_SCAN_INT 18
145 #define TGAP_LIM_DISC_SCAN_WIND 19
146 #define TGAP_CONN_EST_ADV 20
147 #define TGAP_CONN_EST_INT_MIN 21
148 #define TGAP_CONN_EST_INT_MAX 22
149 #define TGAP_CONN_EST_SCAN_INT 23
150 #define TGAP_CONN_EST_SCAN_WIND 24
151 #define TGAP_CONN_EST_SUPERV_TIMEOUT 25
152 #define TGAP_CONN_EST_LATENCY 26
153 #define TGAP_CONN_EST_MIN_CE_LEN 27
154 #define TGAP_CONN_EST_MAX_CE_LEN 28
155 #define TGAP_PRIVATE_ADDR_INT 29
156 #define TGAP_CONN_PAUSE_CENTRAL 30
157 #define TGAP_CONN_PAUSE_PERIPHERAL 31
158 
159 // Proprietary
160 #define TGAP_SM_TIMEOUT 32
161 #define TGAP_SM_MIN_KEY_LEN 33
162 #define TGAP_SM_MAX_KEY_LEN 34
163 #define TGAP_FILTER_ADV_REPORTS 35
164 #define TGAP_SCAN_RSP_RSSI_MIN 36
165 #define TGAP_REJECT_CONN_PARAMS 37
166 
167 #if !defined ( TESTMODES )
168  #define TGAP_AUTH_TASK_ID 38
169  #define TGAP_VERIFY_CAR 39
170  #define TGAP_PARAMID_MAX 40
171 #else
172  #define TGAP_GAP_TESTCODE 38
173  #define TGAP_SM_TESTCODE 39
174  #define TGAP_AUTH_TASK_ID 40
175  #define TGAP_VERIFY_CAR 41
176  #define TGAP_PARAMID_MAX 42
177 
178  #define TGAP_GATT_TESTCODE 100
179  #define TGAP_ATT_TESTCODE 101
180  #define TGAP_GGS_TESTCODE 102
181  #define TGAP_L2CAP_TESTCODE 103
182 #endif
183 
189 #define DEVDISC_MODE_NONDISCOVERABLE 0x00
190 #define DEVDISC_MODE_GENERAL 0x01
191 #define DEVDISC_MODE_LIMITED 0x02
192 #define DEVDISC_MODE_ALL 0x03
193 
198 #define ADDRTYPE_PUBLIC 0x00
199 #define ADDRTYPE_RANDOM 0x01
200 #define ADDRTYPE_PUBLIC_ID 0x02
201 #define ADDRTYPE_RANDOM_ID 0x03
202 
207 #define SET_ADDRTYPE_ID 0x02 // OR with addrtype to change addr type to ID
208 #define MASK_ADDRTYPE_ID 0x01 // AND with addrtype to remove ID from type
209 
214 #define RANDOM_ADDR_SUBTYPE_STATIC 0x00
215 #define RANDOM_ADDR_SUBTYPE_RPA 0x01
216 #define RANDOM_ADDR_SUBTYPE_NRPA 0x02
217 
222 #define RANDOM_ADDR_HDR_MASK 0xC0 // Get top 2 bits of address
223 #define STATIC_ADDR_HDR 0xC0 // Random Static Address (b11)
224 #define PRIVATE_NON_RESOLVE_ADDR_HDR 0x80 // Random Private Non-Resolvable Address (b10)
225 #define PRIVATE_RESOLVE_ADDR_HDR 0x40 // Random Private Resolvable Address (b01)
226 
231 #define ADDRMODE_PUBLIC 0x00
232 #define ADDRMODE_STATIC 0x01
233 #define ADDRMODE_PRIVATE_NONRESOLVE 0x02
234 #define ADDRMODE_PRIVATE_RESOLVE 0x03
235 
241 #define GAP_ADTYPE_ADV_IND 0x00
242 #define GAP_ADTYPE_ADV_HDC_DIRECT_IND 0x01
243 #define GAP_ADTYPE_ADV_SCAN_IND 0x02
244 #define GAP_ADTYPE_ADV_NONCONN_IND 0x03
245 #define GAP_ADTYPE_ADV_LDC_DIRECT_IND 0x04
246 
252 #define GAP_ADRPT_ADV_IND 0x00
253 #define GAP_ADRPT_ADV_DIRECT_IND 0x01
254 #define GAP_ADRPT_ADV_SCAN_IND 0x02
255 #define GAP_ADRPT_ADV_NONCONN_IND 0x03
256 #define GAP_ADRPT_SCAN_RSP 0x04
257 
262 #define GAP_FILTER_POLICY_ALL 0x00
263 #define GAP_FILTER_POLICY_WHITE_SCAN 0x01
264 #define GAP_FILTER_POLICY_WHITE_CON 0x02
265 #define GAP_FILTER_POLICY_WHITE 0x03
266 
271 #define GAP_DISC_FILTER_POLICY_ALL 0x00
272 #define GAP_DISC_FILTER_POLICY_WHITE 0x01
273 #define GAP_DISC_FILTER_POLICY_ALL_DIRECT 0x02
274 #define GAP_DISC_FILTER_POLICY_WHITE_DIRECT 0x03
275 
277 #define ADV_CHANMAP_SIZE 5
279 
281 #define GAP_PASSCODE_MAX 999999
282 
286 #define GAP_INIT_SIGN_COUNTER 0xFFFFFFFF
287 
291 #define GAP_ADVCHAN_37 0x01
292 #define GAP_ADVCHAN_38 0x02
293 #define GAP_ADVCHAN_39 0x04
294 #define GAP_ADVCHAN_ALL (GAP_ADVCHAN_37 | GAP_ADVCHAN_38 | GAP_ADVCHAN_39)
295 
300 #define WL_NOTUSED 0x00
301 #define WL_USED 0x01
302 
308 #define GAP_ADTYPE_FLAGS 0x01
309 #define GAP_ADTYPE_16BIT_MORE 0x02
310 #define GAP_ADTYPE_16BIT_COMPLETE 0x03
311 #define GAP_ADTYPE_32BIT_MORE 0x04
312 #define GAP_ADTYPE_32BIT_COMPLETE 0x05
313 #define GAP_ADTYPE_128BIT_MORE 0x06
314 #define GAP_ADTYPE_128BIT_COMPLETE 0x07
315 #define GAP_ADTYPE_LOCAL_NAME_SHORT 0x08
316 #define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09
317 #define GAP_ADTYPE_POWER_LEVEL 0x0A
318 #define GAP_ADTYPE_OOB_CLASS_OF_DEVICE 0x0D
319 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E
320 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F
321 #define GAP_ADTYPE_SM_TK 0x10
322 #define GAP_ADTYPE_SM_OOB_FLAG 0x11
323 #define GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE 0x12
324 #define GAP_ADTYPE_SIGNED_DATA 0x13
325 #define GAP_ADTYPE_SERVICES_LIST_16BIT 0x14
326 #define GAP_ADTYPE_SERVICES_LIST_128BIT 0x15
327 #define GAP_ADTYPE_SERVICE_DATA 0x16
328 #define GAP_ADTYPE_PUBLIC_TARGET_ADDR 0x17
329 #define GAP_ADTYPE_RANDOM_TARGET_ADDR 0x18
330 #define GAP_ADTYPE_APPEARANCE 0x19
331 #define GAP_ADTYPE_ADV_INTERVAL 0x1A
332 #define GAP_ADTYPE_LE_BD_ADDR 0x1B
333 #define GAP_ADTYPE_LE_ROLE 0x1C
334 #define GAP_ADTYPE_SIMPLE_PAIRING_HASHC_256 0x1D
335 #define GAP_ADTYPE_SIMPLE_PAIRING_RANDR_256 0x1E
336 #define GAP_ADTYPE_SERVICE_DATA_32BIT 0x20
337 #define GAP_ADTYPE_SERVICE_DATA_128BIT 0x21
338 #define GAP_ADTYPE_3D_INFO_DATA 0x3D
339 #define GAP_ADTYPE_MANUFACTURER_SPECIFIC 0xFF
340 
345 #define GAP_ADTYPE_FLAGS_LIMITED 0x01
346 #define GAP_ADTYPE_FLAGS_GENERAL 0x02
347 #define GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
348 
353 #define GAP_STATE_IDLE 0x00
354 #define GAP_STATE_ADV 0x01
355 #define GAP_STATE_SCAN 0x02
356 #define GAP_STATE_INIT 0x04
357 
362 #define GAP_APPEARE_UNKNOWN 0x0000
363 #define GAP_APPEARE_GENERIC_PHONE 0x0040
364 #define GAP_APPEARE_GENERIC_COMPUTER 0x0080
365 #define GAP_APPEARE_GENERIC_WATCH 0x00C0
366 #define GAP_APPEARE_WATCH_SPORTS 0x00C1
367 #define GAP_APPEARE_GENERIC_CLOCK 0x0100
368 #define GAP_APPEARE_GENERIC_DISPLAY 0x0140
369 #define GAP_APPEARE_GENERIC_RC 0x0180
370 #define GAP_APPEARE_GENERIC_EYE_GALSSES 0x01C0
371 #define GAP_APPEARE_GENERIC_TAG 0x0200
372 #define GAP_APPEARE_GENERIC_KEYRING 0x0240
373 #define GAP_APPEARE_GENERIC_MEDIA_PLAYER 0x0280
374 #define GAP_APPEARE_GENERIC_BARCODE_SCANNER 0x02C0
375 #define GAP_APPEARE_GENERIC_THERMOMETER 0x0300
376 #define GAP_APPEARE_GENERIC_THERMO_EAR 0x0301
377 #define GAP_APPEARE_GENERIC_HR_SENSOR 0x0340
378 #define GAP_APPEARE_GENERIC_HRS_BELT 0x0341
379 #define GAP_APPEARE_GENERIC_BLOOD_PRESSURE 0x0380
380 #define GAP_APPEARE_GENERIC_BP_ARM 0x0381
381 #define GAP_APPEARE_GENERIC_BP_WRIST 0x0382
382 #define GAP_APPEARE_GENERIC_HID 0x03C0
383 #define GAP_APPEARE_HID_KEYBOARD 0x03C1
384 #define GAP_APPEARE_HID_MOUSE 0x03C2
385 #define GAP_APPEARE_HID_JOYSTIC 0x03C3
386 #define GAP_APPEARE_HID_GAMEPAD 0x03C4
387 #define GAP_APPEARE_HID_DIGITIZER_TYABLET 0x03C5
388 #define GAP_APPEARE_HID_DIGITAL_CARDREADER 0x03C6
389 #define GAP_APPEARE_HID_DIGITAL_PEN 0x03C7
390 #define GAP_APPEARE_HID_BARCODE_SCANNER 0x03C8
391 
393 /*-------------------------------------------------------------------
394  * TYPEDEFS - Initialization and Configuration
395  */
396 
400 typedef uint16 gapParamIDs_t;
401 
405 typedef struct
406 {
408  uint8 opcode;
409 } gapEventHdr_t;
410 
415 typedef struct
416 {
418  uint8 opcode;
419  uint8 addrMode;
420  uint8 newRandomAddr[B_ADDR_LEN];
422 
428 typedef struct
429 {
431  uint16 intervalMin;
433  uint16 intervalMax;
435  uint16 latency;
437  uint16 timeout;
439 
445 typedef struct
446 {
448  uint8 opcode;
449  uint8 devAddr[B_ADDR_LEN];
450  uint16 dataPktLen;
451  uint8 numDataPkts;
453 
462 typedef struct
463 {
465  uint8 opcode;
466  uint8 addrType;
467  uint8 devAddr[B_ADDR_LEN];
468  uint32 signCounter;
470 
476 typedef struct
477 {
479  uint8 opcode;
480  uint8 eventType;
481  uint8 addrType;
482  uint8 addr[B_ADDR_LEN];
483  int8 rssi;
484  uint8 dataLen;
485  uint8 *pEvtData;
487 
488 /*-------------------------------------------------------------------
489  * TYPEDEFS - Device Discovery
490  */
491 
495 typedef struct
496 {
497  uint8 taskID;
498  uint8 mode;
499  uint8 activeScan;
500  uint8 whiteList;
502 
506 typedef struct
507 {
508  uint8 eventType;
509  uint8 addrType;
510  uint8 addr[B_ADDR_LEN];
511 } gapDevRec_t;
512 
517 typedef struct
518 {
520  uint8 opcode;
521  uint8 numDevs;
524 
528 typedef struct
529 {
530  uint8 eventType;
532  uint8 initiatorAddr[B_ADDR_LEN];
533  uint8 channelMap;
534  uint8 filterPolicy;
536 
541 typedef struct
542 {
544  uint8 opcode;
546 
551 typedef struct
552 {
554  uint8 opcode;
556 
561 typedef struct
562 {
564  uint8 opcode;
565  uint8 adType;
567 
568 /*-------------------------------------------------------------------
569  * TYPEDEFS - Link Establishment
570  */
571 
575 typedef struct
576 {
577  uint8 taskID;
579  uint8 whiteList;
580  uint8 addrTypePeer;
581  uint8 peerAddr[B_ADDR_LEN];
583 
587 typedef struct
588 {
590  uint16 intervalMin;
591  uint16 intervalMax;
592  uint16 connLatency;
593  uint16 connTimeout;
595 
599 typedef struct
600 {
602  uint16 intervalMin;
603  uint16 intervalMax;
604  uint16 connLatency;
605  uint16 connTimeout;
606  uint8 accepted;
608 
614 typedef struct
615 {
617  uint8 opcode;
620 
628 typedef struct
629 {
631  uint8 opcode;
632  uint8 devAddrType;
633  uint8 devAddr[B_ADDR_LEN];
635  uint8 connRole;
636  uint16 connInterval;
637  uint16 connLatency;
638  uint16 connTimeout;
641 
646 typedef struct
647 {
649  uint8 opcode;
650  uint8 status;
652  uint16 connInterval;
653  uint16 connLatency;
654  uint16 connTimeout;
656 
661 typedef struct
662 {
664  uint8 opcode;
666  uint8 reason;
668 
669 /*-------------------------------------------------------------------
670  * TYPEDEFS - Authentication, Bounding and Pairing
671  */
672 
677 typedef struct
678 {
680  uint8 opcode;
681  uint8 deviceAddr[B_ADDR_LEN];
683  uint8 uiInputs;
684  uint8 uiOutputs;
685  uint32 numComparison;
687 
692 typedef struct
693 {
695  uint8 opcode;
697  uint8 authState;
703 
708 typedef struct
709 {
713 
718 typedef struct
719 {
721  uint8 opcode;
723  uint8 deviceAddr[B_ADDR_LEN];
724  uint8 authReq;
726 
731 typedef struct
732 {
734  uint8 opcode;
737 
741 typedef struct
742 {
743  uint8 ioCap;
744  uint8 oobDataFlag;
745  uint8 authReq;
749 
761 typedef struct
762 {
764  uint8 opcode;
768 
774 typedef struct
775 {
776  uint8 adType;
777  uint8 attrLen;
778  uint8 *pAttrData;
780 
784 typedef uint8 (*pfnSuppEnhPrivCB_t)
785 (
786  uint8 *deviceAddr
787 );
788 
792 typedef void (*pfnGapIdleCB_t)();
793 
797 typedef struct
798 {
802 
805 /*-------------------------------------------------------------------
806  * GLOBAL VARIABLES
807  */
808 
815 /*-------------------------------------------------------------------
816  * FUNCTIONS - Initialization and Configuration
817  */
818 
842  extern bStatus_t GAP_DeviceInit( uint8 taskID,
843  uint8 profileRole,
844  uint8 maxScanResponses,
845  uint8 *pIRK,
846  uint8 *pSRK,
847  uint32 *pSignCounter );
848 
865  extern bStatus_t GAP_SetAdvToken( gapAdvDataToken_t *pToken );
866 
874  extern gapAdvDataToken_t *GAP_GetAdvToken( uint8 adType );
875 
884  extern gapAdvDataToken_t *GAP_RemoveAdvToken( uint8 adType );
885 
892  extern bStatus_t GAP_UpdateAdvTokens( void );
893 
903  extern bStatus_t GAP_SetParamValue( gapParamIDs_t paramID, uint16 paramValue );
904 
912  extern uint16 GAP_GetParamValue( gapParamIDs_t paramID );
913 
933  extern bStatus_t GAP_ConfigDeviceAddr( uint8 addrMode, uint8 *pStaticAddr );
934 
943  extern void GAP_RegisterForMsgs( uint8 taskID );
944 
952  extern void GAP_RegisterBondMgrCBs( gapBondMgrCBs_t *pCBs );
953 
954 /*-------------------------------------------------------------------
955  * FUNCTIONS - Device Discovery
956  */
957 
968 
978  extern bStatus_t GAP_DeviceDiscoveryCancel( uint8 taskID );
979 
991  extern bStatus_t GAP_MakeDiscoverable( uint8 taskID, gapAdvertisingParams_t *pParams );
992 
1008  extern bStatus_t GAP_UpdateAdvertisingData( uint8 taskID, uint8 adType,
1009  uint8 dataLen, uint8 *pAdvertData );
1010 
1020  extern bStatus_t GAP_EndDiscoverable( uint8 taskID );
1021 
1022 #if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
1023 
1033  extern bStatus_t GAP_ResolvePrivateAddr( uint8 *pIRK, uint8 *pAddr );
1034 #endif // ! BLE_V42_FEATURES | ! PRIVACY_1_2_CFG
1035 
1036 /*-------------------------------------------------------------------
1037  * FUNCTIONS - Link Establishment
1038  */
1039 
1051  extern bStatus_t GAP_EstablishLinkReq( gapEstLinkReq_t *pParams );
1052 
1065  extern bStatus_t GAP_TerminateLinkReq( uint8 taskID, uint16 connectionHandle, uint8 reason );
1066 
1079 
1093 
1099  extern uint8 GAP_NumActiveConnections( void );
1100 
1101 /*-------------------------------------------------------------------
1102  * FUNCTIONS - Pairing
1103  */
1104 
1123  extern bStatus_t GAP_Authenticate( gapAuthParams_t *pParams, gapPairingReq_t *pPairReq );
1124 
1137  extern bStatus_t GAP_TerminateAuth( uint16 connectionHandle, uint8 reason );
1138 
1155  extern bStatus_t GAP_PasskeyUpdate( uint8 *pPasskey, uint16 connectionHandle );
1156 
1172  extern bStatus_t GAP_PasscodeUpdate( uint32 passcode, uint16 connectionHandle );
1173 
1186  extern bStatus_t GAP_SendSlaveSecurityRequest( uint16 connectionHandle, uint8 authReq );
1187 
1203  extern bStatus_t GAP_Signable( uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams );
1204 
1222  extern bStatus_t GAP_Bond( uint16 connectionHandle, uint8 authenticated,
1223  uint8 secureConnections, smSecurityInfo_t *pParams,
1224  uint8 startEncryption );
1225 
1230 /*-------------------------------------------------------------------
1231  * Internal API - These functions are only called from gap.c module.
1232  */
1233 
1244  extern bStatus_t GAP_ParamsInit( uint8 taskID, uint8 profileRole );
1245 
1255  extern void GAP_PrivacyInit( uint8 *pIRK );
1256 
1266  extern uint8 *GAP_GetIRK( void );
1267 
1282  extern void GAP_SecParamsInit( uint8 *pSRK, uint32 *pSignCounter );
1283 
1293  extern bStatus_t GAP_PeriDevMgrInit( void );
1294 
1304  extern void GAP_PeriConnRegister( void );
1305 
1316  extern bStatus_t GAP_CentDevMgrInit( uint8 maxScanResponses );
1317 
1327  extern void GAP_CentConnRegister( void );
1328 
1329 
1330 /*-------------------------------------------------------------------
1331  * TASK API - These functions must only be called OSAL.
1332  */
1333 
1343  extern void GAP_Init( uint8 task_id );
1344 
1355  extern uint16 GAP_ProcessEvent( uint8 task_id, uint16 events );
1356 
1357 
1358 /*-------------------------------------------------------------------
1359 -------------------------------------------------------------------*/
1360 
1361 #ifdef __cplusplus
1362 }
1363 #endif
1364 
1365 #endif /* GAP_H */
Definition: gap.h:708
uint16 intervalMax
Maximum Connection Interval.
Definition: gap.h:591
bStatus_t GAP_ResolvePrivateAddr(uint8 *pIRK, uint8 *pAddr)
Resolves a private address against an IRK.
uint8 channelMap
Channel Map: Bit mask GAP Advertisement Channel Map.
Definition: gap.h:533
Definition: gap.h:551
uint8 opcode
GAP_SIGNATURE_UPDATED_EVENT.
Definition: gap.h:465
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:648
uint8 activeScan
TRUE for active scanning.
Definition: gap.h:499
uint8 highDutyCycle
TRUE to high duty cycle scan, FALSE if not.
Definition: gap.h:578
uint8 opcode
GAP_ADV_DATA_UPDATE_DONE_EVENT.
Definition: gap.h:564
Definition: gap.h:599
uint16 connectionHandle
Connection Handle from controller used to ref the device.
Definition: gap.h:634
gapAdvDataToken_t * GAP_GetAdvToken(uint8 adType)
Called to read a GAP Advertisement/Scan Response data token.
bStatus_t GAP_UpdateAdvertisingData(uint8 taskID, uint8 adType, uint8 dataLen, uint8 *pAdvertData)
Setup or change advertising and scan response data.
smLinkSecurityReq_t secReqs
Pairing Control info.
Definition: gap.h:711
bStatus_t GAP_PasscodeUpdate(uint32 passcode, uint16 connectionHandle)
Update the passkey in a numeric value (not string). This function is called by the application/profil...
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:553
uint8 filterPolicy
Filer Policy: GAP Advertiser Filter Scan Parameters. Ignored when directed advertising is used...
Definition: gap.h:534
uint8 ioCap
Pairing Request ioCap field.
Definition: gap.h:743
uint8 opcode
GAP_LINK_TERMINATED_EVENT.
Definition: gap.h:664
uint16 connInterval
Connection Interval.
Definition: gap.h:636
Definition: sm.h:166
uint16 connectionHandle
connection Handle
Definition: gap.h:735
uint8 uiInputs
Pairing User Interface Inputs - Ask user to input passcode.
Definition: gap.h:683
Definition: gap.h:428
bStatus_t GAP_Bond(uint16 connectionHandle, uint8 authenticated, uint8 secureConnections, smSecurityInfo_t *pParams, uint8 startEncryption)
Set up the connection&#39;s bound paramaters.
void GAP_RegisterForMsgs(uint8 taskID)
Register your task ID to receive extra (unprocessed) HCI status and complete, and Host events...
uint8 opcode
GAP_AUTHENTICATION_COMPLETE_EVENT.
Definition: gap.h:695
Definition: gap.h:741
uint8 opcode
GAP_DEVICE_INFO_EVENT.
Definition: gap.h:479
uint8 authReq
Pairing Request Auth Req field.
Definition: gap.h:745
uint8 opcode
GAP_LINK_ESTABLISHED_EVENT.
Definition: gap.h:631
uint8 status
bStatus_t
Definition: gap.h:650
uint8 opcode
GAP_SLAVE_REQUESTED_SECURITY_EVENT.
Definition: gap.h:721
uint16 connLatency
Connection Latency.
Definition: gap.h:592
uint16 connTimeout
Connection Timeout.
Definition: gap.h:593
uint8 taskID
Requesting App/Profile&#39;s Task ID.
Definition: gap.h:577
uint8 opcode
GAP_END_DISCOVERABLE_DONE_EVENT.
Definition: gap.h:554
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:114
smSigningInfo_t * pSigningInfo
Signing information.
Definition: gap.h:699
pfnSuppEnhPrivCB_t supportEnhPrivCB
Supports Enhanced Privacy callback.
Definition: gap.h:799
Definition: gap.h:774
smSecurityInfo_t * pSecurityInfo
BOUND - security information from this device.
Definition: gap.h:698
uint8 connRole
Connection formed as Master or Slave.
Definition: gap.h:635
Definition: gap.h:415
uint16 intervalMax
Maximum Connection Interval.
Definition: gap.h:603
bStatus_t GAP_TerminateAuth(uint16 connectionHandle, uint8 reason)
Send a Pairing Failed message and end any existing pairing.
bStatus_t GAP_PasskeyUpdate(uint8 *pPasskey, uint16 connectionHandle)
Update the passkey in string format. This function is called by the application/profile in response t...
uint8 adType
ADTYPE value: GAP Advertisement Data Types.
Definition: gap.h:776
uint16 connLatency
Connection Latency.
Definition: gap.h:604
uint16 intervalMin
Definition: gap.h:431
Definition: gap.h:506
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:464
Definition: sm.h:184
uint8 eventType
Advertisement Type: GAP Advertising Report Event Types.
Definition: gap.h:480
Definition: gap.h:561
uint16 connTimeout
Requested connection timeout.
Definition: gap.h:654
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:694
uint8 * pEvtData
Data field of advertisement or SCAN_RSP.
Definition: gap.h:485
uint8 addrType
Device&#39;s address type for devAddr.
Definition: gap.h:466
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:679
uint8 numDevs
Number of devices found during scan.
Definition: gap.h:521
Definition: gap.h:718
uint8 opcode
GAP_DEVICE_DISCOVERY_EVENT.
Definition: gap.h:520
Definition: gap.h:405
uint8 eventType
Advertise Event Type: GAP Advertising Event Types.
Definition: gap.h:530
uint8 addrTypePeer
Address type of the advertiser: Address Types as defined by BLE Spec.
Definition: gap.h:580
Definition: gap.h:528
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:563
uint16 connectionHandle
Connection Handle from controller,.
Definition: gap.h:710
uint8(* pfnSuppEnhPrivCB_t)(uint8 *deviceAddr)
Definition: gap.h:785
Definition: gap.h:731
Definition: gap.h:517
bStatus_t GAP_TerminateLinkReq(uint8 taskID, uint16 connectionHandle, uint8 reason)
Terminate a link connection.
uint8 dataLen
Length (in bytes) of the data field (evtData)
Definition: gap.h:484
smIdentityInfo_t * pIdentityInfo
BOUND - identity information.
Definition: gap.h:701
uint16 connectionHandle
connection Handle
Definition: gap.h:765
uint8 clockAccuracy
Clock Accuracy.
Definition: gap.h:639
bStatus_t GAP_Signable(uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams)
Set up the connection to accept signed data.
uint8 eventType
Indicates advertising event type used by the advertiser: GAP Advertising Report Event Types...
Definition: gap.h:508
bStatus_t GAP_UpdateLinkParamReq(gapUpdateLinkParamReq_t *pParams)
Update the link parameters to a Master or Slave device.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:407
bStatus_t GAP_UpdateLinkParamReqReply(gapUpdateLinkParamReqReply_t *pParams)
Reply to a Connection Parameter Update Request sent from a remote device.
uint8 opcode
GAP_MAKE_DISCOVERABLE_DONE_EVENT.
Definition: gap.h:544
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:630
uint16 connLatency
Connection Latency.
Definition: gap.h:637
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:616
uint8 reason
termination reason from LL
Definition: gap.h:666
Definition: gap.h:677
smSecurityInfo_t * pDevSecInfo
BOUND - security information from connected device.
Definition: gap.h:700
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:519
uint8 addrType
Address Type: Address Types as defined by BLE Spec.
Definition: gap.h:509
gapAdvDataToken_t * GAP_RemoveAdvToken(uint8 adType)
Called to remove a GAP Advertisement/Scan Response data token.
Definition: gap.h:797
bStatus_t GAP_EstablishLinkReq(gapEstLinkReq_t *pParams)
Establish a link to a slave device.
uint16 connectionHandle
Connection handle of the update.
Definition: gap.h:589
uint8 opcode
GAP_PASSKEY_NEEDED_EVENT.
Definition: gap.h:680
uint8 attrLen
Number of bytes in the attribute data.
Definition: gap.h:777
Definition: sm.h:138
Definition: gap.h:761
uint8 authReq
Authentication Requirements: Bit 2: MITM, Bits 0-1: bonding (0 - no bonding, 1 - bonding) ...
Definition: gap.h:724
int8 rssi
Advertisement or SCAN_RSP RSSI.
Definition: gap.h:483
uint16 connectionHandle
Connection handle of the update.
Definition: gap.h:651
uint16 connLatency
Requested connection latency.
Definition: gap.h:653
uint8 accepted
TRUE if host accepts parameter update, FALSE otherwise.
Definition: gap.h:606
bStatus_t GAP_MakeDiscoverable(uint8 taskID, gapAdvertisingParams_t *pParams)
Setup or change advertising. Also starts advertising.
uint16 intervalMin
Minimum Connection Interval.
Definition: gap.h:602
uint8 addrType
address type: Address Types as defined by BLE Spec
Definition: gap.h:481
uint16 gapParamIDs_t
Definition: gap.h:400
bStatus_t GAP_DeviceDiscoveryCancel(uint8 taskID)
Cancel an existing device discovery request.
uint8 uiOutputs
Pairing User Interface Outputs - Display passcode.
Definition: gap.h:684
Status_t bStatus_t
BLE Generic Status return: BLE Default BLE Status Values.
Definition: bcomdef.h:244
uint8 addrMode
Address mode: GAP Addressing Modes.
Definition: gap.h:419
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:663
Definition: gap.h:661
uint16 connTimeout
Connection Timeout.
Definition: gap.h:638
bStatus_t GAP_DeviceDiscoveryRequest(gapDevDiscReq_t *pParams)
Start a device discovery scan.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:447
uint8 opcode
GAP_UPDATE_LINK_PARAM_REQ_EVENT.
Definition: gap.h:617
uint16 connectionHandle
Connection Handle from controller used to ref the device.
Definition: gap.h:696
gapPairingReq_t pairReq
The Pairing Request fields received.
Definition: gap.h:766
uint16 intervalMax
Definition: gap.h:433
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:543
uint16 connectionHandle
Connection handle.
Definition: gap.h:682
uint16 intervalMin
Minimum Connection Interval.
Definition: gap.h:590
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:720
bStatus_t GAP_SetAdvToken(gapAdvDataToken_t *pToken)
Called to setup a GAP Advertisement/Scan Response data token.
uint16 connInterval
Requested connection interval.
Definition: gap.h:652
uint16 connectionHandle
connection Handle
Definition: gap.h:665
uint8 opcode
GAP_DEVICE_INIT_DONE_EVENT.
Definition: gap.h:448
uint32 signCounter
new Signed Counter
Definition: gap.h:468
void(* pfnGapIdleCB_t)()
Definition: gap.h:792
Definition: gap.h:495
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:417
bStatus_t GAP_SetParamValue(gapParamIDs_t paramID, uint16 paramValue)
Set a GAP Parameter value. Use this function to change the default GAP parameter values.
Definition: osal.h:89
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:763
uint16 connectionHandle
Connection Handle.
Definition: gap.h:722
gapUpdateLinkParamReq_t req
Remote device&#39;s requested parameters.
Definition: gap.h:618
gapDevRec_t * pDevList
array of device records
Definition: gap.h:522
uint8 opcode
GAP_RANDOM_ADDR_CHANGED_EVENT.
Definition: gap.h:418
uint16 connTimeout
Connection Timeout.
Definition: gap.h:605
uint8 opcode
GAP type of command. Ref: GAP Message IDs.
Definition: gap.h:408
uint8 authState
TRUE if the pairing was authenticated (MITM)
Definition: gap.h:697
uint8 devAddrType
Device address type: Address Types as defined by BLE Spec.
Definition: gap.h:632
uint8 maxEncKeySize
Pairing Request Maximum Encryption Key Size field.
Definition: gap.h:746
Definition: gap.h:587
uint16 timeout
Definition: gap.h:437
uint8 numDataPkts
HC_Total_Num_LE_Data_Packets.
Definition: gap.h:451
uint8 opcode
GAP_PAIRING_REQ_EVENT.
Definition: gap.h:764
uint16 connectionHandle
Connection handle of the update.
Definition: gap.h:601
uint8 mode
Discovery Mode: GAP Device Discovery Modes.
Definition: gap.h:498
uint8 whiteList
Determines use of the white list: GAP White List Options.
Definition: gap.h:579
uint8 GAP_NumActiveConnections(void)
Returns the number of active connections.
Definition: sm.h:195
bStatus_t GAP_UpdateAdvTokens(void)
Called to rebuild and load Advertisement and Scan Response data from existing GAP Advertisement Token...
uint16 latency
Definition: gap.h:435
keyDist_t keyDist
Pairing Request Key Distribution field.
Definition: gap.h:747
uint8 taskID
Requesting App&#39;s Task ID, used to return results.
Definition: gap.h:497
bStatus_t GAP_ConfigDeviceAddr(uint8 addrMode, uint8 *pStaticAddr)
Setup the device&#39;s address type. If ADDRMODE_PRIVATE_RESOLVE is selected, the address will change per...
bStatus_t GAP_Authenticate(gapAuthParams_t *pParams, gapPairingReq_t *pPairReq)
Start the Authentication process with the requested device. This function is used to Initiate/Allow p...
uint8 opcode
GAP_LINK_PARAM_UPDATE_EVENT.
Definition: gap.h:649
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:733
bStatus_t GAP_SendSlaveSecurityRequest(uint16 connectionHandle, uint8 authReq)
Generate a Slave Requested Security message to the master.
uint8 adType
TRUE if advertising data, FALSE if SCAN_RSP.
Definition: gap.h:565
uint16 GAP_GetParamValue(gapParamIDs_t paramID)
Get a GAP Parameter value.
void GAP_RegisterBondMgrCBs(gapBondMgrCBs_t *pCBs)
Register bond manager call backs.
pfnGapIdleCB_t gapIdleCB
GAP Idle callback.
Definition: gap.h:800
uint32 numComparison
Numeric Comparison value to be displayed.
Definition: gap.h:685
uint16 dataPktLen
HC_LE_Data_Packet_Length.
Definition: gap.h:450
bStatus_t GAP_EndDiscoverable(uint8 taskID)
Stops advertising.
uint8 * pAttrData
pointer to Attribute data
Definition: gap.h:778
Definition: gap.h:575
uint8 oobDataFlag
Pairing Request OOB Data Flag field.
Definition: gap.h:744
Definition: gap.h:541
Definition: gap.h:614
Definition: gap.h:476
bStatus_t GAP_DeviceInit(uint8 taskID, uint8 profileRole, uint8 maxScanResponses, uint8 *pIRK, uint8 *pSRK, uint32 *pSignCounter)
Called to setup the device. Call just once on initialization.
Definition: gap.h:692
Definition: gap.h:445
Definition: gap.h:462
Definition: sm.h:205
Definition: gap.h:646
osal_event_hdr_t hdr
GAP_MSG_EVENT and status.
Definition: gap.h:478
uint8 initiatorAddrType
Initiator&#39;s address type: Address Types as defined by BLE Spec.
Definition: gap.h:531
uint8 whiteList
Filer Policy: GAP DIscovery Filter Scan Parameters.
Definition: gap.h:500
Definition: gap.h:628
uint8 opcode
GAP_BOND_COMPLETE_EVENT.
Definition: gap.h:734