TI BLE-Stack for Bluetooth API Documentation  3.03.08.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 
24 #ifndef GAPBONDMGR_H
25 #define GAPBONDMGR_H
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 /*-------------------------------------------------------------------
33  * INCLUDES
34  */
35 #include "gap.h"
36 
37 /*-------------------------------------------------------------------
38  * CONSTANTS
39  */
40 
44 #if !defined (GAP_BONDINGS_MAX)
45  #define GAP_BONDINGS_MAX 10
46 #endif
47 
48 #if !defined (GAP_CHAR_CFG_MAX)
49  #define GAP_CHAR_CFG_MAX 4
50 #endif
51 
66 #define GAPBOND_PAIRING_MODE 0x400
67 
78 #define GAPBOND_INITIATE_WAIT 0x401
79 
89 #define GAPBOND_MITM_PROTECTION 0x402
90 
100 #define GAPBOND_IO_CAPABILITIES 0x403
101 
111 #define GAPBOND_OOB_ENABLED 0x404
112 
122 #define GAPBOND_OOB_DATA 0x405
123 
133 #define GAPBOND_BONDING_ENABLED 0x406
134 
147 #define GAPBOND_KEY_DIST_LIST 0x407
148 
163 #define GAPBOND_DEFAULT_PASSCODE 0x408
164 
170 #define GAPBOND_ERASE_ALLBONDS 0x409
171 
173 #define GAPBOND_AUTO_FAIL_PAIRING 0x40A
174 #define GAPBOND_AUTO_FAIL_REASON 0x40B
175 
186 #define GAPBOND_KEYSIZE 0x40C
187 
200 #define GAPBOND_AUTO_SYNC_WL 0x40D
201 
209 #define GAPBOND_BOND_COUNT 0x40E
210 
220 #define GAPBOND_BOND_FAIL_ACTION 0x40F
221 
232 #define GAPBOND_ERASE_SINGLEBOND 0x410
233 
243 #define GAPBOND_SECURE_CONNECTION 0x411
244 
263 #define GAPBOND_ECCKEY_REGEN_POLICY 0x412
264 
282 #define GAPBOND_ECC_KEYS 0x413
283 
297 #define GAPBOND_REMOTE_OOB_SC_ENABLED 0x414
298 
314 #define GAPBOND_REMOTE_OOB_SC_DATA 0x415
315 
331 #define GAPBOND_LOCAL_OOB_SC_ENABLED 0x416
332 
345 #define GAPBOND_LOCAL_OOB_SC_DATA 0x417
346 
359 #define GAPBOND_LRU_BOND_REPLACEMENT 0x418
360 
366 #define GAPBOND_PAIRING_MODE_NO_PAIRING 0x00
367 #define GAPBOND_PAIRING_MODE_WAIT_FOR_REQ 0x01
368 #define GAPBOND_PAIRING_MODE_INITIATE 0x02
369 
374 #define GAPBOND_IO_CAP_DISPLAY_ONLY 0x00
375 #define GAPBOND_IO_CAP_DISPLAY_YES_NO 0x01
376 #define GAPBOND_IO_CAP_KEYBOARD_ONLY 0x02
377 #define GAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT 0x03
378 #define GAPBOND_IO_CAP_KEYBOARD_DISPLAY 0x04
379 
384 #define GAPBOND_KEYDIST_SENCKEY 0x01
385 #define GAPBOND_KEYDIST_SIDKEY 0x02
386 #define GAPBOND_KEYDIST_SSIGN 0x04
387 #define GAPBOND_KEYDIST_SLINK 0x08
388 #define GAPBOND_KEYDIST_MENCKEY 0x10
389 #define GAPBOND_KEYDIST_MIDKEY 0x20
390 #define GAPBOND_KEYDIST_MSIGN 0x40
391 #define GAPBOND_KEYDIST_MLINK 0x80
392 
407 #define GAPBOND_PAIRING_STATE_STARTED 0x00
408 
428 #define GAPBOND_PAIRING_STATE_COMPLETE 0x01
429 
441 #define GAPBOND_PAIRING_STATE_BONDED 0x02
442 #define GAPBOND_PAIRING_STATE_BOND_SAVED 0x03
443 #define GAPBOND_PAIRING_STATE_CAR_READ 0x04
444 
449 #define SMP_PAIRING_FAILED_PASSKEY_ENTRY_FAILED 0x01
450 #define SMP_PAIRING_FAILED_OOB_NOT_AVAIL 0x02
451 #define SMP_PAIRING_FAILED_AUTH_REQ 0x03
452 #define SMP_PAIRING_FAILED_CONFIRM_VALUE 0x04
453 #define SMP_PAIRING_FAILED_NOT_SUPPORTED 0x05
454 #define SMP_PAIRING_FAILED_ENC_KEY_SIZE 0x06
455 #define SMP_PAIRING_FAILED_CMD_NOT_SUPPORTED 0x07
456 #define SMP_PAIRING_FAILED_UNSPECIFIED 0x08
457 #define SMP_PAIRING_FAILED_REPEATED_ATTEMPTS 0x09
458 #define SMP_PAIRING_FAILED_INVALID_PARAMETERS 0x0A
459 #define SMP_PAIRING_FAILED_DHKEY_CHECK_FAILED 0x0B
460 #define SMP_PAIRING_FAILED_NUM_COMPARISON_FAILED 0x0C
461 
466 #define GAPBOND_FAIL_NO_ACTION 0x00
467 #define GAPBOND_FAIL_INITIATE_PAIRING 0x01
468 #define GAPBOND_FAIL_TERMINATE_LINK 0x02
469 #define GAPBOND_FAIL_TERMINATE_ERASE_BONDS 0x03
470 
475 #define GAPBOND_SECURE_CONNECTION_NONE 0x00
476 #define GAPBOND_SECURE_CONNECTION_ALLOW 0x01
477 #define GAPBOND_SECURE_CONNECTION_ONLY 0x02
478 
484 #define GAPBOND_REGENERATE_ALWAYS 0x00
485 #define GAPBOND_REGENERATE_NEVER 0xFF
486 
488 // ECC Key Length
489 #define ECC_KEYLEN 32
490 
491 
493 /*-------------------------------------------------------------------
494  * TYPEDEFS
495  */
496 
516 typedef void (*pfnPasscodeCB_t)
517 (
518  uint8_t* deviceAddr,
519  uint16_t connectionHandle,
520  uint8_t uiInputs,
521  uint8_t uiOutputs,
522  uint32_t numComparison
523 );
524 
535 typedef void (*pfnPairStateCB_t)
536 (
537  uint16_t connectionHandle,
538  uint8_t state,
539  uint8_t status
540 );
541 
542 /*
543  * @brief GAPBondMgr Callback Structure
544  *
545  * This must be setup by the application and passed to the GAPRole when
546  * @ref GAPBondMgr_Register is called.
547  */
548 typedef struct
549 {
550  pfnPasscodeCB_t passcodeCB;
551  pfnPairStateCB_t pairStateCB;
552 } gapBondCBs_t;
553 
560 typedef struct
562 {
563  uint8_t privateKey[ECC_KEYLEN];
564  uint8_t publicKeyX[ECC_KEYLEN];
565  uint8_t publicKeyY[ECC_KEYLEN];
567 
569 typedef struct
570 {
571  uint8_t addr[B_ADDR_LEN];
572  uint8_t confirm[KEYLEN];
573  uint8_t oob[KEYLEN];
575 
578 /*-------------------------------------------------------------------
579  * MACROS
580  */
581 
582 /*-------------------------------------------------------------------
583  * API FUNCTIONS
584  */
585 
603 extern bStatus_t GAPBondMgr_SetParameter(uint16_t param, uint8_t len, void *pValue);
604 
620 extern bStatus_t GAPBondMgr_GetParameter(uint16_t param, void *pValue);
621 
636 extern bStatus_t GAPBondMgr_LinkEst(uint8_t addrType, uint8_t *pDevAddr, uint16_t connHandle, uint8_t role);
637 
646 extern void GAPBondMgr_LinkTerm(uint16_t connHandle);
647 
657 extern void GAPBondMgr_SlaveReqSecurity(uint16_t connHandle, uint8_t authReq);
658 
669 extern uint8_t GAPBondMgr_ResolveAddr(uint8_t addrType, uint8_t *pDevAddr, uint8_t *pResolvedAddr);
670 
682 extern bStatus_t GAPBondMgr_ServiceChangeInd(uint16_t connectionHandle, uint8_t setParam);
683 
696 extern bStatus_t GAPBondMgr_UpdateCharCfg(uint16_t connectionHandle, uint16_t attrHandle, uint16_t value);
697 
706 extern void GAPBondMgr_Register(gapBondCBs_t *pCB);
707 
721 extern bStatus_t GAPBondMgr_PasscodeRsp(uint16_t connectionHandle, uint8_t status, uint32_t passcode);
722 
741 extern bStatus_t GAPBondMgr_ReadCentAddrResChar(uint16_t connectionHandle);
742 
753 extern uint8_t GAPBondMgr_SupportsEnhancedPriv(uint8_t *pPeerIdAddr);
754 
767 extern uint8_t GAPBondMgr_ProcessGAPMsg(gapEventHdr_t *pMsg);
768 
778 extern uint8_t GAPBondMgr_CheckNVLen(uint8_t id, uint8_t len);
779 
788 
790 
791 /*-------------------------------------------------------------------
792  * TASK FUNCTIONS - Don't call these. These are system functions.
793  */
794 
807 extern void GAPBondMgr_Init(uint8_t task_id);
808 
823 extern uint16_t GAPBondMgr_ProcessEvent(uint8_t task_id, uint16_t events);
824 
843 extern bStatus_t GAPBondMgr_Pair(uint16_t connHandle);
844 
846 
847 /*-------------------------------------------------------------------
848 -------------------------------------------------------------------*/
849 
850 #ifdef __cplusplus
851 }
852 #endif
853 
854 #endif /* GAPBONDMGR_H */
855 
Public and Private ECC Keys.
Definition: gapbondmgr.h:561
bStatus_t GAPBondMgr_GetParameter(uint16_t param, void *pValue)
Get a GAP Bond Manager parameter.
bStatus_t GAPBondMgr_PasscodeRsp(uint16_t connectionHandle, uint8_t status, uint32_t passcode)
Respond to a passcode request.
void(* pfnPairStateCB_t)(uint16_t connectionHandle, uint8_t state, uint8_t status)
Pairing State Callback Function.
Definition: gapbondmgr.h:536
GAP event header format.
Definition: gap.h:924
void GAPBondMgr_LinkTerm(uint16_t connHandle)
Notify the Bond Manager that a connection has been terminated.
bStatus_t GAPBondMgr_ReadCentAddrResChar(uint16_t connectionHandle)
Read Central Address Resolution Characteristic.
bStatus_t GAPBondMgr_LinkEst(uint8_t addrType, uint8_t *pDevAddr, uint16_t connHandle, uint8_t role)
Notify the Bond Manager that a connection has been made.
Secure Connections Out of Band.
Definition: gapbondmgr.h:569
uint8_t GAPBondMgr_SupportsEnhancedPriv(uint8_t *pPeerIdAddr)
Determine if peer device supports enhanced privacy by checking the Enhanced Privacy state flag of the...
void GAPBondMgr_Register(gapBondCBs_t *pCB)
Register callback functions with the bond manager.
void(* pfnPasscodeCB_t)(uint8_t *deviceAddr, uint16_t connectionHandle, uint8_t uiInputs, uint8_t uiOutputs, uint32_t numComparison)
Passcode and Numeric Comparison Callback Function.
Definition: gapbondmgr.h:517
bStatus_t GAPBondMgr_syncResolvingList(void)
This function will add all device address and IRK pairs from bond records to the Controller. Used with PRIVACY_1_2_CFG.
uint8_t GAPBondMgr_ResolveAddr(uint8_t addrType, uint8_t *pDevAddr, uint8_t *pResolvedAddr)
Resolve an address from bonding information.
uint32_t len
Image length in bytes.
Definition: oad_image_header.h:662
GAP layer interface.
bStatus_t GAPBondMgr_ServiceChangeInd(uint16_t connectionHandle, uint8_t setParam)
Set/clear the service change indication in a bond record.
uint8_t GAPBondMgr_CheckNVLen(uint8_t id, uint8_t len)
This function will check the length of a Bond Manager NV Item.
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:115
bStatus_t GAPBondMgr_SetParameter(uint16_t param, uint8_t len, void *pValue)
Set a GAP Bond Manager parameter.
uint8_t GAPBondMgr_ProcessGAPMsg(gapEventHdr_t *pMsg)
This is a bypass mechanism to allow the bond manager to process GAP messages.
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:233
#define ECC_KEYLEN
256 bit keys
Definition: gapbondmgr.h:489
bStatus_t GAPBondMgr_UpdateCharCfg(uint16_t connectionHandle, uint16_t attrHandle, uint16_t value)
Update the Characteristic Configuration in a bond record.
#define KEYLEN
Default key length.
Definition: bcomdef.h:118
void GAPBondMgr_SlaveReqSecurity(uint16_t connHandle, uint8_t authReq)
Notify the Bond Manager that a Slave Security Request is received.
© Copyright 1995-2021, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale