BLE-Stack APIs  1.00.00
gap.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Group: WCS, BTS
4  $Target Device: DEVICES $
5 
6  ******************************************************************************
7  $License: TISD 2009 $
8  ******************************************************************************
9  $Release Name: PACKAGE NAME $
10  $Release Date: PACKAGE RELEASE DATE $
11  *****************************************************************************/
12 
24 #ifndef GAP_H
25 #define GAP_H
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 /*-------------------------------------------------------------------
33  * INCLUDES
34  */
35 #include "bcomdef.h"
36 #include "osal.h"
37 #include "sm.h"
38 
39 /*-------------------------------------------------------------------
40  * MACROS
41  */
42 
43 /*-------------------------------------------------------------------
44  * CONSTANTS
45  */
46 
55 #define GAP_DEVICE_INIT_DONE_EVENT 0x00
56 #define GAP_DEVICE_DISCOVERY_EVENT 0x01
57 #define GAP_ADV_DATA_UPDATE_DONE_EVENT 0x02
58 #define GAP_MAKE_DISCOVERABLE_DONE_EVENT 0x03
59 #define GAP_END_DISCOVERABLE_DONE_EVENT 0x04
60 #define GAP_LINK_ESTABLISHED_EVENT 0x05
61 #define GAP_LINK_TERMINATED_EVENT 0x06
62 #define GAP_LINK_PARAM_UPDATE_EVENT 0x07
63 #define GAP_RANDOM_ADDR_CHANGED_EVENT 0x08
64 #define GAP_SIGNATURE_UPDATED_EVENT 0x09
65 #define GAP_AUTHENTICATION_COMPLETE_EVENT 0x0A
66 #define GAP_PASSKEY_NEEDED_EVENT 0x0B
67 #define GAP_SLAVE_REQUESTED_SECURITY_EVENT 0x0C
68 #define GAP_DEVICE_INFO_EVENT 0x0D
69 #define GAP_BOND_COMPLETE_EVENT 0x0E
70 #define GAP_PAIRING_REQ_EVENT 0x0F
71 #define GAP_AUTHENTICATION_FAILURE_EVT 0x10
72 #define GAP_UPDATE_LINK_PARAM_REQ_EVENT 0x11
73 
79 #define GAP_CONNHANDLE_INIT 0xFFFE
80 #define GAP_CONNHANDLE_ALL 0xFFFF
81 
87 #define GAP_PROFILE_BROADCASTER 0x01
88 #define GAP_PROFILE_OBSERVER 0x02
89 #define GAP_PROFILE_PERIPHERAL 0x04
90 #define GAP_PROFILE_CENTRAL 0x08
91 
108 #define TGAP_GEN_DISC_ADV_MIN 0
109 
117 #define TGAP_LIM_ADV_TIMEOUT 1
118 
126 #define TGAP_GEN_DISC_SCAN 2
127 
135 #define TGAP_LIM_DISC_SCAN 3
136 
144 #define TGAP_CONN_EST_ADV_TIMEOUT 4
145 
154 #define TGAP_CONN_PARAM_TIMEOUT 5
155 
163 #define TGAP_LIM_DISC_ADV_INT_MIN 6
164 
172 #define TGAP_LIM_DISC_ADV_INT_MAX 7
173 
181 #define TGAP_GEN_DISC_ADV_INT_MIN 8
182 
190 #define TGAP_GEN_DISC_ADV_INT_MAX 9
191 
199 #define TGAP_CONN_ADV_INT_MIN 10
200 
208 #define TGAP_CONN_ADV_INT_MAX 11
209 
217 #define TGAP_CONN_SCAN_INT 12
218 
226 #define TGAP_CONN_SCAN_WIND 13
227 
235 #define TGAP_CONN_HIGH_SCAN_INT 14
236 
244 #define TGAP_CONN_HIGH_SCAN_WIND 15
245 
253 #define TGAP_GEN_DISC_SCAN_INT 16
254 
262 #define TGAP_GEN_DISC_SCAN_WIND 17
263 
271 #define TGAP_LIM_DISC_SCAN_INT 18
272 
280 #define TGAP_LIM_DISC_SCAN_WIND 19
281 
283 
288 #define TGAP_CONN_EST_ADV 20
289 
298 #define TGAP_CONN_EST_INT_MIN 21
299 
307 #define TGAP_CONN_EST_INT_MAX 22
308 
316 #define TGAP_CONN_EST_SCAN_INT 23
317 
325 #define TGAP_CONN_EST_SCAN_WIND 24
326 
334 #define TGAP_CONN_EST_SUPERV_TIMEOUT 25
335 
343 #define TGAP_CONN_EST_LATENCY 26
344 
352 #define TGAP_CONN_EST_MIN_CE_LEN 27
353 
361 #define TGAP_CONN_EST_MAX_CE_LEN 28
362 
370 #define TGAP_PRIVATE_ADDR_INT 29
371 
379 #define TGAP_CONN_PAUSE_CENTRAL 30
380 
388 #define TGAP_CONN_PAUSE_PERIPHERAL 31
389 
397 #define TGAP_SM_TIMEOUT 32
398 
406 #define TGAP_SM_MIN_KEY_LEN 33
407 
415 #define TGAP_SM_MAX_KEY_LEN 34
416 
424 #define TGAP_FILTER_ADV_REPORTS 35
425 
433 #define TGAP_SCAN_RSP_RSSI_MIN 36
434 
442 #define TGAP_REJECT_CONN_PARAMS 37
443 
445 #if !defined ( TESTMODES )
446  #define TGAP_AUTH_TASK_ID 38
447  #define TGAP_VERIFY_CAR 39
448  #define TGAP_PARAMID_MAX 40
449 
450  #define TGAP_GGS_PARAMS 102
451 #else
452  #define TGAP_GAP_TESTCODE 38
453  #define TGAP_SM_TESTCODE 39
454  #define TGAP_AUTH_TASK_ID 40
455  #define TGAP_VERIFY_CAR 41
456  #define TGAP_PARAMID_MAX 42
457 
458  #define TGAP_GATT_TESTCODE 100
459  #define TGAP_ATT_TESTCODE 101
460  #define TGAP_GGS_PARAMS 102
461  #define TGAP_L2CAP_TESTCODE 103
462 #endif
463 
470 #define DEVDISC_MODE_NONDISCOVERABLE 0x00
471 #define DEVDISC_MODE_GENERAL 0x01
472 #define DEVDISC_MODE_LIMITED 0x02
473 #define DEVDISC_MODE_ALL 0x03
474 
479 #define ADDRTYPE_PUBLIC 0x00
480 #define ADDRTYPE_RANDOM 0x01
481 #define ADDRTYPE_PUBLIC_ID 0x02
482 #define ADDRTYPE_RANDOM_ID 0x03
483 
488 #define SET_ADDRTYPE_ID 0x02
489 #define MASK_ADDRTYPE_ID 0x01
490 
495 #define RANDOM_ADDR_SUBTYPE_STATIC 0x00
496 #define RANDOM_ADDR_SUBTYPE_RPA 0x01
497 #define RANDOM_ADDR_SUBTYPE_NRPA 0x02
498 
503 #define RANDOM_ADDR_HDR_MASK 0xC0
504 #define STATIC_ADDR_HDR 0xC0
505 #define PRIVATE_NON_RESOLVE_ADDR_HDR 0x80
506 #define PRIVATE_RESOLVE_ADDR_HDR 0x40
507 
512 #define ADDRMODE_PUBLIC 0x00
513 #define ADDRMODE_STATIC 0x01
514 #define ADDRMODE_PRIVATE_NONRESOLVE 0x02
515 #define ADDRMODE_PRIVATE_RESOLVE 0x03
516 
522 #define GAP_ADTYPE_ADV_IND 0x00
523 #define GAP_ADTYPE_ADV_HDC_DIRECT_IND 0x01
524 #define GAP_ADTYPE_ADV_SCAN_IND 0x02
525 #define GAP_ADTYPE_ADV_NONCONN_IND 0x03
526 #define GAP_ADTYPE_ADV_LDC_DIRECT_IND 0x04
527 
533 #define GAP_ADRPT_ADV_IND 0x00
534 #define GAP_ADRPT_ADV_DIRECT_IND 0x01
535 #define GAP_ADRPT_ADV_SCAN_IND 0x02
536 #define GAP_ADRPT_ADV_NONCONN_IND 0x03
537 #define GAP_ADRPT_SCAN_RSP 0x04
538 
543 #define GAP_FILTER_POLICY_ALL 0x00
544 #define GAP_FILTER_POLICY_WHITE_SCAN 0x01
545 #define GAP_FILTER_POLICY_WHITE_CON 0x02
546 #define GAP_FILTER_POLICY_WHITE 0x03
547 
552 #define GAP_DISC_FILTER_POLICY_ALL 0x00
553 #define GAP_DISC_FILTER_POLICY_WHITE 0x01
554 #define GAP_DISC_FILTER_POLICY_ALL_DIRECT 0x02
555 #define GAP_DISC_FILTER_POLICY_WHITE_DIRECT 0x03
556 
558 #define ADV_CHANMAP_SIZE 5
559 
560 #define GAP_PASSCODE_MAX 999999
561 
562 
568 #define GAP_INIT_SIGN_COUNTER 0xFFFFFFFF
569 
573 #define GAP_ADVCHAN_37 0x01
574 #define GAP_ADVCHAN_38 0x02
575 #define GAP_ADVCHAN_39 0x04
576 #define GAP_ADVCHAN_ALL (GAP_ADVCHAN_37 | GAP_ADVCHAN_38 | GAP_ADVCHAN_39)
577 
582 #define WL_NOTUSED 0x00
583 #define WL_USED 0x01
584 
590 #define GAP_ADTYPE_FLAGS 0x01
591 #define GAP_ADTYPE_16BIT_MORE 0x02
592 #define GAP_ADTYPE_16BIT_COMPLETE 0x03
593 #define GAP_ADTYPE_32BIT_MORE 0x04
594 #define GAP_ADTYPE_32BIT_COMPLETE 0x05
595 #define GAP_ADTYPE_128BIT_MORE 0x06
596 #define GAP_ADTYPE_128BIT_COMPLETE 0x07
597 #define GAP_ADTYPE_LOCAL_NAME_SHORT 0x08
598 #define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09
599 #define GAP_ADTYPE_POWER_LEVEL 0x0A
600 #define GAP_ADTYPE_OOB_CLASS_OF_DEVICE 0x0D
601 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E
602 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F
603 #define GAP_ADTYPE_SM_TK 0x10
604 #define GAP_ADTYPE_SM_OOB_FLAG 0x11
605 #define GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE 0x12
606 #define GAP_ADTYPE_SIGNED_DATA 0x13
607 #define GAP_ADTYPE_SERVICES_LIST_16BIT 0x14
608 #define GAP_ADTYPE_SERVICES_LIST_128BIT 0x15
609 #define GAP_ADTYPE_SERVICE_DATA 0x16
610 #define GAP_ADTYPE_PUBLIC_TARGET_ADDR 0x17
611 #define GAP_ADTYPE_RANDOM_TARGET_ADDR 0x18
612 #define GAP_ADTYPE_APPEARANCE 0x19
613 #define GAP_ADTYPE_ADV_INTERVAL 0x1A
614 #define GAP_ADTYPE_LE_BD_ADDR 0x1B
615 #define GAP_ADTYPE_LE_ROLE 0x1C
616 #define GAP_ADTYPE_SIMPLE_PAIRING_HASHC_256 0x1D
617 #define GAP_ADTYPE_SIMPLE_PAIRING_RANDR_256 0x1E
618 #define GAP_ADTYPE_SERVICE_DATA_32BIT 0x20
619 #define GAP_ADTYPE_SERVICE_DATA_128BIT 0x21
620 #define GAP_ADTYPE_3D_INFO_DATA 0x3D
621 #define GAP_ADTYPE_MANUFACTURER_SPECIFIC 0xFF
622 #define GAP_ADTYPE_FLAGS_LIMITED 0x01
623 #define GAP_ADTYPE_FLAGS_GENERAL 0x02
624 #define GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
625 
630 #define GAP_STATE_IDLE 0x00
631 #define GAP_STATE_ADV 0x01
632 #define GAP_STATE_SCAN 0x02
633 #define GAP_STATE_INIT 0x04
634 
639 #define GAP_APPEARE_UNKNOWN 0x0000
640 #define GAP_APPEARE_GENERIC_PHONE 0x0040
641 #define GAP_APPEARE_GENERIC_COMPUTER 0x0080
642 #define GAP_APPEARE_GENERIC_WATCH 0x00C0
643 #define GAP_APPEARE_WATCH_SPORTS 0x00C1
644 #define GAP_APPEARE_GENERIC_CLOCK 0x0100
645 #define GAP_APPEARE_GENERIC_DISPLAY 0x0140
646 #define GAP_APPEARE_GENERIC_RC 0x0180
647 #define GAP_APPEARE_GENERIC_EYE_GALSSES 0x01C0
648 #define GAP_APPEARE_GENERIC_TAG 0x0200
649 #define GAP_APPEARE_GENERIC_KEYRING 0x0240
650 #define GAP_APPEARE_GENERIC_MEDIA_PLAYER 0x0280
651 #define GAP_APPEARE_GENERIC_BARCODE_SCANNER 0x02C0
652 #define GAP_APPEARE_GENERIC_THERMOMETER 0x0300
653 #define GAP_APPEARE_GENERIC_THERMO_EAR 0x0301
654 #define GAP_APPEARE_GENERIC_HR_SENSOR 0x0340
655 #define GAP_APPEARE_GENERIC_HRS_BELT 0x0341
656 #define GAP_APPEARE_GENERIC_BLOOD_PRESSURE 0x0380
657 #define GAP_APPEARE_GENERIC_BP_ARM 0x0381
658 #define GAP_APPEARE_GENERIC_BP_WRIST 0x0382
659 #define GAP_APPEARE_GENERIC_HID 0x03C0
660 #define GAP_APPEARE_HID_KEYBOARD 0x03C1
661 #define GAP_APPEARE_HID_MOUSE 0x03C2
662 #define GAP_APPEARE_HID_JOYSTIC 0x03C3
663 #define GAP_APPEARE_HID_GAMEPAD 0x03C4
664 #define GAP_APPEARE_HID_DIGITIZER_TYABLET 0x03C5
665 #define GAP_APPEARE_HID_DIGITAL_CARDREADER 0x03C6
666 #define GAP_APPEARE_HID_DIGITAL_PEN 0x03C7
667 #define GAP_APPEARE_HID_BARCODE_SCANNER 0x03C8
668 
675 #define GAP_PRIVACY_MODE_NETWORK 0
676 #define GAP_PRIVACY_MODE_DEVICE 1
677 
678 /*-------------------------------------------------------------------
679  * TYPEDEFS - Initialization and Configuration
680  */
681 
691 typedef uint16 gapParamIDs_t;
692 
694 typedef struct
695 {
697  uint8 opcode;
698 } gapEventHdr_t;
699 
710 typedef struct
711 {
713  uint8 opcode;
714  uint8 addrMode;
715  uint8 newRandomAddr[B_ADDR_LEN];
717 
727 typedef struct
728 {
730  uint16 intervalMin;
732  uint16 intervalMax;
734  uint16 latency;
736  uint16 timeout;
738 
751 typedef struct
752 {
754  uint8 opcode;
755  uint8 devAddr[B_ADDR_LEN];
756  uint16 dataPktLen;
757  uint8 numDataPkts;
759 
770 typedef struct
771 {
773  uint8 opcode;
774  uint8 addrType;
775  uint8 devAddr[B_ADDR_LEN];
776  uint32 signCounter;
778 
786 typedef struct
787 {
789  uint8 opcode;
790  uint8 eventType;
791  uint8 addrType;
792  uint8 addr[B_ADDR_LEN];
793  int8 rssi;
794  uint8 dataLen;
795  uint8 *pEvtData;
797  // end of GAP_Events
799 
800 /*-------------------------------------------------------------------
801  * TYPEDEFS - Device Discovery
802  */
803 
805 typedef struct
806 {
807  uint8 taskID;
808  uint8 mode;
809  uint8 activeScan;
810  uint8 whiteList;
812 
814 typedef struct
815 {
816  uint8 eventType;
817  uint8 addrType;
818  uint8 addr[B_ADDR_LEN];
819 } gapDevRec_t;
820 
832 typedef struct
833 {
835  uint8 opcode;
836  uint8 numDevs;
839  // end of GAP_Events
841 
843 typedef struct
844 {
845  uint8 eventType;
847  uint8 initiatorAddr[B_ADDR_LEN];
848  uint8 channelMap;
849  uint8 filterPolicy;
851 
863 typedef struct
864 {
866  uint8 opcode;
868 
875 typedef struct
876 {
878  uint8 opcode;
880 
887 typedef struct
888 {
890  uint8 opcode;
891  uint8 adType;
893  // end of GAP_Events
895 
896 /*-------------------------------------------------------------------
897  * TYPEDEFS - Link Establishment
898  */
899 
901 typedef struct
902 {
903  uint8 taskID;
905  uint8 whiteList;
906  uint8 addrTypePeer;
907  uint8 peerAddr[B_ADDR_LEN];
909 
911 typedef struct
912 {
914  uint16 intervalMin;
915  uint16 intervalMax;
916  uint16 connLatency;
917  uint16 connTimeout;
919 
921 typedef struct
922 {
924  uint16 intervalMin;
925  uint16 intervalMax;
926  uint16 connLatency;
927  uint16 connTimeout;
928  uint8 accepted;
930 
942 typedef struct
943 {
945  uint8 opcode;
948 
958 typedef struct
959 {
961  uint8 opcode;
962  uint8 devAddrType;
963  uint8 devAddr[B_ADDR_LEN];
965  uint8 connRole;
966  uint16 connInterval;
967  uint16 connLatency;
968  uint16 connTimeout;
971 
978 typedef struct
979 {
981  uint8 opcode;
982  uint8 status;
984  uint16 connInterval;
985  uint16 connLatency;
986  uint16 connTimeout;
988 
995 typedef struct
996 {
998  uint8 opcode;
1000  uint8 reason;
1002 
1003 /*-------------------------------------------------------------------
1004  * TYPEDEFS - Authentication, Bounding and Pairing
1005  */
1006 
1013 typedef struct
1014 {
1016  uint8 opcode;
1017  uint8 deviceAddr[B_ADDR_LEN];
1019  uint8 uiInputs;
1020  uint8 uiOutputs;
1021  uint32 numComparison;
1023 
1030 typedef struct
1031 {
1033  uint8 opcode;
1035  uint8 authState;
1041  // end of GAP_Events
1043 
1050 typedef struct
1051 {
1054 } gapAuthParams_t;
1055 
1067 typedef struct
1068 {
1070  uint8 opcode;
1072  uint8 deviceAddr[B_ADDR_LEN];
1073  uint8 authReq;
1075 
1082 typedef struct
1083 {
1085  uint8 opcode;
1088  // end of GAP_Events
1090 
1092 typedef struct
1093 {
1094  uint8 ioCap;
1095  uint8 oobDataFlag;
1096  uint8 authReq;
1099 } gapPairingReq_t;
1100 
1117 typedef struct
1118 {
1120  uint8 opcode;
1124  // end of GAP_Events
1126 
1134 typedef struct
1135 {
1136  uint8 adType;
1137  uint8 attrLen;
1138  uint8 *pAttrData;
1140 
1147 typedef uint8 (*pfnSuppEnhPrivCB_t)
1150  uint8 *deviceAddr
1151 );
1152 
1154 typedef void (*pfnGapIdleCB_t)();
1155 
1156 
1158 typedef uint8 (*pfnGapDevPrivModeCB_t)
1160  uint8 addrType,
1161  uint8 *pAddr
1162 );
1163 
1165 typedef struct
1166 {
1170 } gapBondMgrCBs_t;
1171 
1174 /*-------------------------------------------------------------------
1175  * GLOBAL VARIABLES
1176  */
1177 
1178 /*-------------------------------------------------------------------
1179  * FUNCTIONS - Initialization and Configuration
1180  */
1181 
1208  extern bStatus_t GAP_DeviceInit( uint8 taskID,
1209  uint8 profileRole,
1210  uint8 maxScanResponses,
1211  uint8 *pIRK,
1212  uint8 *pSRK,
1213  uint32 *pSignCounter );
1214 
1221  extern void GAP_UpdateResolvingList( uint8 *pIRK );
1222 
1242  extern bStatus_t GAP_SetAdvToken( gapAdvDataToken_t *pToken );
1243 
1253  extern gapAdvDataToken_t *GAP_GetAdvToken( uint8 adType );
1254 
1265  extern gapAdvDataToken_t *GAP_RemoveAdvToken( uint8 adType );
1266 
1275  extern bStatus_t GAP_UpdateAdvTokens( void );
1276 
1289  extern bStatus_t GAP_SetParamValue( gapParamIDs_t paramID, uint16 paramValue );
1290 
1299  extern uint16 GAP_GetParamValue( gapParamIDs_t paramID );
1300 
1328  extern bStatus_t GAP_ConfigDeviceAddr( uint8 addrMode, uint8 *pStaticAddr );
1329 
1338  extern void GAP_RegisterForMsgs( uint8 taskID );
1339 
1345  extern void GAP_RegisterBondMgrCBs( gapBondMgrCBs_t *pCBs );
1346 
1347 #if defined (BLE_V42_FEATURES) && (BLE_V42_FEATURES & PRIVACY_1_2_CFG)
1348 
1360  extern bStatus_t GAP_SetPrivacyMode( uint8 addrType, uint8 *pAddr, uint8 mode );
1361 #endif // BLE_V42_FEATURES & PRIVACY_1_2_CFG
1362 
1363 /*-------------------------------------------------------------------
1364  * FUNCTIONS - Device Discovery
1365  */
1366 
1383 
1397  extern bStatus_t GAP_DeviceDiscoveryCancel( uint8 taskID );
1398 
1413  extern bStatus_t GAP_MakeDiscoverable( uint8 taskID, gapAdvertisingParams_t *pParams );
1414 
1429  extern bStatus_t GAP_UpdateAdvertisingData( uint8 taskID, uint8 adType,
1430  uint8 dataLen, uint8 *pAdvertData );
1431 
1444  extern bStatus_t GAP_EndDiscoverable( uint8 taskID );
1445 
1446 #if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
1447 
1457  extern bStatus_t GAP_ResolvePrivateAddr( uint8 *pIRK, uint8 *pAddr );
1458 #endif // ! BLE_V42_FEATURES | ! PRIVACY_1_2_CFG
1459 
1460 /*-------------------------------------------------------------------
1461  * FUNCTIONS - Link Establishment
1462  */
1463 
1478  extern bStatus_t GAP_EstablishLinkReq( gapEstLinkReq_t *pParams );
1479 
1495  extern bStatus_t GAP_TerminateLinkReq( uint8 taskID, uint16 connectionHandle, uint8 reason );
1496 
1513 
1533 
1539  extern uint8 GAP_NumActiveConnections( void );
1540 
1541 /*-------------------------------------------------------------------
1542  * FUNCTIONS - Pairing
1543  */
1544 
1572  extern bStatus_t GAP_Authenticate( gapAuthParams_t *pParams, gapPairingReq_t *pPairReq );
1573 
1580  extern uint8 GAP_isPairing(void);
1581 
1599  extern bStatus_t GAP_TerminateAuth( uint16 connectionHandle, uint8 reason );
1600 
1620  extern bStatus_t GAP_PasskeyUpdate( uint8 *pPasskey, uint16 connectionHandle );
1621 
1640  extern bStatus_t GAP_PasscodeUpdate( uint32 passcode, uint16 connectionHandle );
1641 
1656  extern bStatus_t GAP_SendSlaveSecurityRequest( uint16 connectionHandle, uint8 authReq );
1657 
1674  extern bStatus_t GAP_Signable( uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams );
1675 
1697  extern bStatus_t GAP_Bond( uint16 connectionHandle, uint8 authenticated,
1698  uint8 secureConnections, smSecurityInfo_t *pParams,
1699  uint8 startEncryption );
1700 
1701 /*-------------------------------------------------------------------
1702  * Internal API - These functions are only called from gap.c module.
1703  */
1704 
1706 
1717  extern bStatus_t GAP_ParamsInit( uint8 taskID, uint8 profileRole );
1718 
1726  extern void GAP_PrivacyInit( uint8 *pIRK );
1727 
1735  extern uint8 *GAP_GetIRK( void );
1736 
1749  extern void GAP_SecParamsInit( uint8 *pSRK, uint32 *pSignCounter );
1750 
1758  extern bStatus_t GAP_PeriDevMgrInit( void );
1759 
1766  extern void GAP_PeriConnRegister( void );
1767 
1779  extern bStatus_t GAP_CentDevMgrInit( uint8 maxScanResponses );
1780 
1787  extern void GAP_CentConnRegister( void );
1788 
1789 
1790 /*-------------------------------------------------------------------
1791  * TASK API - These functions must only be called OSAL.
1792  */
1793 
1801  extern void GAP_Init( uint8 task_id );
1802 
1813  extern uint16 GAP_ProcessEvent( uint8 task_id, uint16 events );
1814 
1816 
1817 /*-------------------------------------------------------------------
1818 -------------------------------------------------------------------*/
1819 
1820 #ifdef __cplusplus
1821 }
1822 #endif
1823 
1824 #endif /* GAP_H */
1825 
bStatus_t GAP_ResolvePrivateAddr(uint8 *pIRK, uint8 *pAddr)
Resolves a private address against an IRK.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:889
uint8 authState
TRUE if the pairing was authenticated (MITM)
Definition: gap.h:1035
uint8 opcode
GAP_MAKE_DISCOVERABLE_DONE_EVENT
Definition: gap.h:866
uint8 opcode
GAP_END_DISCOVERABLE_DONE_EVENT
Definition: gap.h:878
bStatus_t GAP_SetAdvToken(gapAdvDataToken_t *pToken)
Set Advertising Token.
uint8 opcode
GAP_SIGNATURE_UPDATED_EVENT
Definition: gap.h:773
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:772
uint8 eventType
Advertise Event Type: GAP Advertising Event Types.
Definition: gap.h:845
This API allows the software components in the Z-Stack to be written independently of the specifics o...
uint16 connectionHandle
connection Handle
Definition: gap.h:1086
uint8 attrLen
Number of bytes in the attribute data.
Definition: gap.h:1137
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:712
uint8 authReq
Authentication Requirements: Bit 2: MITM, Bits 0-1: bonding (0 - no bonding, 1 - bonding) ...
Definition: gap.h:1073
This file contains the interface to the SM.
bStatus_t GAP_DeviceDiscoveryRequest(gapDevDiscReq_t *pParams)
Start a device discovery scan.
Definition: sm.h:190
smSecurityInfo_t * pSecurityInfo
BOUND - security information from this device.
Definition: gap.h:1036
bStatus_t GAP_TerminateAuth(uint16 connectionHandle, uint8 reason)
Terminate Authnetication.
Authentication Parameters.
Definition: gap.h:1050
bStatus_t GAP_PasskeyUpdate(uint8 *pPasskey, uint16 connectionHandle)
Update the passkey in string format.
GAP_MAKE_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:863
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1069
uint8 mode
Discovery Mode: GAP Device Discovery Modes.
Definition: gap.h:808
bStatus_t GAP_EstablishLinkReq(gapEstLinkReq_t *pParams)
Establish a link to a slave device.
uint8 adType
ADTYPE value: Address Types.
Definition: gap.h:1136
smSigningInfo_t * pSigningInfo
Signing information.
Definition: gap.h:1037
uint8 addrType
Device's address type for devAddr.
Definition: gap.h:774
uint16 connectionHandle
Connection Handle.
Definition: gap.h:1071
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:753
uint16 latency
Definition: gap.h:734
uint8 dataLen
Length (in bytes) of the data field (evtData)
Definition: gap.h:794
uint16 gapParamIDs_t
GAP Parameters IDs.
Definition: gap.h:691
uint8 adType
TRUE if advertising data, FALSE if SCAN_RSP.
Definition: gap.h:891
GAP_PASSKEY_NEEDED_EVENT message format.
Definition: gap.h:1013
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:696
Connection parameters for the peripheral device.
Definition: gap.h:727
GAP_DEVICE_INIT_DONE_EVENT message format.
Definition: gap.h:751
uint8 taskID
Requesting App's Task ID, used to return results.
Definition: gap.h:807
GAP_SLAVE_REQUESTED_SECURITY_EVENT message format.
Definition: gap.h:1067
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:865
bStatus_t GAP_TerminateLinkReq(uint8 taskID, uint16 connectionHandle, uint8 reason)
Terminate a link connection.
GAP event header format.
Definition: gap.h:694
GAP_BOND_COMPLETE_EVENT message format.
Definition: gap.h:1082
uint8 eventType
Indicates advertising event type used by the advertiser: GAP Advertising Report Event Types...
Definition: gap.h:816
bStatus_t GAP_Bond(uint16 connectionHandle, uint8 authenticated, uint8 secureConnections, smSecurityInfo_t *pParams, uint8 startEncryption)
Set up the connection's bound paramaters.
uint16 connectionHandle
Connection Handle from controller,.
Definition: gap.h:1052
GAP_PAIRING_REQ_EVENT message format.
Definition: gap.h:1117
uint8 addrType
Address Type: Address Types.
Definition: gap.h:817
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1084
uint8 uiInputs
Pairing User Interface Inputs - Ask user to input passcode.
Definition: gap.h:1019
uint8 numDevs
Number of devices found during scan.
Definition: gap.h:836
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1015
bStatus_t GAP_UpdateLinkParamReq(gapUpdateLinkParamReq_t *pParams)
Update the link parameters to a Master or Slave device.
uint8 opcode
GAP type of command. GAP Event IDs.
Definition: gap.h:697
keyDist_t keyDist
Pairing Request Key Distribution field.
Definition: gap.h:1098
uint8(* pfnSuppEnhPrivCB_t)(uint8 *deviceAddr)
Enhanced Privacy Check Callback Function.
Definition: gap.h:1149
uint8 maxEncKeySize
Pairing Request Maximum Encryption Key Size field.
Definition: gap.h:1097
bStatus_t GAP_Signable(uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams)
Set up the connection to accept signed data.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:788
GAP_SIGNATURE_UPDATED_EVENT message format.
Definition: gap.h:770
uint8 numDataPkts
HC_Total_Num_LE_Data_Packets.
Definition: gap.h:757
uint8 opcode
GAP_PAIRING_REQ_EVENT
Definition: gap.h:1120
uint8 opcode
GAP_SLAVE_REQUESTED_SECURITY_EVENT
Definition: gap.h:1070
Definition: sm.h:144
uint8 opcode
GAP_DEVICE_INFO_EVENT
Definition: gap.h:789
uint8 initiatorAddrType
Initiator's address type: Address Types.
Definition: gap.h:846
uint8 opcode
GAP_ADV_DATA_UPDATE_DONE_EVENT
Definition: gap.h:890
uint16 intervalMax
Definition: gap.h:732
Type of device discovery (Scan) to perform.
Definition: gap.h:814
uint16 GAP_GetParamValue(gapParamIDs_t paramID)
Get a GAP Parameter value.
uint8 opcode
GAP_DEVICE_INIT_DONE_EVENT
Definition: gap.h:754
bStatus_t GAP_MakeDiscoverable(uint8 taskID, gapAdvertisingParams_t *pParams)
Setup or change advertising. Also starts advertising.
bStatus_t GAP_DeviceDiscoveryCancel(uint8 taskID)
Cancel an existing device discovery request.
smIdentityInfo_t * pIdentityInfo
BOUND - identity information.
Definition: gap.h:1039
void GAP_UpdateResolvingList(uint8 *pIRK)
Update the resolving list.
Definition: sm.h:201
void GAP_RegisterBondMgrCBs(gapBondMgrCBs_t *pCBs)
Register bond manager call backs.
GAP_DEVICE_INFO_EVENT message format.
Definition: gap.h:786
uint8 uiOutputs
Pairing User Interface Outputs - Display passcode.
Definition: gap.h:1020
bStatus_t GAP_ConfigDeviceAddr(uint8 addrMode, uint8 *pStaticAddr)
Configure Device Address.
uint16 connectionHandle
Connection Handle from controller used to ref the device.
Definition: gap.h:1034
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:877
uint8 opcode
GAP_DEVICE_DISCOVERY_EVENT
Definition: gap.h:835
GAP_ADV_DATA_UPDATE_DONE_EVENT message format.
Definition: gap.h:887
uint16 connectionHandle
connection Handle
Definition: gap.h:1121
uint32 signCounter
new Signed Counter
Definition: gap.h:776
smLinkSecurityReq_t secReqs
Pairing Control info.
Definition: gap.h:1053
uint8 addrType
address type: Address Types
Definition: gap.h:791
uint16 timeout
Definition: gap.h:736
bStatus_t GAP_UpdateAdvTokens(void)
Update Advertising Token.
gapAdvDataToken_t * GAP_GetAdvToken(uint8 adType)
Get Advertising Token.
uint16 intervalMin
Definition: gap.h:730
uint8 oobDataFlag
Pairing Request OOB Data Flag field.
Definition: gap.h:1095
int8 rssi
Advertisement or SCAN_RSP RSSI.
Definition: gap.h:793
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:834
Type of device discovery (Scan) to perform.
Definition: gap.h:805
uint8 opcode
GAP_AUTHENTICATION_COMPLETE_EVENT
Definition: gap.h:1033
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1032
Type definitions and macros for BLE stack.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1119
smSecurityInfo_t * pDevSecInfo
BOUND - security information from connected device.
Definition: gap.h:1038
void(* pfnGapIdleCB_t)()
GAP Idle Callback Function.
Definition: gap.h:1154
Definition: sm.h:211
uint8 channelMap
Channel Map: Bit mask GAP Advertisement Channel Map.
Definition: gap.h:848
uint8 addrMode
Address mode: GAP Addressing Modes.
Definition: gap.h:714
uint8 filterPolicy
Filer Policy: GAP Advertiser Filter Scan Parameters. Ignored when directed advertising is used...
Definition: gap.h:849
GAP_END_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:875
uint8 opcode
GAP_PASSKEY_NEEDED_EVENT
Definition: gap.h:1016
bStatus_t GAP_PasscodeUpdate(uint32 passcode, uint16 connectionHandle)
Update the passkey in a numeric value (not string).
void GAP_RegisterForMsgs(uint8 taskID)
Register for GAP Messages.
OSAL Event Header.
Definition: osal.h:92
bStatus_t GAP_UpdateLinkParamReqReply(gapUpdateLinkParamReqReply_t *pParams)
Reply to a Connection Parameter Update Request sent from a remote device.
pfnSuppEnhPrivCB_t supportEnhPrivCB
Supports Enhanced Privacy callback.
Definition: gap.h:1167
uint8 opcode
GAP_RANDOM_ADDR_CHANGED_EVENT
Definition: gap.h:713
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:112
uint8 eventType
Advertisement Type: GAP Advertising Report Event Types.
Definition: gap.h:790
uint8 ioCap
Pairing Request ioCap field.
Definition: gap.h:1094
GAP_AUTHENTICATION_COMPLETE_EVENT message format.
Definition: gap.h:1030
Callback Registration Structure.
Definition: gap.h:1165
uint8 GAP_isPairing(void)
Check if GAP is currently pairing.
uint8 opcode
GAP_BOND_COMPLETE_EVENT
Definition: gap.h:1085
uint8 * pAttrData
pointer to Attribute data
Definition: gap.h:1138
pfnGapIdleCB_t gapIdleCB
GAP Idle callback.
Definition: gap.h:1168
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:225
GAP_DEVICE_DISCOVERY_EVENT message format.
Definition: gap.h:832
GAP_RANDOM_ADDR_CHANGED_EVENT message format.
Definition: gap.h:710
bStatus_t GAP_SendSlaveSecurityRequest(uint16 connectionHandle, uint8 authReq)
Generate a Slave Requested Security message to the master.
bStatus_t GAP_EndDiscoverable(uint8 taskID)
Stops advertising.
uint8 GAP_NumActiveConnections(void)
Returns the number of active connections.
uint8 activeScan
TRUE for active scanning.
Definition: gap.h:809
Pairing Request fields - the parsed fields of the SMP Pairing Request command.
Definition: gap.h:1092
uint8 * pEvtData
Data field of advertisement or SCAN_RSP.
Definition: gap.h:795
Advertising Parameters.
Definition: gap.h:843
bStatus_t GAP_UpdateAdvertisingData(uint8 taskID, uint8 adType, uint8 dataLen, uint8 *pAdvertData)
Setup or change advertising and scan response data.
uint16 dataPktLen
HC_LE_Data_Packet_Length.
Definition: gap.h:756
uint32 numComparison
Numeric Comparison value to be displayed.
Definition: gap.h:1021
uint8(* pfnGapDevPrivModeCB_t)(uint8 addrType, uint8 *pAddr)
GAP Device Privacy Mode Callback Function.
Definition: gap.h:1159
gapPairingReq_t pairReq
The Pairing Request fields received.
Definition: gap.h:1122
bStatus_t GAP_Authenticate(gapAuthParams_t *pParams, gapPairingReq_t *pPairReq)
Start Authentication.
bStatus_t GAP_DeviceInit(uint8 taskID, uint8 profileRole, uint8 maxScanResponses, uint8 *pIRK, uint8 *pSRK, uint32 *pSignCounter)
GAP Device Initialiation.
uint8 whiteList
Filer Policy: GAP Discovery Filter Scan Parameters.
Definition: gap.h:810
uint16 connectionHandle
Connection handle.
Definition: gap.h:1018
GAP Advertisement/Scan Response Data Token.
Definition: gap.h:1134
gapAdvDataToken_t * GAP_RemoveAdvToken(uint8 adType)
Remove Advertising Token.
pfnGapDevPrivModeCB_t gapDevPrivModeCB
GAP Device Privacy Mode callback.
Definition: gap.h:1169
uint8 authReq
Pairing Request Auth Req field.
Definition: gap.h:1096
gapDevRec_t * pDevList
array of device records
Definition: gap.h:837
bStatus_t GAP_SetParamValue(gapParamIDs_t paramID, uint16 paramValue)
Set a GAP Parameter value.
Copyright 2017, Texas Instruments Incorporated