TI BLE5-Stack API Documentation  9.14.00
gap.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Group: WCS, BTS
4  $Target Device: DEVICES $
5 
6  ******************************************************************************
7  $License: TI_TEXT 2009 $
8  ******************************************************************************
9  $Release Name: PACKAGE NAME $
10  $Release Date: PACKAGE RELEASE DATE $
11  *****************************************************************************/
12 
21 #ifndef GAP_H
22 #define GAP_H
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 /*-------------------------------------------------------------------
30  * INCLUDES
31  */
32 #include <stdbool.h>
35 #include "ti/ble/host/sm/sm.h"
36 #include "ti/ble/controller/ll/ll_ae.h"
37 
38 /*-------------------------------------------------------------------
39  * MACROS
40  */
42 #ifndef status_t
43  #define status_t bStatus_t
44 #endif
45 
55 #define GAP_IS_ADDR_RPR(pAddr) ((pAddr[B_ADDR_LEN-1] & RANDOM_ADDR_HDR_MASK) \
56  == PRIVATE_RESOLVE_ADDR_HDR)
57 
66 #define GAP_IS_ADDR_RPN(pAddr) ((pAddr[B_ADDR_LEN-1] & RANDOM_ADDR_HDR_MASK) \
67  == PRIVATE_NON_RESOLVE_ADDR_HDR)
68 
77 #define GAP_IS_ADDR_RS(pAddr) ((pAddr[B_ADDR_LEN-1] & RANDOM_ADDR_HDR_MASK) \
78  == STATIC_ADDR_HDR)
79 
83 #define GAP_IS_ADDR_RAND(pAddr) (GAP_IS_ADDR_RPR(pAddr) | \
84  GAP_IS_ADDR_RPN(pAddr) | \
85  GAP_IS_ADDR_RS(pAddr))
86 
87 /*-------------------------------------------------------------------
88  * CONSTANTS
89  */
90 
107 #define GAP_DEVICE_INIT_DONE_EVENT 0x00
108 
114 #define GAP_ADV_DATA_UPDATE_DONE_EVENT 0x02
115 
119 #define GAP_ADV_MAKE_DISCOVERABLE_DONE_EVENT 0x03
120 
124 #define GAP_ADV_END_DISCOVERABLE_DONE_EVENT 0x04
125 
129 #define GAP_LINK_ESTABLISHED_EVENT 0x05
130 
133 #define GAP_LINK_TERMINATED_EVENT 0x06
134 
139 #define GAP_LINK_PARAM_UPDATE_EVENT 0x07
140 
146 #define GAP_SIGNATURE_UPDATED_EVENT 0x09
147 
152 #define GAP_AUTHENTICATION_COMPLETE_EVENT 0x0A
153 
158 #define GAP_PASSKEY_NEEDED_EVENT 0x0B
159 
165 #define GAP_PERIPHERAL_REQUESTED_SECURITY_EVENT 0x0C
166 
171 #define GAP_BOND_COMPLETE_EVENT 0x0E
172 
178 #define GAP_PAIRING_REQ_EVENT 0x0F
179 
185 #define GAP_AUTHENTICATION_FAILURE_EVT 0x10
186 
192 #define GAP_UPDATE_LINK_PARAM_REQ_EVENT 0x11
193 #define GAP_SCAN_SESSION_END_EVENT 0x12
195 #define GAP_ADV_REMOVE_SET_EVENT 0x13
197 
200 #define GAP_CONNECTING_CANCELLED_EVENT 0x15
201 
205 #define GAP_BOND_LOST_EVENT 0x17
206 
211 #define GAP_LINK_PARAM_UPDATE_REJECT_EVENT 0x18
212 
216 #define GAP_ADV_SET_PERIODIC_ADV_PARAMS_EVENT 0x19
218 #define GAP_ADV_SET_PERIODIC_ADV_DATA_EVENT 0x1A
220 #define GAP_ADV_SET_PERIODIC_ADV_ENABLE_EVENT 0x1B
222 
226 #define GAP_SCAN_CREATE_SYNC_EVENT 0x1C
227 
231 #define GAP_SCAN_SYNC_CANCEL_EVENT 0x1D
233 #define GAP_SCAN_TERMINATE_SYNC_EVENT 0x1E
235 #define GAP_SCAN_PERIODIC_RECEIVE_EVENT 0x1F
237 #define GAP_SCAN_ADD_DEVICE_ADV_LIST_EVENT 0x20
239 #define GAP_SCAN_REMOVE_DEVICE_ADV_LIST_EVENT 0x21
241 #define GAP_SCAN_READ_ADV_LIST_SIZE_EVENT 0x22
243 #define GAP_SCAN_CLEAR_ADV_LIST_EVENT 0x23
245 
249 #define GAP_SCAN_PERIODIC_ADV_SYNC_EST_EVENT 0x24
250 
254 #define GAP_SCAN_PERIODIC_ADV_SYNC_LOST_EVENT 0x25
255 
259 #define GAP_SCAN_PERIODIC_ADV_REPORT_EVENT 0x26
260 
276 #define GAP_EVT_ADV_START_AFTER_ENABLE (uint32_t)BV(0)
277 
282 #define GAP_EVT_ADV_END_AFTER_DISABLE (uint32_t)BV(1)
283 
289 #define GAP_EVT_ADV_START (uint32_t)BV(2)
290 
296 #define GAP_EVT_ADV_END (uint32_t)BV(3)
297 
303 #define GAP_EVT_ADV_SET_TERMINATED (uint32_t)BV(4)
304 
309 #define GAP_EVT_SCAN_REQ_RECEIVED (uint32_t)BV(5)
310 
316 #define GAP_EVT_ADV_DATA_TRUNCATED (uint32_t)BV(6)
317 #define GAP_EVT_SCAN_ENABLED (uint32_t)BV(16)
319 
325 #define GAP_EVT_SCAN_DISABLED (uint32_t)BV(17)
326 
331 #define GAP_EVT_SCAN_PRD_ENDED (uint32_t)BV(18)
332 #define GAP_EVT_SCAN_DUR_ENDED (uint32_t)BV(19)
334 
339 #define GAP_EVT_SCAN_INT_ENDED (uint32_t)BV(20)
340 #define GAP_EVT_SCAN_WND_ENDED (uint32_t)BV(21)
342 
348 #define GAP_EVT_ADV_REPORT (uint32_t)BV(22)
349 
354 #define GAP_EVT_ADV_REPORT_FULL (uint32_t)BV(23)
355 
362 #define GAP_EVT_PRD_ADV_SYNC_ESTABLISHED (uint32_t)BV(24)
363 
369 #define GAP_EVT_PRD_ADV_REPORT (uint32_t)BV(25)
370 
376 #define GAP_EVT_PRD_ADV_SYNC_LOST (uint32_t)BV(26)
377 #define GAP_EVT_INSUFFICIENT_MEMORY (uint32_t)BV(31)
380 
382 #define GAP_EVT_ADV_EVT_MASK (GAP_EVT_ADV_START_AFTER_ENABLE | \
383  GAP_EVT_ADV_END_AFTER_DISABLE | \
384  GAP_EVT_ADV_START | \
385  GAP_EVT_ADV_END | \
386  GAP_EVT_ADV_SET_TERMINATED | \
387  GAP_EVT_SCAN_REQ_RECEIVED | \
388  GAP_EVT_ADV_DATA_TRUNCATED | \
389  GAP_EVT_INSUFFICIENT_MEMORY)
390 
392 #define GAP_EVT_SCAN_EVT_MASK (GAP_EVT_SCAN_ENABLED | \
393  GAP_EVT_SCAN_DISABLED | \
394  GAP_EVT_SCAN_PRD_ENDED | \
395  GAP_EVT_SCAN_DUR_ENDED | \
396  GAP_EVT_SCAN_INT_ENDED | \
397  GAP_EVT_SCAN_WND_ENDED | \
398  GAP_EVT_ADV_REPORT | \
399  GAP_EVT_ADV_REPORT_FULL | \
400  GAP_EVT_PRD_ADV_SYNC_ESTABLISHED | \
401  GAP_EVT_PRD_ADV_REPORT | \
402  GAP_EVT_PRD_ADV_SYNC_LOST | \
403  GAP_EVT_INSUFFICIENT_MEMORY)
404 
421 typedef enum
422 {
441 
460 
478 
480  GAP_CONFIG_PARAM_COUNT
483 
490 {
499 
513 
525 
535 
544 
553 
555 
559  GAP_PARAM_AUTH_TASK_ID,
560 
565  GAP_PARAM_DEPRECATED,
566 
574  GAP_PARAM_GGS_PARAMS,
575 
576 #if defined ( TESTMODES )
577 
580  GAP_PARAM_GAP_TESTCODE,
581 
585  GAP_PARAM_SM_TESTCODE,
586 
590  GAP_PARAM_GATT_TESTCODE,
591 
595  GAP_PARAM_ATT_TESTCODE,
596 
601  GAP_PARAM_L2CAP_TESTCODE,
602 
612  GAP_PARAM_SET_SCAN_CHAN_TESTCODE,
613 
614 #endif // TESTMODES
615 
622  GAP_STUB1_NOT_TESTCODE,
623 
630  GAP_STUB2_NOT_TESTCODE,
631 
638  GAP_STUB3_NOT_TESTCODE,
639 
646  GAP_STUB4_NOT_TESTCODE,
647 
654  GAP_STUB5_NOT_TESTCODE,
655 
665  GAP_PARAM_SET_SCAN_CHAN,
666 
670  GAP_PARAMID_MAX
672 };
673 
687 #define GAP_PROFILE_BROADCASTER 0x01U
689 #define GAP_PROFILE_OBSERVER 0x02U
691 
695 #define GAP_PROFILE_PERIPHERAL 0x04U
696 
700 #define GAP_PROFILE_CENTRAL 0x08U
701 
708 typedef enum
709 {
712 
718 
720 typedef enum
721 {
729 
731 typedef enum
732 {
735  ADDRTYPE_PUBLIC_ID = 0x02,
743 
745 typedef enum
746 {
750 
755 #define SET_ADDRTYPE_ID 0x02
757 #define MASK_ADDRTYPE_ID 0x01
759 
765 #define RANDOM_ADDR_HDR_MASK 0xC0
767 #define STATIC_ADDR_HDR 0xC0
769 #define PRIVATE_NON_RESOLVE_ADDR_HDR 0x80
771 #define PRIVATE_RESOLVE_ADDR_HDR 0x40
773 
781 #define GAP_ADTYPE_FLAGS 0x01
783 #define GAP_ADTYPE_16BIT_MORE 0x02
785 #define GAP_ADTYPE_16BIT_COMPLETE 0x03
787 #define GAP_ADTYPE_32BIT_MORE 0x04
789 #define GAP_ADTYPE_32BIT_COMPLETE 0x05
791 #define GAP_ADTYPE_128BIT_MORE 0x06
793 #define GAP_ADTYPE_128BIT_COMPLETE 0x07
795 #define GAP_ADTYPE_LOCAL_NAME_SHORT 0x08
797 #define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09
799 #define GAP_ADTYPE_POWER_LEVEL 0x0A
801 #define GAP_ADTYPE_OOB_CLASS_OF_DEVICE 0x0D
803 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E
805 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F
807 #define GAP_ADTYPE_SM_TK 0x10
809 #define GAP_ADTYPE_SM_OOB_FLAG 0x11
811 
815 #define GAP_ADTYPE_PERIPHERAL_CONN_INTERVAL_RANGE 0x12
816 #define GAP_ADTYPE_SIGNED_DATA 0x13
818 #define GAP_ADTYPE_SERVICES_LIST_16BIT 0x14
820 #define GAP_ADTYPE_SERVICES_LIST_128BIT 0x15
822 #define GAP_ADTYPE_SERVICE_DATA 0x16
824 #define GAP_ADTYPE_PUBLIC_TARGET_ADDR 0x17
826 #define GAP_ADTYPE_RANDOM_TARGET_ADDR 0x18
828 #define GAP_ADTYPE_APPEARANCE 0x19
830 #define GAP_ADTYPE_ADV_INTERVAL 0x1A
832 #define GAP_ADTYPE_LE_BD_ADDR 0x1B
834 #define GAP_ADTYPE_LE_ROLE 0x1C
836 #define GAP_ADTYPE_SIMPLE_PAIRING_HASHC_256 0x1D
838 #define GAP_ADTYPE_SIMPLE_PAIRING_RANDR_256 0x1E
840 #define GAP_ADTYPE_SERVICE_DATA_32BIT 0x20
842 #define GAP_ADTYPE_SERVICE_DATA_128BIT 0x21
844 #define GAP_ADTYPE_3D_INFO_DATA 0x3D
846 
850 #define GAP_ADTYPE_MANUFACTURER_SPECIFIC 0xFF
851 #define GAP_ADTYPE_FLAGS_LIMITED 0x01
853 #define GAP_ADTYPE_FLAGS_GENERAL 0x02
855 #define GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
857 
863 #define GAP_STATE_IDLE 0x00U
864 #define GAP_STATE_ADV 0x01U
865 #define GAP_STATE_SCAN 0x02U
866 #define GAP_STATE_INIT 0x04U
867 
873 #define GAP_APPEARE_UNKNOWN 0x0000
874 #define GAP_APPEARE_GENERIC_PHONE 0x0040
875 #define GAP_APPEARE_GENERIC_COMPUTER 0x0080
876 #define GAP_APPEARE_GENERIC_WATCH 0x00C0
877 #define GAP_APPEARE_WATCH_SPORTS 0x00C1
878 #define GAP_APPEARE_GENERIC_CLOCK 0x0100
879 #define GAP_APPEARE_GENERIC_DISPLAY 0x0140
880 #define GAP_APPEARE_GENERIC_RC 0x0180
881 #define GAP_APPEARE_GENERIC_EYE_GALSSES 0x01C0
882 #define GAP_APPEARE_GENERIC_TAG 0x0200
883 #define GAP_APPEARE_GENERIC_KEYRING 0x0240
884 #define GAP_APPEARE_GENERIC_MEDIA_PLAYER 0x0280
885 #define GAP_APPEARE_GENERIC_BARCODE_SCANNER 0x02C0
886 #define GAP_APPEARE_GENERIC_THERMOMETER 0x0300
887 #define GAP_APPEARE_GENERIC_THERMO_EAR 0x0301
888 #define GAP_APPEARE_GENERIC_HR_SENSOR 0x0340
889 #define GAP_APPEARE_GENERIC_HRS_BELT 0x0341
890 #define GAP_APPEARE_GENERIC_BLOOD_PRESSURE 0x0380
891 #define GAP_APPEARE_GENERIC_BP_ARM 0x0381
892 #define GAP_APPEARE_GENERIC_BP_WRIST 0x0382
893 #define GAP_APPEARE_GENERIC_HID 0x03C0
894 #define GAP_APPEARE_HID_KEYBOARD 0x03C1
895 #define GAP_APPEARE_HID_MOUSE 0x03C2
896 #define GAP_APPEARE_HID_JOYSTIC 0x03C3
897 #define GAP_APPEARE_HID_GAMEPAD 0x03C4
898 #define GAP_APPEARE_HID_DIGITIZER_TYABLET 0x03C5
899 #define GAP_APPEARE_HID_DIGITAL_CARDREADER 0x03C6
900 #define GAP_APPEARE_HID_DIGITAL_PEN 0x03C7
901 #define GAP_APPEARE_HID_BARCODE_SCANNER 0x03C8
902 
908 #define GAP_PRIVACY_MODE_NETWORK 0
909 #define GAP_PRIVACY_MODE_DEVICE 1
910 
915 typedef enum
916 {
921 
925 typedef enum
926 {
928  GAP_CONN_EVT_STAT_SUCCESS = LL_CONN_EVT_STAT_SUCCESS,
930  GAP_CONN_EVT_STAT_CRC_ERROR = LL_CONN_EVT_STAT_CRC_ERROR,
932  GAP_CONN_EVT_STAT_MISSED = LL_CONN_EVT_STAT_MISSED
934 
938 typedef enum
939 {
941  GAP_CONN_EVT_TASK_TYPE_ADV = LL_TASK_ID_ADVERTISER,
943  GAP_CONN_EVT_TASK_TYPE_INIT = LL_TASK_ID_INITIATOR,
945  GAP_CONN_EVT_TASK_TYPE_PERIPHERAL = LL_TASK_ID_PERIPHERAL,
947  GAP_CONN_EVT_TASK_TYPE_SCAN = LL_TASK_ID_SCANNER,
949  GAP_CONN_EVT_TASK_TYPE_CENTRAL = LL_TASK_ID_CENTRAL,
950  // No task
951  GAP_CONN_EVT_TASK_TYPE_NONE = LL_TASK_ID_NONE
953 
957 typedef enum
958 {
962 
966 // Notes: This is a bitmask enum.
967 // When adding new events, make sure to add them to ll_common.h
968 // under Timesync events.
969 typedef enum
970 {
976 
979 /*-------------------------------------------------------------------
980  * TYPEDEFS
981  */
982 
988 typedef struct
990 {
992  uint8_t opcode;
993 } gapEventHdr_t;
994 
1001 typedef struct
1002 {
1004  uint16_t intervalMin;
1006  uint16_t intervalMax;
1008  uint16_t latency;
1010  uint16_t timeout;
1012 
1020 typedef struct
1021 {
1023  uint8_t opcode;
1024  uint8_t numDataPkts;
1025  uint16_t dataPktLen;
1026  uint8_t devAddr[B_ADDR_LEN];
1028 
1041 typedef struct
1042 {
1044  uint8_t opcode;
1045  uint8_t addrType;
1046  uint8_t devAddr[B_ADDR_LEN];
1047  uint32_t signCounter;
1049 
1055 typedef struct
1056 {
1057  uint16_t connectionHandle;
1058  uint16_t intervalMin;
1059  uint16_t intervalMax;
1060  uint16_t connLatency;
1061  uint16_t connTimeout;
1064 
1070 typedef struct
1071 {
1072  uint16_t connectionHandle;
1073  uint16_t intervalMin;
1074  uint16_t intervalMax;
1075  uint16_t connLatency;
1076  uint16_t connTimeout;
1078  uint8_t accepted;
1080 
1087 typedef struct
1088 {
1090  uint8_t opcode;
1093 
1110 typedef struct
1111 {
1113  uint8_t opcode;
1114  uint8_t devAddrType;
1115  uint8_t devAddr[B_ADDR_LEN];
1116  uint16_t connectionHandle;
1117  uint8_t connRole;
1118  uint16_t connInterval;
1119  uint16_t connLatency;
1120  uint16_t connTimeout;
1121  uint8_t clockAccuracy;
1123 
1130 typedef struct
1131 {
1133  uint8_t opcode;
1134  uint8_t status;
1135  uint16_t connectionHandle;
1136  uint16_t connInterval;
1137  uint16_t connLatency;
1138  uint16_t connTimeout;
1140 
1146 typedef struct
1147 {
1149  uint8_t opcode;
1150  uint16_t connectionHandle;
1151  uint8_t reason;
1153 
1162 typedef struct
1163 {
1165  uint8_t opcode;
1166  uint8_t deviceAddr[B_ADDR_LEN];
1167  uint16_t connectionHandle;
1168  uint8_t uiInputs;
1169  uint8_t uiOutputs;
1170  uint32_t numComparison;
1172 
1180 typedef struct
1181 {
1183  uint8_t opcode;
1184  uint16_t connectionHandle;
1185  uint8_t authState;
1191 
1196 typedef struct
1197 {
1198  uint16_t connectionHandle;
1200 } gapAuthParams_t;
1201 
1209 typedef struct
1210 {
1212  uint8_t opcode;
1213  uint16_t connectionHandle;
1214  uint8_t deviceAddr[B_ADDR_LEN];
1215 
1220  uint8_t authReq;
1222 
1231 typedef struct
1232 {
1234  uint8_t opcode;
1235  uint16_t connectionHandle;
1237 
1242 typedef struct
1243 {
1244  uint8_t ioCap;
1245  uint8_t oobDataFlag;
1246  uint8_t authReq;
1247  uint8_t maxEncKeySize;
1249 } gapPairingReq_t;
1250 
1262 typedef struct
1263 {
1265  uint8_t opcode;
1266  uint16_t connectionHandle;
1269 
1273 typedef struct
1274 {
1275  GAP_ConnEvtStat_t status;
1276  uint16_t handle;
1277  uint8_t channel;
1279  int8_t lastRssi;
1280  uint16_t packets;
1283  uint16_t errors;
1285  GAP_ConnEvtTaskType_t nextTaskType;
1287  uint32_t nextTaskTime;
1288  uint16_t eventCounter; // event Counter
1289  uint32_t timeStamp; // timestamp (anchor point)
1290  GAP_CB_Event_e eventType; // event type of the connection report.
1292 
1300 typedef struct
1301 {
1303  uint8_t opcode;
1304  uint16_t connectionHandle;
1305  uint8_t deviceAddr[B_ADDR_LEN];
1307 
1310 /*-------------------------------------------------------------------
1311  * CALLBACKS
1312  */
1313 
1319 typedef uint8_t(*pfnSuppCentAddrRes_t)
1322  uint8_t *deviceAddr,
1323  GAP_Peer_Addr_Types_t addrType
1324 );
1325 
1326 
1328 typedef void (*pfnGapIdleCB_t)();
1329 
1331 typedef uint8_t(*pfnGapDevPrivModeCB_t)
1333  GAP_Peer_Addr_Types_t addrType,
1334  uint8_t *pAddr
1335 );
1336 
1338 typedef struct
1339 {
1343 } gapBondMgrCBs_t;
1344 
1357 typedef void (*pfnGapCB_t)
1359  uint32_t event,
1360  void *pBuf,
1361  uintptr_t arg
1362 );
1363 
1378 typedef void (*pfnGapConnEvtCB_t)
1381  Gap_ConnEventRpt_t *pReport
1382 );
1383 
1386 /*-------------------------------------------------------------------
1387  * FUNCTIONS - Initialization and Configuration
1388  */
1389 
1420 extern bStatus_t GAP_DeviceInit(uint8_t profileRole, uint8_t taskID,
1421  GAP_Addr_Modes_t addrMode,
1422  uint8_t* pRandomAddr);
1423 
1435 extern bStatus_t GAP_SetParamValue(uint16_t paramID, uint16_t paramValue);
1436 
1445 extern uint16_t GAP_GetParamValue(uint16_t paramID);
1446 
1455 extern void GAP_RegisterForMsgs(uint8_t taskID);
1456 
1462 extern void GAP_RegisterBondMgrCBs(gapBondMgrCBs_t *pCBs);
1463 
1481  uint8_t *pAddr, uint8_t mode);
1482 
1483 /*-------------------------------------------------------------------
1484  * FUNCTIONS - Link Establishment
1485  */
1486 
1501 extern bStatus_t GAP_TerminateLinkReq(uint16_t connectionHandle, uint8_t reason);
1502 
1525 
1550  *pParams);
1551 
1557 extern uint8_t GAP_NumActiveConnections(void);
1558 
1592  GAP_CB_Action_t action,
1593  GAP_CB_Event_e event,
1594  uint16_t connHandle);
1595 
1596 /*-------------------------------------------------------------------
1597  * FUNCTIONS - GAP Configuration
1598  */
1599 
1618 extern bStatus_t GapConfig_SetParameter(Gap_configParamIds_t param,
1619  void *pValue);
1620 
1630 extern uint8_t *GAP_GetDevAddress(uint8 wantIA);
1631 
1642 extern uint8 *GAP_GetDevAddressByType( uint8 wantIA, uint8 deviceAddrType);
1643 
1653 extern uint8_t *GAP_GetIRK(void);
1654 
1664 extern uint8_t *GAP_GetSRK(void);
1665 
1666 /*-------------------------------------------------------------------
1667  * FUNCTIONS - Pairing
1668  */
1669 
1701  gapPairingReq_t *pPairReq);
1702 
1712 extern uint8_t GAP_isPairing(void);
1713 
1731 extern bStatus_t GAP_TerminateAuth(uint16_t connectionHandle, uint8_t reason);
1732 
1754 extern bStatus_t GAP_PasskeyUpdate(uint8_t *pPasskey, uint16_t connectionHandle);
1755 
1773 extern bStatus_t GAP_PasscodeUpdate(uint32_t passcode, uint16_t connectionHandle);
1774 
1791 extern bStatus_t GAP_SendPeripheralSecurityRequest(uint16_t connectionHandle,
1792  uint8_t authReq);
1793 
1811 extern bStatus_t GAP_Signable(uint16_t connectionHandle, uint8_t authenticated,
1812  smSigningInfo_t *pParams);
1813 
1836 extern bStatus_t GAP_Bond(uint16_t connectionHandle, uint8_t authenticated,
1837  uint8_t secureConnections, smSecurityInfo_t *pParams,
1838  uint8_t startEncryption);
1839 
1852 bStatus_t gap_checkLtk_noGapBondMgr( uint16_t connectionHandle );
1853 
1861 bStatus_t gap_checkLtk_GapBondMgr( uint16_t connectionHandle );
1862 
1889 extern bStatus_t Gap_ReplyToLTKReq( uint16_t connectionHandle,
1890  smSecurityInfo_t * const pParams,
1891  uint8_t *isLTKUpdated );
1892 
1893 /*-------------------------------------------------------------------
1894  * TASK FUNCTIONS - To only be used in osal_icall_ble.c
1895  */
1896 
1904 extern void GAP_Init(uint8_t task_id);
1905 
1916 extern uint32 GAP_ProcessEvent(uint8_t task_id, uint32 events);
1917 
1918 /*-------------------------------------------------------------------
1919 -------------------------------------------------------------------*/
1920 
1921 #ifdef __cplusplus
1922 }
1923 #endif
1924 
1925 #endif /* GAP_H */
1926 
uint8_t(* pfnSuppCentAddrRes_t)(uint8_t *deviceAddr, GAP_Peer_Addr_Types_t addrType)
Central Address Resolution (CAR) Support Callback Function.
Definition: gap.h:1321
Definition: gap.h:512
GAP_Addr_Types_t
Address types used for identifying peer address type.
Definition: gap.h:731
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1043
uint8_t * GAP_GetDevAddress(uint8 wantIA)
This API allows the software components in the Z-Stack to be written independently of the specifics o...
GAP_Peer_Addr_Types_t
Address types used for specifying peer address type.
Definition: gap.h:745
uint8_t addrType
Device&#39;s address type for devAddr.
Definition: gap.h:1045
void(* pfnGapConnEvtCB_t)(Gap_ConnEventRpt_t *pReport)
Definition: gap.h:1379
This file contains the interface to the SM.
No address provided.
Definition: gap.h:741
2 MBPS
Definition: gap.h:918
Definition: sm.h:194
Definition: gap.h:534
uint8_t opcode
GAP_BOND_COMPLETE_EVENT
Definition: gap.h:1234
smSecurityInfo_t * pSecurityInfo
security information from this device
Definition: gap.h:1186
Random (static) Identity Address (corresponds to peer&#39;s RPA)
Definition: gap.h:738
Definition: gap.h:1196
bStatus_t GAP_TerminateAuth(uint16_t connectionHandle, uint8_t reason)
Connection established, procedure 0.
Definition: gap.h:972
bStatus_t GAP_SendPeripheralSecurityRequest(uint16_t connectionHandle, uint8_t authReq)
smSigningInfo_t * pSigningInfo
Signing information.
Definition: gap.h:1187
uint16_t handle
connection handle
Definition: gap.h:1276
GAP_ConnEvtTaskType_t
Definition: gap.h:938
PHY was updated, procedure 1.
Definition: gap.h:973
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1022
Definition: gap.h:734
Definition: gap.h:1300
Deny all parameter update requests.
Definition: gap.h:711
bStatus_t GAP_SetParamValue(uint16_t paramID, uint16_t paramValue)
Definition: gap.h:1162
GAP_CB_Action_t
Definition: gap.h:957
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:991
Gap_configParamIds_t
Definition: gap.h:421
Definition: gap.h:1001
Definition: gap.h:1020
Definition: gap.h:1273
uint8_t maxEncKeySize
Pairing Request Maximum Encryption Key Size field.
Definition: gap.h:1247
uint8_t opcode
GAP_DEVICE_INIT_DONE_EVENT
Definition: gap.h:1023
uint16_t connectionHandle
connection Handle
Definition: gap.h:1266
Register a callback.
Definition: gap.h:959
Connection event occurred successfully.
Definition: gap.h:928
GAP_ConnEvtStat_t status
status of connection event
Definition: gap.h:1275
bStatus_t Gap_RegisterConnEventCb(pfnGapConnEvtCB_t cb, GAP_CB_Action_t action, GAP_CB_Event_e event, uint16_t connHandle)
GAP event header format.
Definition: gap.h:989
Definition: gap.h:1231
uint16_t timeout
Connection Timeout (0x000A - 0x0C80 * 10 ms)
Definition: gap.h:1010
GAP_ConnEvtTaskType_t nextTaskType
Type of next BLE task.
Definition: gap.h:1285
Definition: gap.h:1209
Definition: gap.h:716
uint16_t dataPktLen
HC_LE_Data_Packet_Length.
Definition: gap.h:1025
Definition: gap.h:723
Definition: gap.h:1262
int8_t lastRssi
Definition: gap.h:1279
uint16_t intervalMin
Minimum value for the connection event (interval. 0x0006 - 0x0C80 * 1.25 ms)
Definition: gap.h:1004
1 MBPS
Definition: gap.h:917
uint8_t uiInputs
Pairing User Interface Inputs - Ask user to input passcode.
Definition: gap.h:1168
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1233
GAP_ConnEvtStat_t
Definition: gap.h:925
bStatus_t GAP_TerminateLinkReq(uint16_t connectionHandle, uint8_t reason)
Random Device Address (controller unable to resolve)
Definition: gap.h:740
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1164
bStatus_t GAP_UpdateLinkParamReq(gapUpdateLinkParamReq_t *pParams)
void GAP_RegisterForMsgs(uint8_t taskID)
keyDist_t keyDist
Pairing Request Key Distribution field.
Definition: gap.h:1248
uint8_t channel
BLE RF channel index (0-39)
Definition: gap.h:1277
uint8_t ioCap
Pairing Request ioCap field.
Definition: gap.h:1244
uint16_t connectionHandle
connection Handle
Definition: gap.h:1235
GAP_ConnEvtPhy_t
Definition: gap.h:915
Definition: gap.h:1041
Definition: sm.h:148
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1302
Gap_updateDecision_t
Definition: gap.h:708
Public Identity Address (corresponds to peer&#39;s RPA)
Definition: gap.h:736
uint32_t timeStamp
Definition: gap.h:1289
uint8_t opcode
GAP_SIGNATURE_UPDATED_EVENT
Definition: gap.h:1044
void(* pfnGapCB_t)(uint32_t event, void *pBuf, uintptr_t arg)
Definition: gap.h:1358
smIdentityInfo_t * pIdentityInfo
identity information
Definition: gap.h:1189
Connection event in peripheral role.
Definition: gap.h:945
uint8_t * GAP_GetIRK(void)
Definition: sm.h:205
void GAP_RegisterBondMgrCBs(gapBondMgrCBs_t *pCBs)
Can be used by the application to update the IRK immediately.
Definition: gap.h:477
bStatus_t GAP_Bond(uint16_t connectionHandle, uint8_t authenticated, uint8_t secureConnections, smSecurityInfo_t *pParams, uint8_t startEncryption)
uint8_t uiOutputs
Pairing User Interface Outputs - Display passcode.
Definition: gap.h:1169
uint16_t connectionHandle
Connection handle.
Definition: gap.h:1167
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1211
Coded-S2 or Coded-S8.
Definition: gap.h:919
smLinkSecurityReq_t secReqs
Pairing Control info.
Definition: gap.h:1199
uint16_t GAP_GetParamValue(uint16_t paramID)
bStatus_t Gap_ReplyToLTKReq(uint16_t connectionHandle, smSecurityInfo_t *const pParams, uint8_t *isLTKUpdated)
bStatus_t GAP_PasscodeUpdate(uint32_t passcode, uint16_t connectionHandle)
Always Use Resolvable Private Address with Random Identity Address.
Definition: gap.h:727
GAP_CB_Event_e
Definition: gap.h:969
pfnSuppCentAddrRes_t suppCentAddrResCB
Supports Central Address Resolution.
Definition: gap.h:1340
Definition: gap.h:552
uint16_t connectionHandle
Connection Handle.
Definition: gap.h:1213
bStatus_t gap_checkLtk_noGapBondMgr(uint16_t connectionHandle)
Checks the Long Term Key (LTK) for a given connection without using the GAP Bond Manager.
uint16_t errors
Total number of CRC errors for the entire connection.
Definition: gap.h:1283
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1182
Type definitions and macros for BLE stack.
uint32_t numComparison
Numeric Comparison value to be displayed.
Definition: gap.h:1170
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1264
uint16_t latency
Number of LL latency connection events (0x0000 - 0x03e8)
Definition: gap.h:1008
Connection event in central role.
Definition: gap.h:949
uint8_t authReq
Definition: gap.h:1220
uint8_t opcode
GAP_PAIRING_REQ_EVENT
Definition: gap.h:1265
No data was received during connection event.
Definition: gap.h:932
Public Device Address.
Definition: gap.h:733
smSecurityInfo_t * pDevSecInfo
security information from connected device
Definition: gap.h:1188
uint8_t GAP_NumActiveConnections(void)
Initiating a connection.
Definition: gap.h:943
void(* pfnGapIdleCB_t)()
GAP Idle Callback Function.
Definition: gap.h:1328
Definition: sm.h:215
Invalid event type.
Definition: gap.h:971
Definition: gap.h:524
uint8 * GAP_GetDevAddressByType(uint8 wantIA, uint8 deviceAddrType)
Definition: gap.h:543
Can be used by the application to set the SRK.
Definition: gap.h:459
Generic Event Header.
Definition: bcomdef.h:223
Connection event failed because all packets had CRC errors.
Definition: gap.h:930
Gap_ParamIDs_t
Definition: gap.h:489
Always Use Public Address.
Definition: gap.h:722
bStatus_t GAP_UpdateLinkParamReqReply(gapUpdateLinkParamReqReply_t *pParams)
Can be used by the application to set the IRK.
Definition: gap.h:440
uint8_t opcode
GAP_PASSKEY_NEEDED_EVENT
Definition: gap.h:1165
Advertiser.
Definition: gap.h:941
bStatus_t GAP_DeviceInit(uint8_t profileRole, uint8_t taskID, GAP_Addr_Modes_t addrMode, uint8_t *pRandomAddr)
Definition: gap.h:498
uint8_t(* pfnGapDevPrivModeCB_t)(GAP_Peer_Addr_Types_t addrType, uint8_t *pAddr)
GAP Device Privacy Mode Callback Function.
Definition: gap.h:1332
uint8_t authState
TRUE if the pairing was authenticated (MITM)
Definition: gap.h:1185
void GAP_Init(uint8_t task_id)
uint8_t opcode
GAP type of command. GAP Event IDs.
Definition: gap.h:992
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:73
uint8_t opcode
GAP_BOND_LOST_EVENT
Definition: gap.h:1303
uint8_t numDataPkts
HC_Total_Num_LE_Data_Packets.
Definition: gap.h:1024
Definition: gap.h:1180
Callback Registration Structure.
Definition: gap.h:1338
uint8_t GAP_isPairing(void)
uint8_t authReq
Pairing Request Auth Req field.
Definition: gap.h:1246
uint32_t nextTaskTime
Time to next BLE task (in us). 0xFFFFFFFF if there is no next task.
Definition: gap.h:1287
uint8_t * GAP_GetSRK(void)
uint16_t intervalMax
Maximum value for the connection event (interval. 0x0006 - 0x0C80 * 1.25 ms)
Definition: gap.h:1006
pfnGapIdleCB_t gapIdleCB
GAP Idle callback.
Definition: gap.h:1341
uint8_t opcode
GAP_AUTHENTICATION_COMPLETE_EVENT
Definition: gap.h:1183
uint16_t eventCounter
Definition: gap.h:1288
GAP_ConnEvtPhy_t phy
PHY of connection event.
Definition: gap.h:1278
uint8_t oobDataFlag
Pairing Request OOB Data Flag field.
Definition: gap.h:1245
uint16_t connectionHandle
Connection Handle from controller used to ref the device.
Definition: gap.h:1184
Definition: gap.h:951
Random or Random ID Address.
Definition: gap.h:748
Accept all parameter update requests.
Definition: gap.h:710
uint16_t connectionHandle
Connection Handle.
Definition: gap.h:1304
uint32 GAP_ProcessEvent(uint8_t task_id, uint32 events)
bStatus_t GAP_SetPrivacyMode(GAP_Peer_Addr_Types_t addrType, uint8_t *pAddr, uint8_t mode)
Definition: gap.h:1242
bStatus_t GapConfig_SetParameter(Gap_configParamIds_t param, void *pValue)
bStatus_t GAP_Signable(uint16_t connectionHandle, uint8_t authenticated, smSigningInfo_t *pParams)
All connection Events.
Definition: gap.h:974
Always Use Resolvable Private Address with Public Identity Address.
Definition: gap.h:725
uint8_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:220
GAP_CB_Event_e eventType
Definition: gap.h:1290
bStatus_t GAP_PasskeyUpdate(uint8_t *pPasskey, uint16_t connectionHandle)
gapPairingReq_t pairReq
The Pairing Request fields received.
Definition: gap.h:1267
Scanner.
Definition: gap.h:947
Public or Public ID Address.
Definition: gap.h:747
bStatus_t GAP_Authenticate(gapAuthParams_t *pParams, gapPairingReq_t *pPairReq)
uint32_t signCounter
new Signed Counter
Definition: gap.h:1047
Unregister a callback
Definition: gap.h:960
GAP_Addr_Modes_t
Address modes to initialize the local device.
Definition: gap.h:720
bStatus_t gap_checkLtk_GapBondMgr(uint16_t connectionHandle)
Checks the Long Term Key (LTK) for a given connection using the GAP Bond Manager. If GAP Bond Manager...
uint8_t opcode
GAP_PERIPHERAL_REQUESTED_SECURITY_EVENT
Definition: gap.h:1212
pfnGapDevPrivModeCB_t gapDevPrivModeCB
GAP Device Privacy Mode callback.
Definition: gap.h:1342
uint16_t connectionHandle
Connection Handle from controller,.
Definition: gap.h:1198
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale