TI BLE-Stack for Bluetooth API Documentation  3.03.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 
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 
238 #define TGAP_LIM_DISC_ADV_INT_MIN 6
239 
247 #define TGAP_LIM_DISC_ADV_INT_MAX 7
248 
256 #define TGAP_GEN_DISC_ADV_INT_MIN 8
257 
265 #define TGAP_GEN_DISC_ADV_INT_MAX 9
266 
274 #define TGAP_CONN_ADV_INT_MIN 10
275 
283 #define TGAP_CONN_ADV_INT_MAX 11
284 
292 #define TGAP_CONN_SCAN_INT 12
293 
301 #define TGAP_CONN_SCAN_WIND 13
302 
310 #define TGAP_CONN_HIGH_SCAN_INT 14
311 
319 #define TGAP_CONN_HIGH_SCAN_WIND 15
320 
328 #define TGAP_GEN_DISC_SCAN_INT 16
329 
337 #define TGAP_GEN_DISC_SCAN_WIND 17
338 
346 #define TGAP_LIM_DISC_SCAN_INT 18
347 
355 #define TGAP_LIM_DISC_SCAN_WIND 19
356 
358 
363 #define TGAP_CONN_EST_ADV 20
364 
373 #define TGAP_CONN_EST_INT_MIN 21
374 
382 #define TGAP_CONN_EST_INT_MAX 22
383 
391 #define TGAP_CONN_EST_SCAN_INT 23
392 
400 #define TGAP_CONN_EST_SCAN_WIND 24
401 
409 #define TGAP_CONN_EST_SUPERV_TIMEOUT 25
410 
418 #define TGAP_CONN_EST_LATENCY 26
419 
427 #define TGAP_CONN_EST_MIN_CE_LEN 27
428 
436 #define TGAP_CONN_EST_MAX_CE_LEN 28
437 
445 #define TGAP_PRIVATE_ADDR_INT 29
446 
454 #define TGAP_CONN_PAUSE_CENTRAL 30
455 
463 #define TGAP_CONN_PAUSE_PERIPHERAL 31
464 
472 #define TGAP_SM_TIMEOUT 32
473 
481 #define TGAP_SM_MIN_KEY_LEN 33
482 
490 #define TGAP_SM_MAX_KEY_LEN 34
491 
499 #define TGAP_FILTER_ADV_REPORTS 35
500 
508 #define TGAP_SCAN_RSP_RSSI_MIN 36
509 
517 #define TGAP_REJECT_CONN_PARAMS 37
518 
520 #if !defined ( TESTMODES )
521  #define TGAP_AUTH_TASK_ID 38
522  #define TGAP_VERIFY_CAR 39
523 
531  #define TGAP_FAST_INTERVAL_2_INT_MIN 40
532 
539  #define TGAP_FAST_INTERVAL_2_INT_MAX 41
540  #define TGAP_PARAMID_MAX 42
542 #else
543  #define TGAP_GAP_TESTCODE 38
544  #define TGAP_SM_TESTCODE 39
545  #define TGAP_AUTH_TASK_ID 40
546  #define TGAP_VERIFY_CAR 41
547 
548 
555  #define TGAP_FAST_INTERVAL_2_INT_MIN 42
556 
563  #define TGAP_FAST_INTERVAL_2_INT_MAX 43
564  #define TGAP_PARAMID_MAX 44
565 
566  #define TGAP_GATT_TESTCODE 100
567  #define TGAP_ATT_TESTCODE 101
568  #define TGAP_GGS_TESTCODE 102
569  #define TGAP_L2CAP_TESTCODE 103
570 #endif
571 
578 #define DEVDISC_MODE_NONDISCOVERABLE 0x00
579 #define DEVDISC_MODE_GENERAL 0x01
580 #define DEVDISC_MODE_LIMITED 0x02
581 #define DEVDISC_MODE_ALL 0x03
582 
587 #define ADDRTYPE_PUBLIC 0x00
588 #define ADDRTYPE_RANDOM 0x01
589 #define ADDRTYPE_PUBLIC_ID 0x02
590 #define ADDRTYPE_RANDOM_ID 0x03
591 
596 #define SET_ADDRTYPE_ID 0x02
597 #define MASK_ADDRTYPE_ID 0x01
598 
603 #define RANDOM_ADDR_SUBTYPE_STATIC 0x00
604 #define RANDOM_ADDR_SUBTYPE_RPA 0x01
605 #define RANDOM_ADDR_SUBTYPE_NRPA 0x02
606 
611 #define RANDOM_ADDR_HDR_MASK 0xC0
612 #define STATIC_ADDR_HDR 0xC0
613 #define PRIVATE_NON_RESOLVE_ADDR_HDR 0x80
614 #define PRIVATE_RESOLVE_ADDR_HDR 0x40
615 
620 #define ADDRMODE_PUBLIC 0x00
621 #define ADDRMODE_STATIC 0x01
622 #define ADDRMODE_PRIVATE_NONRESOLVE 0x02
623 #define ADDRMODE_PRIVATE_RESOLVE 0x03
624 
630 #define GAP_ADTYPE_ADV_IND 0x00
631 #define GAP_ADTYPE_ADV_HDC_DIRECT_IND 0x01
632 #define GAP_ADTYPE_ADV_SCAN_IND 0x02
633 #define GAP_ADTYPE_ADV_NONCONN_IND 0x03
634 #define GAP_ADTYPE_ADV_LDC_DIRECT_IND 0x04
635 
641 #define GAP_ADRPT_ADV_IND 0x00
642 #define GAP_ADRPT_ADV_DIRECT_IND 0x01
643 #define GAP_ADRPT_ADV_SCAN_IND 0x02
644 #define GAP_ADRPT_ADV_NONCONN_IND 0x03
645 #define GAP_ADRPT_SCAN_RSP 0x04
646 
651 #define GAP_FILTER_POLICY_ALL 0x00
652 #define GAP_FILTER_POLICY_WHITE_SCAN 0x01
653 #define GAP_FILTER_POLICY_WHITE_CON 0x02
654 #define GAP_FILTER_POLICY_WHITE 0x03
655 
667 #define GAP_DISC_FILTER_POLICY_ALL 0x00
668 #define GAP_DISC_FILTER_POLICY_WHITE 0x01
669 #define GAP_DISC_FILTER_POLICY_ALL_DIRECT 0x02
670 #define GAP_DISC_FILTER_POLICY_WHITE_DIRECT 0x03
671 
673 #define ADV_CHANMAP_SIZE 5
674 
675 #define GAP_PASSCODE_MAX 999999
676 
677 
683 #define GAP_INIT_SIGN_COUNTER 0xFFFFFFFF
684 
688 #define GAP_ADVCHAN_37 0x01
689 #define GAP_ADVCHAN_38 0x02
690 #define GAP_ADVCHAN_39 0x04
691 #define GAP_ADVCHAN_ALL (GAP_ADVCHAN_37 | GAP_ADVCHAN_38 | GAP_ADVCHAN_39)
692 
697 #define WL_NOTUSED 0x00
698 #define WL_USED 0x01
699 
705 #define GAP_ADTYPE_FLAGS 0x01
706 #define GAP_ADTYPE_16BIT_MORE 0x02
707 #define GAP_ADTYPE_16BIT_COMPLETE 0x03
708 #define GAP_ADTYPE_32BIT_MORE 0x04
709 #define GAP_ADTYPE_32BIT_COMPLETE 0x05
710 #define GAP_ADTYPE_128BIT_MORE 0x06
711 #define GAP_ADTYPE_128BIT_COMPLETE 0x07
712 #define GAP_ADTYPE_LOCAL_NAME_SHORT 0x08
713 #define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09
714 #define GAP_ADTYPE_POWER_LEVEL 0x0A
715 #define GAP_ADTYPE_OOB_CLASS_OF_DEVICE 0x0D
716 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E
717 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F
718 #define GAP_ADTYPE_SM_TK 0x10
719 #define GAP_ADTYPE_SM_OOB_FLAG 0x11
720 #define GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE 0x12
721 #define GAP_ADTYPE_SIGNED_DATA 0x13
722 #define GAP_ADTYPE_SERVICES_LIST_16BIT 0x14
723 #define GAP_ADTYPE_SERVICES_LIST_128BIT 0x15
724 #define GAP_ADTYPE_SERVICE_DATA 0x16
725 #define GAP_ADTYPE_PUBLIC_TARGET_ADDR 0x17
726 #define GAP_ADTYPE_RANDOM_TARGET_ADDR 0x18
727 #define GAP_ADTYPE_APPEARANCE 0x19
728 #define GAP_ADTYPE_ADV_INTERVAL 0x1A
729 #define GAP_ADTYPE_LE_BD_ADDR 0x1B
730 #define GAP_ADTYPE_LE_ROLE 0x1C
731 #define GAP_ADTYPE_SIMPLE_PAIRING_HASHC_256 0x1D
732 #define GAP_ADTYPE_SIMPLE_PAIRING_RANDR_256 0x1E
733 #define GAP_ADTYPE_SERVICE_DATA_32BIT 0x20
734 #define GAP_ADTYPE_SERVICE_DATA_128BIT 0x21
735 #define GAP_ADTYPE_3D_INFO_DATA 0x3D
736 #define GAP_ADTYPE_MANUFACTURER_SPECIFIC 0xFF
737 #define GAP_ADTYPE_FLAGS_LIMITED 0x01
738 #define GAP_ADTYPE_FLAGS_GENERAL 0x02
739 #define GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
740 
745 #define GAP_STATE_IDLE 0x00
746 #define GAP_STATE_ADV 0x01
747 #define GAP_STATE_SCAN 0x02
748 #define GAP_STATE_INIT 0x04
749 
754 #define GAP_APPEARE_UNKNOWN 0x0000
755 #define GAP_APPEARE_GENERIC_PHONE 0x0040
756 #define GAP_APPEARE_GENERIC_COMPUTER 0x0080
757 #define GAP_APPEARE_GENERIC_WATCH 0x00C0
758 #define GAP_APPEARE_WATCH_SPORTS 0x00C1
759 #define GAP_APPEARE_GENERIC_CLOCK 0x0100
760 #define GAP_APPEARE_GENERIC_DISPLAY 0x0140
761 #define GAP_APPEARE_GENERIC_RC 0x0180
762 #define GAP_APPEARE_GENERIC_EYE_GALSSES 0x01C0
763 #define GAP_APPEARE_GENERIC_TAG 0x0200
764 #define GAP_APPEARE_GENERIC_KEYRING 0x0240
765 #define GAP_APPEARE_GENERIC_MEDIA_PLAYER 0x0280
766 #define GAP_APPEARE_GENERIC_BARCODE_SCANNER 0x02C0
767 #define GAP_APPEARE_GENERIC_THERMOMETER 0x0300
768 #define GAP_APPEARE_GENERIC_THERMO_EAR 0x0301
769 #define GAP_APPEARE_GENERIC_HR_SENSOR 0x0340
770 #define GAP_APPEARE_GENERIC_HRS_BELT 0x0341
771 #define GAP_APPEARE_GENERIC_BLOOD_PRESSURE 0x0380
772 #define GAP_APPEARE_GENERIC_BP_ARM 0x0381
773 #define GAP_APPEARE_GENERIC_BP_WRIST 0x0382
774 #define GAP_APPEARE_GENERIC_HID 0x03C0
775 #define GAP_APPEARE_HID_KEYBOARD 0x03C1
776 #define GAP_APPEARE_HID_MOUSE 0x03C2
777 #define GAP_APPEARE_HID_JOYSTIC 0x03C3
778 #define GAP_APPEARE_HID_GAMEPAD 0x03C4
779 #define GAP_APPEARE_HID_DIGITIZER_TYABLET 0x03C5
780 #define GAP_APPEARE_HID_DIGITAL_CARDREADER 0x03C6
781 #define GAP_APPEARE_HID_DIGITAL_PEN 0x03C7
782 #define GAP_APPEARE_HID_BARCODE_SCANNER 0x03C8
783 
788 #define GAP_LLERROR_COMMAND_DISALLOWED 0x0C
789 #define GAP_LLERROR_INVALID_PARAMETERS 0x12
790 
795 typedef enum
796 {
798  GAP_CONN_EVT_STAT_SUCCESS = LL_CONN_EVT_STAT_SUCCESS,
800  GAP_CONN_EVT_STAT_CRC_ERROR = LL_CONN_EVT_STAT_CRC_ERROR,
802  GAP_CONN_EVT_STAT_MISSED = LL_CONN_EVT_STAT_MISSED
804 
808 typedef enum
809 {
811  GAP_CONN_EVT_TASK_TYPE_ADV = LL_TASK_ID_ADVERTISER,
813  GAP_CONN_EVT_TASK_TYPE_INIT = LL_TASK_ID_INITIATOR,
815  GAP_CONN_EVT_TASK_TYPE_SLAVE = LL_TASK_ID_SLAVE,
817  GAP_CONN_EVT_TASK_TYPE_SCAN = LL_TASK_ID_SCANNER,
819  GAP_CONN_EVT_TASK_TYPE_MASTER = LL_TASK_ID_MASTER,
820  // No task
821  GAP_CONN_EVT_TASK_TYPE_NONE = LL_TASK_ID_NONE
823 
827 typedef enum
828 {
832 
833 
836 /*-------------------------------------------------------------------
837  * TYPEDEFS - Initialization and Configuration
838  */
839 
849 typedef uint16 gapParamIDs_t;
850 
852 typedef struct
853 {
855  uint8 opcode;
856 } gapEventHdr_t;
857 
868 typedef struct
869 {
871  uint8 opcode;
872  uint8 addrMode;
873  uint8 newRandomAddr[B_ADDR_LEN];
875 
885 typedef struct
886 {
888  uint16 intervalMin;
890  uint16 intervalMax;
892  uint16 latency;
894  uint16 timeout;
896 
909 typedef struct
910 {
912  uint8 opcode;
913  uint8 devAddr[B_ADDR_LEN];
914  uint16 dataPktLen;
915  uint8 numDataPkts;
917 
928 typedef struct
929 {
931  uint8 opcode;
932  uint8 addrType;
933  uint8 devAddr[B_ADDR_LEN];
934  uint32 signCounter;
936 
944 typedef struct
945 {
947  uint8 opcode;
948  uint8 eventType;
949  uint8 addrType;
950  uint8 addr[B_ADDR_LEN];
951  int8 rssi;
952  uint8 dataLen;
953  uint8 *pEvtData;
955  // end of GAP_Events
957 
958 /*-------------------------------------------------------------------
959  * TYPEDEFS - Device Discovery
960  */
961 
963 typedef struct
964 {
965  uint8 taskID;
966  uint8 mode;
967  uint8 activeScan;
968  uint8 whiteList;
970 
972 typedef struct
973 {
974  uint8 eventType;
975  uint8 addrType;
976  uint8 addr[B_ADDR_LEN];
977 } gapDevRec_t;
978 
990 typedef struct
991 {
993  uint8 opcode;
994  uint8 numDevs;
997  // end of GAP_Events
999 
1001 typedef struct
1002 {
1003  uint8 eventType;
1005  uint8 initiatorAddr[B_ADDR_LEN];
1006  uint8 channelMap;
1009 
1021 typedef struct
1022 {
1024  uint8 opcode;
1026 
1033 typedef struct
1034 {
1036  uint8 opcode;
1038 
1045 typedef struct
1046 {
1048  uint8 opcode;
1049  uint8 adType;
1051  // end of GAP_Events
1053 
1054 /*-------------------------------------------------------------------
1055  * TYPEDEFS - Link Establishment
1056  */
1057 
1059 typedef struct
1060 {
1061  uint8 taskID;
1063  uint8 whiteList;
1065  uint8 peerAddr[B_ADDR_LEN];
1066 } gapEstLinkReq_t;
1067 
1069 typedef struct
1070 {
1072  uint16 intervalMin;
1073  uint16 intervalMax;
1074  uint16 connLatency;
1075  uint16 connTimeout;
1077 
1079 typedef struct
1080 {
1082  uint16 intervalMin;
1083  uint16 intervalMax;
1084  uint16 connLatency;
1085  uint16 connTimeout;
1086  uint8 accepted;
1088 
1100 typedef struct
1101 {
1103  uint8 opcode;
1106 
1116 typedef struct
1117 {
1119  uint8 opcode;
1120  uint8 devAddrType;
1121  uint8 devAddr[B_ADDR_LEN];
1123  uint8 connRole;
1124  uint16 connInterval;
1125  uint16 connLatency;
1126  uint16 connTimeout;
1129 
1136 typedef struct
1137 {
1139  uint8 opcode;
1140  uint8 status;
1142  uint16 connInterval;
1143  uint16 connLatency;
1144  uint16 connTimeout;
1146 
1153 typedef struct
1154 {
1156  uint8 opcode;
1158  uint8 reason;
1160 
1161 /*-------------------------------------------------------------------
1162  * TYPEDEFS - Authentication, Bounding and Pairing
1163  */
1164 
1171 typedef struct
1172 {
1174  uint8 opcode;
1175  uint8 deviceAddr[B_ADDR_LEN];
1177  uint8 uiInputs;
1178  uint8 uiOutputs;
1179  uint32 numComparison;
1181 
1188 typedef struct
1189 {
1191  uint8 opcode;
1193  uint8 authState;
1199  // end of GAP_Events
1201 
1208 typedef struct
1209 {
1212 } gapAuthParams_t;
1213 
1225 typedef struct
1226 {
1228  uint8 opcode;
1230  uint8 deviceAddr[B_ADDR_LEN];
1231  uint8 authReq;
1233 
1240 typedef struct
1241 {
1243  uint8 opcode;
1246  // end of GAP_Events
1248 
1250 typedef struct
1251 {
1252  uint8 ioCap;
1253  uint8 oobDataFlag;
1254  uint8 authReq;
1257 } gapPairingReq_t;
1258 
1275 typedef struct
1276 {
1278  uint8 opcode;
1282 
1286 typedef struct
1287 {
1288  GAP_ConnEvtStat_t status;
1289  uint16_t handle;
1290  uint8_t channel;
1291  int8_t lastRssi;
1292  uint16_t packets;
1295  uint16_t errors;
1297  GAP_ConnEvtTaskType_t nextTaskType;
1299  uint32_t nextTaskTime;
1301  // end of GAP_Events
1303 
1311 typedef struct
1312 {
1313  uint8 adType;
1314  uint8 attrLen;
1315  uint8 *pAttrData;
1317 
1324 typedef uint8 (*pfnSuppEnhPrivCB_t)
1327  uint8 *deviceAddr
1328 );
1329 
1331 typedef void (*pfnGapIdleCB_t)();
1332 
1334 typedef struct
1335 {
1338 } gapBondMgrCBs_t;
1339 
1354 typedef void (*pfnGapConnEvtCB_t)
1357  Gap_ConnEventRpt_t *pReport
1358 );
1359 
1362 /*-------------------------------------------------------------------
1363  * GLOBAL VARIABLES
1364  */
1365 
1366 /*-------------------------------------------------------------------
1367  * FUNCTIONS - Initialization and Configuration
1368  */
1369 
1404  extern bStatus_t GAP_DeviceInit( uint8 taskID,
1405  uint8 profileRole,
1406  uint8 maxScanResponses,
1407  uint8 *pIRK,
1408  uint8 *pSRK,
1409  uint32 *pSignCounter );
1410 
1420  extern void GAP_UpdateResolvingList( uint8 *pIRK );
1421 
1441  extern bStatus_t GAP_SetAdvToken( gapAdvDataToken_t *pToken );
1442 
1452  extern gapAdvDataToken_t *GAP_GetAdvToken( uint8 adType );
1453 
1464  extern gapAdvDataToken_t *GAP_RemoveAdvToken( uint8 adType );
1465 
1474  extern bStatus_t GAP_UpdateAdvTokens( void );
1475 
1488  extern bStatus_t GAP_SetParamValue( gapParamIDs_t paramID, uint16 paramValue );
1489 
1498  extern uint16 GAP_GetParamValue( gapParamIDs_t paramID );
1499 
1527  extern bStatus_t GAP_ConfigDeviceAddr( uint8 addrMode, uint8 *pStaticAddr );
1528 
1537  extern void GAP_RegisterForMsgs( uint8 taskID );
1538 
1544  extern void GAP_RegisterBondMgrCBs( gapBondMgrCBs_t *pCBs );
1545 
1546 /*-------------------------------------------------------------------
1547  * FUNCTIONS - Device Discovery
1548  */
1549 
1566 
1580  extern bStatus_t GAP_DeviceDiscoveryCancel( uint8 taskID );
1581 
1596  extern bStatus_t GAP_MakeDiscoverable( uint8 taskID, gapAdvertisingParams_t *pParams );
1597 
1612  extern bStatus_t GAP_UpdateAdvertisingData( uint8 taskID, uint8 adType,
1613  uint8 dataLen, uint8 *pAdvertData );
1614 
1627  extern bStatus_t GAP_EndDiscoverable( uint8 taskID );
1628 
1629 #if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
1630 
1640  extern bStatus_t GAP_ResolvePrivateAddr( uint8 *pIRK, uint8 *pAddr );
1641 #endif // ! BLE_V42_FEATURES | ! PRIVACY_1_2_CFG
1642 
1643 /*-------------------------------------------------------------------
1644  * FUNCTIONS - Link Establishment
1645  */
1646 
1661  extern bStatus_t GAP_EstablishLinkReq( gapEstLinkReq_t *pParams );
1662 
1678  extern bStatus_t GAP_TerminateLinkReq( uint8 taskID, uint16 connectionHandle, uint8 reason );
1679 
1696 
1723 
1729  extern uint8 GAP_NumActiveConnections( void );
1730 
1757  GAP_CB_Action_t action,
1758  uint16_t connHandle);
1759 
1760 
1761 
1762 /*-------------------------------------------------------------------
1763  * FUNCTIONS - Pairing
1764  */
1765 
1793  extern bStatus_t GAP_Authenticate( gapAuthParams_t *pParams, gapPairingReq_t *pPairReq );
1794 
1801  extern uint8 GAP_isPairing(void);
1802 
1820  extern bStatus_t GAP_TerminateAuth( uint16 connectionHandle, uint8 reason );
1821 
1841  extern bStatus_t GAP_PasskeyUpdate( uint8 *pPasskey, uint16 connectionHandle );
1842 
1861  extern bStatus_t GAP_PasscodeUpdate( uint32 passcode, uint16 connectionHandle );
1862 
1877  extern bStatus_t GAP_SendSlaveSecurityRequest( uint16 connectionHandle, uint8 authReq );
1878 
1895  extern bStatus_t GAP_Signable( uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams );
1896 
1918  extern bStatus_t GAP_Bond( uint16 connectionHandle, uint8 authenticated,
1919  uint8 secureConnections, smSecurityInfo_t *pParams,
1920  uint8 startEncryption );
1921 
1922 /*-------------------------------------------------------------------
1923  * Internal API - These functions are only called from gap.c module.
1924  */
1925 
1927 
1938  extern bStatus_t GAP_ParamsInit( uint8 taskID, uint8 profileRole );
1939 
1947  extern void GAP_PrivacyInit( uint8 *pIRK );
1948 
1956  extern uint8 *GAP_GetIRK( void );
1957 
1970  extern void GAP_SecParamsInit( uint8 *pSRK, uint32 *pSignCounter );
1971 
1979  extern bStatus_t GAP_PeriDevMgrInit( void );
1980 
1987  extern void GAP_PeriConnRegister( void );
1988 
2000  extern bStatus_t GAP_CentDevMgrInit( uint8 maxScanResponses );
2001 
2008  extern void GAP_CentConnRegister( void );
2009 
2010 
2011 /*-------------------------------------------------------------------
2012  * TASK API - These functions must only be called OSAL.
2013  */
2014 
2022  extern void GAP_Init( uint8 task_id );
2023 
2034  extern uint16 GAP_ProcessEvent( uint8 task_id, uint16 events );
2035 
2037 
2038 /*-------------------------------------------------------------------
2039 -------------------------------------------------------------------*/
2040 
2041 #ifdef __cplusplus
2042 }
2043 #endif
2044 
2045 #endif /* GAP_H */
2046 
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:1047
uint8 authState
TRUE if the pairing was authenticated (MITM)
Definition: gap.h:1193
uint8 opcode
GAP_MAKE_DISCOVERABLE_DONE_EVENT
Definition: gap.h:1024
uint8 opcode
GAP_END_DISCOVERABLE_DONE_EVENT
Definition: gap.h:1036
bStatus_t GAP_SetAdvToken(gapAdvDataToken_t *pToken)
Set Advertising Token.
uint8 opcode
GAP_SIGNATURE_UPDATED_EVENT
Definition: gap.h:931
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:930
uint8 eventType
Advertise Event Type: GAP Advertising Event Types.
Definition: gap.h:1003
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:1244
uint8 attrLen
Number of bytes in the attribute data.
Definition: gap.h:1314
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:870
void(* pfnGapConnEvtCB_t)(Gap_ConnEventRpt_t *pReport)
Definition: gap.h:1355
uint8 authReq
Authentication Requirements: Bit 2: MITM, Bits 0-1: bonding (0 - no bonding, 1 - bonding) ...
Definition: gap.h:1231
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:1194
bStatus_t GAP_TerminateAuth(uint16 connectionHandle, uint8 reason)
Terminate Authnetication.
Authentication Parameters.
Definition: gap.h:1208
bStatus_t GAP_PasskeyUpdate(uint8 *pPasskey, uint16 connectionHandle)
Update the passkey in string format.
GAP_MAKE_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:1021
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1227
uint8 mode
Discovery Mode: GAP Device Discovery Modes.
Definition: gap.h:966
bStatus_t GAP_EstablishLinkReq(gapEstLinkReq_t *pParams)
Establish a link to a slave device.
Connection event in slave role.
Definition: gap.h:815
uint8 adType
ADTYPE value: Address Types.
Definition: gap.h:1313
smSigningInfo_t * pSigningInfo
Signing information.
Definition: gap.h:1195
uint8 addrType
Device's address type for devAddr.
Definition: gap.h:932
uint16_t handle
connection handle
Definition: gap.h:1289
uint16 connectionHandle
Connection Handle.
Definition: gap.h:1229
GAP_ConnEvtTaskType_t
Definition: gap.h:808
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:911
uint16 latency
Definition: gap.h:892
uint8 dataLen
Length (in bytes) of the data field (evtData)
Definition: gap.h:952
uint16 gapParamIDs_t
GAP Parameters IDs.
Definition: gap.h:849
uint8 adType
TRUE if advertising data, FALSE if SCAN_RSP.
Definition: gap.h:1049
GAP_PASSKEY_NEEDED_EVENT message format.
Definition: gap.h:1171
GAP_CB_Action_t
Definition: gap.h:827
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:854
Connection parameters for the peripheral device.
Definition: gap.h:885
GAP_DEVICE_INIT_DONE_EVENT message format.
Definition: gap.h:909
Definition: gap.h:1286
uint8 taskID
Requesting App's Task ID, used to return results.
Definition: gap.h:965
GAP_SLAVE_REQUESTED_SECURITY_EVENT message format.
Definition: gap.h:1225
Register a callback.
Definition: gap.h:829
Connection event occurred successfully.
Definition: gap.h:798
GAP_ConnEvtStat_t status
status of connection event
Definition: gap.h:1288
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1023
bStatus_t GAP_TerminateLinkReq(uint8 taskID, uint16 connectionHandle, uint8 reason)
Terminate a link connection.
GAP event header format.
Definition: gap.h:852
GAP_BOND_COMPLETE_EVENT message format.
Definition: gap.h:1240
uint8 eventType
Indicates advertising event type used by the advertiser: GAP Advertising Report Event Types...
Definition: gap.h:974
GAP_ConnEvtTaskType_t nextTaskType
Type of next BLE task.
Definition: gap.h:1297
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:1210
GAP_PAIRING_REQ_EVENT message format.
Definition: gap.h:1275
uint8 addrType
Address Type: Address Types.
Definition: gap.h:975
int8_t lastRssi
Definition: gap.h:1291
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1242
uint8 uiInputs
Pairing User Interface Inputs - Ask user to input passcode.
Definition: gap.h:1177
uint8 numDevs
Number of devices found during scan.
Definition: gap.h:994
GAP_ConnEvtStat_t
Definition: gap.h:795
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1173
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:855
keyDist_t keyDist
Pairing Request Key Distribution field.
Definition: gap.h:1256
uint8_t channel
BLE RF channel index (0-39)
Definition: gap.h:1290
uint8(* pfnSuppEnhPrivCB_t)(uint8 *deviceAddr)
Enhanced Privacy Check Callback Function.
Definition: gap.h:1326
uint8 maxEncKeySize
Pairing Request Maximum Encryption Key Size field.
Definition: gap.h:1255
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:946
GAP_SIGNATURE_UPDATED_EVENT message format.
Definition: gap.h:928
uint8 numDataPkts
HC_Total_Num_LE_Data_Packets.
Definition: gap.h:915
uint8 opcode
GAP_PAIRING_REQ_EVENT
Definition: gap.h:1278
uint8 opcode
GAP_SLAVE_REQUESTED_SECURITY_EVENT
Definition: gap.h:1228
Definition: sm.h:144
uint8 opcode
GAP_DEVICE_INFO_EVENT
Definition: gap.h:947
uint8 initiatorAddrType
Initiator's address type: Address Types.
Definition: gap.h:1004
uint8 opcode
GAP_ADV_DATA_UPDATE_DONE_EVENT
Definition: gap.h:1048
uint16 intervalMax
Definition: gap.h:890
Type of device discovery (Scan) to perform.
Definition: gap.h:972
uint16 GAP_GetParamValue(gapParamIDs_t paramID)
Get a GAP Parameter value.
uint8 opcode
GAP_DEVICE_INIT_DONE_EVENT
Definition: gap.h:912
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:1197
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:944
uint8 uiOutputs
Pairing User Interface Outputs - Display passcode.
Definition: gap.h:1178
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:1192
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1035
uint8 opcode
GAP_DEVICE_DISCOVERY_EVENT
Definition: gap.h:993
GAP_ADV_DATA_UPDATE_DONE_EVENT message format.
Definition: gap.h:1045
uint16 connectionHandle
connection Handle
Definition: gap.h:1279
bStatus_t GAP_RegisterConnEventCb(pfnGapConnEvtCB_t cb, GAP_CB_Action_t action, uint16_t connHandle)
uint32 signCounter
new Signed Counter
Definition: gap.h:934
smLinkSecurityReq_t secReqs
Pairing Control info.
Definition: gap.h:1211
uint8 addrType
address type: Address Types
Definition: gap.h:949
uint16 timeout
Definition: gap.h:894
bStatus_t GAP_UpdateAdvTokens(void)
Update Advertising Token.
gapAdvDataToken_t * GAP_GetAdvToken(uint8 adType)
Get Advertising Token.
uint16 intervalMin
Definition: gap.h:888
uint8 oobDataFlag
Pairing Request OOB Data Flag field.
Definition: gap.h:1253
uint16_t errors
Total number of CRC errors for the entire connection.
Definition: gap.h:1295
int8 rssi
Advertisement or SCAN_RSP RSSI.
Definition: gap.h:951
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:992
Type of device discovery (Scan) to perform.
Definition: gap.h:963
uint8 opcode
GAP_AUTHENTICATION_COMPLETE_EVENT
Definition: gap.h:1191
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1190
Type definitions and macros for BLE stack.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1277
No data was received during connection event.
Definition: gap.h:802
smSecurityInfo_t * pDevSecInfo
BOUND - security information from connected device.
Definition: gap.h:1196
Initiating a connection.
Definition: gap.h:813
void(* pfnGapIdleCB_t)()
GAP Idle Callback Function.
Definition: gap.h:1331
Definition: sm.h:211
uint8 channelMap
Channel Map: Bit mask GAP Advertisement Channel Map.
Definition: gap.h:1006
uint8 addrMode
Address mode: GAP Addressing Modes.
Definition: gap.h:872
uint8 filterPolicy
Filer Policy: GAP Advertiser Filter Scan Parameters. Ignored when directed advertising is used...
Definition: gap.h:1007
GAP_END_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:1033
uint8 opcode
GAP_PASSKEY_NEEDED_EVENT
Definition: gap.h:1174
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:800
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:1336
Advertiser.
Definition: gap.h:811
uint8 opcode
GAP_RANDOM_ADDR_CHANGED_EVENT
Definition: gap.h:871
#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:948
uint8 ioCap
Pairing Request ioCap field.
Definition: gap.h:1252
GAP_AUTHENTICATION_COMPLETE_EVENT message format.
Definition: gap.h:1188
Callback Registration Structure.
Definition: gap.h:1334
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:1299
uint8 opcode
GAP_BOND_COMPLETE_EVENT
Definition: gap.h:1243
uint8 * pAttrData
pointer to Attribute data
Definition: gap.h:1315
pfnGapIdleCB_t gapIdleCB
GAP Idle callback.
Definition: gap.h:1337
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:233
GAP_DEVICE_DISCOVERY_EVENT message format.
Definition: gap.h:990
GAP_RANDOM_ADDR_CHANGED_EVENT message format.
Definition: gap.h:868
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:967
Pairing Request fields - the parsed fields of the SMP Pairing Request command.
Definition: gap.h:1250
uint8 * pEvtData
Data field of advertisement or SCAN_RSP.
Definition: gap.h:953
Advertising Parameters.
Definition: gap.h:1001
Connection event in master role.
Definition: gap.h:819
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:914
uint32 numComparison
Numeric Comparison value to be displayed.
Definition: gap.h:1179
gapPairingReq_t pairReq
The Pairing Request fields received.
Definition: gap.h:1280
Scanner.
Definition: gap.h:817
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:968
uint16 connectionHandle
Connection handle.
Definition: gap.h:1176
GAP Advertisement/Scan Response Data Token.
Definition: gap.h:1311
Unregister a callback
Definition: gap.h:830
gapAdvDataToken_t * GAP_RemoveAdvToken(uint8 adType)
Remove Advertising Token.
uint8 authReq
Pairing Request Auth Req field.
Definition: gap.h:1254
gapDevRec_t * pDevList
array of device records
Definition: gap.h:995
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