TI BLE5-Stack API Documentation  1.00.01.04
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 
374 #define GAPBOND_ALLOW_DEVICE_PRIVACY_MODE 0x419
375 
381 #define GAPBOND_PAIRING_MODE_NO_PAIRING 0x00
382 #define GAPBOND_PAIRING_MODE_WAIT_FOR_REQ 0x01
383 #define GAPBOND_PAIRING_MODE_INITIATE 0x02
384 
389 #define GAPBOND_IO_CAP_DISPLAY_ONLY 0x00
390 #define GAPBOND_IO_CAP_DISPLAY_YES_NO 0x01
391 #define GAPBOND_IO_CAP_KEYBOARD_ONLY 0x02
392 #define GAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT 0x03
393 #define GAPBOND_IO_CAP_KEYBOARD_DISPLAY 0x04
394 
399 #define GAPBOND_KEYDIST_SENCKEY 0x01
400 #define GAPBOND_KEYDIST_SIDKEY 0x02
401 #define GAPBOND_KEYDIST_SSIGN 0x04
402 #define GAPBOND_KEYDIST_SLINK 0x08
403 #define GAPBOND_KEYDIST_MENCKEY 0x10
404 #define GAPBOND_KEYDIST_MIDKEY 0x20
405 #define GAPBOND_KEYDIST_MSIGN 0x40
406 #define GAPBOND_KEYDIST_MLINK 0x80
407 
422 #define GAPBOND_PAIRING_STATE_STARTED 0x00
423 
443 #define GAPBOND_PAIRING_STATE_COMPLETE 0x01
444 
456 #define GAPBOND_PAIRING_STATE_BONDED 0x02
457 #define GAPBOND_PAIRING_STATE_BOND_SAVED 0x03
458 #define GAPBOND_PAIRING_STATE_CAR_READ 0x04
459 #define GAPBOND_PAIRING_STATE_RPAO_READ 0x05
460 
465 #define SMP_PAIRING_FAILED_PASSKEY_ENTRY_FAILED 0x01
466 #define SMP_PAIRING_FAILED_OOB_NOT_AVAIL 0x02
467 #define SMP_PAIRING_FAILED_AUTH_REQ 0x03
468 #define SMP_PAIRING_FAILED_CONFIRM_VALUE 0x04
469 #define SMP_PAIRING_FAILED_NOT_SUPPORTED 0x05
470 #define SMP_PAIRING_FAILED_ENC_KEY_SIZE 0x06
471 #define SMP_PAIRING_FAILED_CMD_NOT_SUPPORTED 0x07
472 #define SMP_PAIRING_FAILED_UNSPECIFIED 0x08
473 #define SMP_PAIRING_FAILED_REPEATED_ATTEMPTS 0x09
474 #define SMP_PAIRING_FAILED_INVALID_PARAMETERS 0x0A
475 #define SMP_PAIRING_FAILED_DHKEY_CHECK_FAILED 0x0B
476 #define SMP_PAIRING_FAILED_NUM_COMPARISON_FAILED 0x0C
477 
482 #define GAPBOND_FAIL_NO_ACTION 0x00
483 #define GAPBOND_FAIL_INITIATE_PAIRING 0x01
484 #define GAPBOND_FAIL_TERMINATE_LINK 0x02
485 #define GAPBOND_FAIL_TERMINATE_ERASE_BONDS 0x03
486 
491 #define GAPBOND_SECURE_CONNECTION_NONE 0x00
492 #define GAPBOND_SECURE_CONNECTION_ALLOW 0x01
493 #define GAPBOND_SECURE_CONNECTION_ONLY 0x02
494 
500 #define GAPBOND_REGENERATE_ALWAYS 0x00
501 #define GAPBOND_REGENERATE_NEVER 0xFF
502 
504 // ECC Key Length
505 #define ECC_KEYLEN 32
506 
507 
509 /*-------------------------------------------------------------------
510  * TYPEDEFS
511  */
512 
532 typedef void (*pfnPasscodeCB_t)
533 (
534  uint8 *deviceAddr,
535  uint16 connectionHandle,
536  uint8 uiInputs,
537  uint8 uiOutputs,
538  uint32 numComparison
539  );
540 
551 typedef void (*pfnPairStateCB_t)
552 (
553  uint16 connectionHandle,
554  uint8 state,
555  uint8 status
556 );
557 
558 /*
559  * @brief GAPBondMgr Callback Structure
560  *
561  * This must be setup by the application and passed to the GAPRole when
562  * @ref GAPBondMgr_Register is called.
563  */
564 typedef struct
565 {
566  pfnPasscodeCB_t passcodeCB;
567  pfnPairStateCB_t pairStateCB;
568 } gapBondCBs_t;
569 
576 typedef struct
578 {
579  uint8 privateKey[ECC_KEYLEN];
580  uint8 publicKeyX[ECC_KEYLEN];
581  uint8 publicKeyY[ECC_KEYLEN];
583 
585 typedef struct
586 {
587  uint8 addr[B_ADDR_LEN];
588  uint8 confirm[KEYLEN];
589  uint8 oob[KEYLEN];
591 
594 /*-------------------------------------------------------------------
595  * MACROS
596  */
597 
598 /*-------------------------------------------------------------------
599  * API FUNCTIONS
600  */
601 
619 extern bStatus_t GAPBondMgr_SetParameter( uint16 param, uint8 len, void *pValue );
620 
636 extern bStatus_t GAPBondMgr_GetParameter( uint16 param, void *pValue );
637 
652 extern bStatus_t GAPBondMgr_LinkEst( uint8 addrType, uint8 *pDevAddr, uint16 connHandle, uint8 role );
653 
662 extern void GAPBondMgr_LinkTerm(uint16 connHandle);
663 
673 extern void GAPBondMgr_SlaveReqSecurity(uint16 connHandle, uint8 authReq);
674 
685 extern uint8 GAPBondMgr_ResolveAddr( uint8 addrType, uint8 *pDevAddr, uint8 *pResolvedAddr );
686 
698 extern bStatus_t GAPBondMgr_ServiceChangeInd( uint16 connectionHandle, uint8 setParam );
699 
712 extern bStatus_t GAPBondMgr_UpdateCharCfg( uint16 connectionHandle, uint16 attrHandle, uint16 value );
713 
723 extern void GAPBondMgr_Register( gapBondCBs_t *pCB );
724 
738 extern bStatus_t GAPBondMgr_PasscodeRsp( uint16 connectionHandle, uint8 status, uint32 passcode );
739 
755 extern bStatus_t GAPBondMgr_ReadGattChar( uint16 connectionHandle, uint16 uuid );
756 
767 extern uint8 GAPBondMgr_SupportsEnhancedPriv( uint8 *pPeerIdAddr );
768 
781 extern uint8 GAPBondMgr_ProcessGAPMsg( gapEventHdr_t *pMsg );
782 
792 extern uint8 GAPBondMgr_CheckNVLen( uint8 id, uint8 len );
793 
802 
804 
805 /*-------------------------------------------------------------------
806  * TASK FUNCTIONS - Don't call these. These are system functions.
807  */
808 
821 extern void GAPBondMgr_Init( uint8 task_id );
822 
837 extern uint16 GAPBondMgr_ProcessEvent( uint8 task_id, uint16 events );
838 
840 
841 /*-------------------------------------------------------------------
842 -------------------------------------------------------------------*/
843 
844 #ifdef __cplusplus
845 }
846 #endif
847 
848 #endif /* GAPBONDMGR_H */
849 
bStatus_t GAPBondMgr_PasscodeRsp(uint16 connectionHandle, uint8 status, uint32 passcode)
Respond to a passcode request.
Public and Private ECC Keys.
Definition: gapbondmgr.h:577
bStatus_t GAPBondMgr_UpdateCharCfg(uint16 connectionHandle, uint16 attrHandle, uint16 value)
Update the Characteristic Configuration in a bond record.
bStatus_t GAPBondMgr_ReadGattChar(uint16 connectionHandle, uint16 uuid)
Send Read By Type Request to retrieve the value of a characteristic with the specified uuid...
GAP event header format.
Definition: gap.h:769
bStatus_t GAPBondMgr_LinkEst(uint8 addrType, uint8 *pDevAddr, uint16 connHandle, uint8 role)
Notify the Bond Manager that a connection has been made.
uint8 GAPBondMgr_ProcessGAPMsg(gapEventHdr_t *pMsg)
This is a bypass mechanism to allow the bond manager to process GAP messages.
Secure Connections Out of Band.
Definition: gapbondmgr.h:585
uint8 GAPBondMgr_ResolveAddr(uint8 addrType, uint8 *pDevAddr, uint8 *pResolvedAddr)
Resolve an address from bonding information.
void GAPBondMgr_Register(gapBondCBs_t *pCB)
Register callback functions with the bond manager.
bStatus_t GAPBondMgr_ServiceChangeInd(uint16 connectionHandle, uint8 setParam)
Set/clear the service change indication in a bond record.
uint8 GAPBondMgr_SupportsEnhancedPriv(uint8 *pPeerIdAddr)
Determine if peer device supports enhanced privacy by checking the Enhanced Privacy state flag of the...
void(* pfnPasscodeCB_t)(uint8 *deviceAddr, uint16 connectionHandle, uint8 uiInputs, uint8 uiOutputs, uint32 numComparison)
Passcode and Numeric Comparison Callback Function.
Definition: gapbondmgr.h:533
void(* pfnPairStateCB_t)(uint16 connectionHandle, uint8 state, uint8 status)
Pairing State Callback Function.
Definition: gapbondmgr.h:552
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.
void GAPBondMgr_LinkTerm(uint16 connHandle)
Notify the Bond Manager that a connection has been terminated.
GAP layer interface.
uint8 GAPBondMgr_CheckNVLen(uint8 id, uint8 len)
This function will check the length of a Bond Manager NV Item.
bStatus_t GAPBondMgr_GetParameter(uint16 param, void *pValue)
Get a GAP Bond Manager parameter.
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:112
bStatus_t GAPBondMgr_SetParameter(uint16 param, uint8 len, void *pValue)
Set a GAP Bond Manager parameter.
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:225
#define ECC_KEYLEN
256 bit keys
Definition: gapbondmgr.h:505
void GAPBondMgr_SlaveReqSecurity(uint16 connHandle, uint8 authReq)
Notify the Bond Manager that a Slave Security Request is received.
#define KEYLEN
Default key length.
Definition: bcomdef.h:115
Copyright 2017, Texas Instruments Incorporated