TI BLE5-Stack API Documentation  2.01.03.00
gapbondmgr.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Group: WCS, BTS
4  $Target Device: DEVICES $
5 
6  ******************************************************************************
7  $License: BSD3 2010 $
8  ******************************************************************************
9  $Release Name: PACKAGE NAME $
10  $Release Date: PACKAGE RELEASE DATE $
11  *****************************************************************************/
12 
21 #ifndef GAPBONDMGR_H
22 #define GAPBONDMGR_H
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 /*-------------------------------------------------------------------
30  * INCLUDES
31  */
32 #include "gap.h"
33 
34 /*-------------------------------------------------------------------
35  * CONSTANTS
36  */
37 
43 // This is a common file for the legacy and sysconfig examples,
44 // the parameters under ifndef SYSCFG are defined in this file for
45 // the legacy examples and generated using the sysconfig tool for
46 // the sysconfig examples
47 #ifndef SYSCFG
48 #if !defined ( GAP_BONDINGS_MAX )
49 #define GAP_BONDINGS_MAX 10
51 #endif
52 
53 #if !defined ( GAP_CHAR_CFG_MAX )
54 #define GAP_CHAR_CFG_MAX 4
56 #endif
57 #endif //SYSCFG
58 
78 #define GAPBOND_PAIRING_MODE 0x400
79 
89 #define GAPBOND_MITM_PROTECTION 0x402
90 
100 #define GAPBOND_IO_CAPABILITIES 0x403
101 
111 #define GAPBOND_OOB_ENABLED 0x404
112 
123 #define GAPBOND_OOB_DATA 0x405
124 
134 #define GAPBOND_BONDING_ENABLED 0x406
135 
148 #define GAPBOND_KEY_DIST_LIST 0x407
149 
155 #define GAPBOND_ERASE_ALLBONDS 0x409
156 
158 #define GAPBOND_AUTO_FAIL_PAIRING 0x40A
159 #define GAPBOND_AUTO_FAIL_REASON 0x40B
160 
171 #define GAPBOND_KEYSIZE 0x40C
172 
186 #define GAPBOND_AUTO_SYNC_WL 0x40D
187 
195 #define GAPBOND_BOND_COUNT 0x40E
196 
207 #define GAPBOND_BOND_FAIL_ACTION 0x40F
208 
221 #define GAPBOND_ERASE_SINGLEBOND 0x410
222 
236 #define GAPBOND_SECURE_CONNECTION 0x411
237 
256 #define GAPBOND_ECCKEY_REGEN_POLICY 0x412
257 
279 #define GAPBOND_ECC_KEYS 0x413
280 
290 #define GAPBOND_SC_HOST_DEBUG 0x414
291 
308 #define GAPBOND_ERASE_BOND_IN_CONN 0x415
309 
323 #define GAPBOND_LRU_BOND_REPLACEMENT 0x418
324 
333 #define GAPBOND_ERASE_LOCAL_INFO 0x41A
334 
345 #define GAPBOND_PAIRING_MODE_NO_PAIRING 0x00
347 #define GAPBOND_PAIRING_MODE_WAIT_FOR_REQ 0x01
349 #define GAPBOND_PAIRING_MODE_INITIATE 0x02
351 
357 #define GAPBOND_IO_CAP_DISPLAY_ONLY 0x00
359 #define GAPBOND_IO_CAP_DISPLAY_YES_NO 0x01
361 #define GAPBOND_IO_CAP_KEYBOARD_ONLY 0x02
363 #define GAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT 0x03
365 #define GAPBOND_IO_CAP_KEYBOARD_DISPLAY 0x04
367 
373 #define GAPBOND_KEYDIST_SENCKEY 0x01
375 #define GAPBOND_KEYDIST_SIDKEY 0x02
377 #define GAPBOND_KEYDIST_SSIGN 0x04
379 #define GAPBOND_KEYDIST_SLINK 0x08
381 #define GAPBOND_KEYDIST_MENCKEY 0x10
383 #define GAPBOND_KEYDIST_MIDKEY 0x20
385 #define GAPBOND_KEYDIST_MSIGN 0x40
387 #define GAPBOND_KEYDIST_MLINK 0x80
389 
408 #define GAPBOND_PAIRING_STATE_STARTED 0x00
409 
429 #define GAPBOND_PAIRING_STATE_COMPLETE 0x01
430 
448 #define GAPBOND_PAIRING_STATE_ENCRYPTED 0x02
449 #define GAPBOND_PAIRING_STATE_BOND_SAVED 0x03
451 #define GAPBOND_PAIRING_STATE_CAR_READ 0x04
453 #define GAPBOND_PAIRING_STATE_RPAO_READ 0x05
455 #define GAPBOND_GENERATE_ECC_DONE 0x06
457 
472 #define SMP_PAIRING_FAILED_PASSKEY_ENTRY_FAILED 0x01
473 #define SMP_PAIRING_FAILED_OOB_NOT_AVAIL 0x02
475 
479 #define SMP_PAIRING_FAILED_AUTH_REQ 0x03
480 #define SMP_PAIRING_FAILED_CONFIRM_VALUE 0x04
482 #define SMP_PAIRING_FAILED_NOT_SUPPORTED 0x05
484 
488 #define SMP_PAIRING_FAILED_ENC_KEY_SIZE 0x06
489 #define SMP_PAIRING_FAILED_CMD_NOT_SUPPORTED 0x07
491 #define SMP_PAIRING_FAILED_UNSPECIFIED 0x08
493 
497 #define SMP_PAIRING_FAILED_REPEATED_ATTEMPTS 0x09
498 
502 #define SMP_PAIRING_FAILED_INVALID_PARAMETERS 0x0A
503 
507 #define SMP_PAIRING_FAILED_DHKEY_CHECK_FAILED 0x0B
508 
512 #define SMP_PAIRING_FAILED_NUM_COMPARISON_FAILED 0x0C
513 
519 #define GAPBOND_FAIL_NO_ACTION 0x00
521 #define GAPBOND_FAIL_INITIATE_PAIRING 0x01
523 #define GAPBOND_FAIL_TERMINATE_LINK 0x02
525 
529 #define GAPBOND_FAIL_TERMINATE_ERASE_BONDS 0x03
530 
536 #define GAPBOND_SECURE_CONNECTION_NONE 0x00
538 #define GAPBOND_SECURE_CONNECTION_ALLOW 0x01
540 #define GAPBOND_SECURE_CONNECTION_ONLY 0x02
542 
552 #define GAPBOND_REGENERATE_ALWAYS 0x00
554 #define GAPBOND_REGENERATE_NEVER 0xFF
556 
558 #define ECC_KEYLEN 32
560 
563 /*-------------------------------------------------------------------
564  * TYPEDEFS
565  */
566 
590 typedef void (*pfnPasscodeCB_t)
591 (
592  uint8_t *deviceAddr,
593  uint16_t connectionHandle,
594  uint8_t uiInputs,
595  uint8_t uiOutputs,
596  uint32_t numComparison
597 );
598 
610 typedef void (*pfnPairStateCB_t)
611 (
612  uint16_t connectionHandle,
613  uint8_t state,
614  uint8_t status
615 );
616 
623 typedef struct
624 {
627 } gapBondCBs_t;
628 
636 typedef struct
638 {
639  uint8_t privateKey[ECC_KEYLEN];
640  uint8_t publicKeyX[ECC_KEYLEN];
641  uint8_t publicKeyY[ECC_KEYLEN];
643 
644 //structure of OOB data
645 typedef struct gapBondOOBData
646 {
647  uint8 confirm[KEYLEN]; //calculated/received confirm value
648  uint8 rand[KEYLEN]; //calculated/received random number
649 } gapBondOOBData_t;
650 
652 /*-------------------------------------------------------------------
653  * API's
654  */
655 
661 extern void GAPBondMgr_Register(gapBondCBs_t *pCB);
662 
679 extern bStatus_t GAPBondMgr_SetParameter(uint16_t param, uint8_t len,
680  void *pValue);
681 
696 extern bStatus_t GAPBondMgr_GetParameter(uint16_t param, void *pValue);
697 
716 extern bStatus_t GAPBondMgr_Pair(uint16_t connHandle);
717 
746 extern bStatus_t GAPBondMgr_FindAddr(uint8_t *pDevAddr,
747  GAP_Peer_Addr_Types_t addrType,
748  uint8_t *pIdx,
749  GAP_Peer_Addr_Types_t *pIdentityAddrType,
750  uint8_t *pIdentityAddr);
751 
764 extern bStatus_t GAPBondMgr_ServiceChangeInd(uint16_t connectionHandle,
765  uint8_t setParam);
766 
781 extern bStatus_t GAPBondMgr_PasscodeRsp(uint16_t connectionHandle,
782  uint8_t status, uint32_t passcode);
783 
796 extern bStatus_t GAPBondMgr_SCGetLocalOOBParameters(gapBondOOBData_t *localOobData);
797 
812 extern bStatus_t GAPBondMgr_SCSetRemoteOOBParameters(gapBondOOBData_t *remoteOobData,
813  uint8 OOBDataFlag);
814 
815 /*********************************************************************
816  * @fn GAPBondMgr_GenerateEccKeys
817  *
818  * @brief Generates ECC keys.
819  *
820  * @design /ref did_244389729
821  *
822  * @return SUCCESS - if processing.
823  * FAILURE - if SM is pairing
824  */
825 extern bStatus_t GAPBondMgr_GenerateEccKeys( void );
826 
827 /*-------------------------------------------------------------------
828 -------------------------------------------------------------------*/
829 #ifdef __cplusplus
830 }
831 #endif
832 
833 #endif /* GAPBONDMGR_H */
834 
GAP_Peer_Addr_Types_t
Address types used for specifying peer address type.
Definition: gap.h:662
Public and Private ECC Keys.
Definition: gapbondmgr.h:637
bStatus_t GAPBondMgr_Pair(uint16_t connHandle)
bStatus_t GAPBondMgr_GetParameter(uint16_t param, void *pValue)
bStatus_t GAPBondMgr_PasscodeRsp(uint16_t connectionHandle, uint8_t status, uint32_t passcode)
void(* pfnPairStateCB_t)(uint16_t connectionHandle, uint8_t state, uint8_t status)
Definition: gapbondmgr.h:611
pfnPasscodeCB_t passcodeCB
Passcode callback.
Definition: gapbondmgr.h:625
bStatus_t GAPBondMgr_FindAddr(uint8_t *pDevAddr, GAP_Peer_Addr_Types_t addrType, uint8_t *pIdx, GAP_Peer_Addr_Types_t *pIdentityAddrType, uint8_t *pIdentityAddr)
Search for an address in the bonding table. If the address is a random private resolvable address...
void GAPBondMgr_Register(gapBondCBs_t *pCB)
Definition: gapbondmgr.h:623
void(* pfnPasscodeCB_t)(uint8_t *deviceAddr, uint16_t connectionHandle, uint8_t uiInputs, uint8_t uiOutputs, uint32_t numComparison)
Definition: gapbondmgr.h:591
GAP layer interface.
bStatus_t GAPBondMgr_ServiceChangeInd(uint16_t connectionHandle, uint8_t setParam)
bStatus_t GAPBondMgr_SetParameter(uint16_t param, uint8_t len, void *pValue)
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:246
#define ECC_KEYLEN
ECC Key Length: 256 bit keys.
Definition: gapbondmgr.h:559
#define KEYLEN
Default key length.
Definition: bcomdef.h:111
pfnPairStateCB_t pairStateCB
Pairing state callback.
Definition: gapbondmgr.h:626
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale