TI BLE-Stack for Bluetooth API Documentation  3.03.01.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 
60 #define GAP_DEVICE_INIT_DONE_EVENT 0x00
61 
65 #define GAP_DEVICE_DISCOVERY_EVENT 0x01
66 
70 #define GAP_ADV_DATA_UPDATE_DONE_EVENT 0x02
71 
75 #define GAP_MAKE_DISCOVERABLE_DONE_EVENT 0x03
76 
80 #define GAP_END_DISCOVERABLE_DONE_EVENT 0x04
81 
85 #define GAP_LINK_ESTABLISHED_EVENT 0x05
86 
90 #define GAP_LINK_TERMINATED_EVENT 0x06
91 
95 #define GAP_LINK_PARAM_UPDATE_EVENT 0x07
96 
100 #define GAP_RANDOM_ADDR_CHANGED_EVENT 0x08
101 
105 #define GAP_SIGNATURE_UPDATED_EVENT 0x09
106 
110 #define GAP_AUTHENTICATION_COMPLETE_EVENT 0x0A
111 
115 #define GAP_PASSKEY_NEEDED_EVENT 0x0B
116 
120 #define GAP_SLAVE_REQUESTED_SECURITY_EVENT 0x0C
121 
125 #define GAP_DEVICE_INFO_EVENT 0x0D
126 
130 #define GAP_BOND_COMPLETE_EVENT 0x0E
131 
135 #define GAP_PAIRING_REQ_EVENT 0x0F
136 
141 #define GAP_AUTHENTICATION_FAILURE_EVT 0x10
142 
147 #define GAP_UPDATE_LINK_PARAM_REQ_EVENT 0x11
148 
154 #define GAP_CONNHANDLE_INIT 0xFFFE
155 #define GAP_CONNHANDLE_ALL 0xFFFF
156 
162 #define GAP_PROFILE_BROADCASTER 0x01
163 #define GAP_PROFILE_OBSERVER 0x02
164 #define GAP_PROFILE_PERIPHERAL 0x04
165 #define GAP_PROFILE_CENTRAL 0x08
166 
183 #define TGAP_GEN_DISC_ADV_MIN 0
184 
192 #define TGAP_LIM_ADV_TIMEOUT 1
193 
201 #define TGAP_GEN_DISC_SCAN 2
202 
210 #define TGAP_LIM_DISC_SCAN 3
211 
219 #define TGAP_CONN_EST_ADV_TIMEOUT 4
220 
229 #define TGAP_CONN_PARAM_TIMEOUT 5
230 
242 #define TGAP_LIM_DISC_ADV_INT_MIN 6
243 
255 #define TGAP_LIM_DISC_ADV_INT_MAX 7
256 
268 #define TGAP_GEN_DISC_ADV_INT_MIN 8
269 
281 #define TGAP_GEN_DISC_ADV_INT_MAX 9
282 
290 #define TGAP_CONN_ADV_INT_MIN 10
291 
299 #define TGAP_CONN_ADV_INT_MAX 11
300 
308 #define TGAP_CONN_SCAN_INT 12
309 
317 #define TGAP_CONN_SCAN_WIND 13
318 
326 #define TGAP_CONN_HIGH_SCAN_INT 14
327 
335 #define TGAP_CONN_HIGH_SCAN_WIND 15
336 
344 #define TGAP_GEN_DISC_SCAN_INT 16
345 
353 #define TGAP_GEN_DISC_SCAN_WIND 17
354 
362 #define TGAP_LIM_DISC_SCAN_INT 18
363 
371 #define TGAP_LIM_DISC_SCAN_WIND 19
372 
374 
379 #define TGAP_CONN_EST_ADV 20
380 
389 #define TGAP_CONN_EST_INT_MIN 21
390 
398 #define TGAP_CONN_EST_INT_MAX 22
399 
407 #define TGAP_CONN_EST_SCAN_INT 23
408 
416 #define TGAP_CONN_EST_SCAN_WIND 24
417 
425 #define TGAP_CONN_EST_SUPERV_TIMEOUT 25
426 
434 #define TGAP_CONN_EST_LATENCY 26
435 
443 #define TGAP_CONN_EST_MIN_CE_LEN 27
444 
452 #define TGAP_CONN_EST_MAX_CE_LEN 28
453 
461 #define TGAP_PRIVATE_ADDR_INT 29
462 
470 #define TGAP_CONN_PAUSE_CENTRAL 30
471 
479 #define TGAP_CONN_PAUSE_PERIPHERAL 31
480 
488 #define TGAP_SM_TIMEOUT 32
489 
497 #define TGAP_SM_MIN_KEY_LEN 33
498 
506 #define TGAP_SM_MAX_KEY_LEN 34
507 
515 #define TGAP_FILTER_ADV_REPORTS 35
516 
524 #define TGAP_SCAN_RSP_RSSI_MIN 36
525 
533 #define TGAP_REJECT_CONN_PARAMS 37
534 
536 #if !defined ( TESTMODES )
537  #define TGAP_AUTH_TASK_ID 38
538  #define TGAP_VERIFY_CAR 39
539 
547  #define TGAP_FAST_INTERVAL_2_INT_MIN 40
548 
555  #define TGAP_FAST_INTERVAL_2_INT_MAX 41
556  #define TGAP_PARAMID_MAX 42
558 #else
559  #define TGAP_GAP_TESTCODE 38
560  #define TGAP_SM_TESTCODE 39
561  #define TGAP_AUTH_TASK_ID 40
562  #define TGAP_VERIFY_CAR 41
563 
564 
571  #define TGAP_FAST_INTERVAL_2_INT_MIN 42
572 
579  #define TGAP_FAST_INTERVAL_2_INT_MAX 43
580  #define TGAP_PARAMID_MAX 44
581 
582  #define TGAP_GATT_TESTCODE 100
583  #define TGAP_ATT_TESTCODE 101
584  #define TGAP_GGS_TESTCODE 102
585  #define TGAP_L2CAP_TESTCODE 103
586 #endif
587 
594 #define DEVDISC_MODE_NONDISCOVERABLE 0x00
595 #define DEVDISC_MODE_GENERAL 0x01
596 #define DEVDISC_MODE_LIMITED 0x02
597 #define DEVDISC_MODE_ALL 0x03
598 
603 #define ADDRTYPE_PUBLIC 0x00
604 #define ADDRTYPE_RANDOM 0x01
605 #define ADDRTYPE_PUBLIC_ID 0x02
606 #define ADDRTYPE_RANDOM_ID 0x03
607 
612 #define SET_ADDRTYPE_ID 0x02
613 #define MASK_ADDRTYPE_ID 0x01
614 
619 #define RANDOM_ADDR_SUBTYPE_STATIC 0x00
620 #define RANDOM_ADDR_SUBTYPE_RPA 0x01
621 #define RANDOM_ADDR_SUBTYPE_NRPA 0x02
622 
627 #define RANDOM_ADDR_HDR_MASK 0xC0
628 #define STATIC_ADDR_HDR 0xC0
629 #define PRIVATE_NON_RESOLVE_ADDR_HDR 0x80
630 #define PRIVATE_RESOLVE_ADDR_HDR 0x40
631 
636 #define ADDRMODE_PUBLIC 0x00
637 #define ADDRMODE_STATIC 0x01
638 #define ADDRMODE_PRIVATE_NONRESOLVE 0x02
639 #define ADDRMODE_PRIVATE_RESOLVE 0x03
640 
646 #define GAP_ADTYPE_ADV_IND 0x00
647 #define GAP_ADTYPE_ADV_HDC_DIRECT_IND 0x01
648 #define GAP_ADTYPE_ADV_SCAN_IND 0x02
649 #define GAP_ADTYPE_ADV_NONCONN_IND 0x03
650 #define GAP_ADTYPE_ADV_LDC_DIRECT_IND 0x04
651 
657 #define GAP_ADRPT_ADV_IND 0x00
658 #define GAP_ADRPT_ADV_DIRECT_IND 0x01
659 #define GAP_ADRPT_ADV_SCAN_IND 0x02
660 #define GAP_ADRPT_ADV_NONCONN_IND 0x03
661 #define GAP_ADRPT_SCAN_RSP 0x04
662 
667 #define GAP_FILTER_POLICY_ALL 0x00
668 #define GAP_FILTER_POLICY_WHITE_SCAN 0x01
669 #define GAP_FILTER_POLICY_WHITE_CON 0x02
670 #define GAP_FILTER_POLICY_WHITE 0x03
671 
683 #define GAP_DISC_FILTER_POLICY_ALL 0x00
684 #define GAP_DISC_FILTER_POLICY_WHITE 0x01
685 #define GAP_DISC_FILTER_POLICY_ALL_DIRECT 0x02
686 #define GAP_DISC_FILTER_POLICY_WHITE_DIRECT 0x03
687 
689 #define ADV_CHANMAP_SIZE 5
690 
691 #define GAP_PASSCODE_MAX 999999
692 
693 
699 #define GAP_INIT_SIGN_COUNTER 0xFFFFFFFF
700 
704 #define GAP_ADVCHAN_37 0x01
705 #define GAP_ADVCHAN_38 0x02
706 #define GAP_ADVCHAN_39 0x04
707 #define GAP_ADVCHAN_ALL (GAP_ADVCHAN_37 | GAP_ADVCHAN_38 | GAP_ADVCHAN_39)
708 
713 #define WL_NOTUSED 0x00
714 #define WL_USED 0x01
715 
721 #define GAP_ADTYPE_FLAGS 0x01
722 #define GAP_ADTYPE_16BIT_MORE 0x02
723 #define GAP_ADTYPE_16BIT_COMPLETE 0x03
724 #define GAP_ADTYPE_32BIT_MORE 0x04
725 #define GAP_ADTYPE_32BIT_COMPLETE 0x05
726 #define GAP_ADTYPE_128BIT_MORE 0x06
727 #define GAP_ADTYPE_128BIT_COMPLETE 0x07
728 #define GAP_ADTYPE_LOCAL_NAME_SHORT 0x08
729 #define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09
730 #define GAP_ADTYPE_POWER_LEVEL 0x0A
731 #define GAP_ADTYPE_OOB_CLASS_OF_DEVICE 0x0D
732 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E
733 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F
734 #define GAP_ADTYPE_SM_TK 0x10
735 #define GAP_ADTYPE_SM_OOB_FLAG 0x11
736 #define GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE 0x12
737 #define GAP_ADTYPE_SIGNED_DATA 0x13
738 #define GAP_ADTYPE_SERVICES_LIST_16BIT 0x14
739 #define GAP_ADTYPE_SERVICES_LIST_128BIT 0x15
740 #define GAP_ADTYPE_SERVICE_DATA 0x16
741 #define GAP_ADTYPE_PUBLIC_TARGET_ADDR 0x17
742 #define GAP_ADTYPE_RANDOM_TARGET_ADDR 0x18
743 #define GAP_ADTYPE_APPEARANCE 0x19
744 #define GAP_ADTYPE_ADV_INTERVAL 0x1A
745 #define GAP_ADTYPE_LE_BD_ADDR 0x1B
746 #define GAP_ADTYPE_LE_ROLE 0x1C
747 #define GAP_ADTYPE_SIMPLE_PAIRING_HASHC_256 0x1D
748 #define GAP_ADTYPE_SIMPLE_PAIRING_RANDR_256 0x1E
749 #define GAP_ADTYPE_SERVICE_DATA_32BIT 0x20
750 #define GAP_ADTYPE_SERVICE_DATA_128BIT 0x21
751 #define GAP_ADTYPE_3D_INFO_DATA 0x3D
752 #define GAP_ADTYPE_MANUFACTURER_SPECIFIC 0xFF
753 #define GAP_ADTYPE_FLAGS_LIMITED 0x01
754 #define GAP_ADTYPE_FLAGS_GENERAL 0x02
755 #define GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
756 
761 #define GAP_STATE_IDLE 0x00
762 #define GAP_STATE_ADV 0x01
763 #define GAP_STATE_SCAN 0x02
764 #define GAP_STATE_INIT 0x04
765 
770 #define GAP_APPEARE_UNKNOWN 0x0000
771 #define GAP_APPEARE_GENERIC_PHONE 0x0040
772 #define GAP_APPEARE_GENERIC_COMPUTER 0x0080
773 #define GAP_APPEARE_GENERIC_WATCH 0x00C0
774 #define GAP_APPEARE_WATCH_SPORTS 0x00C1
775 #define GAP_APPEARE_GENERIC_CLOCK 0x0100
776 #define GAP_APPEARE_GENERIC_DISPLAY 0x0140
777 #define GAP_APPEARE_GENERIC_RC 0x0180
778 #define GAP_APPEARE_GENERIC_EYE_GALSSES 0x01C0
779 #define GAP_APPEARE_GENERIC_TAG 0x0200
780 #define GAP_APPEARE_GENERIC_KEYRING 0x0240
781 #define GAP_APPEARE_GENERIC_MEDIA_PLAYER 0x0280
782 #define GAP_APPEARE_GENERIC_BARCODE_SCANNER 0x02C0
783 #define GAP_APPEARE_GENERIC_THERMOMETER 0x0300
784 #define GAP_APPEARE_GENERIC_THERMO_EAR 0x0301
785 #define GAP_APPEARE_GENERIC_HR_SENSOR 0x0340
786 #define GAP_APPEARE_GENERIC_HRS_BELT 0x0341
787 #define GAP_APPEARE_GENERIC_BLOOD_PRESSURE 0x0380
788 #define GAP_APPEARE_GENERIC_BP_ARM 0x0381
789 #define GAP_APPEARE_GENERIC_BP_WRIST 0x0382
790 #define GAP_APPEARE_GENERIC_HID 0x03C0
791 #define GAP_APPEARE_HID_KEYBOARD 0x03C1
792 #define GAP_APPEARE_HID_MOUSE 0x03C2
793 #define GAP_APPEARE_HID_JOYSTIC 0x03C3
794 #define GAP_APPEARE_HID_GAMEPAD 0x03C4
795 #define GAP_APPEARE_HID_DIGITIZER_TYABLET 0x03C5
796 #define GAP_APPEARE_HID_DIGITAL_CARDREADER 0x03C6
797 #define GAP_APPEARE_HID_DIGITAL_PEN 0x03C7
798 #define GAP_APPEARE_HID_BARCODE_SCANNER 0x03C8
799 
804 #define GAP_LLERROR_COMMAND_DISALLOWED 0x0C
805 #define GAP_LLERROR_INVALID_PARAMETERS 0x12
806 
811 typedef enum
812 {
814  GAP_CONN_EVT_STAT_SUCCESS = LL_CONN_EVT_STAT_SUCCESS,
816  GAP_CONN_EVT_STAT_CRC_ERROR = LL_CONN_EVT_STAT_CRC_ERROR,
818  GAP_CONN_EVT_STAT_MISSED = LL_CONN_EVT_STAT_MISSED
820 
824 typedef enum
825 {
827  GAP_CONN_EVT_TASK_TYPE_ADV = LL_TASK_ID_ADVERTISER,
829  GAP_CONN_EVT_TASK_TYPE_INIT = LL_TASK_ID_INITIATOR,
831  GAP_CONN_EVT_TASK_TYPE_SLAVE = LL_TASK_ID_SLAVE,
833  GAP_CONN_EVT_TASK_TYPE_SCAN = LL_TASK_ID_SCANNER,
835  GAP_CONN_EVT_TASK_TYPE_MASTER = LL_TASK_ID_MASTER,
836  // No task
837  GAP_CONN_EVT_TASK_TYPE_NONE = LL_TASK_ID_NONE
839 
843 typedef enum
844 {
848 
849 
852 /*-------------------------------------------------------------------
853  * TYPEDEFS - Initialization and Configuration
854  */
855 
865 typedef uint16 gapParamIDs_t;
866 
868 typedef struct
869 {
871  uint8 opcode;
872 } gapEventHdr_t;
873 
884 typedef struct
885 {
887  uint8 opcode;
888  uint8 addrMode;
889  uint8 newRandomAddr[B_ADDR_LEN];
891 
901 typedef struct
902 {
904  uint16 intervalMin;
906  uint16 intervalMax;
908  uint16 latency;
910  uint16 timeout;
912 
925 typedef struct
926 {
928  uint8 opcode;
929  uint8 devAddr[B_ADDR_LEN];
930  uint16 dataPktLen;
931  uint8 numDataPkts;
933 
944 typedef struct
945 {
947  uint8 opcode;
948  uint8 addrType;
949  uint8 devAddr[B_ADDR_LEN];
950  uint32 signCounter;
952 
960 typedef struct
961 {
963  uint8 opcode;
964  uint8 eventType;
965  uint8 addrType;
966  uint8 addr[B_ADDR_LEN];
967  int8 rssi;
968  uint8 dataLen;
969  uint8 *pEvtData;
971  // end of GAP_Events
973 
974 /*-------------------------------------------------------------------
975  * TYPEDEFS - Device Discovery
976  */
977 
979 typedef struct
980 {
981  uint8 taskID;
982  uint8 mode;
983  uint8 activeScan;
984  uint8 whiteList;
986 
988 typedef struct
989 {
990  uint8 eventType;
991  uint8 addrType;
992  uint8 addr[B_ADDR_LEN];
993 } gapDevRec_t;
994 
1006 typedef struct
1007 {
1009  uint8 opcode;
1010  uint8 numDevs;
1013  // end of GAP_Events
1015 
1017 typedef struct
1018 {
1019  uint8 eventType;
1021  uint8 initiatorAddr[B_ADDR_LEN];
1022  uint8 channelMap;
1025 
1037 typedef struct
1038 {
1040  uint8 opcode;
1042 
1049 typedef struct
1050 {
1052  uint8 opcode;
1054 
1061 typedef struct
1062 {
1064  uint8 opcode;
1065  uint8 adType;
1067  // end of GAP_Events
1069 
1070 /*-------------------------------------------------------------------
1071  * TYPEDEFS - Link Establishment
1072  */
1073 
1075 typedef struct
1076 {
1077  uint8 taskID;
1079  uint8 whiteList;
1081  uint8 peerAddr[B_ADDR_LEN];
1082 } gapEstLinkReq_t;
1083 
1085 typedef struct
1086 {
1088  uint16 intervalMin;
1089  uint16 intervalMax;
1090  uint16 connLatency;
1091  uint16 connTimeout;
1093 
1095 typedef struct
1096 {
1098  uint16 intervalMin;
1099  uint16 intervalMax;
1100  uint16 connLatency;
1101  uint16 connTimeout;
1102  uint8 accepted;
1104 
1116 typedef struct
1117 {
1119  uint8 opcode;
1122 
1132 typedef struct
1133 {
1135  uint8 opcode;
1136  uint8 devAddrType;
1137  uint8 devAddr[B_ADDR_LEN];
1139  uint8 connRole;
1140  uint16 connInterval;
1141  uint16 connLatency;
1142  uint16 connTimeout;
1145 
1152 typedef struct
1153 {
1155  uint8 opcode;
1156  uint8 status;
1158  uint16 connInterval;
1159  uint16 connLatency;
1160  uint16 connTimeout;
1162 
1169 typedef struct
1170 {
1172  uint8 opcode;
1174  uint8 reason;
1176 
1177 /*-------------------------------------------------------------------
1178  * TYPEDEFS - Authentication, Bounding and Pairing
1179  */
1180 
1187 typedef struct
1188 {
1190  uint8 opcode;
1191  uint8 deviceAddr[B_ADDR_LEN];
1193  uint8 uiInputs;
1194  uint8 uiOutputs;
1195  uint32 numComparison;
1197 
1204 typedef struct
1205 {
1207  uint8 opcode;
1209  uint8 authState;
1215  // end of GAP_Events
1217 
1224 typedef struct
1225 {
1228 } gapAuthParams_t;
1229 
1241 typedef struct
1242 {
1244  uint8 opcode;
1246  uint8 deviceAddr[B_ADDR_LEN];
1247  uint8 authReq;
1249 
1256 typedef struct
1257 {
1259  uint8 opcode;
1262  // end of GAP_Events
1264 
1266 typedef struct
1267 {
1268  uint8 ioCap;
1269  uint8 oobDataFlag;
1270  uint8 authReq;
1273 } gapPairingReq_t;
1274 
1291 typedef struct
1292 {
1294  uint8 opcode;
1298 
1302 typedef struct
1303 {
1304  GAP_ConnEvtStat_t status;
1305  uint16_t handle;
1306  uint8_t channel;
1307  int8_t lastRssi;
1308  uint16_t packets;
1311  uint16_t errors;
1313  GAP_ConnEvtTaskType_t nextTaskType;
1315  uint32_t nextTaskTime;
1317  // end of GAP_Events
1319 
1327 typedef struct
1328 {
1329  uint8 adType;
1330  uint8 attrLen;
1331  uint8 *pAttrData;
1333 
1340 typedef uint8 (*pfnSuppEnhPrivCB_t)
1343  uint8 *deviceAddr
1344 );
1345 
1347 typedef void (*pfnGapIdleCB_t)();
1348 
1350 typedef struct
1351 {
1354 } gapBondMgrCBs_t;
1355 
1370 typedef void (*pfnGapConnEvtCB_t)
1373  Gap_ConnEventRpt_t *pReport
1374 );
1375 
1378 /*-------------------------------------------------------------------
1379  * GLOBAL VARIABLES
1380  */
1381 
1382 /*-------------------------------------------------------------------
1383  * FUNCTIONS - Initialization and Configuration
1384  */
1385 
1420  extern bStatus_t GAP_DeviceInit( uint8 taskID,
1421  uint8 profileRole,
1422  uint8 maxScanResponses,
1423  uint8 *pIRK,
1424  uint8 *pSRK,
1425  uint32 *pSignCounter );
1426 
1436  extern void GAP_UpdateResolvingList( uint8 *pIRK );
1437 
1457  extern bStatus_t GAP_SetAdvToken( gapAdvDataToken_t *pToken );
1458 
1468  extern gapAdvDataToken_t *GAP_GetAdvToken( uint8 adType );
1469 
1480  extern gapAdvDataToken_t *GAP_RemoveAdvToken( uint8 adType );
1481 
1490  extern bStatus_t GAP_UpdateAdvTokens( void );
1491 
1504  extern bStatus_t GAP_SetParamValue( gapParamIDs_t paramID, uint16 paramValue );
1505 
1514  extern uint16 GAP_GetParamValue( gapParamIDs_t paramID );
1515 
1543  extern bStatus_t GAP_ConfigDeviceAddr( uint8 addrMode, uint8 *pStaticAddr );
1544 
1553  extern void GAP_RegisterForMsgs( uint8 taskID );
1554 
1560  extern void GAP_RegisterBondMgrCBs( gapBondMgrCBs_t *pCBs );
1561 
1562 /*-------------------------------------------------------------------
1563  * FUNCTIONS - Device Discovery
1564  */
1565 
1582 
1596  extern bStatus_t GAP_DeviceDiscoveryCancel( uint8 taskID );
1597 
1612  extern bStatus_t GAP_MakeDiscoverable( uint8 taskID, gapAdvertisingParams_t *pParams );
1613 
1628  extern bStatus_t GAP_UpdateAdvertisingData( uint8 taskID, uint8 adType,
1629  uint8 dataLen, uint8 *pAdvertData );
1630 
1643  extern bStatus_t GAP_EndDiscoverable( uint8 taskID );
1644 
1645 #if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
1646 
1656  extern bStatus_t GAP_ResolvePrivateAddr( uint8 *pIRK, uint8 *pAddr );
1657 #endif // ! BLE_V42_FEATURES | ! PRIVACY_1_2_CFG
1658 
1659 /*-------------------------------------------------------------------
1660  * FUNCTIONS - Link Establishment
1661  */
1662 
1677  extern bStatus_t GAP_EstablishLinkReq( gapEstLinkReq_t *pParams );
1678 
1694  extern bStatus_t GAP_TerminateLinkReq( uint8 taskID, uint16 connectionHandle, uint8 reason );
1695 
1712 
1739 
1745  extern uint8 GAP_NumActiveConnections( void );
1746 
1773  GAP_CB_Action_t action,
1774  uint16_t connHandle);
1775 
1776 
1777 
1778 /*-------------------------------------------------------------------
1779  * FUNCTIONS - Pairing
1780  */
1781 
1809  extern bStatus_t GAP_Authenticate( gapAuthParams_t *pParams, gapPairingReq_t *pPairReq );
1810 
1817  extern uint8 GAP_isPairing(void);
1818 
1836  extern bStatus_t GAP_TerminateAuth( uint16 connectionHandle, uint8 reason );
1837 
1857  extern bStatus_t GAP_PasskeyUpdate( uint8 *pPasskey, uint16 connectionHandle );
1858 
1877  extern bStatus_t GAP_PasscodeUpdate( uint32 passcode, uint16 connectionHandle );
1878 
1893  extern bStatus_t GAP_SendSlaveSecurityRequest( uint16 connectionHandle, uint8 authReq );
1894 
1911  extern bStatus_t GAP_Signable( uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams );
1912 
1934  extern bStatus_t GAP_Bond( uint16 connectionHandle, uint8 authenticated,
1935  uint8 secureConnections, smSecurityInfo_t *pParams,
1936  uint8 startEncryption );
1937 
1938 /*-------------------------------------------------------------------
1939  * Internal API - These functions are only called from gap.c module.
1940  */
1941 
1943 
1954  extern bStatus_t GAP_ParamsInit( uint8 taskID, uint8 profileRole );
1955 
1963  extern void GAP_PrivacyInit( uint8 *pIRK );
1964 
1972  extern uint8 *GAP_GetIRK( void );
1973 
1986  extern void GAP_SecParamsInit( uint8 *pSRK, uint32 *pSignCounter );
1987 
1995  extern bStatus_t GAP_PeriDevMgrInit( void );
1996 
2003  extern void GAP_PeriConnRegister( void );
2004 
2016  extern bStatus_t GAP_CentDevMgrInit( uint8 maxScanResponses );
2017 
2024  extern void GAP_CentConnRegister( void );
2025 
2026 
2027 /*-------------------------------------------------------------------
2028  * TASK API - These functions must only be called OSAL.
2029  */
2030 
2038  extern void GAP_Init( uint8 task_id );
2039 
2050  extern uint16 GAP_ProcessEvent( uint8 task_id, uint16 events );
2051 
2053 
2054 /*-------------------------------------------------------------------
2055 -------------------------------------------------------------------*/
2056 
2057 #ifdef __cplusplus
2058 }
2059 #endif
2060 
2061 #endif /* GAP_H */
2062 
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:1063
uint8 authState
TRUE if the pairing was authenticated (MITM)
Definition: gap.h:1209
uint8 opcode
GAP_MAKE_DISCOVERABLE_DONE_EVENT
Definition: gap.h:1040
uint8 opcode
GAP_END_DISCOVERABLE_DONE_EVENT
Definition: gap.h:1052
bStatus_t GAP_SetAdvToken(gapAdvDataToken_t *pToken)
Set Advertising Token.
uint8 opcode
GAP_SIGNATURE_UPDATED_EVENT
Definition: gap.h:947
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:946
uint8 eventType
Advertise Event Type: GAP Advertising Event Types.
Definition: gap.h:1019
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:1260
uint8 attrLen
Number of bytes in the attribute data.
Definition: gap.h:1330
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:886
void(* pfnGapConnEvtCB_t)(Gap_ConnEventRpt_t *pReport)
Definition: gap.h:1371
uint8 authReq
Authentication Requirements: Bit 2: MITM, Bits 0-1: bonding (0 - no bonding, 1 - bonding) ...
Definition: gap.h:1247
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:1210
bStatus_t GAP_TerminateAuth(uint16 connectionHandle, uint8 reason)
Terminate Authnetication.
Authentication Parameters.
Definition: gap.h:1224
bStatus_t GAP_PasskeyUpdate(uint8 *pPasskey, uint16 connectionHandle)
Update the passkey in string format.
GAP_MAKE_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:1037
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1243
uint8 mode
Discovery Mode: GAP Device Discovery Modes.
Definition: gap.h:982
bStatus_t GAP_EstablishLinkReq(gapEstLinkReq_t *pParams)
Establish a link to a slave device.
Connection event in slave role.
Definition: gap.h:831
uint8 adType
ADTYPE value: Address Types.
Definition: gap.h:1329
smSigningInfo_t * pSigningInfo
Signing information.
Definition: gap.h:1211
uint8 addrType
Device's address type for devAddr.
Definition: gap.h:948
uint16_t handle
connection handle
Definition: gap.h:1305
uint16 connectionHandle
Connection Handle.
Definition: gap.h:1245
GAP_ConnEvtTaskType_t
Definition: gap.h:824
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:927
uint16 latency
Definition: gap.h:908
uint8 dataLen
Length (in bytes) of the data field (evtData)
Definition: gap.h:968
uint16 gapParamIDs_t
GAP Parameters IDs.
Definition: gap.h:865
uint8 adType
TRUE if advertising data, FALSE if SCAN_RSP.
Definition: gap.h:1065
GAP_PASSKEY_NEEDED_EVENT message format.
Definition: gap.h:1187
GAP_CB_Action_t
Definition: gap.h:843
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:870
Connection parameters for the peripheral device.
Definition: gap.h:901
GAP_DEVICE_INIT_DONE_EVENT message format.
Definition: gap.h:925
Definition: gap.h:1302
uint8 taskID
Requesting App's Task ID, used to return results.
Definition: gap.h:981
GAP_SLAVE_REQUESTED_SECURITY_EVENT message format.
Definition: gap.h:1241
Register a callback.
Definition: gap.h:845
Connection event occurred successfully.
Definition: gap.h:814
GAP_ConnEvtStat_t status
status of connection event
Definition: gap.h:1304
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1039
bStatus_t GAP_TerminateLinkReq(uint8 taskID, uint16 connectionHandle, uint8 reason)
Terminate a link connection.
GAP event header format.
Definition: gap.h:868
GAP_BOND_COMPLETE_EVENT message format.
Definition: gap.h:1256
uint8 eventType
Indicates advertising event type used by the advertiser: GAP Advertising Report Event Types...
Definition: gap.h:990
GAP_ConnEvtTaskType_t nextTaskType
Type of next BLE task.
Definition: gap.h:1313
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:1226
GAP_PAIRING_REQ_EVENT message format.
Definition: gap.h:1291
uint8 addrType
Address Type: Address Types.
Definition: gap.h:991
int8_t lastRssi
Definition: gap.h:1307
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1258
uint8 uiInputs
Pairing User Interface Inputs - Ask user to input passcode.
Definition: gap.h:1193
uint8 numDevs
Number of devices found during scan.
Definition: gap.h:1010
GAP_ConnEvtStat_t
Definition: gap.h:811
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1189
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:871
keyDist_t keyDist
Pairing Request Key Distribution field.
Definition: gap.h:1272
uint8_t channel
BLE RF channel index (0-39)
Definition: gap.h:1306
uint8(* pfnSuppEnhPrivCB_t)(uint8 *deviceAddr)
Enhanced Privacy Check Callback Function.
Definition: gap.h:1342
uint8 maxEncKeySize
Pairing Request Maximum Encryption Key Size field.
Definition: gap.h:1271
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:962
GAP_SIGNATURE_UPDATED_EVENT message format.
Definition: gap.h:944
uint8 numDataPkts
HC_Total_Num_LE_Data_Packets.
Definition: gap.h:931
uint8 opcode
GAP_PAIRING_REQ_EVENT
Definition: gap.h:1294
uint8 opcode
GAP_SLAVE_REQUESTED_SECURITY_EVENT
Definition: gap.h:1244
Definition: sm.h:144
uint8 opcode
GAP_DEVICE_INFO_EVENT
Definition: gap.h:963
uint8 initiatorAddrType
Initiator's address type: Address Types.
Definition: gap.h:1020
uint8 opcode
GAP_ADV_DATA_UPDATE_DONE_EVENT
Definition: gap.h:1064
uint16 intervalMax
Definition: gap.h:906
Type of device discovery (Scan) to perform.
Definition: gap.h:988
uint16 GAP_GetParamValue(gapParamIDs_t paramID)
Get a GAP Parameter value.
uint8 opcode
GAP_DEVICE_INIT_DONE_EVENT
Definition: gap.h:928
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:1213
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:960
uint8 uiOutputs
Pairing User Interface Outputs - Display passcode.
Definition: gap.h:1194
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:1208
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1051
uint8 opcode
GAP_DEVICE_DISCOVERY_EVENT
Definition: gap.h:1009
GAP_ADV_DATA_UPDATE_DONE_EVENT message format.
Definition: gap.h:1061
uint16 connectionHandle
connection Handle
Definition: gap.h:1295
bStatus_t GAP_RegisterConnEventCb(pfnGapConnEvtCB_t cb, GAP_CB_Action_t action, uint16_t connHandle)
uint32 signCounter
new Signed Counter
Definition: gap.h:950
smLinkSecurityReq_t secReqs
Pairing Control info.
Definition: gap.h:1227
uint8 addrType
address type: Address Types
Definition: gap.h:965
uint16 timeout
Definition: gap.h:910
bStatus_t GAP_UpdateAdvTokens(void)
Update Advertising Token.
gapAdvDataToken_t * GAP_GetAdvToken(uint8 adType)
Get Advertising Token.
uint16 intervalMin
Definition: gap.h:904
uint8 oobDataFlag
Pairing Request OOB Data Flag field.
Definition: gap.h:1269
uint16_t errors
Total number of CRC errors for the entire connection.
Definition: gap.h:1311
int8 rssi
Advertisement or SCAN_RSP RSSI.
Definition: gap.h:967
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1008
Type of device discovery (Scan) to perform.
Definition: gap.h:979
uint8 opcode
GAP_AUTHENTICATION_COMPLETE_EVENT
Definition: gap.h:1207
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1206
Type definitions and macros for BLE stack.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1293
No data was received during connection event.
Definition: gap.h:818
smSecurityInfo_t * pDevSecInfo
BOUND - security information from connected device.
Definition: gap.h:1212
Initiating a connection.
Definition: gap.h:829
void(* pfnGapIdleCB_t)()
GAP Idle Callback Function.
Definition: gap.h:1347
Definition: sm.h:211
uint8 channelMap
Channel Map: Bit mask GAP Advertisement Channel Map.
Definition: gap.h:1022
uint8 addrMode
Address mode: GAP Addressing Modes.
Definition: gap.h:888
uint8 filterPolicy
Filer Policy: GAP Advertiser Filter Scan Parameters. Ignored when directed advertising is used...
Definition: gap.h:1023
GAP_END_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:1049
uint8 opcode
GAP_PASSKEY_NEEDED_EVENT
Definition: gap.h:1190
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
Connection event failed because all packets had CRC errors.
Definition: gap.h:816
bStatus_t GAP_UpdateLinkParamReqReply(gapUpdateLinkParamReqReply_t *pParams)
Reply to a Connection Parameter Update Request sent from a peer device.
pfnSuppEnhPrivCB_t supportEnhPrivCB
Supports Enhanced Privacy callback.
Definition: gap.h:1352
Advertiser.
Definition: gap.h:827
uint8 opcode
GAP_RANDOM_ADDR_CHANGED_EVENT
Definition: gap.h:887
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:115
uint8 eventType
Advertisement Type: GAP Advertising Report Event Types.
Definition: gap.h:964
uint8 ioCap
Pairing Request ioCap field.
Definition: gap.h:1268
GAP_AUTHENTICATION_COMPLETE_EVENT message format.
Definition: gap.h:1204
Callback Registration Structure.
Definition: gap.h:1350
uint8 GAP_isPairing(void)
Check if GAP is currently pairing.
uint32_t nextTaskTime
Time to next BLE task (in us). 0xFFFFFFFF if there is no next task.
Definition: gap.h:1315
uint8 opcode
GAP_BOND_COMPLETE_EVENT
Definition: gap.h:1259
uint8 * pAttrData
pointer to Attribute data
Definition: gap.h:1331
pfnGapIdleCB_t gapIdleCB
GAP Idle callback.
Definition: gap.h:1353
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:233
GAP_DEVICE_DISCOVERY_EVENT message format.
Definition: gap.h:1006
GAP_RANDOM_ADDR_CHANGED_EVENT message format.
Definition: gap.h:884
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:983
Pairing Request fields - the parsed fields of the SMP Pairing Request command.
Definition: gap.h:1266
uint8 * pEvtData
Data field of advertisement or SCAN_RSP.
Definition: gap.h:969
Advertising Parameters.
Definition: gap.h:1017
Connection event in master role.
Definition: gap.h:835
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:930
uint32 numComparison
Numeric Comparison value to be displayed.
Definition: gap.h:1195
gapPairingReq_t pairReq
The Pairing Request fields received.
Definition: gap.h:1296
Scanner.
Definition: gap.h:833
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:984
uint16 connectionHandle
Connection handle.
Definition: gap.h:1192
GAP Advertisement/Scan Response Data Token.
Definition: gap.h:1327
Unregister a callback
Definition: gap.h:846
gapAdvDataToken_t * GAP_RemoveAdvToken(uint8 adType)
Remove Advertising Token.
uint8 authReq
Pairing Request Auth Req field.
Definition: gap.h:1270
gapDevRec_t * pDevList
array of device records
Definition: gap.h:1011
bStatus_t GAP_SetParamValue(gapParamIDs_t paramID, uint16 paramValue)
Set a GAP Parameter value.
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale