TI BLE-Stack for Bluetooth 4.2 API Documentation  3.01.00.07
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  #define TGAP_PARAMID_MAX 40
524 #else
525  #define TGAP_GAP_TESTCODE 38
526  #define TGAP_SM_TESTCODE 39
527  #define TGAP_AUTH_TASK_ID 40
528  #define TGAP_VERIFY_CAR 41
529  #define TGAP_PARAMID_MAX 42
530 
531  #define TGAP_GATT_TESTCODE 100
532  #define TGAP_ATT_TESTCODE 101
533  #define TGAP_GGS_TESTCODE 102
534  #define TGAP_L2CAP_TESTCODE 103
535 #endif
536 
543 #define DEVDISC_MODE_NONDISCOVERABLE 0x00
544 #define DEVDISC_MODE_GENERAL 0x01
545 #define DEVDISC_MODE_LIMITED 0x02
546 #define DEVDISC_MODE_ALL 0x03
547 
552 #define ADDRTYPE_PUBLIC 0x00
553 #define ADDRTYPE_RANDOM 0x01
554 #define ADDRTYPE_PUBLIC_ID 0x02
555 #define ADDRTYPE_RANDOM_ID 0x03
556 
561 #define SET_ADDRTYPE_ID 0x02
562 #define MASK_ADDRTYPE_ID 0x01
563 
568 #define RANDOM_ADDR_SUBTYPE_STATIC 0x00
569 #define RANDOM_ADDR_SUBTYPE_RPA 0x01
570 #define RANDOM_ADDR_SUBTYPE_NRPA 0x02
571 
576 #define RANDOM_ADDR_HDR_MASK 0xC0
577 #define STATIC_ADDR_HDR 0xC0
578 #define PRIVATE_NON_RESOLVE_ADDR_HDR 0x80
579 #define PRIVATE_RESOLVE_ADDR_HDR 0x40
580 
585 #define ADDRMODE_PUBLIC 0x00
586 #define ADDRMODE_STATIC 0x01
587 #define ADDRMODE_PRIVATE_NONRESOLVE 0x02
588 #define ADDRMODE_PRIVATE_RESOLVE 0x03
589 
595 #define GAP_ADTYPE_ADV_IND 0x00
596 #define GAP_ADTYPE_ADV_HDC_DIRECT_IND 0x01
597 #define GAP_ADTYPE_ADV_SCAN_IND 0x02
598 #define GAP_ADTYPE_ADV_NONCONN_IND 0x03
599 #define GAP_ADTYPE_ADV_LDC_DIRECT_IND 0x04
600 
606 #define GAP_ADRPT_ADV_IND 0x00
607 #define GAP_ADRPT_ADV_DIRECT_IND 0x01
608 #define GAP_ADRPT_ADV_SCAN_IND 0x02
609 #define GAP_ADRPT_ADV_NONCONN_IND 0x03
610 #define GAP_ADRPT_SCAN_RSP 0x04
611 
616 #define GAP_FILTER_POLICY_ALL 0x00
617 #define GAP_FILTER_POLICY_WHITE_SCAN 0x01
618 #define GAP_FILTER_POLICY_WHITE_CON 0x02
619 #define GAP_FILTER_POLICY_WHITE 0x03
620 
625 #define GAP_DISC_FILTER_POLICY_ALL 0x00
626 #define GAP_DISC_FILTER_POLICY_WHITE 0x01
627 #define GAP_DISC_FILTER_POLICY_ALL_DIRECT 0x02
628 #define GAP_DISC_FILTER_POLICY_WHITE_DIRECT 0x03
629 
631 #define ADV_CHANMAP_SIZE 5
632 
633 #define GAP_PASSCODE_MAX 999999
634 
635 
641 #define GAP_INIT_SIGN_COUNTER 0xFFFFFFFF
642 
646 #define GAP_ADVCHAN_37 0x01
647 #define GAP_ADVCHAN_38 0x02
648 #define GAP_ADVCHAN_39 0x04
649 #define GAP_ADVCHAN_ALL (GAP_ADVCHAN_37 | GAP_ADVCHAN_38 | GAP_ADVCHAN_39)
650 
655 #define WL_NOTUSED 0x00
656 #define WL_USED 0x01
657 
663 #define GAP_ADTYPE_FLAGS 0x01
664 #define GAP_ADTYPE_16BIT_MORE 0x02
665 #define GAP_ADTYPE_16BIT_COMPLETE 0x03
666 #define GAP_ADTYPE_32BIT_MORE 0x04
667 #define GAP_ADTYPE_32BIT_COMPLETE 0x05
668 #define GAP_ADTYPE_128BIT_MORE 0x06
669 #define GAP_ADTYPE_128BIT_COMPLETE 0x07
670 #define GAP_ADTYPE_LOCAL_NAME_SHORT 0x08
671 #define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09
672 #define GAP_ADTYPE_POWER_LEVEL 0x0A
673 #define GAP_ADTYPE_OOB_CLASS_OF_DEVICE 0x0D
674 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E
675 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F
676 #define GAP_ADTYPE_SM_TK 0x10
677 #define GAP_ADTYPE_SM_OOB_FLAG 0x11
678 #define GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE 0x12
679 #define GAP_ADTYPE_SIGNED_DATA 0x13
680 #define GAP_ADTYPE_SERVICES_LIST_16BIT 0x14
681 #define GAP_ADTYPE_SERVICES_LIST_128BIT 0x15
682 #define GAP_ADTYPE_SERVICE_DATA 0x16
683 #define GAP_ADTYPE_PUBLIC_TARGET_ADDR 0x17
684 #define GAP_ADTYPE_RANDOM_TARGET_ADDR 0x18
685 #define GAP_ADTYPE_APPEARANCE 0x19
686 #define GAP_ADTYPE_ADV_INTERVAL 0x1A
687 #define GAP_ADTYPE_LE_BD_ADDR 0x1B
688 #define GAP_ADTYPE_LE_ROLE 0x1C
689 #define GAP_ADTYPE_SIMPLE_PAIRING_HASHC_256 0x1D
690 #define GAP_ADTYPE_SIMPLE_PAIRING_RANDR_256 0x1E
691 #define GAP_ADTYPE_SERVICE_DATA_32BIT 0x20
692 #define GAP_ADTYPE_SERVICE_DATA_128BIT 0x21
693 #define GAP_ADTYPE_3D_INFO_DATA 0x3D
694 #define GAP_ADTYPE_MANUFACTURER_SPECIFIC 0xFF
695 #define GAP_ADTYPE_FLAGS_LIMITED 0x01
696 #define GAP_ADTYPE_FLAGS_GENERAL 0x02
697 #define GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
698 
703 #define GAP_STATE_IDLE 0x00
704 #define GAP_STATE_ADV 0x01
705 #define GAP_STATE_SCAN 0x02
706 #define GAP_STATE_INIT 0x04
707 
712 #define GAP_APPEARE_UNKNOWN 0x0000
713 #define GAP_APPEARE_GENERIC_PHONE 0x0040
714 #define GAP_APPEARE_GENERIC_COMPUTER 0x0080
715 #define GAP_APPEARE_GENERIC_WATCH 0x00C0
716 #define GAP_APPEARE_WATCH_SPORTS 0x00C1
717 #define GAP_APPEARE_GENERIC_CLOCK 0x0100
718 #define GAP_APPEARE_GENERIC_DISPLAY 0x0140
719 #define GAP_APPEARE_GENERIC_RC 0x0180
720 #define GAP_APPEARE_GENERIC_EYE_GALSSES 0x01C0
721 #define GAP_APPEARE_GENERIC_TAG 0x0200
722 #define GAP_APPEARE_GENERIC_KEYRING 0x0240
723 #define GAP_APPEARE_GENERIC_MEDIA_PLAYER 0x0280
724 #define GAP_APPEARE_GENERIC_BARCODE_SCANNER 0x02C0
725 #define GAP_APPEARE_GENERIC_THERMOMETER 0x0300
726 #define GAP_APPEARE_GENERIC_THERMO_EAR 0x0301
727 #define GAP_APPEARE_GENERIC_HR_SENSOR 0x0340
728 #define GAP_APPEARE_GENERIC_HRS_BELT 0x0341
729 #define GAP_APPEARE_GENERIC_BLOOD_PRESSURE 0x0380
730 #define GAP_APPEARE_GENERIC_BP_ARM 0x0381
731 #define GAP_APPEARE_GENERIC_BP_WRIST 0x0382
732 #define GAP_APPEARE_GENERIC_HID 0x03C0
733 #define GAP_APPEARE_HID_KEYBOARD 0x03C1
734 #define GAP_APPEARE_HID_MOUSE 0x03C2
735 #define GAP_APPEARE_HID_JOYSTIC 0x03C3
736 #define GAP_APPEARE_HID_GAMEPAD 0x03C4
737 #define GAP_APPEARE_HID_DIGITIZER_TYABLET 0x03C5
738 #define GAP_APPEARE_HID_DIGITAL_CARDREADER 0x03C6
739 #define GAP_APPEARE_HID_DIGITAL_PEN 0x03C7
740 #define GAP_APPEARE_HID_BARCODE_SCANNER 0x03C8
741 
745 /*-------------------------------------------------------------------
746  * TYPEDEFS - Initialization and Configuration
747  */
748 
758 typedef uint16 gapParamIDs_t;
759 
761 typedef struct
762 {
764  uint8 opcode;
765 } gapEventHdr_t;
766 
777 typedef struct
778 {
780  uint8 opcode;
781  uint8 addrMode;
782  uint8 newRandomAddr[B_ADDR_LEN];
784 
794 typedef struct
795 {
797  uint16 intervalMin;
799  uint16 intervalMax;
801  uint16 latency;
803  uint16 timeout;
805 
818 typedef struct
819 {
821  uint8 opcode;
822  uint8 devAddr[B_ADDR_LEN];
823  uint16 dataPktLen;
824  uint8 numDataPkts;
826 
837 typedef struct
838 {
840  uint8 opcode;
841  uint8 addrType;
842  uint8 devAddr[B_ADDR_LEN];
843  uint32 signCounter;
845 
853 typedef struct
854 {
856  uint8 opcode;
857  uint8 eventType;
858  uint8 addrType;
859  uint8 addr[B_ADDR_LEN];
860  int8 rssi;
861  uint8 dataLen;
862  uint8 *pEvtData;
864  // end of GAP_Events
866 
867 /*-------------------------------------------------------------------
868  * TYPEDEFS - Device Discovery
869  */
870 
872 typedef struct
873 {
874  uint8 taskID;
875  uint8 mode;
876  uint8 activeScan;
877  uint8 whiteList;
879 
881 typedef struct
882 {
883  uint8 eventType;
884  uint8 addrType;
885  uint8 addr[B_ADDR_LEN];
886 } gapDevRec_t;
887 
899 typedef struct
900 {
902  uint8 opcode;
903  uint8 numDevs;
906  // end of GAP_Events
908 
910 typedef struct
911 {
912  uint8 eventType;
914  uint8 initiatorAddr[B_ADDR_LEN];
915  uint8 channelMap;
916  uint8 filterPolicy;
918 
930 typedef struct
931 {
933  uint8 opcode;
935 
942 typedef struct
943 {
945  uint8 opcode;
947 
954 typedef struct
955 {
957  uint8 opcode;
958  uint8 adType;
960  // end of GAP_Events
962 
963 /*-------------------------------------------------------------------
964  * TYPEDEFS - Link Establishment
965  */
966 
968 typedef struct
969 {
970  uint8 taskID;
972  uint8 whiteList;
973  uint8 addrTypePeer;
974  uint8 peerAddr[B_ADDR_LEN];
976 
978 typedef struct
979 {
981  uint16 intervalMin;
982  uint16 intervalMax;
983  uint16 connLatency;
984  uint16 connTimeout;
986 
988 typedef struct
989 {
991  uint16 intervalMin;
992  uint16 intervalMax;
993  uint16 connLatency;
994  uint16 connTimeout;
995  uint8 accepted;
997 
1009 typedef struct
1010 {
1012  uint8 opcode;
1015 
1025 typedef struct
1026 {
1028  uint8 opcode;
1029  uint8 devAddrType;
1030  uint8 devAddr[B_ADDR_LEN];
1032  uint8 connRole;
1033  uint16 connInterval;
1034  uint16 connLatency;
1035  uint16 connTimeout;
1038 
1045 typedef struct
1046 {
1048  uint8 opcode;
1049  uint8 status;
1051  uint16 connInterval;
1052  uint16 connLatency;
1053  uint16 connTimeout;
1055 
1062 typedef struct
1063 {
1065  uint8 opcode;
1067  uint8 reason;
1069 
1070 /*-------------------------------------------------------------------
1071  * TYPEDEFS - Authentication, Bounding and Pairing
1072  */
1073 
1080 typedef struct
1081 {
1083  uint8 opcode;
1084  uint8 deviceAddr[B_ADDR_LEN];
1086  uint8 uiInputs;
1087  uint8 uiOutputs;
1088  uint32 numComparison;
1090 
1097 typedef struct
1098 {
1100  uint8 opcode;
1102  uint8 authState;
1108  // end of GAP_Events
1110 
1117 typedef struct
1118 {
1121 } gapAuthParams_t;
1122 
1134 typedef struct
1135 {
1137  uint8 opcode;
1139  uint8 deviceAddr[B_ADDR_LEN];
1140  uint8 authReq;
1142 
1149 typedef struct
1150 {
1152  uint8 opcode;
1155  // end of GAP_Events
1157 
1159 typedef struct
1160 {
1161  uint8 ioCap;
1162  uint8 oobDataFlag;
1163  uint8 authReq;
1166 } gapPairingReq_t;
1167 
1184 typedef struct
1185 {
1187  uint8 opcode;
1191  // end of GAP_Events
1193 
1201 typedef struct
1202 {
1203  uint8 adType;
1204  uint8 attrLen;
1205  uint8 *pAttrData;
1207 
1214 typedef uint8 (*pfnSuppEnhPrivCB_t)
1217  uint8 *deviceAddr
1218 );
1219 
1221 typedef void (*pfnGapIdleCB_t)();
1222 
1224 typedef struct
1225 {
1228 } gapBondMgrCBs_t;
1229 
1232 /*-------------------------------------------------------------------
1233  * GLOBAL VARIABLES
1234  */
1235 
1236 /*-------------------------------------------------------------------
1237  * FUNCTIONS - Initialization and Configuration
1238  */
1239 
1266  extern bStatus_t GAP_DeviceInit( uint8 taskID,
1267  uint8 profileRole,
1268  uint8 maxScanResponses,
1269  uint8 *pIRK,
1270  uint8 *pSRK,
1271  uint32 *pSignCounter );
1272 
1282  extern void GAP_UpdateResolvingList( uint8 *pIRK );
1283 
1303  extern bStatus_t GAP_SetAdvToken( gapAdvDataToken_t *pToken );
1304 
1314  extern gapAdvDataToken_t *GAP_GetAdvToken( uint8 adType );
1315 
1326  extern gapAdvDataToken_t *GAP_RemoveAdvToken( uint8 adType );
1327 
1336  extern bStatus_t GAP_UpdateAdvTokens( void );
1337 
1350  extern bStatus_t GAP_SetParamValue( gapParamIDs_t paramID, uint16 paramValue );
1351 
1360  extern uint16 GAP_GetParamValue( gapParamIDs_t paramID );
1361 
1389  extern bStatus_t GAP_ConfigDeviceAddr( uint8 addrMode, uint8 *pStaticAddr );
1390 
1399  extern void GAP_RegisterForMsgs( uint8 taskID );
1400 
1406  extern void GAP_RegisterBondMgrCBs( gapBondMgrCBs_t *pCBs );
1407 
1408 /*-------------------------------------------------------------------
1409  * FUNCTIONS - Device Discovery
1410  */
1411 
1428 
1442  extern bStatus_t GAP_DeviceDiscoveryCancel( uint8 taskID );
1443 
1458  extern bStatus_t GAP_MakeDiscoverable( uint8 taskID, gapAdvertisingParams_t *pParams );
1459 
1474  extern bStatus_t GAP_UpdateAdvertisingData( uint8 taskID, uint8 adType,
1475  uint8 dataLen, uint8 *pAdvertData );
1476 
1489  extern bStatus_t GAP_EndDiscoverable( uint8 taskID );
1490 
1491 #if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
1492 
1502  extern bStatus_t GAP_ResolvePrivateAddr( uint8 *pIRK, uint8 *pAddr );
1503 #endif // ! BLE_V42_FEATURES | ! PRIVACY_1_2_CFG
1504 
1505 /*-------------------------------------------------------------------
1506  * FUNCTIONS - Link Establishment
1507  */
1508 
1523  extern bStatus_t GAP_EstablishLinkReq( gapEstLinkReq_t *pParams );
1524 
1540  extern bStatus_t GAP_TerminateLinkReq( uint8 taskID, uint16 connectionHandle, uint8 reason );
1541 
1558 
1585 
1591  extern uint8 GAP_NumActiveConnections( void );
1592 
1593 /*-------------------------------------------------------------------
1594  * FUNCTIONS - Pairing
1595  */
1596 
1624  extern bStatus_t GAP_Authenticate( gapAuthParams_t *pParams, gapPairingReq_t *pPairReq );
1625 
1632  extern uint8 GAP_isPairing(void);
1633 
1651  extern bStatus_t GAP_TerminateAuth( uint16 connectionHandle, uint8 reason );
1652 
1672  extern bStatus_t GAP_PasskeyUpdate( uint8 *pPasskey, uint16 connectionHandle );
1673 
1692  extern bStatus_t GAP_PasscodeUpdate( uint32 passcode, uint16 connectionHandle );
1693 
1708  extern bStatus_t GAP_SendSlaveSecurityRequest( uint16 connectionHandle, uint8 authReq );
1709 
1726  extern bStatus_t GAP_Signable( uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams );
1727 
1749  extern bStatus_t GAP_Bond( uint16 connectionHandle, uint8 authenticated,
1750  uint8 secureConnections, smSecurityInfo_t *pParams,
1751  uint8 startEncryption );
1752 
1753 /*-------------------------------------------------------------------
1754  * Internal API - These functions are only called from gap.c module.
1755  */
1756 
1758 
1769  extern bStatus_t GAP_ParamsInit( uint8 taskID, uint8 profileRole );
1770 
1778  extern void GAP_PrivacyInit( uint8 *pIRK );
1779 
1787  extern uint8 *GAP_GetIRK( void );
1788 
1801  extern void GAP_SecParamsInit( uint8 *pSRK, uint32 *pSignCounter );
1802 
1810  extern bStatus_t GAP_PeriDevMgrInit( void );
1811 
1818  extern void GAP_PeriConnRegister( void );
1819 
1831  extern bStatus_t GAP_CentDevMgrInit( uint8 maxScanResponses );
1832 
1839  extern void GAP_CentConnRegister( void );
1840 
1841 
1842 /*-------------------------------------------------------------------
1843  * TASK API - These functions must only be called OSAL.
1844  */
1845 
1853  extern void GAP_Init( uint8 task_id );
1854 
1865  extern uint16 GAP_ProcessEvent( uint8 task_id, uint16 events );
1866 
1868 
1869 /*-------------------------------------------------------------------
1870 -------------------------------------------------------------------*/
1871 
1872 #ifdef __cplusplus
1873 }
1874 #endif
1875 
1876 #endif /* GAP_H */
1877 
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:956
uint8 authState
TRUE if the pairing was authenticated (MITM)
Definition: gap.h:1102
uint8 opcode
GAP_MAKE_DISCOVERABLE_DONE_EVENT
Definition: gap.h:933
uint8 opcode
GAP_END_DISCOVERABLE_DONE_EVENT
Definition: gap.h:945
bStatus_t GAP_SetAdvToken(gapAdvDataToken_t *pToken)
Set Advertising Token.
uint8 opcode
GAP_SIGNATURE_UPDATED_EVENT
Definition: gap.h:840
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:839
uint8 eventType
Advertise Event Type: GAP Advertising Event Types.
Definition: gap.h:912
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:1153
uint8 attrLen
Number of bytes in the attribute data.
Definition: gap.h:1204
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:779
uint8 authReq
Authentication Requirements: Bit 2: MITM, Bits 0-1: bonding (0 - no bonding, 1 - bonding) ...
Definition: gap.h:1140
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:1103
bStatus_t GAP_TerminateAuth(uint16 connectionHandle, uint8 reason)
Terminate Authnetication.
Authentication Parameters.
Definition: gap.h:1117
bStatus_t GAP_PasskeyUpdate(uint8 *pPasskey, uint16 connectionHandle)
Update the passkey in string format.
GAP_MAKE_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:930
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1136
uint8 mode
Discovery Mode: GAP Device Discovery Modes.
Definition: gap.h:875
bStatus_t GAP_EstablishLinkReq(gapEstLinkReq_t *pParams)
Establish a link to a slave device.
uint8 adType
ADTYPE value: Address Types.
Definition: gap.h:1203
smSigningInfo_t * pSigningInfo
Signing information.
Definition: gap.h:1104
uint8 addrType
Device's address type for devAddr.
Definition: gap.h:841
uint16 connectionHandle
Connection Handle.
Definition: gap.h:1138
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:820
uint16 latency
Definition: gap.h:801
uint8 dataLen
Length (in bytes) of the data field (evtData)
Definition: gap.h:861
uint16 gapParamIDs_t
GAP Parameters IDs.
Definition: gap.h:758
uint8 adType
TRUE if advertising data, FALSE if SCAN_RSP.
Definition: gap.h:958
GAP_PASSKEY_NEEDED_EVENT message format.
Definition: gap.h:1080
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:763
Connection parameters for the peripheral device.
Definition: gap.h:794
GAP_DEVICE_INIT_DONE_EVENT message format.
Definition: gap.h:818
uint8 taskID
Requesting App's Task ID, used to return results.
Definition: gap.h:874
GAP_SLAVE_REQUESTED_SECURITY_EVENT message format.
Definition: gap.h:1134
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:932
bStatus_t GAP_TerminateLinkReq(uint8 taskID, uint16 connectionHandle, uint8 reason)
Terminate a link connection.
GAP event header format.
Definition: gap.h:761
GAP_BOND_COMPLETE_EVENT message format.
Definition: gap.h:1149
uint8 eventType
Indicates advertising event type used by the advertiser: GAP Advertising Report Event Types...
Definition: gap.h:883
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:1119
GAP_PAIRING_REQ_EVENT message format.
Definition: gap.h:1184
uint8 addrType
Address Type: Address Types.
Definition: gap.h:884
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1151
uint8 uiInputs
Pairing User Interface Inputs - Ask user to input passcode.
Definition: gap.h:1086
uint8 numDevs
Number of devices found during scan.
Definition: gap.h:903
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1082
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:764
keyDist_t keyDist
Pairing Request Key Distribution field.
Definition: gap.h:1165
uint8(* pfnSuppEnhPrivCB_t)(uint8 *deviceAddr)
Enhanced Privacy Check Callback Function.
Definition: gap.h:1216
uint8 maxEncKeySize
Pairing Request Maximum Encryption Key Size field.
Definition: gap.h:1164
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:855
GAP_SIGNATURE_UPDATED_EVENT message format.
Definition: gap.h:837
uint8 numDataPkts
HC_Total_Num_LE_Data_Packets.
Definition: gap.h:824
uint8 opcode
GAP_PAIRING_REQ_EVENT
Definition: gap.h:1187
uint8 opcode
GAP_SLAVE_REQUESTED_SECURITY_EVENT
Definition: gap.h:1137
Definition: sm.h:144
uint8 opcode
GAP_DEVICE_INFO_EVENT
Definition: gap.h:856
uint8 initiatorAddrType
Initiator's address type: Address Types.
Definition: gap.h:913
uint8 opcode
GAP_ADV_DATA_UPDATE_DONE_EVENT
Definition: gap.h:957
uint16 intervalMax
Definition: gap.h:799
Type of device discovery (Scan) to perform.
Definition: gap.h:881
uint16 GAP_GetParamValue(gapParamIDs_t paramID)
Get a GAP Parameter value.
uint8 opcode
GAP_DEVICE_INIT_DONE_EVENT
Definition: gap.h:821
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:1106
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:853
uint8 uiOutputs
Pairing User Interface Outputs - Display passcode.
Definition: gap.h:1087
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:1101
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:944
uint8 opcode
GAP_DEVICE_DISCOVERY_EVENT
Definition: gap.h:902
GAP_ADV_DATA_UPDATE_DONE_EVENT message format.
Definition: gap.h:954
uint16 connectionHandle
connection Handle
Definition: gap.h:1188
uint32 signCounter
new Signed Counter
Definition: gap.h:843
smLinkSecurityReq_t secReqs
Pairing Control info.
Definition: gap.h:1120
uint8 addrType
address type: Address Types
Definition: gap.h:858
uint16 timeout
Definition: gap.h:803
bStatus_t GAP_UpdateAdvTokens(void)
Update Advertising Token.
gapAdvDataToken_t * GAP_GetAdvToken(uint8 adType)
Get Advertising Token.
uint16 intervalMin
Definition: gap.h:797
uint8 oobDataFlag
Pairing Request OOB Data Flag field.
Definition: gap.h:1162
int8 rssi
Advertisement or SCAN_RSP RSSI.
Definition: gap.h:860
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:901
Type of device discovery (Scan) to perform.
Definition: gap.h:872
uint8 opcode
GAP_AUTHENTICATION_COMPLETE_EVENT
Definition: gap.h:1100
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1099
Type definitions and macros for BLE stack.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1186
smSecurityInfo_t * pDevSecInfo
BOUND - security information from connected device.
Definition: gap.h:1105
void(* pfnGapIdleCB_t)()
GAP Idle Callback Function.
Definition: gap.h:1221
Definition: sm.h:211
uint8 channelMap
Channel Map: Bit mask GAP Advertisement Channel Map.
Definition: gap.h:915
uint8 addrMode
Address mode: GAP Addressing Modes.
Definition: gap.h:781
uint8 filterPolicy
Filer Policy: GAP Advertiser Filter Scan Parameters. Ignored when directed advertising is used...
Definition: gap.h:916
GAP_END_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:942
uint8 opcode
GAP_PASSKEY_NEEDED_EVENT
Definition: gap.h:1083
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 peer device.
pfnSuppEnhPrivCB_t supportEnhPrivCB
Supports Enhanced Privacy callback.
Definition: gap.h:1226
uint8 opcode
GAP_RANDOM_ADDR_CHANGED_EVENT
Definition: gap.h:780
#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:857
uint8 ioCap
Pairing Request ioCap field.
Definition: gap.h:1161
GAP_AUTHENTICATION_COMPLETE_EVENT message format.
Definition: gap.h:1097
Callback Registration Structure.
Definition: gap.h:1224
uint8 GAP_isPairing(void)
Check if GAP is currently pairing.
uint8 opcode
GAP_BOND_COMPLETE_EVENT
Definition: gap.h:1152
uint8 * pAttrData
pointer to Attribute data
Definition: gap.h:1205
pfnGapIdleCB_t gapIdleCB
GAP Idle callback.
Definition: gap.h:1227
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:227
GAP_DEVICE_DISCOVERY_EVENT message format.
Definition: gap.h:899
GAP_RANDOM_ADDR_CHANGED_EVENT message format.
Definition: gap.h:777
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:876
Pairing Request fields - the parsed fields of the SMP Pairing Request command.
Definition: gap.h:1159
uint8 * pEvtData
Data field of advertisement or SCAN_RSP.
Definition: gap.h:862
Advertising Parameters.
Definition: gap.h:910
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:823
uint32 numComparison
Numeric Comparison value to be displayed.
Definition: gap.h:1088
gapPairingReq_t pairReq
The Pairing Request fields received.
Definition: gap.h:1189
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:877
uint16 connectionHandle
Connection handle.
Definition: gap.h:1085
GAP Advertisement/Scan Response Data Token.
Definition: gap.h:1201
gapAdvDataToken_t * GAP_RemoveAdvToken(uint8 adType)
Remove Advertising Token.
uint8 authReq
Pairing Request Auth Req field.
Definition: gap.h:1163
gapDevRec_t * pDevList
array of device records
Definition: gap.h:904
bStatus_t GAP_SetParamValue(gapParamIDs_t paramID, uint16 paramValue)
Set a GAP Parameter value.
Copyright 2017, Texas Instruments Incorporated