BLE-Stack APIs  3.00.01
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 
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 "bcomdef.h"
33 #include "osal.h"
34 #include "sm.h"
35 
36 /*-------------------------------------------------------------------
37  * MACROS
38  */
39 
40 /*-------------------------------------------------------------------
41  * CONSTANTS
42  */
43 
52 #define GAP_DEVICE_INIT_DONE_EVENT 0x00
53 #define GAP_DEVICE_DISCOVERY_EVENT 0x01
54 #define GAP_ADV_DATA_UPDATE_DONE_EVENT 0x02
55 #define GAP_MAKE_DISCOVERABLE_DONE_EVENT 0x03
56 #define GAP_END_DISCOVERABLE_DONE_EVENT 0x04
57 #define GAP_LINK_ESTABLISHED_EVENT 0x05
58 #define GAP_LINK_TERMINATED_EVENT 0x06
59 #define GAP_LINK_PARAM_UPDATE_EVENT 0x07
60 #define GAP_RANDOM_ADDR_CHANGED_EVENT 0x08
61 #define GAP_SIGNATURE_UPDATED_EVENT 0x09
62 #define GAP_AUTHENTICATION_COMPLETE_EVENT 0x0A
63 #define GAP_PASSKEY_NEEDED_EVENT 0x0B
64 #define GAP_SLAVE_REQUESTED_SECURITY_EVENT 0x0C
65 #define GAP_DEVICE_INFO_EVENT 0x0D
66 #define GAP_BOND_COMPLETE_EVENT 0x0E
67 #define GAP_PAIRING_REQ_EVENT 0x0F
68 #define GAP_AUTHENTICATION_FAILURE_EVT 0x10
69 #define GAP_UPDATE_LINK_PARAM_REQ_EVENT 0x11
70 
76 #define GAP_CONNHANDLE_INIT 0xFFFE
77 #define GAP_CONNHANDLE_ALL 0xFFFF
78 
84 #define GAP_PROFILE_BROADCASTER 0x01
85 #define GAP_PROFILE_OBSERVER 0x02
86 #define GAP_PROFILE_PERIPHERAL 0x04
87 #define GAP_PROFILE_CENTRAL 0x08
88 
105 #define TGAP_GEN_DISC_ADV_MIN 0
106 
114 #define TGAP_LIM_ADV_TIMEOUT 1
115 
123 #define TGAP_GEN_DISC_SCAN 2
124 
132 #define TGAP_LIM_DISC_SCAN 3
133 
141 #define TGAP_CONN_EST_ADV_TIMEOUT 4
142 
151 #define TGAP_CONN_PARAM_TIMEOUT 5
152 
160 #define TGAP_LIM_DISC_ADV_INT_MIN 6
161 
169 #define TGAP_LIM_DISC_ADV_INT_MAX 7
170 
178 #define TGAP_GEN_DISC_ADV_INT_MIN 8
179 
187 #define TGAP_GEN_DISC_ADV_INT_MAX 9
188 
196 #define TGAP_CONN_ADV_INT_MIN 10
197 
205 #define TGAP_CONN_ADV_INT_MAX 11
206 
214 #define TGAP_CONN_SCAN_INT 12
215 
223 #define TGAP_CONN_SCAN_WIND 13
224 
232 #define TGAP_CONN_HIGH_SCAN_INT 14
233 
241 #define TGAP_CONN_HIGH_SCAN_WIND 15
242 
250 #define TGAP_GEN_DISC_SCAN_INT 16
251 
259 #define TGAP_GEN_DISC_SCAN_WIND 17
260 
268 #define TGAP_LIM_DISC_SCAN_INT 18
269 
277 #define TGAP_LIM_DISC_SCAN_WIND 19
278 
280 
285 #define TGAP_CONN_EST_ADV 20
286 
295 #define TGAP_CONN_EST_INT_MIN 21
296 
304 #define TGAP_CONN_EST_INT_MAX 22
305 
313 #define TGAP_CONN_EST_SCAN_INT 23
314 
322 #define TGAP_CONN_EST_SCAN_WIND 24
323 
331 #define TGAP_CONN_EST_SUPERV_TIMEOUT 25
332 
340 #define TGAP_CONN_EST_LATENCY 26
341 
349 #define TGAP_CONN_EST_MIN_CE_LEN 27
350 
358 #define TGAP_CONN_EST_MAX_CE_LEN 28
359 
367 #define TGAP_PRIVATE_ADDR_INT 29
368 
376 #define TGAP_CONN_PAUSE_CENTRAL 30
377 
385 #define TGAP_CONN_PAUSE_PERIPHERAL 31
386 
394 #define TGAP_SM_TIMEOUT 32
395 
403 #define TGAP_SM_MIN_KEY_LEN 33
404 
412 #define TGAP_SM_MAX_KEY_LEN 34
413 
421 #define TGAP_FILTER_ADV_REPORTS 35
422 
430 #define TGAP_SCAN_RSP_RSSI_MIN 36
431 
439 #define TGAP_REJECT_CONN_PARAMS 37
440 
442 #if !defined ( TESTMODES )
443  #define TGAP_AUTH_TASK_ID 38
444  #define TGAP_VERIFY_CAR 39
445  #define TGAP_PARAMID_MAX 40
446 #else
447  #define TGAP_GAP_TESTCODE 38
448  #define TGAP_SM_TESTCODE 39
449  #define TGAP_AUTH_TASK_ID 40
450  #define TGAP_VERIFY_CAR 41
451  #define TGAP_PARAMID_MAX 42
452 
453  #define TGAP_GATT_TESTCODE 100
454  #define TGAP_ATT_TESTCODE 101
455  #define TGAP_GGS_TESTCODE 102
456  #define TGAP_L2CAP_TESTCODE 103
457 #endif
458 
465 #define DEVDISC_MODE_NONDISCOVERABLE 0x00
466 #define DEVDISC_MODE_GENERAL 0x01
467 #define DEVDISC_MODE_LIMITED 0x02
468 #define DEVDISC_MODE_ALL 0x03
469 
474 #define ADDRTYPE_PUBLIC 0x00
475 #define ADDRTYPE_RANDOM 0x01
476 #define ADDRTYPE_PUBLIC_ID 0x02
477 #define ADDRTYPE_RANDOM_ID 0x03
478 
483 #define SET_ADDRTYPE_ID 0x02
484 #define MASK_ADDRTYPE_ID 0x01
485 
490 #define RANDOM_ADDR_SUBTYPE_STATIC 0x00
491 #define RANDOM_ADDR_SUBTYPE_RPA 0x01
492 #define RANDOM_ADDR_SUBTYPE_NRPA 0x02
493 
498 #define RANDOM_ADDR_HDR_MASK 0xC0
499 #define STATIC_ADDR_HDR 0xC0
500 #define PRIVATE_NON_RESOLVE_ADDR_HDR 0x80
501 #define PRIVATE_RESOLVE_ADDR_HDR 0x40
502 
507 #define ADDRMODE_PUBLIC 0x00
508 #define ADDRMODE_STATIC 0x01
509 #define ADDRMODE_PRIVATE_NONRESOLVE 0x02
510 #define ADDRMODE_PRIVATE_RESOLVE 0x03
511 
517 #define GAP_ADTYPE_ADV_IND 0x00
518 #define GAP_ADTYPE_ADV_HDC_DIRECT_IND 0x01
519 #define GAP_ADTYPE_ADV_SCAN_IND 0x02
520 #define GAP_ADTYPE_ADV_NONCONN_IND 0x03
521 #define GAP_ADTYPE_ADV_LDC_DIRECT_IND 0x04
522 
528 #define GAP_ADRPT_ADV_IND 0x00
529 #define GAP_ADRPT_ADV_DIRECT_IND 0x01
530 #define GAP_ADRPT_ADV_SCAN_IND 0x02
531 #define GAP_ADRPT_ADV_NONCONN_IND 0x03
532 #define GAP_ADRPT_SCAN_RSP 0x04
533 
538 #define GAP_FILTER_POLICY_ALL 0x00
539 #define GAP_FILTER_POLICY_WHITE_SCAN 0x01
540 #define GAP_FILTER_POLICY_WHITE_CON 0x02
541 #define GAP_FILTER_POLICY_WHITE 0x03
542 
547 #define GAP_DISC_FILTER_POLICY_ALL 0x00
548 #define GAP_DISC_FILTER_POLICY_WHITE 0x01
549 #define GAP_DISC_FILTER_POLICY_ALL_DIRECT 0x02
550 #define GAP_DISC_FILTER_POLICY_WHITE_DIRECT 0x03
551 
553 #define ADV_CHANMAP_SIZE 5
554 
555 #define GAP_PASSCODE_MAX 999999
556 
557 
563 #define GAP_INIT_SIGN_COUNTER 0xFFFFFFFF
564 
568 #define GAP_ADVCHAN_37 0x01
569 #define GAP_ADVCHAN_38 0x02
570 #define GAP_ADVCHAN_39 0x04
571 #define GAP_ADVCHAN_ALL (GAP_ADVCHAN_37 | GAP_ADVCHAN_38 | GAP_ADVCHAN_39)
572 
577 #define WL_NOTUSED 0x00
578 #define WL_USED 0x01
579 
585 #define GAP_ADTYPE_FLAGS 0x01
586 #define GAP_ADTYPE_16BIT_MORE 0x02
587 #define GAP_ADTYPE_16BIT_COMPLETE 0x03
588 #define GAP_ADTYPE_32BIT_MORE 0x04
589 #define GAP_ADTYPE_32BIT_COMPLETE 0x05
590 #define GAP_ADTYPE_128BIT_MORE 0x06
591 #define GAP_ADTYPE_128BIT_COMPLETE 0x07
592 #define GAP_ADTYPE_LOCAL_NAME_SHORT 0x08
593 #define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09
594 #define GAP_ADTYPE_POWER_LEVEL 0x0A
595 #define GAP_ADTYPE_OOB_CLASS_OF_DEVICE 0x0D
596 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E
597 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F
598 #define GAP_ADTYPE_SM_TK 0x10
599 #define GAP_ADTYPE_SM_OOB_FLAG 0x11
600 #define GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE 0x12
601 #define GAP_ADTYPE_SIGNED_DATA 0x13
602 #define GAP_ADTYPE_SERVICES_LIST_16BIT 0x14
603 #define GAP_ADTYPE_SERVICES_LIST_128BIT 0x15
604 #define GAP_ADTYPE_SERVICE_DATA 0x16
605 #define GAP_ADTYPE_PUBLIC_TARGET_ADDR 0x17
606 #define GAP_ADTYPE_RANDOM_TARGET_ADDR 0x18
607 #define GAP_ADTYPE_APPEARANCE 0x19
608 #define GAP_ADTYPE_ADV_INTERVAL 0x1A
609 #define GAP_ADTYPE_LE_BD_ADDR 0x1B
610 #define GAP_ADTYPE_LE_ROLE 0x1C
611 #define GAP_ADTYPE_SIMPLE_PAIRING_HASHC_256 0x1D
612 #define GAP_ADTYPE_SIMPLE_PAIRING_RANDR_256 0x1E
613 #define GAP_ADTYPE_SERVICE_DATA_32BIT 0x20
614 #define GAP_ADTYPE_SERVICE_DATA_128BIT 0x21
615 #define GAP_ADTYPE_3D_INFO_DATA 0x3D
616 #define GAP_ADTYPE_MANUFACTURER_SPECIFIC 0xFF
617 #define GAP_ADTYPE_FLAGS_LIMITED 0x01
618 #define GAP_ADTYPE_FLAGS_GENERAL 0x02
619 #define GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
620 
625 #define GAP_STATE_IDLE 0x00
626 #define GAP_STATE_ADV 0x01
627 #define GAP_STATE_SCAN 0x02
628 #define GAP_STATE_INIT 0x04
629 
634 #define GAP_APPEARE_UNKNOWN 0x0000
635 #define GAP_APPEARE_GENERIC_PHONE 0x0040
636 #define GAP_APPEARE_GENERIC_COMPUTER 0x0080
637 #define GAP_APPEARE_GENERIC_WATCH 0x00C0
638 #define GAP_APPEARE_WATCH_SPORTS 0x00C1
639 #define GAP_APPEARE_GENERIC_CLOCK 0x0100
640 #define GAP_APPEARE_GENERIC_DISPLAY 0x0140
641 #define GAP_APPEARE_GENERIC_RC 0x0180
642 #define GAP_APPEARE_GENERIC_EYE_GALSSES 0x01C0
643 #define GAP_APPEARE_GENERIC_TAG 0x0200
644 #define GAP_APPEARE_GENERIC_KEYRING 0x0240
645 #define GAP_APPEARE_GENERIC_MEDIA_PLAYER 0x0280
646 #define GAP_APPEARE_GENERIC_BARCODE_SCANNER 0x02C0
647 #define GAP_APPEARE_GENERIC_THERMOMETER 0x0300
648 #define GAP_APPEARE_GENERIC_THERMO_EAR 0x0301
649 #define GAP_APPEARE_GENERIC_HR_SENSOR 0x0340
650 #define GAP_APPEARE_GENERIC_HRS_BELT 0x0341
651 #define GAP_APPEARE_GENERIC_BLOOD_PRESSURE 0x0380
652 #define GAP_APPEARE_GENERIC_BP_ARM 0x0381
653 #define GAP_APPEARE_GENERIC_BP_WRIST 0x0382
654 #define GAP_APPEARE_GENERIC_HID 0x03C0
655 #define GAP_APPEARE_HID_KEYBOARD 0x03C1
656 #define GAP_APPEARE_HID_MOUSE 0x03C2
657 #define GAP_APPEARE_HID_JOYSTIC 0x03C3
658 #define GAP_APPEARE_HID_GAMEPAD 0x03C4
659 #define GAP_APPEARE_HID_DIGITIZER_TYABLET 0x03C5
660 #define GAP_APPEARE_HID_DIGITAL_CARDREADER 0x03C6
661 #define GAP_APPEARE_HID_DIGITAL_PEN 0x03C7
662 #define GAP_APPEARE_HID_BARCODE_SCANNER 0x03C8
663 
667 /*-------------------------------------------------------------------
668  * TYPEDEFS - Initialization and Configuration
669  */
670 
680 typedef uint16 gapParamIDs_t;
681 
683 typedef struct
684 {
686  uint8 opcode;
687 } gapEventHdr_t;
688 
699 typedef struct
700 {
702  uint8 opcode;
703  uint8 addrMode;
704  uint8 newRandomAddr[B_ADDR_LEN];
706 
716 typedef struct
717 {
719  uint16 intervalMin;
721  uint16 intervalMax;
723  uint16 latency;
725  uint16 timeout;
727 
740 typedef struct
741 {
743  uint8 opcode;
744  uint8 devAddr[B_ADDR_LEN];
745  uint16 dataPktLen;
746  uint8 numDataPkts;
748 
759 typedef struct
760 {
762  uint8 opcode;
763  uint8 addrType;
764  uint8 devAddr[B_ADDR_LEN];
765  uint32 signCounter;
767 
775 typedef struct
776 {
778  uint8 opcode;
779  uint8 eventType;
780  uint8 addrType;
781  uint8 addr[B_ADDR_LEN];
782  int8 rssi;
783  uint8 dataLen;
784  uint8 *pEvtData;
786  // end of GAP_Events
788 
789 /*-------------------------------------------------------------------
790  * TYPEDEFS - Device Discovery
791  */
792 
794 typedef struct
795 {
796  uint8 taskID;
797  uint8 mode;
798  uint8 activeScan;
799  uint8 whiteList;
801 
803 typedef struct
804 {
805  uint8 eventType;
806  uint8 addrType;
807  uint8 addr[B_ADDR_LEN];
808 } gapDevRec_t;
809 
821 typedef struct
822 {
824  uint8 opcode;
825  uint8 numDevs;
828  // end of GAP_Events
830 
832 typedef struct
833 {
834  uint8 eventType;
836  uint8 initiatorAddr[B_ADDR_LEN];
837  uint8 channelMap;
838  uint8 filterPolicy;
840 
852 typedef struct
853 {
855  uint8 opcode;
857 
864 typedef struct
865 {
867  uint8 opcode;
869 
876 typedef struct
877 {
879  uint8 opcode;
880  uint8 adType;
882  // end of GAP_Events
884 
885 /*-------------------------------------------------------------------
886  * TYPEDEFS - Link Establishment
887  */
888 
890 typedef struct
891 {
892  uint8 taskID;
894  uint8 whiteList;
895  uint8 addrTypePeer;
896  uint8 peerAddr[B_ADDR_LEN];
898 
900 typedef struct
901 {
903  uint16 intervalMin;
904  uint16 intervalMax;
905  uint16 connLatency;
906  uint16 connTimeout;
908 
910 typedef struct
911 {
913  uint16 intervalMin;
914  uint16 intervalMax;
915  uint16 connLatency;
916  uint16 connTimeout;
917  uint8 accepted;
919 
931 typedef struct
932 {
934  uint8 opcode;
937 
947 typedef struct
948 {
950  uint8 opcode;
951  uint8 devAddrType;
952  uint8 devAddr[B_ADDR_LEN];
954  uint8 connRole;
955  uint16 connInterval;
956  uint16 connLatency;
957  uint16 connTimeout;
960 
967 typedef struct
968 {
970  uint8 opcode;
971  uint8 status;
973  uint16 connInterval;
974  uint16 connLatency;
975  uint16 connTimeout;
977 
984 typedef struct
985 {
987  uint8 opcode;
989  uint8 reason;
991 
992 /*-------------------------------------------------------------------
993  * TYPEDEFS - Authentication, Bounding and Pairing
994  */
995 
1002 typedef struct
1003 {
1005  uint8 opcode;
1006  uint8 deviceAddr[B_ADDR_LEN];
1008  uint8 uiInputs;
1009  uint8 uiOutputs;
1010  uint32 numComparison;
1012 
1019 typedef struct
1020 {
1022  uint8 opcode;
1024  uint8 authState;
1030  // end of GAP_Events
1032 
1039 typedef struct
1040 {
1043 } gapAuthParams_t;
1044 
1056 typedef struct
1057 {
1059  uint8 opcode;
1061  uint8 deviceAddr[B_ADDR_LEN];
1062  uint8 authReq;
1064 
1071 typedef struct
1072 {
1074  uint8 opcode;
1077  // end of GAP_Events
1079 
1081 typedef struct
1082 {
1083  uint8 ioCap;
1084  uint8 oobDataFlag;
1085  uint8 authReq;
1088 } gapPairingReq_t;
1089 
1106 typedef struct
1107 {
1109  uint8 opcode;
1113  // end of GAP_Events
1115 
1123 typedef struct
1124 {
1125  uint8 adType;
1126  uint8 attrLen;
1127  uint8 *pAttrData;
1129 
1136 typedef uint8 (*pfnSuppEnhPrivCB_t)
1139  uint8 *deviceAddr
1140 );
1141 
1143 typedef void (*pfnGapIdleCB_t)();
1144 
1146 typedef struct
1147 {
1150 } gapBondMgrCBs_t;
1151 
1154 /*-------------------------------------------------------------------
1155  * GLOBAL VARIABLES
1156  */
1157 
1158 /*-------------------------------------------------------------------
1159  * FUNCTIONS - Initialization and Configuration
1160  */
1161 
1188  extern bStatus_t GAP_DeviceInit( uint8 taskID,
1189  uint8 profileRole,
1190  uint8 maxScanResponses,
1191  uint8 *pIRK,
1192  uint8 *pSRK,
1193  uint32 *pSignCounter );
1194 
1214  extern bStatus_t GAP_SetAdvToken( gapAdvDataToken_t *pToken );
1215 
1225  extern gapAdvDataToken_t *GAP_GetAdvToken( uint8 adType );
1226 
1237  extern gapAdvDataToken_t *GAP_RemoveAdvToken( uint8 adType );
1238 
1247  extern bStatus_t GAP_UpdateAdvTokens( void );
1248 
1261  extern bStatus_t GAP_SetParamValue( gapParamIDs_t paramID, uint16 paramValue );
1262 
1271  extern uint16 GAP_GetParamValue( gapParamIDs_t paramID );
1272 
1300  extern bStatus_t GAP_ConfigDeviceAddr( uint8 addrMode, uint8 *pStaticAddr );
1301 
1310  extern void GAP_RegisterForMsgs( uint8 taskID );
1311 
1317  extern void GAP_RegisterBondMgrCBs( gapBondMgrCBs_t *pCBs );
1318 
1319 /*-------------------------------------------------------------------
1320  * FUNCTIONS - Device Discovery
1321  */
1322 
1339 
1353  extern bStatus_t GAP_DeviceDiscoveryCancel( uint8 taskID );
1354 
1369  extern bStatus_t GAP_MakeDiscoverable( uint8 taskID, gapAdvertisingParams_t *pParams );
1370 
1385  extern bStatus_t GAP_UpdateAdvertisingData( uint8 taskID, uint8 adType,
1386  uint8 dataLen, uint8 *pAdvertData );
1387 
1400  extern bStatus_t GAP_EndDiscoverable( uint8 taskID );
1401 
1402 #if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
1403 
1413  extern bStatus_t GAP_ResolvePrivateAddr( uint8 *pIRK, uint8 *pAddr );
1414 #endif // ! BLE_V42_FEATURES | ! PRIVACY_1_2_CFG
1415 
1416 /*-------------------------------------------------------------------
1417  * FUNCTIONS - Link Establishment
1418  */
1419 
1434  extern bStatus_t GAP_EstablishLinkReq( gapEstLinkReq_t *pParams );
1435 
1451  extern bStatus_t GAP_TerminateLinkReq( uint8 taskID, uint16 connectionHandle, uint8 reason );
1452 
1469 
1489 
1495  extern uint8 GAP_NumActiveConnections( void );
1496 
1497 /*-------------------------------------------------------------------
1498  * FUNCTIONS - Pairing
1499  */
1500 
1528  extern bStatus_t GAP_Authenticate( gapAuthParams_t *pParams, gapPairingReq_t *pPairReq );
1529 
1536  extern uint8 GAP_isPairing(void);
1537 
1555  extern bStatus_t GAP_TerminateAuth( uint16 connectionHandle, uint8 reason );
1556 
1576  extern bStatus_t GAP_PasskeyUpdate( uint8 *pPasskey, uint16 connectionHandle );
1577 
1596  extern bStatus_t GAP_PasscodeUpdate( uint32 passcode, uint16 connectionHandle );
1597 
1612  extern bStatus_t GAP_SendSlaveSecurityRequest( uint16 connectionHandle, uint8 authReq );
1613 
1630  extern bStatus_t GAP_Signable( uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams );
1631 
1653  extern bStatus_t GAP_Bond( uint16 connectionHandle, uint8 authenticated,
1654  uint8 secureConnections, smSecurityInfo_t *pParams,
1655  uint8 startEncryption );
1656 
1657 /*-------------------------------------------------------------------
1658  * Internal API - These functions are only called from gap.c module.
1659  */
1660 
1662 
1673  extern bStatus_t GAP_ParamsInit( uint8 taskID, uint8 profileRole );
1674 
1682  extern void GAP_PrivacyInit( uint8 *pIRK );
1683 
1691  extern uint8 *GAP_GetIRK( void );
1692 
1705  extern void GAP_SecParamsInit( uint8 *pSRK, uint32 *pSignCounter );
1706 
1714  extern bStatus_t GAP_PeriDevMgrInit( void );
1715 
1722  extern void GAP_PeriConnRegister( void );
1723 
1735  extern bStatus_t GAP_CentDevMgrInit( uint8 maxScanResponses );
1736 
1743  extern void GAP_CentConnRegister( void );
1744 
1745 
1746 /*-------------------------------------------------------------------
1747  * TASK API - These functions must only be called OSAL.
1748  */
1749 
1757  extern void GAP_Init( uint8 task_id );
1758 
1769  extern uint16 GAP_ProcessEvent( uint8 task_id, uint16 events );
1770 
1772 
1773 /*-------------------------------------------------------------------
1774 -------------------------------------------------------------------*/
1775 
1776 #ifdef __cplusplus
1777 }
1778 #endif
1779 
1780 #endif /* GAP_H */
1781 
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:878
uint8 authState
TRUE if the pairing was authenticated (MITM)
Definition: gap.h:1024
uint8 opcode
GAP_MAKE_DISCOVERABLE_DONE_EVENT
Definition: gap.h:855
uint8 opcode
GAP_END_DISCOVERABLE_DONE_EVENT
Definition: gap.h:867
bStatus_t GAP_SetAdvToken(gapAdvDataToken_t *pToken)
Set Advertising Token.
uint8 opcode
GAP_SIGNATURE_UPDATED_EVENT
Definition: gap.h:762
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:761
uint8 eventType
Advertise Event Type: GAP Advertising Event Types.
Definition: gap.h:834
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:1075
uint8 attrLen
Number of bytes in the attribute data.
Definition: gap.h:1126
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:701
uint8 authReq
Authentication Requirements: Bit 2: MITM, Bits 0-1: bonding (0 - no bonding, 1 - bonding) ...
Definition: gap.h:1062
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:1025
bStatus_t GAP_TerminateAuth(uint16 connectionHandle, uint8 reason)
Terminate Authnetication.
Authentication Parameters.
Definition: gap.h:1039
bStatus_t GAP_PasskeyUpdate(uint8 *pPasskey, uint16 connectionHandle)
Update the passkey in string format.
GAP_MAKE_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:852
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1058
uint8 mode
Discovery Mode: GAP Device Discovery Modes.
Definition: gap.h:797
bStatus_t GAP_EstablishLinkReq(gapEstLinkReq_t *pParams)
Establish a link to a slave device.
uint8 adType
ADTYPE value: Address Types.
Definition: gap.h:1125
smSigningInfo_t * pSigningInfo
Signing information.
Definition: gap.h:1026
uint8 addrType
Device's address type for devAddr.
Definition: gap.h:763
uint16 connectionHandle
Connection Handle.
Definition: gap.h:1060
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:742
uint16 latency
Definition: gap.h:723
uint8 dataLen
Length (in bytes) of the data field (evtData)
Definition: gap.h:783
uint16 gapParamIDs_t
GAP Parameters IDs.
Definition: gap.h:680
uint8 adType
TRUE if advertising data, FALSE if SCAN_RSP.
Definition: gap.h:880
GAP_PASSKEY_NEEDED_EVENT message format.
Definition: gap.h:1002
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:685
Connection parameters for the peripheral device.
Definition: gap.h:716
GAP_DEVICE_INIT_DONE_EVENT message format.
Definition: gap.h:740
uint8 taskID
Requesting App's Task ID, used to return results.
Definition: gap.h:796
GAP_SLAVE_REQUESTED_SECURITY_EVENT message format.
Definition: gap.h:1056
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:854
bStatus_t GAP_TerminateLinkReq(uint8 taskID, uint16 connectionHandle, uint8 reason)
Terminate a link connection.
GAP event header format.
Definition: gap.h:683
GAP_BOND_COMPLETE_EVENT message format.
Definition: gap.h:1071
uint8 eventType
Indicates advertising event type used by the advertiser: GAP Advertising Report Event Types...
Definition: gap.h:805
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:1041
GAP_PAIRING_REQ_EVENT message format.
Definition: gap.h:1106
uint8 addrType
Address Type: Address Types.
Definition: gap.h:806
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1073
uint8 uiInputs
Pairing User Interface Inputs - Ask user to input passcode.
Definition: gap.h:1008
uint8 numDevs
Number of devices found during scan.
Definition: gap.h:825
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1004
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:686
keyDist_t keyDist
Pairing Request Key Distribution field.
Definition: gap.h:1087
uint8(* pfnSuppEnhPrivCB_t)(uint8 *deviceAddr)
Enhanced Privacy Check Callback Function.
Definition: gap.h:1138
uint8 maxEncKeySize
Pairing Request Maximum Encryption Key Size field.
Definition: gap.h:1086
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:777
GAP_SIGNATURE_UPDATED_EVENT message format.
Definition: gap.h:759
uint8 numDataPkts
HC_Total_Num_LE_Data_Packets.
Definition: gap.h:746
uint8 opcode
GAP_PAIRING_REQ_EVENT
Definition: gap.h:1109
uint8 opcode
GAP_SLAVE_REQUESTED_SECURITY_EVENT
Definition: gap.h:1059
Definition: sm.h:144
uint8 opcode
GAP_DEVICE_INFO_EVENT
Definition: gap.h:778
uint8 initiatorAddrType
Initiator's address type: Address Types.
Definition: gap.h:835
uint8 opcode
GAP_ADV_DATA_UPDATE_DONE_EVENT
Definition: gap.h:879
uint16 intervalMax
Definition: gap.h:721
Type of device discovery (Scan) to perform.
Definition: gap.h:803
uint16 GAP_GetParamValue(gapParamIDs_t paramID)
Get a GAP Parameter value.
uint8 opcode
GAP_DEVICE_INIT_DONE_EVENT
Definition: gap.h:743
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:1028
Definition: sm.h:201
void GAP_RegisterBondMgrCBs(gapBondMgrCBs_t *pCBs)
Register bond manager call backs.
GAP_DEVICE_INFO_EVENT message format.
Definition: gap.h:775
uint8 uiOutputs
Pairing User Interface Outputs - Display passcode.
Definition: gap.h:1009
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:1023
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:866
uint8 opcode
GAP_DEVICE_DISCOVERY_EVENT
Definition: gap.h:824
GAP_ADV_DATA_UPDATE_DONE_EVENT message format.
Definition: gap.h:876
uint16 connectionHandle
connection Handle
Definition: gap.h:1110
uint32 signCounter
new Signed Counter
Definition: gap.h:765
smLinkSecurityReq_t secReqs
Pairing Control info.
Definition: gap.h:1042
uint8 addrType
address type: Address Types
Definition: gap.h:780
uint16 timeout
Definition: gap.h:725
bStatus_t GAP_UpdateAdvTokens(void)
Update Advertising Token.
gapAdvDataToken_t * GAP_GetAdvToken(uint8 adType)
Get Advertising Token.
uint16 intervalMin
Definition: gap.h:719
uint8 oobDataFlag
Pairing Request OOB Data Flag field.
Definition: gap.h:1084
int8 rssi
Advertisement or SCAN_RSP RSSI.
Definition: gap.h:782
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:823
Type of device discovery (Scan) to perform.
Definition: gap.h:794
uint8 opcode
GAP_AUTHENTICATION_COMPLETE_EVENT
Definition: gap.h:1022
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1021
Type definitions and macros for BLE stack.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1108
smSecurityInfo_t * pDevSecInfo
BOUND - security information from connected device.
Definition: gap.h:1027
void(* pfnGapIdleCB_t)()
GAP Idle Callback Function.
Definition: gap.h:1143
Definition: sm.h:211
uint8 channelMap
Channel Map: Bit mask GAP Advertisement Channel Map.
Definition: gap.h:837
uint8 addrMode
Address mode: GAP Addressing Modes.
Definition: gap.h:703
uint8 filterPolicy
Filer Policy: GAP Advertiser Filter Scan Parameters. Ignored when directed advertising is used...
Definition: gap.h:838
GAP_END_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:864
uint8 opcode
GAP_PASSKEY_NEEDED_EVENT
Definition: gap.h:1005
bStatus_t GAP_PasscodeUpdate(uint32 passcode, uint16 connectionHandle)
Update the passkey in a numeric value (not string).
void GAP_RegisterForMsgs(uint8 taskID)
Register for GAP Messages.
OSAL Event Header.
Definition: osal.h:92
bStatus_t GAP_UpdateLinkParamReqReply(gapUpdateLinkParamReqReply_t *pParams)
Reply to a Connection Parameter Update Request sent from a remote device.
pfnSuppEnhPrivCB_t supportEnhPrivCB
Supports Enhanced Privacy callback.
Definition: gap.h:1148
uint8 opcode
GAP_RANDOM_ADDR_CHANGED_EVENT
Definition: gap.h:702
#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:779
uint8 ioCap
Pairing Request ioCap field.
Definition: gap.h:1083
GAP_AUTHENTICATION_COMPLETE_EVENT message format.
Definition: gap.h:1019
Callback Registration Structure.
Definition: gap.h:1146
uint8 GAP_isPairing(void)
Check if GAP is currently pairing.
uint8 opcode
GAP_BOND_COMPLETE_EVENT
Definition: gap.h:1074
uint8 * pAttrData
pointer to Attribute data
Definition: gap.h:1127
pfnGapIdleCB_t gapIdleCB
GAP Idle callback.
Definition: gap.h:1149
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:224
GAP_DEVICE_DISCOVERY_EVENT message format.
Definition: gap.h:821
GAP_RANDOM_ADDR_CHANGED_EVENT message format.
Definition: gap.h:699
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:798
Pairing Request fields - the parsed fields of the SMP Pairing Request command.
Definition: gap.h:1081
uint8 * pEvtData
Data field of advertisement or SCAN_RSP.
Definition: gap.h:784
Advertising Parameters.
Definition: gap.h:832
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:745
uint32 numComparison
Numeric Comparison value to be displayed.
Definition: gap.h:1010
gapPairingReq_t pairReq
The Pairing Request fields received.
Definition: gap.h:1111
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:799
uint16 connectionHandle
Connection handle.
Definition: gap.h:1007
GAP Advertisement/Scan Response Data Token.
Definition: gap.h:1123
gapAdvDataToken_t * GAP_RemoveAdvToken(uint8 adType)
Remove Advertising Token.
uint8 authReq
Pairing Request Auth Req field.
Definition: gap.h:1085
gapDevRec_t * pDevList
array of device records
Definition: gap.h:826
bStatus_t GAP_SetParamValue(gapParamIDs_t paramID, uint16 paramValue)
Set a GAP Parameter value.
Copyright 2017, Texas Instruments Incorporated