![]() |
![]() |
TI BLE5-Stack API Documentation
9.11.01
|
This module implements the Generic Access Protocol (GAP) More...
Modules | |
GAP Callbacks | |
GAP Constants | |
GAP Events | |
GAP Parameters | |
GAP Structures | |
Files | |
file | gap.h |
GAP layer interface. | |
Macros | |
#define | GAP_IS_ADDR_RAND(pAddr) |
#define | GAP_IS_ADDR_RPN(pAddr) |
#define | GAP_IS_ADDR_RPR(pAddr) |
#define | GAP_IS_ADDR_RS(pAddr) |
Functions | |
bStatus_t | GAP_Authenticate (gapAuthParams_t *pParams, gapPairingReq_t *pPairReq) |
bStatus_t | GAP_Bond (uint16_t connectionHandle, uint8_t authenticated, uint8_t secureConnections, smSecurityInfo_t *pParams, uint8_t startEncryption) |
bStatus_t | gap_checkLtk_GapBondMgr (uint16_t connectionHandle) |
Checks the Long Term Key (LTK) for a given connection using the GAP Bond Manager. If GAP Bond Manager is used, this function will always return SUCCESS because the LTK is stored in the bond manager. More... | |
bStatus_t | gap_checkLtk_noGapBondMgr (uint16_t connectionHandle) |
Checks the Long Term Key (LTK) for a given connection without using the GAP Bond Manager. More... | |
bStatus_t | GAP_DeviceInit (uint8_t profileRole, uint8_t taskID, GAP_Addr_Modes_t addrMode, uint8_t *pRandomAddr) |
uint8_t * | GAP_GetDevAddress (uint8 wantIA) |
uint8 * | GAP_GetDevAddressByType (uint8 wantIA, uint8 deviceAddrType) |
uint8_t * | GAP_GetIRK (void) |
uint16_t | GAP_GetParamValue (uint16_t paramID) |
uint8_t * | GAP_GetSRK (void) |
void | GAP_Init (uint8_t task_id) |
uint8_t | GAP_isPairing (void) |
uint8_t | GAP_NumActiveConnections (void) |
bStatus_t | GAP_PasscodeUpdate (uint32_t passcode, uint16_t connectionHandle) |
bStatus_t | GAP_PasskeyUpdate (uint8_t *pPasskey, uint16_t connectionHandle) |
uint32 | GAP_ProcessEvent (uint8_t task_id, uint32 events) |
void | GAP_RegisterBondMgrCBs (gapBondMgrCBs_t *pCBs) |
bStatus_t | Gap_RegisterConnEventCb (pfnGapConnEvtCB_t cb, GAP_CB_Action_t action, GAP_CB_Event_e event, uint16_t connHandle) |
void | GAP_RegisterForMsgs (uint8_t taskID) |
bStatus_t | Gap_ReplyToLTKReq (uint16_t connectionHandle, smSecurityInfo_t *const pParams, uint8_t *isLTKUpdated) |
bStatus_t | GAP_SendPeripheralSecurityRequest (uint16_t connectionHandle, uint8_t authReq) |
bStatus_t | GAP_SetParamValue (uint16_t paramID, uint16_t paramValue) |
bStatus_t | GAP_SetPrivacyMode (GAP_Peer_Addr_Types_t addrType, uint8_t *pAddr, uint8_t mode) |
bStatus_t | GAP_Signable (uint16_t connectionHandle, uint8_t authenticated, smSigningInfo_t *pParams) |
bStatus_t | GAP_TerminateAuth (uint16_t connectionHandle, uint8_t reason) |
bStatus_t | GAP_TerminateLinkReq (uint16_t connectionHandle, uint8_t reason) |
bStatus_t | GAP_UpdateLinkParamReq (gapUpdateLinkParamReq_t *pParams) |
bStatus_t | GAP_UpdateLinkParamReqReply (gapUpdateLinkParamReqReply_t *pParams) |
bStatus_t | GapConfig_SetParameter (Gap_configParamIds_t param, void *pValue) |
This module implements the Generic Access Protocol (GAP)
#define GAP_IS_ADDR_RAND | ( | pAddr | ) |
Is the address any type of random address?
#define GAP_IS_ADDR_RPN | ( | pAddr | ) |
Is the address random private non-resolvable (NRPA)?
pAddr | pointer to address |
#define GAP_IS_ADDR_RPR | ( | pAddr | ) |
Is the address random private resolvable (RPA)?
pAddr | pointer to address |
#define GAP_IS_ADDR_RS | ( | pAddr | ) |
Is the address random static?
pAddr | pointer to address |
bStatus_t GAP_Authenticate | ( | gapAuthParams_t * | pParams, |
gapPairingReq_t * | pPairReq | ||
) |
Start Authentication
Start the Authentication process with the requested device. This function is used to Initiate/Allow pairing. Called by both central and peripheral device (Central and Peripheral).
pParams | Authentication parameters |
pPairReq | Enter these parameters if the Pairing Request was already received. NULL, if waiting for Pairing Request or if initiating. |
bStatus_t GAP_Bond | ( | uint16_t | connectionHandle, |
uint8_t | authenticated, | ||
uint8_t | secureConnections, | ||
smSecurityInfo_t * | pParams, | ||
uint8_t | startEncryption | ||
) |
Set up the connection's bound parameters.
connectionHandle | connection handle of the signing information |
authenticated | TRUE if bond is authenticated. |
secureConnections | TRUE if bond has Secure Connections strength. |
pParams | the connected device's security parameters |
startEncryption | whether or not to start encryption |
bStatus_t gap_checkLtk_GapBondMgr | ( | uint16_t | connectionHandle | ) |
Checks the Long Term Key (LTK) for a given connection using the GAP Bond Manager. If GAP Bond Manager is used, this function will always return SUCCESS because the LTK is stored in the bond manager.
bStatus_t gap_checkLtk_noGapBondMgr | ( | uint16_t | connectionHandle | ) |
Checks the Long Term Key (LTK) for a given connection without using the GAP Bond Manager.
This function verifies the validity of the Long Term Key (LTK) associated with a specific connection. It is used in scenarios where the GAP Bond Manager is not utilized for managing security keys.
pLinkItem | Pointer to the link database item containing connection information. |
connectionHandle | The handle identifying the connection for which the LTK is being checked. |
bStatus_t GAP_DeviceInit | ( | uint8_t | profileRole, |
uint8_t | taskID, | ||
GAP_Addr_Modes_t | addrMode, | ||
uint8_t * | pRandomAddr | ||
) |
GAP Device Initialization
Setup the device. Can only be called once per reset. In order to change the address mode / random address, it is necessary to reset the device and call this API again. In the case where the address mode or random address is different than it was for the last initialization, all bonds and local information stored in NV will be erased.
profileRole | GAP Profile Roles: GAP Profile Roles |
taskID | end application task to receive unprocessed GAP events. |
addrMode | Own address mode. If always using Resolvable Private Address, set this to either ADDRMODE_RP_WITH_PUBLIC_ID or ADDRMODE_RP_WITH_RANDOM_ID. If always using Identity Address, set this to either ADDRMODE_PUBLIC or ADDRMODE_RANDOM. |
pRandomAddr | Pointer to 6-byte Random Static Address of this device that will be copied to the stack. Valid only if addrMode is ADDRMODE_RANDOM or ADDRMODE_RP_WITH_RANDOM_ID and can not be NULL in these cases. Ignored for other address types. |
uint8_t* GAP_GetDevAddress | ( | uint8 | wantIA | ) |
Get the address of this device
wantIA | TRUE for Identity Address. FALSE for Resolvable Private Address (if the device has been initialized with the address mode ADDRMODE_RP_WITH_PUBLIC_ID or ADDRMODE_RP_WITH_RANDOM_ID) |
uint8* GAP_GetDevAddressByType | ( | uint8 | wantIA, |
uint8 | deviceAddrType | ||
) |
Get the address of this device using the it's type
wantIA | TRUE for Identity Address. FALSE for Resolvable Private Address (if the device has been initialized with the address mode ADDRMODE_RP_WITH_PUBLIC_ID or ADDRMODE_RP_WITH_RANDOM_ID) |
deviceAddrType | - The own device address type |
uint8_t* GAP_GetIRK | ( | void | ) |
Get the IRK
uint16_t GAP_GetParamValue | ( | uint16_t | paramID | ) |
Get a GAP Parameter value.
paramID | parameter ID: Gap_ParamIDs_t |
uint8_t* GAP_GetSRK | ( | void | ) |
Get the SRK
void GAP_Init | ( | uint8_t | task_id | ) |
Initialization for GAP module
This should only be used in osal_icall_ble.c in osalInitTasks()
task_id | OSAL task ID |
uint8_t GAP_isPairing | ( | void | ) |
Check if GAP is currently pairing.
uint8_t GAP_NumActiveConnections | ( | void | ) |
Returns the number of active connections.
bStatus_t GAP_PasscodeUpdate | ( | uint32_t | passcode, |
uint16_t | connectionHandle | ||
) |
Update the passkey in a numeric value (not string).
This API should be called in response to receiving a GAP_PASSKEY_NEEDED_EVENT
passcode | not string - range: 0 - 999,999. |
connectionHandle | connection handle. |
bStatus_t GAP_PasskeyUpdate | ( | uint8_t * | pPasskey, |
uint16_t | connectionHandle | ||
) |
Update the passkey in string format.
This API should be called in response to receiving a GAP_PASSKEY_NEEDED_EVENT
pPasskey | new passkey - pointer to numeric string (ie. "019655" ) This string's range is "000000" to "999999" |
connectionHandle | connection handle. |
uint32 GAP_ProcessEvent | ( | uint8_t | task_id, |
uint32 | events | ||
) |
GAP Module event processing
This should only be used in osal_icall_ble.c in tasksArr[]
task_id | OSAL task ID |
events | OSAL event received |
void GAP_RegisterBondMgrCBs | ( | gapBondMgrCBs_t * | pCBs | ) |
Register bond manager call backs
pCBs | pointer to Bond Manager Callbacks. |
bStatus_t Gap_RegisterConnEventCb | ( | pfnGapConnEvtCB_t | cb, |
GAP_CB_Action_t | action, | ||
GAP_CB_Event_e | event, | ||
uint16_t | connHandle | ||
) |
Register/Unregister a connection event callback
It is only possible to register for one connection handle of for all connection handles. In the case of unregistering, it does not matter what connHandle or cb is passed in as whatever is currently registered will be unregistered. It it possible to register to certain type of connection event. The types that are currently supported are: Connection established, PHY Update Request Completed (without PHY change).
cb | Function pointer to a callback. |
action | Register or unregister the callback. |
event | Connection Event type to register to. Supported event options: GAP_CB_CONN_ESTABLISHED, GAP_CB_PHY_UPDATE, GAP_CB_CONN_EVENT_ALL |
connHandle | if LINKDB_CONNHANDLE_ALL, apply to all connections. else, apply only for a specific connection. |
void GAP_RegisterForMsgs | ( | uint8_t | taskID | ) |
Register for GAP Messages
Register a task ID to receive extra (unprocessed) HCI status and complete, and Host events.
taskID | Default task ID to send events. |
bStatus_t Gap_ReplyToLTKReq | ( | uint16_t | connectionHandle, |
smSecurityInfo_t *const | pParams, | ||
uint8_t * | isLTKUpdated | ||
) |
Reply to an LTK request.
This API should be called in response to receiving a HCI_BLE_LTK_REQUESTED_EVENT
If encryption parameters exist for the connectionHandle, and are equal to the ones recieved in the event, the LTK provided in the pParams will be used.
If encryption parameters exist for the connectionHandle, but are not equal to the ones recieved in the event, the pParams will not be used.
If encryption parameters doesn't exist for the connectionHandle, use the provided pParams for the LTK replay.
connectionHandle | connection handle of the signing information |
pParams | the connected device's encription parameters and updated LTK parameter |
bStatus_t GAP_SendPeripheralSecurityRequest | ( | uint16_t | connectionHandle, |
uint8_t | authReq | ||
) |
Generate a Peripheral Requested Security message to the central.
connectionHandle | connection handle. |
authReq | Authentication Requirements: Bit 2: MITM, Bits 0-1: bonding (0 - no bonding, 1 - bonding) Bit 3: Secure Connections |
bStatus_t GAP_SetParamValue | ( | uint16_t | paramID, |
uint16_t | paramValue | ||
) |
Set a GAP Parameter value
Use this function to change the default GAP parameter values.
paramID | parameter ID: Gap_ParamIDs_t |
paramValue | new param value |
bStatus_t GAP_SetPrivacyMode | ( | GAP_Peer_Addr_Types_t | addrType, |
uint8_t * | pAddr, | ||
uint8_t | mode | ||
) |
Set the Privacy Mode of the requested device to the desired mode.
addrType | remote device's identity address type |
pAddr | pointer to the address |
mode | GAP Privacy Modes to use for this device |
bStatus_t GAP_Signable | ( | uint16_t | connectionHandle, |
uint8_t | authenticated, | ||
smSigningInfo_t * | pParams | ||
) |
Set up the connection to accept signed data.
connectionHandle | connection handle of the signing information |
authenticated | TRUE if the signing information is authenticated, FALSE otherwise |
pParams | signing parameters |
bStatus_t GAP_TerminateAuth | ( | uint16_t | connectionHandle, |
uint8_t | reason | ||
) |
Terminate Authentication
Send a Pairing Failed message and end any existing pairing.
connectionHandle | connection handle. |
reason | Pairing Failed reason code. |
bStatus_t GAP_TerminateLinkReq | ( | uint16_t | connectionHandle, |
uint8_t | reason | ||
) |
Terminate a link connection.
connectionHandle | connection handle of link to terminate or LINKDB_CONNHANDLE_ALL |
reason | terminate reason. |
bStatus_t GAP_UpdateLinkParamReq | ( | gapUpdateLinkParamReq_t * | pParams | ) |
Update the link parameters to a Central or Peripheral device.
As long as LL connection updates are supported on the own device (which is the case by default), an LL Connection Update procedure will be attempted. If this fails, the stack will automatically attempt an L2CAP parameter update request.
pParams | link update parameters |
bStatus_t GAP_UpdateLinkParamReqReply | ( | gapUpdateLinkParamReqReply_t * | pParams | ) |
Reply to a Connection Parameter Update Request that was received from a remote device.
This API should be used in response to a GAP_UPDATE_LINK_PARAM_REQ_EVENT which will only be received when GAP_PARAM_LINK_UPDATE_DECISION is set to GAP_UPDATE_REQ_PASS_TO_APP.
pParams | local device's desired connection parameters. |
bStatus_t GapConfig_SetParameter | ( | Gap_configParamIds_t | param, |
void * | pValue | ||
) |
Set a GAP Configuration Parameter
Use this function to write a GAP configuration parameter. These parameters must be set before GAP_DeviceInit
param | parameter ID: Gap_configParamIds_t |
pValue | pointer to parameter value. Cast based on the type defined in Gap_configParamIds_t |