BLE-Stack APIs  3.00.00
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gap.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Texas Instruments Incorporated
3  * All rights reserved.
4 
5 
6 
7 
8 
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * * Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18 
19 
20  * documentation and/or other materials provided with the distribution.
21 
22 
23  * * Neither the name of Texas Instruments Incorporated nor the names of
24  * its contributors may be used to endorse or promote products derived
25  * from this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
31  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
34  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
36  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
37  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  */
39 /*!*****************************************************************************
40  * @defgroup GAP GAP
41  * @brief This module implements the Generic Access Protocol (GAP)
42  * @{
43  * @file gap.h
44  * @brief GAP layer interface
45  */
46 
47 #ifndef GAP_H
48 #define GAP_H
49 
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif
54 
55 /*-------------------------------------------------------------------
56  * INCLUDES
57  */
58 #include "bcomdef.h"
59 #include "osal.h"
60 #include "sm.h"
61 
62 /*-------------------------------------------------------------------
63  * MACROS
64  */
65 
66 /*-------------------------------------------------------------------
67  * CONSTANTS
68  */
69 
78 #define GAP_DEVICE_INIT_DONE_EVENT 0x00
79 #define GAP_DEVICE_DISCOVERY_EVENT 0x01
80 #define GAP_ADV_DATA_UPDATE_DONE_EVENT 0x02
81 #define GAP_MAKE_DISCOVERABLE_DONE_EVENT 0x03
82 #define GAP_END_DISCOVERABLE_DONE_EVENT 0x04
83 #define GAP_LINK_ESTABLISHED_EVENT 0x05
84 #define GAP_LINK_TERMINATED_EVENT 0x06
85 #define GAP_LINK_PARAM_UPDATE_EVENT 0x07
86 #define GAP_RANDOM_ADDR_CHANGED_EVENT 0x08
87 #define GAP_SIGNATURE_UPDATED_EVENT 0x09
88 #define GAP_AUTHENTICATION_COMPLETE_EVENT 0x0A
89 #define GAP_PASSKEY_NEEDED_EVENT 0x0B
90 #define GAP_SLAVE_REQUESTED_SECURITY_EVENT 0x0C
91 #define GAP_DEVICE_INFO_EVENT 0x0D
92 #define GAP_BOND_COMPLETE_EVENT 0x0E
93 #define GAP_PAIRING_REQ_EVENT 0x0F
94 #define GAP_AUTHENTICATION_FAILURE_EVT 0x10
95 #define GAP_UPDATE_LINK_PARAM_REQ_EVENT 0x11
96 
102 #define GAP_CONNHANDLE_INIT 0xFFFE
103 #define GAP_CONNHANDLE_ALL 0xFFFF
104 
110 #define GAP_PROFILE_BROADCASTER 0x01
111 #define GAP_PROFILE_OBSERVER 0x02
112 #define GAP_PROFILE_PERIPHERAL 0x04
113 #define GAP_PROFILE_CENTRAL 0x08
114 
131 #define TGAP_GEN_DISC_ADV_MIN 0
132 
140 #define TGAP_LIM_ADV_TIMEOUT 1
141 
149 #define TGAP_GEN_DISC_SCAN 2
150 
158 #define TGAP_LIM_DISC_SCAN 3
159 
167 #define TGAP_CONN_EST_ADV_TIMEOUT 4
168 
177 #define TGAP_CONN_PARAM_TIMEOUT 5
178 
186 #define TGAP_LIM_DISC_ADV_INT_MIN 6
187 
195 #define TGAP_LIM_DISC_ADV_INT_MAX 7
196 
204 #define TGAP_GEN_DISC_ADV_INT_MIN 8
205 
213 #define TGAP_GEN_DISC_ADV_INT_MAX 9
214 
222 #define TGAP_CONN_ADV_INT_MIN 10
223 
231 #define TGAP_CONN_ADV_INT_MAX 11
232 
240 #define TGAP_CONN_SCAN_INT 12
241 
249 #define TGAP_CONN_SCAN_WIND 13
250 
258 #define TGAP_CONN_HIGH_SCAN_INT 14
259 
267 #define TGAP_CONN_HIGH_SCAN_WIND 15
268 
276 #define TGAP_GEN_DISC_SCAN_INT 16
277 
285 #define TGAP_GEN_DISC_SCAN_WIND 17
286 
294 #define TGAP_LIM_DISC_SCAN_INT 18
295 
303 #define TGAP_LIM_DISC_SCAN_WIND 19
304 
306 
311 #define TGAP_CONN_EST_ADV 20
312 
321 #define TGAP_CONN_EST_INT_MIN 21
322 
330 #define TGAP_CONN_EST_INT_MAX 22
331 
339 #define TGAP_CONN_EST_SCAN_INT 23
340 
348 #define TGAP_CONN_EST_SCAN_WIND 24
349 
357 #define TGAP_CONN_EST_SUPERV_TIMEOUT 25
358 
366 #define TGAP_CONN_EST_LATENCY 26
367 
375 #define TGAP_CONN_EST_MIN_CE_LEN 27
376 
384 #define TGAP_CONN_EST_MAX_CE_LEN 28
385 
393 #define TGAP_PRIVATE_ADDR_INT 29
394 
402 #define TGAP_CONN_PAUSE_CENTRAL 30
403 
411 #define TGAP_CONN_PAUSE_PERIPHERAL 31
412 
420 #define TGAP_SM_TIMEOUT 32
421 
429 #define TGAP_SM_MIN_KEY_LEN 33
430 
438 #define TGAP_SM_MAX_KEY_LEN 34
439 
447 #define TGAP_FILTER_ADV_REPORTS 35
448 
456 #define TGAP_SCAN_RSP_RSSI_MIN 36
457 
465 #define TGAP_REJECT_CONN_PARAMS 37
466 
468 #if !defined ( TESTMODES )
469  #define TGAP_AUTH_TASK_ID 38
470  #define TGAP_VERIFY_CAR 39
471  #define TGAP_PARAMID_MAX 40
472 #else
473  #define TGAP_GAP_TESTCODE 38
474  #define TGAP_SM_TESTCODE 39
475  #define TGAP_AUTH_TASK_ID 40
476  #define TGAP_VERIFY_CAR 41
477  #define TGAP_PARAMID_MAX 42
478 
479  #define TGAP_GATT_TESTCODE 100
480  #define TGAP_ATT_TESTCODE 101
481  #define TGAP_GGS_TESTCODE 102
482  #define TGAP_L2CAP_TESTCODE 103
483 #endif
484 
491 #define DEVDISC_MODE_NONDISCOVERABLE 0x00
492 #define DEVDISC_MODE_GENERAL 0x01
493 #define DEVDISC_MODE_LIMITED 0x02
494 #define DEVDISC_MODE_ALL 0x03
495 
500 #define ADDRTYPE_PUBLIC 0x00
501 #define ADDRTYPE_RANDOM 0x01
502 #define ADDRTYPE_PUBLIC_ID 0x02
503 #define ADDRTYPE_RANDOM_ID 0x03
504 
509 #define SET_ADDRTYPE_ID 0x02 // OR with addrtype to change addr type to ID
510 #define MASK_ADDRTYPE_ID 0x01 // AND with addrtype to remove ID from type
511 
516 #define RANDOM_ADDR_SUBTYPE_STATIC 0x00
517 #define RANDOM_ADDR_SUBTYPE_RPA 0x01
518 #define RANDOM_ADDR_SUBTYPE_NRPA 0x02
519 
524 #define RANDOM_ADDR_HDR_MASK 0xC0 // Get top 2 bits of address
525 #define STATIC_ADDR_HDR 0xC0 // Random Static Address (b11)
526 #define PRIVATE_NON_RESOLVE_ADDR_HDR 0x80 // Random Private Non-Resolvable Address (b10)
527 #define PRIVATE_RESOLVE_ADDR_HDR 0x40 // Random Private Resolvable Address (b01)
528 
533 #define ADDRMODE_PUBLIC 0x00
534 #define ADDRMODE_STATIC 0x01
535 #define ADDRMODE_PRIVATE_NONRESOLVE 0x02
536 #define ADDRMODE_PRIVATE_RESOLVE 0x03
537 
543 #define GAP_ADTYPE_ADV_IND 0x00
544 #define GAP_ADTYPE_ADV_HDC_DIRECT_IND 0x01
545 #define GAP_ADTYPE_ADV_SCAN_IND 0x02
546 #define GAP_ADTYPE_ADV_NONCONN_IND 0x03
547 #define GAP_ADTYPE_ADV_LDC_DIRECT_IND 0x04
548 
554 #define GAP_ADRPT_ADV_IND 0x00
555 #define GAP_ADRPT_ADV_DIRECT_IND 0x01
556 #define GAP_ADRPT_ADV_SCAN_IND 0x02
557 #define GAP_ADRPT_ADV_NONCONN_IND 0x03
558 #define GAP_ADRPT_SCAN_RSP 0x04
559 
564 #define GAP_FILTER_POLICY_ALL 0x00
565 #define GAP_FILTER_POLICY_WHITE_SCAN 0x01
566 #define GAP_FILTER_POLICY_WHITE_CON 0x02
567 #define GAP_FILTER_POLICY_WHITE 0x03
568 
573 #define GAP_DISC_FILTER_POLICY_ALL 0x00
574 #define GAP_DISC_FILTER_POLICY_WHITE 0x01
575 #define GAP_DISC_FILTER_POLICY_ALL_DIRECT 0x02
576 #define GAP_DISC_FILTER_POLICY_WHITE_DIRECT 0x03
577 
579 #define ADV_CHANMAP_SIZE 5
580 
581 #define GAP_PASSCODE_MAX 999999
582 
583 
589 #define GAP_INIT_SIGN_COUNTER 0xFFFFFFFF
590 
594 #define GAP_ADVCHAN_37 0x01
595 #define GAP_ADVCHAN_38 0x02
596 #define GAP_ADVCHAN_39 0x04
597 #define GAP_ADVCHAN_ALL (GAP_ADVCHAN_37 | GAP_ADVCHAN_38 | GAP_ADVCHAN_39)
598 
603 #define WL_NOTUSED 0x00
604 #define WL_USED 0x01
605 
611 #define GAP_ADTYPE_FLAGS 0x01
612 #define GAP_ADTYPE_16BIT_MORE 0x02
613 #define GAP_ADTYPE_16BIT_COMPLETE 0x03
614 #define GAP_ADTYPE_32BIT_MORE 0x04
615 #define GAP_ADTYPE_32BIT_COMPLETE 0x05
616 #define GAP_ADTYPE_128BIT_MORE 0x06
617 #define GAP_ADTYPE_128BIT_COMPLETE 0x07
618 #define GAP_ADTYPE_LOCAL_NAME_SHORT 0x08
619 #define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09
620 #define GAP_ADTYPE_POWER_LEVEL 0x0A
621 #define GAP_ADTYPE_OOB_CLASS_OF_DEVICE 0x0D
622 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E
623 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F
624 #define GAP_ADTYPE_SM_TK 0x10
625 #define GAP_ADTYPE_SM_OOB_FLAG 0x11
626 #define GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE 0x12
627 #define GAP_ADTYPE_SIGNED_DATA 0x13
628 #define GAP_ADTYPE_SERVICES_LIST_16BIT 0x14
629 #define GAP_ADTYPE_SERVICES_LIST_128BIT 0x15
630 #define GAP_ADTYPE_SERVICE_DATA 0x16
631 #define GAP_ADTYPE_PUBLIC_TARGET_ADDR 0x17
632 #define GAP_ADTYPE_RANDOM_TARGET_ADDR 0x18
633 #define GAP_ADTYPE_APPEARANCE 0x19
634 #define GAP_ADTYPE_ADV_INTERVAL 0x1A
635 #define GAP_ADTYPE_LE_BD_ADDR 0x1B
636 #define GAP_ADTYPE_LE_ROLE 0x1C
637 #define GAP_ADTYPE_SIMPLE_PAIRING_HASHC_256 0x1D
638 #define GAP_ADTYPE_SIMPLE_PAIRING_RANDR_256 0x1E
639 #define GAP_ADTYPE_SERVICE_DATA_32BIT 0x20
640 #define GAP_ADTYPE_SERVICE_DATA_128BIT 0x21
641 #define GAP_ADTYPE_3D_INFO_DATA 0x3D
642 #define GAP_ADTYPE_MANUFACTURER_SPECIFIC 0xFF
643 #define GAP_ADTYPE_FLAGS_LIMITED 0x01
644 #define GAP_ADTYPE_FLAGS_GENERAL 0x02
645 #define GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
646 
651 #define GAP_STATE_IDLE 0x00
652 #define GAP_STATE_ADV 0x01
653 #define GAP_STATE_SCAN 0x02
654 #define GAP_STATE_INIT 0x04
655 
660 #define GAP_APPEARE_UNKNOWN 0x0000
661 #define GAP_APPEARE_GENERIC_PHONE 0x0040
662 #define GAP_APPEARE_GENERIC_COMPUTER 0x0080
663 #define GAP_APPEARE_GENERIC_WATCH 0x00C0
664 #define GAP_APPEARE_WATCH_SPORTS 0x00C1
665 #define GAP_APPEARE_GENERIC_CLOCK 0x0100
666 #define GAP_APPEARE_GENERIC_DISPLAY 0x0140
667 #define GAP_APPEARE_GENERIC_RC 0x0180
668 #define GAP_APPEARE_GENERIC_EYE_GALSSES 0x01C0
669 #define GAP_APPEARE_GENERIC_TAG 0x0200
670 #define GAP_APPEARE_GENERIC_KEYRING 0x0240
671 #define GAP_APPEARE_GENERIC_MEDIA_PLAYER 0x0280
672 #define GAP_APPEARE_GENERIC_BARCODE_SCANNER 0x02C0
673 #define GAP_APPEARE_GENERIC_THERMOMETER 0x0300
674 #define GAP_APPEARE_GENERIC_THERMO_EAR 0x0301
675 #define GAP_APPEARE_GENERIC_HR_SENSOR 0x0340
676 #define GAP_APPEARE_GENERIC_HRS_BELT 0x0341
677 #define GAP_APPEARE_GENERIC_BLOOD_PRESSURE 0x0380
678 #define GAP_APPEARE_GENERIC_BP_ARM 0x0381
679 #define GAP_APPEARE_GENERIC_BP_WRIST 0x0382
680 #define GAP_APPEARE_GENERIC_HID 0x03C0
681 #define GAP_APPEARE_HID_KEYBOARD 0x03C1
682 #define GAP_APPEARE_HID_MOUSE 0x03C2
683 #define GAP_APPEARE_HID_JOYSTIC 0x03C3
684 #define GAP_APPEARE_HID_GAMEPAD 0x03C4
685 #define GAP_APPEARE_HID_DIGITIZER_TYABLET 0x03C5
686 #define GAP_APPEARE_HID_DIGITAL_CARDREADER 0x03C6
687 #define GAP_APPEARE_HID_DIGITAL_PEN 0x03C7
688 #define GAP_APPEARE_HID_BARCODE_SCANNER 0x03C8
689 
693 /*-------------------------------------------------------------------
694  * TYPEDEFS - Initialization and Configuration
695  */
696 
706 typedef uint16 gapParamIDs_t;
707 
709 typedef struct
710 {
712  uint8 opcode;
713 } gapEventHdr_t;
714 
725 typedef struct
726 {
728  uint8 opcode;
729  uint8 addrMode;
730  uint8 newRandomAddr[B_ADDR_LEN];
732 
742 typedef struct
743 {
745  uint16 intervalMin;
747  uint16 intervalMax;
749  uint16 latency;
751  uint16 timeout;
753 
766 typedef struct
767 {
769  uint8 opcode;
770  uint8 devAddr[B_ADDR_LEN];
771  uint16 dataPktLen;
772  uint8 numDataPkts;
774 
785 typedef struct
786 {
788  uint8 opcode;
789  uint8 addrType;
790  uint8 devAddr[B_ADDR_LEN];
791  uint32 signCounter;
793 
801 typedef struct
802 {
804  uint8 opcode;
805  uint8 eventType;
806  uint8 addrType;
807  uint8 addr[B_ADDR_LEN];
808  int8 rssi;
809  uint8 dataLen;
810  uint8 *pEvtData;
812  // end of GAP_Events
814 
815 /*-------------------------------------------------------------------
816  * TYPEDEFS - Device Discovery
817  */
818 
820 typedef struct
821 {
822  uint8 taskID;
823  uint8 mode;
824  uint8 activeScan;
825  uint8 whiteList;
827 
829 typedef struct
830 {
831  uint8 eventType;
832  uint8 addrType;
833  uint8 addr[B_ADDR_LEN];
834 } gapDevRec_t;
835 
847 typedef struct
848 {
850  uint8 opcode;
851  uint8 numDevs;
854  // end of GAP_Events
856 
858 typedef struct
859 {
860  uint8 eventType;
862  uint8 initiatorAddr[B_ADDR_LEN];
863  uint8 channelMap;
864  uint8 filterPolicy;
866 
878 typedef struct
879 {
881  uint8 opcode;
883 
890 typedef struct
891 {
893  uint8 opcode;
895 
902 typedef struct
903 {
905  uint8 opcode;
906  uint8 adType;
908  // end of GAP_Events
910 
911 /*-------------------------------------------------------------------
912  * TYPEDEFS - Link Establishment
913  */
914 
916 typedef struct
917 {
918  uint8 taskID;
920  uint8 whiteList;
921  uint8 addrTypePeer;
922  uint8 peerAddr[B_ADDR_LEN];
924 
926 typedef struct
927 {
929  uint16 intervalMin;
930  uint16 intervalMax;
931  uint16 connLatency;
932  uint16 connTimeout;
934 
936 typedef struct
937 {
939  uint16 intervalMin;
940  uint16 intervalMax;
941  uint16 connLatency;
942  uint16 connTimeout;
943  uint8 accepted;
945 
957 typedef struct
958 {
960  uint8 opcode;
963 
973 typedef struct
974 {
976  uint8 opcode;
977  uint8 devAddrType;
978  uint8 devAddr[B_ADDR_LEN];
980  uint8 connRole;
981  uint16 connInterval;
982  uint16 connLatency;
983  uint16 connTimeout;
986 
993 typedef struct
994 {
996  uint8 opcode;
997  uint8 status;
999  uint16 connInterval;
1000  uint16 connLatency;
1001  uint16 connTimeout;
1003 
1010 typedef struct
1011 {
1013  uint8 opcode;
1015  uint8 reason;
1017 
1018 /*-------------------------------------------------------------------
1019  * TYPEDEFS - Authentication, Bounding and Pairing
1020  */
1021 
1028 typedef struct
1029 {
1031  uint8 opcode;
1032  uint8 deviceAddr[B_ADDR_LEN];
1034  uint8 uiInputs;
1035  uint8 uiOutputs;
1036  uint32 numComparison;
1038 
1045 typedef struct
1046 {
1048  uint8 opcode;
1050  uint8 authState;
1056  // end of GAP_Events
1058 
1065 typedef struct
1066 {
1069 } gapAuthParams_t;
1070 
1082 typedef struct
1083 {
1085  uint8 opcode;
1087  uint8 deviceAddr[B_ADDR_LEN];
1088  uint8 authReq;
1090 
1097 typedef struct
1098 {
1100  uint8 opcode;
1103  // end of GAP_Events
1105 
1107 typedef struct
1108 {
1109  uint8 ioCap;
1110  uint8 oobDataFlag;
1111  uint8 authReq;
1114 } gapPairingReq_t;
1115 
1132 typedef struct
1133 {
1135  uint8 opcode;
1139  // end of GAP_Events
1141 
1149 typedef struct
1150 {
1151  uint8 adType;
1152  uint8 attrLen;
1153  uint8 *pAttrData;
1155 
1162 typedef uint8 (*pfnSuppEnhPrivCB_t)
1165  uint8 *deviceAddr
1166 );
1167 
1169 typedef void (*pfnGapIdleCB_t)();
1170 
1172 typedef struct
1173 {
1176 } gapBondMgrCBs_t;
1177 
1180 /*-------------------------------------------------------------------
1181  * GLOBAL VARIABLES
1182  */
1183 
1184 /*-------------------------------------------------------------------
1185  * FUNCTIONS - Initialization and Configuration
1186  */
1187 
1214  extern bStatus_t GAP_DeviceInit( uint8 taskID,
1215  uint8 profileRole,
1216  uint8 maxScanResponses,
1217  uint8 *pIRK,
1218  uint8 *pSRK,
1219  uint32 *pSignCounter );
1220 
1240  extern bStatus_t GAP_SetAdvToken( gapAdvDataToken_t *pToken );
1241 
1251  extern gapAdvDataToken_t *GAP_GetAdvToken( uint8 adType );
1252 
1263  extern gapAdvDataToken_t *GAP_RemoveAdvToken( uint8 adType );
1264 
1273  extern bStatus_t GAP_UpdateAdvTokens( void );
1274 
1287  extern bStatus_t GAP_SetParamValue( gapParamIDs_t paramID, uint16 paramValue );
1288 
1297  extern uint16 GAP_GetParamValue( gapParamIDs_t paramID );
1298 
1326  extern bStatus_t GAP_ConfigDeviceAddr( uint8 addrMode, uint8 *pStaticAddr );
1327 
1336  extern void GAP_RegisterForMsgs( uint8 taskID );
1337 
1343  extern void GAP_RegisterBondMgrCBs( gapBondMgrCBs_t *pCBs );
1344 
1345 /*-------------------------------------------------------------------
1346  * FUNCTIONS - Device Discovery
1347  */
1348 
1365 
1379  extern bStatus_t GAP_DeviceDiscoveryCancel( uint8 taskID );
1380 
1395  extern bStatus_t GAP_MakeDiscoverable( uint8 taskID, gapAdvertisingParams_t *pParams );
1396 
1411  extern bStatus_t GAP_UpdateAdvertisingData( uint8 taskID, uint8 adType,
1412  uint8 dataLen, uint8 *pAdvertData );
1413 
1426  extern bStatus_t GAP_EndDiscoverable( uint8 taskID );
1427 
1428 #if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
1429 
1439  extern bStatus_t GAP_ResolvePrivateAddr( uint8 *pIRK, uint8 *pAddr );
1440 #endif // ! BLE_V42_FEATURES | ! PRIVACY_1_2_CFG
1441 
1442 /*-------------------------------------------------------------------
1443  * FUNCTIONS - Link Establishment
1444  */
1445 
1460  extern bStatus_t GAP_EstablishLinkReq( gapEstLinkReq_t *pParams );
1461 
1477  extern bStatus_t GAP_TerminateLinkReq( uint8 taskID, uint16 connectionHandle, uint8 reason );
1478 
1495 
1515 
1521  extern uint8 GAP_NumActiveConnections( void );
1522 
1523 /*-------------------------------------------------------------------
1524  * FUNCTIONS - Pairing
1525  */
1526 
1554  extern bStatus_t GAP_Authenticate( gapAuthParams_t *pParams, gapPairingReq_t *pPairReq );
1555 
1562  extern uint8 GAP_isPairing(void);
1563 
1581  extern bStatus_t GAP_TerminateAuth( uint16 connectionHandle, uint8 reason );
1582 
1602  extern bStatus_t GAP_PasskeyUpdate( uint8 *pPasskey, uint16 connectionHandle );
1603 
1622  extern bStatus_t GAP_PasscodeUpdate( uint32 passcode, uint16 connectionHandle );
1623 
1638  extern bStatus_t GAP_SendSlaveSecurityRequest( uint16 connectionHandle, uint8 authReq );
1639 
1656  extern bStatus_t GAP_Signable( uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams );
1657 
1679  extern bStatus_t GAP_Bond( uint16 connectionHandle, uint8 authenticated,
1680  uint8 secureConnections, smSecurityInfo_t *pParams,
1681  uint8 startEncryption );
1682 
1683 /*-------------------------------------------------------------------
1684  * Internal API - These functions are only called from gap.c module.
1685  */
1686 
1688 
1699  extern bStatus_t GAP_ParamsInit( uint8 taskID, uint8 profileRole );
1700 
1708  extern void GAP_PrivacyInit( uint8 *pIRK );
1709 
1717  extern uint8 *GAP_GetIRK( void );
1718 
1731  extern void GAP_SecParamsInit( uint8 *pSRK, uint32 *pSignCounter );
1732 
1740  extern bStatus_t GAP_PeriDevMgrInit( void );
1741 
1748  extern void GAP_PeriConnRegister( void );
1749 
1761  extern bStatus_t GAP_CentDevMgrInit( uint8 maxScanResponses );
1762 
1769  extern void GAP_CentConnRegister( void );
1770 
1771 
1772 /*-------------------------------------------------------------------
1773  * TASK API - These functions must only be called OSAL.
1774  */
1775 
1783  extern void GAP_Init( uint8 task_id );
1784 
1795  extern uint16 GAP_ProcessEvent( uint8 task_id, uint16 events );
1796 
1798 
1799 /*-------------------------------------------------------------------
1800 -------------------------------------------------------------------*/
1801 
1802 #ifdef __cplusplus
1803 }
1804 #endif
1805 
1806 #endif /* GAP_H */
1807 
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:904
uint8 authState
TRUE if the pairing was authenticated (MITM)
Definition: gap.h:1050
uint8 opcode
GAP_MAKE_DISCOVERABLE_DONE_EVENT
Definition: gap.h:881
uint8 opcode
GAP_END_DISCOVERABLE_DONE_EVENT
Definition: gap.h:893
bStatus_t GAP_SetAdvToken(gapAdvDataToken_t *pToken)
Set Advertising Token.
uint8 opcode
GAP_SIGNATURE_UPDATED_EVENT
Definition: gap.h:788
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:787
uint8 eventType
Advertise Event Type: GAP Advertising Event Types.
Definition: gap.h:860
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:1101
uint8 attrLen
Number of bytes in the attribute data.
Definition: gap.h:1152
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:727
uint8 authReq
Authentication Requirements: Bit 2: MITM, Bits 0-1: bonding (0 - no bonding, 1 - bonding) ...
Definition: gap.h:1088
This file contains the interface to the SM.
bStatus_t GAP_DeviceDiscoveryRequest(gapDevDiscReq_t *pParams)
Start a device discovery scan.
Definition: sm.h:209
smSecurityInfo_t * pSecurityInfo
BOUND - security information from this device.
Definition: gap.h:1051
bStatus_t GAP_TerminateAuth(uint16 connectionHandle, uint8 reason)
Terminate Authnetication.
Authentication Parameters.
Definition: gap.h:1065
uint8(* pfnSuppEnhPrivCB_t)(uint8 *deviceAddr)
Enhanced Privacy Check Callback Function.
Definition: gap.h:1164
bStatus_t GAP_PasskeyUpdate(uint8 *pPasskey, uint16 connectionHandle)
Update the passkey in string format.
GAP_MAKE_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:878
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1084
uint8 mode
Discovery Mode: GAP Device Discovery Modes.
Definition: gap.h:823
bStatus_t GAP_EstablishLinkReq(gapEstLinkReq_t *pParams)
Establish a link to a slave device.
uint8 adType
ADTYPE value: Address Types.
Definition: gap.h:1151
smSigningInfo_t * pSigningInfo
Signing information.
Definition: gap.h:1052
uint8 addrType
Device's address type for devAddr.
Definition: gap.h:789
uint16 connectionHandle
Connection Handle.
Definition: gap.h:1086
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:768
uint16 latency
Definition: gap.h:749
uint8 dataLen
Length (in bytes) of the data field (evtData)
Definition: gap.h:809
uint16 gapParamIDs_t
GAP Parameters IDs.
Definition: gap.h:706
uint8 adType
TRUE if advertising data, FALSE if SCAN_RSP.
Definition: gap.h:906
GAP_PASSKEY_NEEDED_EVENT message format.
Definition: gap.h:1028
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:711
Connection parameters for the peripheral device.
Definition: gap.h:742
GAP_DEVICE_INIT_DONE_EVENT message format.
Definition: gap.h:766
uint8 taskID
Requesting App's Task ID, used to return results.
Definition: gap.h:822
GAP_SLAVE_REQUESTED_SECURITY_EVENT message format.
Definition: gap.h:1082
void(* pfnGapIdleCB_t)()
GAP Idle Callback Function.
Definition: gap.h:1169
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:880
bStatus_t GAP_TerminateLinkReq(uint8 taskID, uint16 connectionHandle, uint8 reason)
Terminate a link connection.
GAP event header format.
Definition: gap.h:709
GAP_BOND_COMPLETE_EVENT message format.
Definition: gap.h:1097
uint8 eventType
Indicates advertising event type used by the advertiser: GAP Advertising Report Event Types...
Definition: gap.h:831
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:1067
GAP_PAIRING_REQ_EVENT message format.
Definition: gap.h:1132
uint8 addrType
Address Type: Address Types.
Definition: gap.h:832
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1099
uint8 uiInputs
Pairing User Interface Inputs - Ask user to input passcode.
Definition: gap.h:1034
uint8 numDevs
Number of devices found during scan.
Definition: gap.h:851
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1030
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:712
keyDist_t keyDist
Pairing Request Key Distribution field.
Definition: gap.h:1113
uint8 maxEncKeySize
Pairing Request Maximum Encryption Key Size field.
Definition: gap.h:1112
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:803
GAP_SIGNATURE_UPDATED_EVENT message format.
Definition: gap.h:785
uint8 numDataPkts
HC_Total_Num_LE_Data_Packets.
Definition: gap.h:772
uint8 opcode
GAP_PAIRING_REQ_EVENT
Definition: gap.h:1135
uint8 opcode
GAP_SLAVE_REQUESTED_SECURITY_EVENT
Definition: gap.h:1085
Definition: sm.h:163
uint8 opcode
GAP_DEVICE_INFO_EVENT
Definition: gap.h:804
uint8 initiatorAddrType
Initiator's address type: Address Types.
Definition: gap.h:861
uint8 opcode
GAP_ADV_DATA_UPDATE_DONE_EVENT
Definition: gap.h:905
uint16 intervalMax
Definition: gap.h:747
Type of device discovery (Scan) to perform.
Definition: gap.h:829
uint16 GAP_GetParamValue(gapParamIDs_t paramID)
Get a GAP Parameter value.
uint8 opcode
GAP_DEVICE_INIT_DONE_EVENT
Definition: gap.h:769
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:1054
Definition: sm.h:220
void GAP_RegisterBondMgrCBs(gapBondMgrCBs_t *pCBs)
Register bond manager call backs.
GAP_DEVICE_INFO_EVENT message format.
Definition: gap.h:801
uint8 uiOutputs
Pairing User Interface Outputs - Display passcode.
Definition: gap.h:1035
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:1049
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:892
uint8 opcode
GAP_DEVICE_DISCOVERY_EVENT
Definition: gap.h:850
GAP_ADV_DATA_UPDATE_DONE_EVENT message format.
Definition: gap.h:902
uint16 connectionHandle
connection Handle
Definition: gap.h:1136
uint32 signCounter
new Signed Counter
Definition: gap.h:791
smLinkSecurityReq_t secReqs
Pairing Control info.
Definition: gap.h:1068
uint8 addrType
address type: Address Types
Definition: gap.h:806
uint16 timeout
Definition: gap.h:751
bStatus_t GAP_UpdateAdvTokens(void)
Update Advertising Token.
gapAdvDataToken_t * GAP_GetAdvToken(uint8 adType)
Get Advertising Token.
uint16 intervalMin
Definition: gap.h:745
uint8 oobDataFlag
Pairing Request OOB Data Flag field.
Definition: gap.h:1110
int8 rssi
Advertisement or SCAN_RSP RSSI.
Definition: gap.h:808
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:849
Type of device discovery (Scan) to perform.
Definition: gap.h:820
uint8 opcode
GAP_AUTHENTICATION_COMPLETE_EVENT
Definition: gap.h:1048
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1047
Type definitions and macros for BLE stack.
osal_event_hdr_t hdr
GAP_MSG_EVENT and status
Definition: gap.h:1134
smSecurityInfo_t * pDevSecInfo
BOUND - security information from connected device.
Definition: gap.h:1053
Definition: sm.h:230
uint8 channelMap
Channel Map: Bit mask GAP Advertisement Channel Map.
Definition: gap.h:863
uint8 addrMode
Address mode: GAP Addressing Modes.
Definition: gap.h:729
uint8 filterPolicy
Filer Policy: GAP Advertiser Filter Scan Parameters. Ignored when directed advertising is used...
Definition: gap.h:864
GAP_END_DISCOVERABLE_DONE_EVENT message format.
Definition: gap.h:890
uint8 opcode
GAP_PASSKEY_NEEDED_EVENT
Definition: gap.h:1031
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:110
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:1174
uint8 opcode
GAP_RANDOM_ADDR_CHANGED_EVENT
Definition: gap.h:728
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:131
uint8 eventType
Advertisement Type: GAP Advertising Report Event Types.
Definition: gap.h:805
uint8 ioCap
Pairing Request ioCap field.
Definition: gap.h:1109
GAP_AUTHENTICATION_COMPLETE_EVENT message format.
Definition: gap.h:1045
Callback Registration Structure.
Definition: gap.h:1172
uint8 GAP_isPairing(void)
Check if GAP is currently pairing.
uint8 opcode
GAP_BOND_COMPLETE_EVENT
Definition: gap.h:1100
uint8 * pAttrData
pointer to Attribute data
Definition: gap.h:1153
pfnGapIdleCB_t gapIdleCB
GAP Idle callback.
Definition: gap.h:1175
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:243
GAP_DEVICE_DISCOVERY_EVENT message format.
Definition: gap.h:847
GAP_RANDOM_ADDR_CHANGED_EVENT message format.
Definition: gap.h:725
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:824
Pairing Request fields - the parsed fields of the SMP Pairing Request command.
Definition: gap.h:1107
uint8 * pEvtData
Data field of advertisement or SCAN_RSP.
Definition: gap.h:810
Advertising Parameters.
Definition: gap.h:858
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:771
uint32 numComparison
Numeric Comparison value to be displayed.
Definition: gap.h:1036
gapPairingReq_t pairReq
The Pairing Request fields received.
Definition: gap.h:1137
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:825
uint16 connectionHandle
Connection handle.
Definition: gap.h:1033
GAP Advertisement/Scan Response Data Token.
Definition: gap.h:1149
gapAdvDataToken_t * GAP_RemoveAdvToken(uint8 adType)
Remove Advertising Token.
uint8 authReq
Pairing Request Auth Req field.
Definition: gap.h:1111
gapDevRec_t * pDevList
array of device records
Definition: gap.h:852
bStatus_t GAP_SetParamValue(gapParamIDs_t paramID, uint16 paramValue)
Set a GAP Parameter value.
Copyright 2016, Texas Instruments Incorporated