Bluetooth Low Energy Host Stack  Rev. 4
API Reference Manual
Generic Access Profile

Overview


 

Files

file  gap_interface.h
 
file  gap_types.h
 

Data Structures

struct  gapSmpKeys_t
 
struct  gapSecurityRequirements_t
 
struct  gapServiceSecurityRequirements_t
 
struct  gapDeviceSecurityRequirements_t
 
struct  gapHandleList_t
 
struct  gapConnectionSecurityInformation_t
 
struct  gapPairingParameters_t
 
struct  gapSlaveSecurityRequestParameters_t
 
struct  gapAdvertisingParameters_t
 
struct  gapScanningParameters_t
 
struct  gapConnectionRequestParameters_t
 
struct  gapConnectionParameters_t
 
struct  gapAdStructure_t
 
struct  gapAdvertisingData_t
 
struct  gapAdvertisingEvent_t
 
union  gapAdvertisingEvent_t.eventData
 
struct  gapScannedDevice_t
 
struct  gapScanningEvent_t
 
union  gapScanningEvent_t.eventData
 
struct  gapConnectedEvent_t
 
struct  gapKeyExchangeRequestEvent_t
 
struct  gapKeysReceivedEvent_t
 
struct  gapAuthenticationRejectedEvent_t
 
struct  gapPairingCompleteEvent_t
 
union  gapPairingCompleteEvent_t.pairingCompleteData
 
struct  gapLongTermKeyRequestEvent_t
 
struct  gapEncryptionChangedEvent_t
 
struct  gapDisconnectedEvent_t
 
struct  gapConnParamsUpdateReq_t
 
struct  gapConnParamsUpdateComplete_t
 
struct  gapConnLeDataLengthChanged_t
 
struct  gapConnectionEvent_t
 
union  gapConnectionEvent_t.eventData
 
struct  gapIdentityInformation_t
 
struct  gapAutoConnectParams_t
 

Macros

#define Gap_AddSecurityModesAndLevels(modeLevelA, modeLevelB)
 
#define Gap_CancelInitiatingConnection()
 
#define Gap_ReadAdvertisingTxPowerLevel()
 
#define Gap_ReadRssi(deviceId)
 
#define Gap_ReadTxPowerLevelInConnection(deviceId)
 
#define gCancelOngoingInitiatingConnection_d
 
#define gMode_2_Mask_d
 
#define getSecurityLevel(modeLevel)
 
#define getSecurityMode(modeLevel)
 
#define isMode_2(modeLevel)
 
#define isMode_1(modeLevel)
 
#define isSameMode(modeLevelA, modeLevelB)
 
#define addSameSecurityModes(modeLevelA, modeLevelB)
 
#define addMode1AndMode2(mode1, mode2)
 
#define addDifferentSecurityModes(modeLevelA, modeLevelB)
 
#define gDefaultEncryptionKeySize_d
 
#define gGapDefaultDeviceSecurity_d
 
#define gGapDefaultSecurityRequirements_d
 
#define gGapAdvertisingIntervalRangeMinimum_c
 
#define gGapAdvertisingIntervalDefault_c
 
#define gGapAdvertisingIntervalRangeMaximum_c
 
#define gGapAdvertisingChannelMapDefault_c
 
#define gGapDefaultAdvertisingParameters_d
 
#define gGapScanIntervalMin_d
 
#define gGapScanIntervalDefault_d
 
#define gGapScanIntervalMax_d
 
#define gGapScanWindowMin_d
 
#define gGapScanWindowDefault_d
 
#define gGapScanWindowMax_d
 
#define gGapRssiMin_d
 
#define gGapRssiMax_d
 
#define gGapRssiNotAvailable_d
 
#define gGapDefaultScanningParameters_d
 
#define gGapConnIntervalMin_d
 
#define gGapConnIntervalMax_d
 
#define gGapConnLatencyMin_d
 
#define gGapConnLatencyMax_d
 
#define gGapConnSuperTimeoutMin_d
 
#define gGapConnSuperTimeoutMax_d
 
#define gGapConnEventLengthMin_d
 
#define gGapConnEventLengthMax_d
 
#define gGapDefaultConnectionLatency_d
 
#define gGapDefaultSupervisionTimeout_d
 
#define gGapDefaultMinConnectionInterval_d
 
#define gGapDefaultMaxConnectionInterval_d
 
#define gGapDefaultConnectionRequestParameters_d
 

Typedefs

typedef gapAdvertisingData_t gapScanResponseData_t
 
typedef bleResult_t gapDisconnectionReason_t
 
typedef void(* gapAdvertisingCallback_t) (gapAdvertisingEvent_t *pAdvertisingEvent)
 
typedef void(* gapScanningCallback_t) (gapScanningEvent_t *pScanningEvent)
 
typedef void(* gapConnectionCallback_t) (deviceId_t deviceId, gapConnectionEvent_t *pConnectionEvent)
 

Enumerations

enum  gapRole_t { gGapCentral_c, gGapPeripheral_c, gGapObserver_c, gGapBroadcaster_c }
 
enum  gapIoCapabilities_t {
  gIoDisplayOnly_c, gIoDisplayYesNo_c, gIoKeyboardOnly_c, gIoNone_c,
  gIoKeyboardDisplay_c
}
 
enum  gapSmpKeyFlags_t { gNoKeys_c, gLtk_c, gIrk_c, gCsrk_c }
 
enum  gapSecurityMode_t { gSecurityMode_1_c, gSecurityMode_2_c }
 
enum  gapSecurityLevel_t { gSecurityLevel_NoSecurity_c, gSecurityLevel_NoMitmProtection_c, gSecurityLevel_WithMitmProtection_c, gSecurityLevel_LeSecureConnections_c }
 
enum  gapSecurityModeAndLevel_t {
  gSecurityMode_1_Level_1_c, gSecurityMode_1_Level_2_c, gSecurityMode_1_Level_3_c, gSecurityMode_1_Level_4_c,
  gSecurityMode_2_Level_1_c, gSecurityMode_2_Level_2_c
}
 
enum  gapKeypressNotification_t {
  gKnPasskeyEntryStarted_c, gKnPasskeyDigitStarted_c, gKnPasskeyDigitErased_c, gKnPasskeyCleared_c,
  gKnPasskeyEntryCompleted_c
}
 
enum  gapAuthenticationRejectReason_t {
  gLinkEncryptionFailed_c, gOobNotAvailable_c, gIncompatibleIoCapabilities_c, gPairingNotSupported_c,
  gLowEncryptionKeySize_c, gRepeatedAttempts_c, gUnspecifiedReason_c
}
 
enum  gapScanMode_t { gDefaultScan_c, gLimitedDiscovery_c, gGeneralDiscovery_c, gAutoConnect_c }
 
enum  gapAdvertisingChannelMapFlags_t { gAdvChanMapFlag37_c, gAdvChanMapFlag38_c, gAdvChanMapFlag39_c }
 
enum  gapAdvertisingFilterPolicy_t { gProcessAll_c, gProcessConnAllScanWL_c, gProcessScanAllConnWL_c, gProcessWhiteListOnly_c }
 
enum  gapAdType_t {
  gAdFlags_c, gAdIncomplete16bitServiceList_c, gAdComplete16bitServiceList_c, gAdIncomplete32bitServiceList_c,
  gAdComplete32bitServiceList_c, gAdIncomplete128bitServiceList_c, gAdComplete128bitServiceList_c, gAdShortenedLocalName_c,
  gAdCompleteLocalName_c, gAdTxPowerLevel_c, gAdClassOfDevice_c, gAdSimplePairingHashC192_c,
  gAdSimplePairingRandomizerR192_c, gAdSecurityManagerTkValue_c, gAdSecurityManagerOobFlags_c, gAdSlaveConnectionIntervalRange_c,
  gAdServiceSolicitationList16bit_c, gAdServiceSolicitationList32bit_c, gAdServiceSolicitationList128bit_c, gAdServiceData16bit_c,
  gAdServiceData32bit_c, gAdServiceData128bit_c, gAdPublicTargetAddress_c, gAdRandomTargetAddress_c,
  gAdAppearance_c, gAdAdvertisingInterval_c, gAdLeDeviceAddress_c, gAdLeRole_c,
  gAdSimplePairingHashC256_c, gAdSimplePairingRandomizerR256_c, gAd3dInformationData_c, gAdManufacturerSpecificData_c
}
 
enum  gapAdTypeFlags_t {
  gNone_c, gLeLimitedDiscoverableMode_c, gLeGeneralDiscoverableMode_c, gBrEdrNotSupported_c,
  gSimultaneousLeBrEdrCapableController_c, gSimultaneousLeBrEdrCapableHost_c
}
 
enum  gapRadioPowerLevelReadType_t { gTxPowerCurrentLevelInConnection_c, gTxPowerMaximumLevelInConnection_c, gTxPowerLevelForAdvertising_c, gRssi_c }
 
enum  gapControllerTestCmd_t { gControllerTestCmdStartRx_c, gControllerTestCmdStartTx_c, gControllerTestCmdEnd_c }
 
enum  gapControllerTestTxType_t {
  gControllerTestTxPrbs9_c, gControllerTestTxF0_c, gControllerTestTxAA_c, gControllerTestTxPrbs15_c,
  gControllerTestTxFF_c, gControllerTestTx00_c, gControllerTestTx0F_c, gControllerTestTx55_c
}
 
enum  gapAdvertisingEventType_t { gAdvertisingStateChanged_c, gAdvertisingCommandFailed_c }
 
enum  gapScanningEventType_t { gScanStateChanged_c, gScanCommandFailed_c, gDeviceScanned_c }
 
enum  gapConnectionEventType_t {
  gConnEvtConnected_c, gConnEvtPairingRequest_c, gConnEvtSlaveSecurityRequest_c, gConnEvtPairingResponse_c,
  gConnEvtAuthenticationRejected_c, gConnEvtPasskeyRequest_c, gConnEvtOobRequest_c, gConnEvtPasskeyDisplay_c,
  gConnEvtKeyExchangeRequest_c, gConnEvtKeysReceived_c, gConnEvtLongTermKeyRequest_c, gConnEvtEncryptionChanged_c,
  gConnEvtPairingComplete_c, gConnEvtDisconnected_c, gConnEvtRssiRead_c, gConnEvtTxPowerLevelRead_c,
  gConnEvtPowerReadFailure_c, gConnEvtParameterUpdateRequest_c, gConnEvtParameterUpdateComplete_c, gConnEvtLeDataLengthChanged_c,
  gConnEvtLeScOobDataRequest_c, gConnEvtLeScDisplayNumericValue_c, gConnEvtLeScKeypressNotification_c
}
 
enum  gapAppearance_t {
  gUnknown_c, gGenericPhone_c, gGenericComputer_c, gGenericWatch_c,
  gSportsWatch_c, gGenericClock_c, gGenericDisplay_c, gGenericRemoteControl_c,
  gGenericEyeglasses_c, gGenericTag_c, gGenericKeyring_c, gGenericMediaPlayer_c,
  gGenericBarcodeScanner_c, gGenericThermometer_c, gThermometerEar_c, gGenericHeartrateSensor_c,
  gHeartRateSensorHeartRateBelt_c, gGenericBloodPressure_c, gBloodPressureArm_c, gBloodPressureWrist_c,
  gHumanInterfaceDevice_c, gKeyboard_c, gMouse_c, gJoystick_c,
  gGamepad_c, gDigitizerTablet_c, gCardReader_c, gDigitalPen_c,
  gBarcodeScanner_c, gGenericGlucoseMeter_c, gGenericRunningWalkingSensor_c, gRunningWalkingSensorInShoe_c,
  gRunningWalkingSensorOnShoe_c, gRunningWalkingSensorOnHip_c, gGenericCycling_c, gCyclingComputer_c,
  gCyclingSpeedSensor_c, gCyclingCadenceSensor_c, gCyclingPowerSensor_c, gCyclingSpeedandCadenceSensor_c,
  gGenericPulseOximeter_c, gFingertip_c, gWristWorn_c, gGenericWeightScale_c,
  gGenericOutdoorSportsActivity_c, gLocationDisplayDevice_c, gLocationandNavigationDisplayDevice_c, gLocationPod_c,
  gLocationAndNavigationPod_c
}
 

Functions

bleResult_t Gap_RegisterDeviceSecurityRequirements (gapDeviceSecurityRequirements_t *pSecurity)
 
bleResult_t Gap_SetAdvertisingParameters (gapAdvertisingParameters_t *pAdvertisingParameters)
 
bleResult_t Gap_SetAdvertisingData (gapAdvertisingData_t *pAdvertisingData, gapScanResponseData_t *pScanResponseData)
 
bleResult_t Gap_StartAdvertising (gapAdvertisingCallback_t advertisingCallback, gapConnectionCallback_t connectionCallback)
 
bleResult_t Gap_StopAdvertising (void)
 
bleResult_t Gap_Authorize (deviceId_t deviceId, uint16_t handle, gattDbAccessType_t access)
 
bleResult_t Gap_SaveCccd (deviceId_t deviceId, uint16_t handle, gattCccdFlags_t cccd)
 
bleResult_t Gap_CheckNotificationStatus (deviceId_t deviceId, uint16_t handle, bool_t *pOutIsActive)
 
bleResult_t Gap_CheckIndicationStatus (deviceId_t deviceId, uint16_t handle, bool_t *pOutIsActive)
 
bleResult_t Gap_GetBondedStaticAddresses (bleDeviceAddress_t *aOutDeviceAddresses, uint8_t maxDevices, uint8_t *pOutActualCount)
 
bleResult_t Gap_GetBondedDevicesIdentityInformation (gapIdentityInformation_t *aOutIdentityAddresses, uint8_t maxDevices, uint8_t *pOutActualCount)
 
bleResult_t Gap_Pair (deviceId_t deviceId, gapPairingParameters_t *pPairingParameters)
 
bleResult_t Gap_SendSlaveSecurityRequest (deviceId_t deviceId, bool_t bondAfterPairing, gapSecurityModeAndLevel_t securityModeLevel)
 
bleResult_t Gap_EncryptLink (deviceId_t deviceId)
 
bleResult_t Gap_AcceptPairingRequest (deviceId_t deviceId, gapPairingParameters_t *pPairingParameters)
 
bleResult_t Gap_RejectPairing (deviceId_t deviceId, gapAuthenticationRejectReason_t reason)
 
bleResult_t Gap_EnterPasskey (deviceId_t deviceId, uint32_t passkey)
 
bleResult_t Gap_ProvideOob (deviceId_t deviceId, uint8_t *aOob)
 
bleResult_t Gap_RejectPasskeyRequest (deviceId_t deviceId)
 
bleResult_t Gap_SendSmpKeys (deviceId_t deviceId, gapSmpKeys_t *pKeys)
 
bleResult_t Gap_RejectKeyExchangeRequest (deviceId_t deviceId)
 
bleResult_t Gap_LeScRegeneratePublicKey (void)
 
bleResult_t Gap_LeScValidateNumericValue (deviceId_t deviceId, bool_t valid)
 
bleResult_t Gap_LeScGetLocalOobData (void)
 
bleResult_t Gap_LeScSetPeerOobData (deviceId_t deviceId, gapLeScOobData_t *pPeerOobData)
 
bleResult_t Gap_LeScSendKeypressNotification (deviceId_t deviceId, gapKeypressNotification_t keypressNotification)
 
bleResult_t Gap_ProvideLongTermKey (deviceId_t deviceId, uint8_t *aLtk, uint8_t ltkSize)
 
bleResult_t Gap_DenyLongTermKey (deviceId_t deviceId)
 
bleResult_t Gap_LoadEncryptionInformation (deviceId_t deviceId, uint8_t *aOutLtk, uint8_t *pOutLtkSize)
 
bleResult_t Gap_SetLocalPasskey (uint32_t passkey)
 
bleResult_t Gap_SetScanMode (gapScanMode_t scanMode, gapAutoConnectParams_t *pAutoConnectParams)
 
bleResult_t Gap_StartScanning (gapScanningParameters_t *pScanningParameters, gapScanningCallback_t scanningCallback)
 
bleResult_t Gap_StopScanning (void)
 
bleResult_t Gap_Connect (gapConnectionRequestParameters_t *pParameters, gapConnectionCallback_t connCallback)
 
bleResult_t Gap_Disconnect (deviceId_t deviceId)
 
bleResult_t Gap_SaveCustomPeerInformation (deviceId_t deviceId, void *aInfo, uint16_t offset, uint16_t infoSize)
 
bleResult_t Gap_LoadCustomPeerInformation (deviceId_t deviceId, void *aOutInfo, uint16_t offset, uint16_t infoSize)
 
bleResult_t Gap_CheckIfBonded (deviceId_t deviceId, bool_t *pOutIsBonded)
 
bleResult_t Gap_ReadWhiteListSize (void)
 
bleResult_t Gap_ClearWhiteList (void)
 
bleResult_t Gap_AddDeviceToWhiteList (bleAddressType_t addressType, bleDeviceAddress_t address)
 
bleResult_t Gap_RemoveDeviceFromWhiteList (bleAddressType_t addressType, bleDeviceAddress_t address)
 
bleResult_t Gap_ReadPublicDeviceAddress (void)
 
bleResult_t Gap_CreateRandomDeviceAddress (uint8_t *aIrk, uint8_t *aRandomPart)
 
bleResult_t Gap_SaveDeviceName (deviceId_t deviceId, uchar_t *aName, uint8_t cNameSize)
 
bleResult_t Gap_GetBondedDevicesCount (uint8_t *pOutBondedDevicesCount)
 
bleResult_t Gap_GetBondedDeviceName (uint8_t nvmIndex, uchar_t *aOutName, uint8_t maxNameSize)
 
bleResult_t Gap_RemoveBond (uint8_t nvmIndex)
 
bleResult_t Gap_RemoveAllBonds (void)
 
bleResult_t Gap_ReadRadioPowerLevel (gapRadioPowerLevelReadType_t txReadType, deviceId_t deviceId)
 
bleResult_t Gap_SetTxPowerLevel (uint8_t powerLevel, bleTransmitPowerChannelType_t channelType)
 
bleResult_t Gap_VerifyPrivateResolvableAddress (uint8_t nvmIndex, bleDeviceAddress_t aAddress)
 
bleResult_t Gap_SetRandomAddress (bleDeviceAddress_t aAddress)
 
bleResult_t Gap_SetDefaultPairingParameters (gapPairingParameters_t *pPairingParameters)
 
bleResult_t Gap_UpdateConnectionParameters (deviceId_t deviceId, uint16_t intervalMin, uint16_t intervalMax, uint16_t slaveLatency, uint16_t timeoutMultiplier, uint16_t minCeLength, uint16_t maxCeLength)
 
bleResult_t Gap_EnableUpdateConnectionParameters (deviceId_t deviceId, bool_t enable)
 
bleResult_t Gap_UpdateLeDataLength (deviceId_t deviceId, uint16_t txOctets, uint16_t txTime)
 
bleResult_t Gap_ControllerReset (void)
 
bleResult_t Gap_EnableHostPrivacy (bool_t enable, uint8_t *aIrk)
 
bleResult_t Gap_EnableControllerPrivacy (bool_t enable, uint8_t *aOwnIrk, uint8_t peerIdCount, gapIdentityInformation_t *aPeerIdentities)
 
bleResult_t Gap_ControllerTest (gapControllerTestCmd_t testCmd, uint8_t radioChannel, uint8_t txDataLength, gapControllerTestTxType_t txPayloadType)
 

Data Structure Documentation

◆ gapSmpKeys_t

struct gapSmpKeys_t

Structure containing the SMP information exchanged during pairing.

Data Fields
uint8_t cLtkSize Encryption Key Size.

If aLtk is NULL, this is ignored.

uint8_t * aLtk Long Term (Encryption) Key.

NULL if LTK is not distributed, else size is given by cLtkSize.

uint8_t * aIrk Identity Resolving Key.

NULL if aIrk is not distributed.

uint8_t * aCsrk Connection Signature Resolving Key.

NULL if aCsrk is not distributed.

uint8_t cRandSize Size of RAND; usually equal to gcMaxRandSize_d.

If aLtk is NULL, this is ignored.

uint8_t * aRand RAND value used to identify the LTK.

If aLtk is NULL, this is ignored.

uint16_t ediv EDIV value used to identify the LTK.

If aLtk is NULL, this is ignored.

bleAddressType_t addressType Public or Random address.

If aAddress is NULL, this is ignored.

uint8_t * aAddress Device Address.

NULL if address is not distributed. If aIrk is NULL, this is ignored.

◆ gapSecurityRequirements_t

struct gapSecurityRequirements_t

Security Requirements structure for a Device, a Service or a Characteristic.

Data Fields
gapSecurityModeAndLevel_t securityModeLevel Security mode and level.
bool_t authorization Authorization required.
uint16_t minimumEncryptionKeySize Minimum encryption key (LTK) size.

◆ gapServiceSecurityRequirements_t

struct gapServiceSecurityRequirements_t

Service Security Requirements.

Data Fields
uint16_t serviceHandle Handle of the Service declaration in the GATT Database.
gapSecurityRequirements_t requirements Requirements for all attributes in this service.

◆ gapDeviceSecurityRequirements_t

struct gapDeviceSecurityRequirements_t

Device Security - Master Security Requirements + Service Security Requirements.

Data Fields
gapSecurityRequirements_t * pMasterSecurityRequirements Security requirements added to all services.
uint8_t cNumServices Number of service-specific requirements; must be less than or equal to gcMaxServiceSpecificSecurityRequirements_d.
gapServiceSecurityRequirements_t * aServiceSecurityRequirements Array of service-specific requirements.

◆ gapHandleList_t

struct gapHandleList_t

List of Attribute Handles for authorization lists.

Data Fields
uint8_t cNumHandles Number of handles in this list.
uint16_t aHandles[gcGapMaxAuthorizationHandles_c] List of handles.

◆ gapConnectionSecurityInformation_t

struct gapConnectionSecurityInformation_t

Connection Security Information structure.

Data Fields
bool_t authenticated TRUE if pairing was performed with MITM protection.
gapHandleList_t authorizedToRead List of handles the peer has been authorized to read.
gapHandleList_t authorizedToWrite List of handles the peer has been authorized to write.

◆ gapPairingParameters_t

struct gapPairingParameters_t

Pairing parameters structure for the Gap_Pair and Gap_AcceptPairingRequest APIs.

Data Fields
bool_t withBonding TRUE if this device is able to and wants to bond after pairing, FALSE otherwise.
gapSecurityModeAndLevel_t securityModeAndLevel The desired security mode-level.
uint8_t maxEncryptionKeySize Maximum LTK size supported by the device.
gapIoCapabilities_t localIoCapabilities I/O capabilities used to determine the pairing method.
bool_t oobAvailable TRUE if this device has Out-of-Band data that can be used for authenticated pairing.

FALSE otherwise.

gapSmpKeyFlags_t centralKeys Indicates the SMP keys to be distributed by the Central.
gapSmpKeyFlags_t peripheralKeys Indicates the SMP keys to be distributed by the Peripheral.
bool_t leSecureConnectionSupported In BLE 4.2, indicates if device supports LE Secure Connections pairing.
bool_t useKeypressNotifications In BLE 4.2, indicates if device supports Keypress Notification PDUs during Passkey Entry pairing.

◆ gapSlaveSecurityRequestParameters_t

struct gapSlaveSecurityRequestParameters_t

Parameters of a Slave Security Request.

Data Fields
bool_t bondAfterPairing TRUE if the Slave supports bonding.
bool_t authenticationRequired TRUE if the Slave requires authentication for MITM protection.

◆ gapAdvertisingParameters_t

struct gapAdvertisingParameters_t

Advertising Parameters; for defaults see gGapDefaultAdvertisingParameters_d.

Data Fields
uint16_t minInterval Minimum desired advertising interval.

Default: 1.28 s.

uint16_t maxInterval Maximum desired advertising interval.

Default: 1.28 s.

bleAdvertisingType_t advertisingType Advertising type.

Default: connectable undirected.

bleAddressType_t ownAddressType Indicates whether the advertising address is the public address (BD_ADDR) or the random address (set by Gap_SetRandomAddress).

Default: public address. If BLE 4.2 Controller Privacy is enabled, this parameter is irrelevant as Private Resolvable Addresses are always used.

bleAddressType_t peerAddressType Address type of the peer; only used in directed advertising and Enhanced Privacy (BLE 4.2).
bleDeviceAddress_t peerAddress Address of the peer; same as above.
gapAdvertisingChannelMapFlags_t channelMap Bit mask indicating which of the three advertising channels are used.

Default: all three.

gapAdvertisingFilterPolicy_t filterPolicy Indicates whether the connect and scan requests are filtered using the White List.

Default: does not use White List (process all).

◆ gapScanningParameters_t

struct gapScanningParameters_t

Scanning parameters; for defaults see gGapDefaultScanningParameters_d.

Data Fields
bleScanType_t type Scanning type.

Default: passive.

uint16_t interval Scanning interval.

Default: 10 ms.

uint16_t window Scanning window.

Default: 10 ms.

bleAddressType_t ownAddressType Indicates whether the address used in scan requests is the public address (BD_ADDR) or the random address (set by Gap_SetRandomAddress).

Default: public address. If BLE 4.2 Controller Privacy is enabled, this parameter is irrelevant as Private Resolvable Addresses are always used.

bleScanningFilterPolicy_t filterPolicy Indicates whether the advertising packets are filtered using the White List.

Default: does not use White List (scan all).

◆ gapConnectionRequestParameters_t

struct gapConnectionRequestParameters_t

Connection request parameter structure to be used in the Gap_Connect function; for API-defined defaults, use gGapDefaultConnectionRequestParameters_d.

Data Fields
uint16_t scanInterval Scanning interval.

Default: 10 ms.

uint16_t scanWindow Scanning window.

Default: 10 ms.

bleInitiatorFilterPolicy_t filterPolicy Indicates whether the connection request is issued for a specific device or for all the devices in the White List.

Default: specific device.

bleAddressType_t ownAddressType Indicates whether the address used in connection requests is the public address (BD_ADDR) or the random address (set by Gap_SetRandomAddress).

Default: public address.

bleAddressType_t peerAddressType When connecting to a specific device (see filterPolicy), this indicates that device's address type.

Default: public address.

bleDeviceAddress_t peerAddress When connecting to a specific device (see filterPolicy), this indicates that device's address.
uint16_t connIntervalMin The minimum desired connection interval.

Default: 100 ms.

uint16_t connIntervalMax The maximum desired connection interval.

Default: 200 ms.

uint16_t connLatency The desired connection latency (the maximum number of consecutive connection events the Slave is allowed to ignore).

Default: 0.

uint16_t supervisionTimeout The maximum time interval between consecutive over-the-air packets; if this timer expires, the connection is dropped.

Default: 10 s.

uint16_t connEventLengthMin The minimum desired connection event length.

Default: 0 ms.

uint16_t connEventLengthMax The maximum desired connection event length.

Default: maximum possible, ~41 s. (lets the Controller decide).

bool_t usePeerIdentityAddress If Controller Privacy is enabled and this parameter is TRUE, the address defined in the peerAddressType and peerAddress is an identity address.

Otherwise, it is a device address.

◆ gapConnectionParameters_t

struct gapConnectionParameters_t

Connection parameters as received in the gConnEvtConnected_c connection event.

Data Fields
uint16_t connInterval Interval between connection events.
uint16_t connLatency Number of consecutive connection events the Slave may ignore.
uint16_t supervisionTimeout The maximum time interval between consecutive over-the-air packets; if this timer expires, the connection is dropped.
bleMasterClockAccuracy_t masterClockAccuracy Accuracy of master's clock, allowing for frame detection optimizations.

◆ gapAdStructure_t

struct gapAdStructure_t

Definition of an AD Structure as contained in Advertising and Scan Response packets.

An Advertising or Scan Response packet contains several AD Structures.

Data Fields
uint8_t length Total length of the [adType + aData] fields.

Equal to 1 + lengthOf(aData).

gapAdType_t adType AD Type of this AD Structure.
uint8_t * aData Data contained in this AD Structure; length of this array is equal to (gapAdStructure_t.length - 1).

◆ gapAdvertisingData_t

struct gapAdvertisingData_t

Advertising Data structure : a list of several gapAdStructure_t structures.

Data Fields
uint8_t cNumAdStructures Number of AD Structures.
gapAdStructure_t * aAdStructures Array of AD Structures.

◆ gapAdvertisingEvent_t

struct gapAdvertisingEvent_t

Advertising event structure: type + data.

Data Fields
gapAdvertisingEventType_t eventType Event type.
union gapAdvertisingEvent_t eventData Event data, to be interpreted according to gapAdvertisingEvent_t.eventType.

◆ gapAdvertisingEvent_t.eventData

union gapAdvertisingEvent_t.eventData
Data Fields
bleResult_t failReason Event data for gAdvertisingCommandFailed_c event type: reason of failure to enable or disable advertising.

◆ gapScannedDevice_t

struct gapScannedDevice_t

Scanned device information structure, obtained from LE Advertising Reports.

Data Fields
bleAddressType_t addressType Device's advertising address type.
bleDeviceAddress_t aAddress Device's advertising address.
int8_t rssi RSSI on the advertising channel; may be compared to the TX power contained in the AD Structure of type gAdTxPowerLevel_c to estimate distance from the advertiser.
uint8_t dataLength Length of the advertising or scan response data.
uint8_t * data Advertising or scan response data.
bleAdvertisingReportEventType_t advEventType Advertising report type, indicating what type of event generated this data (advertising, scan response).
bool_t directRpaUsed TRUE if directed advertising with Resolvable Private Address as Direct Address was detected while Enhanced Privacy is enabled.
bleDeviceAddress_t directRpa Resolvable Private Address set as Direct Address for directed advertising.

Valid only when directRpaUsed is TRUE.

bool_t advertisingAddressResolved If this is TRUE, the address contained in the addressType and aAddress fields is the identity address of a resolved RPA from the Advertising Address field.

Otherwise, the adress from the respective fields is the public or random device address contained in the Advertising Address field.

◆ gapScanningEvent_t

struct gapScanningEvent_t

Scanning event structure: type + data.

Data Fields
gapScanningEventType_t eventType Event type.
union gapScanningEvent_t eventData Event data, to be interpreted according to gapScanningEvent_t.eventType.

◆ gapScanningEvent_t.eventData

union gapScanningEvent_t.eventData
Data Fields
bleResult_t failReason Event data for gScanCommandFailed_c event type: reason of failure to enable or disable scanning.
gapScannedDevice_t scannedDevice Event data for gGapScanEventDeviceScanned_c event type: scanned device information.

◆ gapConnectedEvent_t

struct gapConnectedEvent_t

Event data structure for the gConnEvtConnected_c event.

Data Fields
gapConnectionParameters_t connParameters Connection parameters established by the Controller.
bleAddressType_t peerAddressType Connected device's address type.
bleDeviceAddress_t peerAddress Connected device's address.
bool_t peerRpaResolved If this is TRUE, the address defined by peerAddressType and peerAddress is the identity address of the peer, and the peer used an RPA that was resolved by the Controller and is contained in the peerRpa field.

Otherwise, it is a device address. This parameter is irrelevant if BLE 4.2 Controller Privacy is not enabled.

bleDeviceAddress_t peerRpa Peer Resolvable Private Address if Controller Privacy is active and peerRpaResolved is TRUE.
bool_t localRpaUsed If this is TRUE, the Controller has used an RPA contained in the localRpa field.

This parameter is irrelevant if BLE 4.2 Controller Privacy is not enabled.

bleDeviceAddress_t localRpa Local Resolvable Private Address if Controller Privacy is active and localRpaUsed is TRUE.

◆ gapKeyExchangeRequestEvent_t

struct gapKeyExchangeRequestEvent_t

Event data structure for the gConnEvtKeyExchangeRequest_c event.

Data Fields
gapSmpKeyFlags_t requestedKeys Mask identifying the keys being requested.
uint8_t requestedLtkSize Requested size of the encryption key.

◆ gapKeysReceivedEvent_t

struct gapKeysReceivedEvent_t

Event data structure for the gConnEvtKeysReceived_c event.

Data Fields
gapSmpKeys_t * pKeys The SMP keys distributed by the peer.

◆ gapAuthenticationRejectedEvent_t

struct gapAuthenticationRejectedEvent_t

Event data structure for the gConnEvtAuthenticationRejected_c event.

Data Fields
gapAuthenticationRejectReason_t rejectReason Slave's reason for rejecting the authentication.

◆ gapPairingCompleteEvent_t

struct gapPairingCompleteEvent_t

Event data structure for the gConnEvtPairingComplete_c event.

Data Fields
bool_t pairingSuccessful TRUE if pairing succeeded, FALSE otherwise.
union gapPairingCompleteEvent_t pairingCompleteData Information of completion, selected upon the value of gapPairingCompleteEvent_t.pairingSuccessful.

◆ gapPairingCompleteEvent_t.pairingCompleteData

union gapPairingCompleteEvent_t.pairingCompleteData
Data Fields
bool_t withBonding If pairingSuccessful is TRUE, this indicates whether the devices bonded.
bleResult_t failReason If pairingSuccessful is FALSE, this contains the reason of failure.

◆ gapLongTermKeyRequestEvent_t

struct gapLongTermKeyRequestEvent_t

Event data structure for the gConnEvtLongTermKeyRequest_c event.

Data Fields
uint16_t ediv The Encryption Diversifier, as defined by the SMP.
uint8_t aRand[gcSmpMaxRandSize_c] The Random number, as defined by the SMP.
uint8_t randSize Usually equal to gcMaxRandSize_d.

◆ gapEncryptionChangedEvent_t

struct gapEncryptionChangedEvent_t

Event data structure for the gConnEvtEncryptionChanged_c event.

Data Fields
bool_t newEncryptionState TRUE if link has been encrypted, FALSE if encryption was paused or removed.

◆ gapDisconnectedEvent_t

struct gapDisconnectedEvent_t

Event data structure for the gConnEvtDisconnected_c event.

Data Fields
gapDisconnectionReason_t reason Reason for disconnection.

◆ gapConnParamsUpdateReq_t

struct gapConnParamsUpdateReq_t

Event data structure for the gConnEvtParameterUpdateRequest_c event.

Data Fields
uint16_t intervalMin Minimum interval between connection events.
uint16_t intervalMax Maximum interval between connection events.
uint16_t slaveLatency Number of consecutive connection events the Slave may ignore.
uint16_t timeoutMultiplier The maximum time interval between consecutive over-the-air packets; if this timer expires, the connection is dropped.

◆ gapConnParamsUpdateComplete_t

struct gapConnParamsUpdateComplete_t

Event data structure for the gConnEvtParameterUpdateComplete_c event.

Data Fields
bleResult_t status
uint16_t connInterval Interval between connection events.
uint16_t connLatency Number of consecutive connection events the Slave may ignore.
uint16_t supervisionTimeout The maximum time interval between consecutive over-the-air packets; if this timer expires, the connection is dropped.

◆ gapConnLeDataLengthChanged_t

struct gapConnLeDataLengthChanged_t

Event data structure for the gConnEvtLeDataLengthChanged_c event.

Data Fields
uint16_t maxTxOctets The maximum number of payload octets in a Link Layer Data Channel PDU to transmit on this connection.
uint16_t maxTxTime The maximum time that the local Controller will take to send a Link Layer Data Channel PDU on this connection.
uint16_t maxRxOctets The maximum number of payload octets in a Link Layer Data Channel PDU to receive on this connection.
uint16_t maxRxTime The maximum time that the local Controller will take to receive a Link Layer Data Channel PDU on this connection.

◆ gapConnectionEvent_t

struct gapConnectionEvent_t

Connection event structure: type + data.

Data Fields
gapConnectionEventType_t eventType Event type.
union gapConnectionEvent_t eventData Event data, to be interpreted according to gapConnectionEvent_t.eventType.

◆ gapConnectionEvent_t.eventData

union gapConnectionEvent_t.eventData
Data Fields
gapConnectedEvent_t connectedEvent Data for gConnEvtConnected_c: information about the connection parameters.
gapPairingParameters_t pairingEvent Data for gConnEvtPairingRequest_c, gConnEvtPairingResponse_c: pairing parameters.
gapAuthenticationRejectedEvent_t authenticationRejectedEvent Data for gConnEvtAuthenticationRejected_c: reason for rejection.
gapSlaveSecurityRequestParameters_t slaveSecurityRequestEvent Data for gConnEvtSlaveSecurityRequest_c: Slave's security requirements.
gapKeyExchangeRequestEvent_t keyExchangeRequestEvent Data for gConnEvtKeyExchangeRequest_c: mask indicating the keys that were requested by the peer.
gapKeysReceivedEvent_t keysReceivedEvent Data for gConnEvtKeysReceived_c: the keys received from the peer.
gapPairingCompleteEvent_t pairingCompleteEvent Data for gConnEvtPairingComplete_c: fail reason or (if successful) bonding state.
gapLongTermKeyRequestEvent_t longTermKeyRequestEvent Data for gConnEvtLongTermKeyRequest_c: encryption diversifier and random number.
gapEncryptionChangedEvent_t encryptionChangedEvent Data for gConnEvtEncryptionChanged_c: new encryption state.
gapDisconnectedEvent_t disconnectedEvent Data for gConnEvtDisconnected_c: reason for disconnection.
int8_t rssi_dBm Data for gConnEvtRssiRead_c: value of the RSSI in dBm.
int8_t txPowerLevel_dBm Data for gConnEvtTxPowerLevelRead_c: value of the TX power.
bleResult_t failReason Data for gConnEvtPowerReadFailure_c: reason for power reading failure.
uint32_t passkeyForDisplay
gapConnParamsUpdateReq_t connectionUpdateRequest Data for gConnEvtParameterUpdateRequest_c: connection parameters update.
gapConnParamsUpdateComplete_t connectionUpdateComplete Data for gConnEvtParameterUpdateComplete_c: connection parameters update.
gapConnLeDataLengthChanged_t leDataLengthChanged Data for gConnEvtLeDataLengthChanged_c: new data length parameters.
gapKeypressNotification_t incomingKeypressNotification
uint32_t numericValueForDisplay

◆ gapIdentityInformation_t

struct gapIdentityInformation_t

Indentity Information structure definition.

Data Fields
bleIdentityAddress_t identityAddress Identity Address - Public or Random Static.
uint8_t irk[gcSmpIrkSize_c] Identity Resolving Key.

◆ gapAutoConnectParams_t

struct gapAutoConnectParams_t

Parameters for the Auto Connect Scan Mode.

Data Fields
uint8_t cNumAddresses Number of device addresses to automatically connect to.
bool_t writeInWhiteList If set to TRUE, the device addresses are written in the White List before scanning is enabled.
gapConnectionRequestParameters_t * aAutoConnectData The array of connection request parameters, of size equal to cNumAddresses.
gapConnectionCallback_t connectionCallback The callback used to receive connection events if the device auto-connects.

Macro Definition Documentation

◆ Gap_AddSecurityModesAndLevels

#define Gap_AddSecurityModesAndLevels (   modeLevelA,
  modeLevelB 
)


Macro used to combine two security mode-levels.

Parameters
[in]modeLevelA,modeLevelBThe two security mode-levels.
Returns
The resulting security mode-level.
Remarks
This macro is useful when two different security requirements must be satisfied at the same time, such as a device master security requirement and a service-specific security requirement.

◆ Gap_CancelInitiatingConnection

#define Gap_CancelInitiatingConnection ( )


Macro used to cancel a connection initiated by Gap_Connect(...).

Returns
gBleSuccess_c or error.
Remarks
This macro can only be used for a connection that has not yet been established, such as the "gConnEvtConnected_c" has not been received. For example, call this when a connection request has timed out.

◆ Gap_ReadAdvertisingTxPowerLevel

#define Gap_ReadAdvertisingTxPowerLevel ( )


Macro used to read the radio transmitter power when advertising.

Returns
gBleSuccess_c or error.
Remarks
The result is contained in the gAdvTxPowerLevelRead_c generic event.

◆ Gap_ReadRssi

#define Gap_ReadRssi (   deviceId)


Macro used to read the RSSI of a radio connection.

Parameters
[in]deviceIdDevice ID identifying the radio connection.
Returns
gBleSuccess_c or error.
Remarks
The result is contained in the gConnEvtRssiRead_c connection event. The RSSI value is a signed byte, and the unit is dBm. If the RSSI cannot be read, the gConnEvtPowerReadFailure_c connection event is generated.

◆ Gap_ReadTxPowerLevelInConnection

#define Gap_ReadTxPowerLevelInConnection (   deviceId)


Macro used to read the radio transmitting power level of a radio connection.

Parameters
[in]deviceIdDevice ID identifying the radio connection.
Returns
gBleSuccess_c or error.
Remarks
The result is contained in the gConnEvtTxPowerLevelRead_c connection event. If the TX Power cannot be read, the gConnEvtPowerReadFailure_c connection event is generated.

◆ gCancelOngoingInitiatingConnection_d

#define gCancelOngoingInitiatingConnection_d

Use this value as a parameter to the Gap_Disconnect(deviceId) function to cancel any ongoing connection initiation, for example if the connection has timed out.

◆ gMode_2_Mask_d

#define gMode_2_Mask_d

Mask to check if a Security Mode-and-Level is Mode 2.

◆ getSecurityLevel

#define getSecurityLevel (   modeLevel)

Extracts the security level (see gapSecurityLevel_t) from the combined security mode-level (gapSecurityModeAndLevel_t).

◆ getSecurityMode

#define getSecurityMode (   modeLevel)

Extracts the security mode (see gapSecurityMode_t) from the combined security mode-level (gapSecurityModeAndLevel_t).

◆ gDefaultEncryptionKeySize_d

#define gDefaultEncryptionKeySize_d

The default value for the LTK size.

◆ gGapDefaultDeviceSecurity_d

#define gGapDefaultDeviceSecurity_d

The default value for the Device Security (no requirements)

◆ gGapDefaultSecurityRequirements_d

#define gGapDefaultSecurityRequirements_d

The default value for a Security Requirement.

◆ gGapAdvertisingIntervalRangeMinimum_c

#define gGapAdvertisingIntervalRangeMinimum_c

Minimum advertising interval (20 ms)

◆ gGapAdvertisingIntervalDefault_c

#define gGapAdvertisingIntervalDefault_c

Default advertising interval (1.28 s)

◆ gGapAdvertisingIntervalRangeMaximum_c

#define gGapAdvertisingIntervalRangeMaximum_c

Maximum advertising interval (10.24 s)

◆ gGapAdvertisingChannelMapDefault_c

#define gGapAdvertisingChannelMapDefault_c

Default Advertising Channel Map - all 3 channels are enabled.

◆ gGapDefaultAdvertisingParameters_d

#define gGapDefaultAdvertisingParameters_d

Default value for Advertising Parameters struct.

◆ gGapScanIntervalMin_d

#define gGapScanIntervalMin_d

Minimum scan interval (2.5 ms)

◆ gGapScanIntervalDefault_d

#define gGapScanIntervalDefault_d

Default scan interval (10 ms)

◆ gGapScanIntervalMax_d

#define gGapScanIntervalMax_d

Maximum scan interval (10.24 s)

◆ gGapScanWindowMin_d

#define gGapScanWindowMin_d

Minimum scan window (2.5 ms)

◆ gGapScanWindowDefault_d

#define gGapScanWindowDefault_d

Default scan window (10 ms)

◆ gGapScanWindowMax_d

#define gGapScanWindowMax_d

Maximum scan window (10.24 s)

◆ gGapRssiMin_d

#define gGapRssiMin_d

Minimum valid value for RSSI (dB)

◆ gGapRssiMax_d

#define gGapRssiMax_d

Maximum valid value for RSSI (dB)

◆ gGapRssiNotAvailable_d

#define gGapRssiNotAvailable_d

A special invalid value for the RSSI indicating that the measurement is not available.

◆ gGapDefaultScanningParameters_d

#define gGapDefaultScanningParameters_d

Default value for Scanning Parameters struct.

◆ gGapConnIntervalMin_d

#define gGapConnIntervalMin_d

Minimum connection interval (7.5 ms)

◆ gGapConnIntervalMax_d

#define gGapConnIntervalMax_d

Maximum connection interval (4 s)

◆ gGapConnLatencyMin_d

#define gGapConnLatencyMin_d

Minimum connection latency value (0 - no connection event may be ignored)

◆ gGapConnLatencyMax_d

#define gGapConnLatencyMax_d

Maximum connection latency value (499 connection events may be ignored)

◆ gGapConnSuperTimeoutMin_d

#define gGapConnSuperTimeoutMin_d

Minimum supervision timeout (100 ms)

◆ gGapConnSuperTimeoutMax_d

#define gGapConnSuperTimeoutMax_d

Maximum supervision timeout (32 s)

◆ gGapConnEventLengthMin_d

#define gGapConnEventLengthMin_d

Minimum value of the connection event length (0 ms)

◆ gGapConnEventLengthMax_d

#define gGapConnEventLengthMax_d

Maximum value of the connection event length (~41 s)

◆ gGapDefaultConnectionLatency_d

#define gGapDefaultConnectionLatency_d

Default connection latency: 0.

◆ gGapDefaultSupervisionTimeout_d

#define gGapDefaultSupervisionTimeout_d

Default supervision timeout: 10s.

◆ gGapDefaultMinConnectionInterval_d

#define gGapDefaultMinConnectionInterval_d

Default minimum connection interval: 100ms.

◆ gGapDefaultMaxConnectionInterval_d

#define gGapDefaultMaxConnectionInterval_d

Default maximum connection interval: 200ms.

◆ gGapDefaultConnectionRequestParameters_d

#define gGapDefaultConnectionRequestParameters_d

The default value for the Connection Request Parameters structure.

Typedef Documentation

◆ gapScanResponseData_t

Scan Response Data structure : a list of several gapAdStructure_t structures.

◆ gapDisconnectionReason_t

Disconnection reason alias - reasons are contained in HCI error codes.

◆ gapAdvertisingCallback_t

typedef void(* gapAdvertisingCallback_t) (gapAdvertisingEvent_t *pAdvertisingEvent)

Advertising Callback prototype.

◆ gapScanningCallback_t

typedef void(* gapScanningCallback_t) (gapScanningEvent_t *pScanningEvent)

Scanning Callback prototype.

◆ gapConnectionCallback_t

typedef void(* gapConnectionCallback_t) (deviceId_t deviceId, gapConnectionEvent_t *pConnectionEvent)

Connection Callback prototype.

Enumeration Type Documentation

◆ gapRole_t

enum gapRole_t

GAP Role of a BLE device.

Enumerator
gGapCentral_c 

Central scans and connects to Peripherals.

gGapPeripheral_c 

Peripheral advertises and connects to Centrals.

gGapObserver_c 

Observer only scans and makes no connections.

gGapBroadcaster_c 

Broadcaster only advertises and makes no connections.

◆ gapIoCapabilities_t

I/O Capabilities as defined by the SMP.

Enumerator
gIoDisplayOnly_c 

May display a PIN, no input.

gIoDisplayYesNo_c 

May display a PIN and has a binary input (e.g., YES and NO buttons).

gIoKeyboardOnly_c 

Has keyboard input, no display.

gIoNone_c 

No input and no display.

gIoKeyboardDisplay_c 

Has keyboard input and display.

◆ gapSmpKeyFlags_t

Flags indicating the Keys to be exchanged by the SMP during the key exchange phase of pairing.

Enumerator
gNoKeys_c 

No key can be distributed.

gLtk_c 

Long Term Key.

gIrk_c 

Identity Resolving Key.

gCsrk_c 

Connection Signature Resolving Key.

◆ gapSecurityMode_t

LE Security Mode.

Enumerator
gSecurityMode_1_c 

Mode 1 - Encryption required (except for Level 1).

gSecurityMode_2_c 

Mode 2 - Data Signing required.

◆ gapSecurityLevel_t

LE Security Level.

Enumerator
gSecurityLevel_NoSecurity_c 

No security (combined only with Mode 1).

gSecurityLevel_NoMitmProtection_c 

Unauthenticated (no MITM protection).

gSecurityLevel_WithMitmProtection_c 

Authenticated (MITM protection by PIN or OOB).

gSecurityLevel_LeSecureConnections_c 

Authenticated with LE Secure Connections (BLE 4.2 only).

◆ gapSecurityModeAndLevel_t

Security Mode-and-Level definitions.

Enumerator
gSecurityMode_1_Level_1_c 

Mode 1 Level 1 - No Security.

gSecurityMode_1_Level_2_c 

Mode 1 Level 2 - Encryption without authentication.

gSecurityMode_1_Level_3_c 

Mode 1 Level 3 - Encryption with authentication.

gSecurityMode_1_Level_4_c 

Mode 1 Level 4 - Encryption with LE Secure Connections pairing (BLE 4.2 only).

gSecurityMode_2_Level_1_c 

Mode 2 Level 1 - Data Signing without authentication.

gSecurityMode_2_Level_2_c 

Mode 2 Level 2 - Data Signing with authentication.

◆ gapKeypressNotification_t

Keypress Notification Types.

Enumerator
gKnPasskeyEntryStarted_c 

Start of the Passkey Entry.

gKnPasskeyDigitStarted_c 

Digit entered.

gKnPasskeyDigitErased_c 

Digit erased.

gKnPasskeyCleared_c 

Passkey cleared.

gKnPasskeyEntryCompleted_c 

Passkey Entry completed.

◆ gapAuthenticationRejectReason_t

Reason for rejecting the pairing request.

These values are equal to the corresponding reasons from SMP.

Enumerator
gLinkEncryptionFailed_c 

Link could not be encrypted.

This reason may not be used by Gap_RejectPairing!

gOobNotAvailable_c 

This device does not have the required OOB for authenticated pairing.

gIncompatibleIoCapabilities_c 

The combination of I/O capabilities does not allow pairing with the desired level of security.

gPairingNotSupported_c 

This device does not support pairing.

gLowEncryptionKeySize_c 

The peer's encryption key size is too low for this device's required security level.

gRepeatedAttempts_c 

This device is the target of repeated unsuccessful pairing attempts and does not allow further pairing attempts at the moment.

gUnspecifiedReason_c 

The host has rejected the pairing for an unknown reason.

◆ gapScanMode_t

Scan Mode options; used as parameter for Gap_SetScanMode.

Enumerator
gDefaultScan_c 

Reports all scanned devices to the application.

gLimitedDiscovery_c 

Reports only devices in Limited Discoverable Mode, i.e., containing the Flags AD with the LE Limited Discoverable Flag set.

gGeneralDiscovery_c 

Reports only devices in General Discoverable Mode, i.e., containing the Flags AD with the LE General Discoverable Flag set.

gAutoConnect_c 

Automatically connects with devices with known addresses and does not report any scanned device to the application.

◆ gapAdvertisingChannelMapFlags_t

Advertising Channel Map flags - setting a bit activates advertising on the respective channel.

Enumerator
gAdvChanMapFlag37_c 

Bit for channel 37.

gAdvChanMapFlag38_c 

Bit for channel 38.

gAdvChanMapFlag39_c 

Bit for channel 39.

◆ gapAdvertisingFilterPolicy_t

Advertising Filter Policy values.

Enumerator
gProcessAll_c 

Default value: accept all connect and scan requests.

gProcessConnAllScanWL_c 

Accept all connect requests, but scan requests only from devices in White List.

gProcessScanAllConnWL_c 

Accept all scan requests, but connect requests only from devices in White List.

gProcessWhiteListOnly_c 

Accept connect and scan requests only from devices in White List.

◆ gapAdType_t

AD Type values as defined by Bluetooth SIG used when defining gapAdStructure_t structures for advertising or scan response data.

Enumerator
gAdFlags_c 

Defined by the Bluetooth SIG.

gAdIncomplete16bitServiceList_c 

Defined by the Bluetooth SIG.

gAdComplete16bitServiceList_c 

Defined by the Bluetooth SIG.

gAdIncomplete32bitServiceList_c 

Defined by the Bluetooth SIG.

gAdComplete32bitServiceList_c 

Defined by the Bluetooth SIG.

gAdIncomplete128bitServiceList_c 

Defined by the Bluetooth SIG.

gAdComplete128bitServiceList_c 

Defined by the Bluetooth SIG.

gAdShortenedLocalName_c 

Defined by the Bluetooth SIG.

gAdCompleteLocalName_c 

Defined by the Bluetooth SIG.

gAdTxPowerLevel_c 

Defined by the Bluetooth SIG.

gAdClassOfDevice_c 

Defined by the Bluetooth SIG.

gAdSimplePairingHashC192_c 

Defined by the Bluetooth SIG.

gAdSimplePairingRandomizerR192_c 

Defined by the Bluetooth SIG.

gAdSecurityManagerTkValue_c 

Defined by the Bluetooth SIG.

gAdSecurityManagerOobFlags_c 

Defined by the Bluetooth SIG.

gAdSlaveConnectionIntervalRange_c 

Defined by the Bluetooth SIG.

gAdServiceSolicitationList16bit_c 

Defined by the Bluetooth SIG.

gAdServiceSolicitationList32bit_c 

Defined by the Bluetooth SIG.

gAdServiceSolicitationList128bit_c 

Defined by the Bluetooth SIG.

gAdServiceData16bit_c 

Defined by the Bluetooth SIG.

gAdServiceData32bit_c 

Defined by the Bluetooth SIG.

gAdServiceData128bit_c 

Defined by the Bluetooth SIG.

gAdPublicTargetAddress_c 

Defined by the Bluetooth SIG.

gAdRandomTargetAddress_c 

Defined by the Bluetooth SIG.

gAdAppearance_c 

Defined by the Bluetooth SIG.

gAdAdvertisingInterval_c 

Defined by the Bluetooth SIG.

gAdLeDeviceAddress_c 

Defined by the Bluetooth SIG.

gAdLeRole_c 

Defined by the Bluetooth SIG.

gAdSimplePairingHashC256_c 

Defined by the Bluetooth SIG.

gAdSimplePairingRandomizerR256_c 

Defined by the Bluetooth SIG.

gAd3dInformationData_c 

Defined by the Bluetooth SIG.

gAdManufacturerSpecificData_c 

Defined by the Bluetooth SIG.

◆ gapAdTypeFlags_t

Values of the AD Flags advertising data structure.

Enumerator
gNone_c 

No information.

gLeLimitedDiscoverableMode_c 

This device is in Limited Discoverable mode.

gLeGeneralDiscoverableMode_c 

This device is in General Discoverable mode.

gBrEdrNotSupported_c 

This device supports only Bluetooth Low Energy; no support for Classic Bluetooth.

gSimultaneousLeBrEdrCapableController_c 

This device's Controller also supports Classic Bluetooth.

gSimultaneousLeBrEdrCapableHost_c 

This device's Host also supports Classic Bluetooth.

◆ gapRadioPowerLevelReadType_t

Enumeration used by the Gap_ReadRadioPowerLevel function.

Enumerator
gTxPowerCurrentLevelInConnection_c 

Reading the instantaneous TX power level in a connection.

gTxPowerMaximumLevelInConnection_c 

Reading the maximum TX power level achieved during a connection.

gTxPowerLevelForAdvertising_c 

Reading the TX power on the advertising channels.

gRssi_c 

Reading the Received Signal Strength Indication in a connection.

◆ gapControllerTestCmd_t

Enumeration for Controller Test commands.

Enumerator
gControllerTestCmdStartRx_c 

Start Receiver Test.

gControllerTestCmdStartTx_c 

Start Transmitter Test.

gControllerTestCmdEnd_c 

End Test.

◆ gapControllerTestTxType_t

Enumeration for Controller Transmitter Test payload types.

Enumerator
gControllerTestTxPrbs9_c 

PRBS9 sequence ‘11111111100000111101…’

gControllerTestTxF0_c 

Repeated ‘11110000’

gControllerTestTxAA_c 

Repeated ‘10101010’

gControllerTestTxPrbs15_c 

PRBS15 sequence.

gControllerTestTxFF_c 

Repeated ‘11111111’

gControllerTestTx00_c 

Repeated ‘00000000’

gControllerTestTx0F_c 

Repeated ‘00001111’

gControllerTestTx55_c 

Repeated ‘01010101’

◆ gapAdvertisingEventType_t

Advertising event type enumeration, as contained in the gapAdvertisingEvent_t.

Enumerator
gAdvertisingStateChanged_c 

Event received when advertising has been successfully enabled or disabled.

gAdvertisingCommandFailed_c 

Event received when advertising could not be enabled or disabled.

Reason contained in gapAdvertisingEvent_t.eventData.failReason.

◆ gapScanningEventType_t

Scanning event type enumeration, as contained in the gapScanningEvent_t.

Enumerator
gScanStateChanged_c 

Event received when scanning had been successfully enabled or disabled.

gScanCommandFailed_c 

Event received when scanning could not be enabled or disabled.

Reason contained in gapScanningEvent_t.eventData.failReason.

gDeviceScanned_c 

Event received when an advertising device has been scanned.

Device data contained in gapScanningEvent_t.eventData.scannedDevice.

◆ gapConnectionEventType_t

Connection event type enumeration, as contained in the gapConnectionEvent_t.

Enumerator
gConnEvtConnected_c 

A connection has been established.

Data in gapConnectionEvent_t.eventData.connectedEvent.

gConnEvtPairingRequest_c 

A pairing request has been received from the peer Master.

Data in gapConnectionEvent_t.eventData.pairingEvent.

gConnEvtSlaveSecurityRequest_c 

A Slave Security Request has been received from the peer Slave.

Data in gapConnectionEvent_t.eventData.slaveSecurityRequestEvent.

gConnEvtPairingResponse_c 

A pairing response has been received from the peer Slave.

Data in gapConnectionEvent_t.eventData.pairingEvent.

gConnEvtAuthenticationRejected_c 

A link encryption or pairing request has been rejected by the peer Slave.

Data in gapConnectionEvent_t.eventData.authenticationRejectedEvent.

gConnEvtPasskeyRequest_c 

Peer Slave has requested a passkey (maximum 6 digit PIN) for the pairing procedure.

Master should respond with Gap_EnterPasskey. Slave will not receive this event! Slave's application must call Gap_SetLocalPasskey before any connection.

gConnEvtOobRequest_c 

Out-of-Band data must be provided for the pairing procedure.

Master or Slave should respond with Gap_ProvideOob.

gConnEvtPasskeyDisplay_c 

The pairing procedure requires this Slave to display the passkey for the Master's user.

gConnEvtKeyExchangeRequest_c 

The pairing procedure requires the SMP keys to be distributed to the peer.

Data in gapConnectionEvent_t.eventData.keyExchangeRequestEvent.

gConnEvtKeysReceived_c 

SMP keys distributed by the peer during pairing have been received.

Data in gapConnectionEvent_t.eventData.keysReceivedEvent.

gConnEvtLongTermKeyRequest_c 

The bonded peer Master has requested link encryption and the LTK must be provided.

Slave should respond with Gap_ProvideLongTermKey. Data in gapConnectionEvent_t.eventData.longTermKeyRequestEvent.

gConnEvtEncryptionChanged_c 

Link's encryption state has changed, e.g., during pairing or after a reconnection with a bonded peer.

Data in gapConnectionEvent_t.eventData.encryptionChangedEvent.

gConnEvtPairingComplete_c 

Pairing procedure is complete, either successfully or with failure.

Data in gapConnectionEvent_t.eventData.pairingCompleteEvent.

gConnEvtDisconnected_c 

A connection has been terminated.

Data in gapConnectionEvent_t.eventData.disconnectedEvent.

gConnEvtRssiRead_c 

RSSI for an active connection has been read.

Data in gapConnectionEvent_t.eventData.rssi_dBm.

gConnEvtTxPowerLevelRead_c 

TX power level for an active connection has been read.

Data in gapConnectionEvent_t.eventData.txPowerLevel_dBm.

gConnEvtPowerReadFailure_c 

Power reading could not be performed.

Data in gapConnectionEvent_t.eventData.failReason.

gConnEvtParameterUpdateRequest_c 

A connection parameter update request has been received.

Data in gapConnectionEvent_t.eventData.connectionUpdateRequest.

gConnEvtParameterUpdateComplete_c 

The connection has new parameters.

Data in gapConnectionEvent_t.eventData.connectionUpdateComplete.

gConnEvtLeDataLengthChanged_c 

The new TX/RX Data Length paramaters.

Data in gapConnectionEvent_t.eventData.rssi_dBm.leDataLengthChanged.

gConnEvtLeScOobDataRequest_c 

Event sent to request LE SC OOB Data (r, Cr and Addr) received from a peer.

gConnEvtLeScDisplayNumericValue_c 

Event sent to display and confirm a Numeric Comparison Value when using the LE SC Numeric Comparison pairing method.

gConnEvtLeScKeypressNotification_c 

Remote Keypress Notification recieved during Passkey Entry Pairing Method.

◆ gapAppearance_t

Appearance characteristic enumeration, also used in advertising.

Function Documentation

◆ Gap_RegisterDeviceSecurityRequirements()

bleResult_t Gap_RegisterDeviceSecurityRequirements ( gapDeviceSecurityRequirements_t pSecurity)


Registers the device security requirements. This function includes a master security for all services and, optionally, additional stronger security settings for services as required by the profile and/or application.

Parameters
[in]pSecurityA pointer to the application-allocated gapDeviceSecurityRequirements_t structure.
Returns
gBleSuccess_c or error.
Remarks
pSecurity or any other contained security structure pointers that are NULL are ignored, i.e., defaulted to No Security (Security Mode 1 Level 1, No Authorization, Minimum encryption key size). This function executes synchronously.
GATT Server-only API function.

◆ Gap_SetAdvertisingParameters()

bleResult_t Gap_SetAdvertisingParameters ( gapAdvertisingParameters_t pAdvertisingParameters)


Sets up the Advertising Parameters.

Parameters
[in]pAdvertisingParametersPointer to gapAdvertisingParameters_t structure.
Returns
gBleSuccess_c or error.
Remarks
GAP Peripheral-only API function.

◆ Gap_SetAdvertisingData()

bleResult_t Gap_SetAdvertisingData ( gapAdvertisingData_t pAdvertisingData,
gapScanResponseData_t pScanResponseData 
)


Sets up the Advertising and Scan Response Data.

Parameters
[in]pAdvertisingDataPointer to gapAdvertisingData_t structure or NULL.
[in]pScanResponseDataPointer to gapScanResponseData_t structure or NULL.
Returns
gBleSuccess_c or error.
Remarks
Any of the parameters may be NULL, in which case they are ignored. Therefore, this function can be used to set any of the parameters individually or both at once.
GAP Peripheral-only API function.

◆ Gap_StartAdvertising()

bleResult_t Gap_StartAdvertising ( gapAdvertisingCallback_t  advertisingCallback,
gapConnectionCallback_t  connectionCallback 
)


Commands the controller to start advertising.

Parameters
[in]advertisingCallbackCallback used by the application to receive advertising events. Can be NULL.
[in]connectionCallbackCallback used by the application to receive connection events. Can be NULL.
Returns
gBleSuccess_c or error.
Remarks
The advertisingCallback confirms or denies whether the advertising has started. The connectionCallback is only used if a connection gets established during advertising.
GAP Peripheral-only API function.

◆ Gap_StopAdvertising()

bleResult_t Gap_StopAdvertising ( void  )


Commands the controller to stop advertising.

Returns
gBleSuccess_c or error.
Remarks
GAP Peripheral-only API function.

◆ Gap_Authorize()

bleResult_t Gap_Authorize ( deviceId_t  deviceId,
uint16_t  handle,
gattDbAccessType_t  access 
)


Authorizes a peer for an attribute in the database.

Parameters
[in]deviceIdThe peer being authorized.
[in]handleThe attribute handle.
[in]accessThe type of access granted (gAccessRead_c or gAccessWrite_c).
Returns
gBleSuccess_c or error.
Remarks
This function executes synchronously.
GATT Server-only API function.

◆ Gap_SaveCccd()

bleResult_t Gap_SaveCccd ( deviceId_t  deviceId,
uint16_t  handle,
gattCccdFlags_t  cccd 
)


Save the CCCD value for a specific Client and CCCD handle.

Parameters
[in]deviceIdThe peer GATT Client.
[in]handleThe handle of the CCCD as defined in the GATT Database.
[in]cccdThe bit mask representing the CCCD value to be saved.
Returns
gBleSuccess_c or error.
Remarks
The GATT Server layer saves the CCCD value automatically when it is written by the Client. This API should only be used to save the CCCD in other situations, e.g., when for some reason the application decides to disable notifications/indications for a specific Client.
This function executes synchronously.
GATT Server-only API function.

◆ Gap_CheckNotificationStatus()

bleResult_t Gap_CheckNotificationStatus ( deviceId_t  deviceId,
uint16_t  handle,
bool_t *  pOutIsActive 
)


Retrieves the notification status for a given Client and a given CCCD handle.

Parameters
[in]deviceIdThe peer GATT Client.
[in]handleThe handle of the CCCD.
[out]pOutIsActiveThe address to store the status into.
Returns
gBleSuccess_c or error.
Remarks
This function executes synchronously.
GATT Server-only API function.

◆ Gap_CheckIndicationStatus()

bleResult_t Gap_CheckIndicationStatus ( deviceId_t  deviceId,
uint16_t  handle,
bool_t *  pOutIsActive 
)


Retrieves the indication status for a given Client and a given CCCD handle.

Parameters
[in]deviceIdThe peer GATT Client.
[in]handleThe handle of the CCCD.
[out]pOutIsActiveThe address to store the status into.
Returns
gBleSuccess_c or error.
Remarks
This function executes synchronously.
GATT Server-only API function.

◆ Gap_GetBondedStaticAddresses()

bleResult_t Gap_GetBondedStaticAddresses ( bleDeviceAddress_t aOutDeviceAddresses,
uint8_t  maxDevices,
uint8_t *  pOutActualCount 
)


Retrieves a list of the static addresses of bonded devices, if any.

Parameters
[out]aOutDeviceAddressesArray of addresses to be filled.
[in]maxDevicesMaximum number of addresses to be obtained.
[out]pOutActualCountThe actual number of addresses written.
Returns
gBleSuccess_c or error.
Remarks
This API may be used to create a white list.
This function executes synchronously.

◆ Gap_GetBondedDevicesIdentityInformation()

bleResult_t Gap_GetBondedDevicesIdentityInformation ( gapIdentityInformation_t aOutIdentityAddresses,
uint8_t  maxDevices,
uint8_t *  pOutActualCount 
)


Retrieves a list of the identity information of bonded devices, if any.

Parameters
[out]aOutIdentityAddressesArray of identities to be filled.
[in]maxDevicesMaximum number of identities to be obtained.
[out]pOutActualCountThe actual number of identities written.
Returns
gBleSuccess_c or error.
Remarks
This API may be useful when creating a white list or a resolving list (BLE 4.2 only).
This function executes synchronously.

◆ Gap_Pair()

bleResult_t Gap_Pair ( deviceId_t  deviceId,
gapPairingParameters_t pPairingParameters 
)


Initiates pairing with a peer device.

Parameters
[in]deviceIdThe peer to pair with.
[in]pPairingParametersPairing parameters as required by the SMP.
Returns
gBleSuccess_c or error.
Remarks
GAP Central-only API function.

◆ Gap_SendSlaveSecurityRequest()

bleResult_t Gap_SendSlaveSecurityRequest ( deviceId_t  deviceId,
bool_t  bondAfterPairing,
gapSecurityModeAndLevel_t  securityModeLevel 
)


Informs the peer Master about the local security requirements.

Parameters
[in]deviceIdThe GAP peer to pair with.
[in]bondAfterPairingSpecifies if bonding is supported.
[in]securityModeLevelThe level of security requested.
Returns
gBleSuccess_c or error.
Remarks
The procedure has the same parameters as the pairing request, but, because it is initiated by the Slave, it has no pairing effect. It only informs the Master about the requirements.
GAP Peripheral-only API function.

◆ Gap_EncryptLink()

bleResult_t Gap_EncryptLink ( deviceId_t  deviceId)


Encrypts the link with a bonded peer.

Parameters
[in]deviceIdDevice ID of the peer.
Returns
gBleSuccess_c or error.
Remarks
GAP Central-only API function.

◆ Gap_AcceptPairingRequest()

bleResult_t Gap_AcceptPairingRequest ( deviceId_t  deviceId,
gapPairingParameters_t pPairingParameters 
)


Accepts the pairing request from a peer.

Parameters
[in]deviceIdThe peer requesting authentication.
[in]pPairingParametersPairing parameters as required by the SMP.
Returns
gBleSuccess_c or error.
Remarks
This should be called in response to a gPairingRequest_c event.
GAP Peripheral-only API function.

◆ Gap_RejectPairing()

bleResult_t Gap_RejectPairing ( deviceId_t  deviceId,
gapAuthenticationRejectReason_t  reason 
)


Rejects the peer's authentication request.

Parameters
[in]deviceIdThe GAP peer who requested authentication.
[in]reasonReason why the current device rejects the authentication.
Returns
gBleSuccess_c or error.

◆ Gap_EnterPasskey()

bleResult_t Gap_EnterPasskey ( deviceId_t  deviceId,
uint32_t  passkey 
)


Enters the passkey requested by the peer during the pairing process.

Parameters
[in]deviceIdThe GAP peer that requested a passkey entry.
[in]passkeyThe peer's secret passkey.
Returns
gBleSuccess_c or error.

◆ Gap_ProvideOob()

bleResult_t Gap_ProvideOob ( deviceId_t  deviceId,
uint8_t *  aOob 
)


Provides the Out-Of-Band data for the SMP Pairing process.

Parameters
[in]deviceIdThe pairing device.
[in]aOobPointer to OOB data (array of gcSmpOobSize_d size).
Returns
gBleSuccess_c or error.

◆ Gap_RejectPasskeyRequest()

bleResult_t Gap_RejectPasskeyRequest ( deviceId_t  deviceId)


Rejects the passkey request from a peer.

Parameters
[in]deviceIdThe GAP peer that requested a passkey entry.
Returns
gBleSuccess_c or error.
Remarks
GAP Central-only API function.

◆ Gap_SendSmpKeys()

bleResult_t Gap_SendSmpKeys ( deviceId_t  deviceId,
gapSmpKeys_t pKeys 
)


Sends the SMP keys during the SMP Key Exchange procedure.

Parameters
[in]deviceIdThe GAP peer who initiated the procedure.
[in]pKeysThe SMP keys of the local device.
Returns
gBleSuccess_c or error.

◆ Gap_RejectKeyExchangeRequest()

bleResult_t Gap_RejectKeyExchangeRequest ( deviceId_t  deviceId)


Rejects the Key Exchange procedure with a paired peer.

Parameters
[in]deviceIdThe GAP peer who requested the Key Exchange procedure.
Returns
gBleSuccess_c or error.

◆ Gap_LeScRegeneratePublicKey()

bleResult_t Gap_LeScRegeneratePublicKey ( void  )


Regenerates the private/public key pair used for LE Secure Connections pairing.

Returns
gBleSuccess_c or error.
Remarks
The application should listen for the gLeScPublicKeyRegenerated_c generic event.
This API is available only in the Bluetooth 4.2 Host Stack.

◆ Gap_LeScValidateNumericValue()

bleResult_t Gap_LeScValidateNumericValue ( deviceId_t  deviceId,
bool_t  valid 
)


Validates the numeric value during the Numeric Comparison LE Secure Connections pairing.

Parameters
deviceIdDevice ID of the peer.
validTRUE if user has indicated that numeric values are matched, FALSE otherwise.
Returns
gBleSuccess_c or error.
Remarks
This API is available only in the Bluetooth 4.2 Host Stack.

◆ Gap_LeScGetLocalOobData()

bleResult_t Gap_LeScGetLocalOobData ( void  )


Retrieves local OOB data used for LE Secure Connections pairing.

Returns
gBleSuccess_c or error.
Remarks
The application should listen for the gLeScLocalOobData_c generic event.
This API is available only in the Bluetooth 4.2 Host Stack.

◆ Gap_LeScSetPeerOobData()

bleResult_t Gap_LeScSetPeerOobData ( deviceId_t  deviceId,
gapLeScOobData_t pPeerOobData 
)


Sets peer OOB data used for LE Secure Connections pairing.

Parameters
deviceIdDevice ID of the peer.
pPeerOobDataOOB data received from the peer.
Returns
gBleSuccess_c or error.
Remarks
This function should be called in response to the gConnEvtLeScOobData_c generic event.
This API is available only in the Bluetooth 4.2 Host Stack.

◆ Gap_LeScSendKeypressNotification()

bleResult_t Gap_LeScSendKeypressNotification ( deviceId_t  deviceId,
gapKeypressNotification_t  keypressNotification 
)


Sends a Keypress Notification to the peer.

Parameters
deviceIdDevice ID of the peer.
keypressNotificationValue of the Keypress Notification.
Returns
gBleSuccess_c or error.
Remarks
This function shall only be called during the passkey entry process and only if both peers support Keypress Notifications.
This API is available only in the Bluetooth 4.2 Host Stack.

◆ Gap_ProvideLongTermKey()

bleResult_t Gap_ProvideLongTermKey ( deviceId_t  deviceId,
uint8_t *  aLtk,
uint8_t  ltkSize 
)


Provides the Long Term Key (LTK) to the controller for encryption setup.

Parameters
[in]deviceIdThe GAP peer who requested encryption.
[in]aLtkThe Long Term Key.
[in]ltkSizeThe Long Term Key size.
Returns
gBleSuccess_c or error.
Remarks
The application should provide the same LTK used during bonding with the respective peer.
GAP Peripheral-only API function.

◆ Gap_DenyLongTermKey()

bleResult_t Gap_DenyLongTermKey ( deviceId_t  deviceId)


Rejects an LTK request originating from the controller.

Parameters
[in]deviceIdThe GAP peer who requested encryption.
Returns
gBleSuccess_c or error.
Remarks
GAP Peripheral-only API function.

◆ Gap_LoadEncryptionInformation()

bleResult_t Gap_LoadEncryptionInformation ( deviceId_t  deviceId,
uint8_t *  aOutLtk,
uint8_t *  pOutLtkSize 
)


Loads the encryption key for a bonded device.

Parameters
[in]deviceIdDevice ID of the peer.
[out]aOutLtkArray of size gcMaxLtkSize_d to be filled with the LTK.
[out]pOutLtkSizeThe LTK size.
Returns
gBleSuccess_c or error.
Remarks
This function executes synchronously.

◆ Gap_SetLocalPasskey()

bleResult_t Gap_SetLocalPasskey ( uint32_t  passkey)


Sets the SMP passkey for this device.

Parameters
[in]passkeyThe SMP passkey.
Returns
gBleSuccess_c or error.
Remarks
This is the PIN that the peer's user must enter during pairing.
This function executes synchronously.
GAP Peripheral-only API function.

◆ Gap_SetScanMode()

bleResult_t Gap_SetScanMode ( gapScanMode_t  scanMode,
gapAutoConnectParams_t pAutoConnectParams 
)


Sets internal scan filters and actions.

Parameters
[in]scanModeThe scan mode to be activated. Default is gDefaultScan_c.
[in]pAutoConnectParamsParameters for the Auto Connect Scan Mode.
Returns
gBleSuccess_c or error.
Remarks
This function can be called before Gap_StartScanning. If this function is never called, then the default value of gDefaultScan_c is considered and all scanned devices are reported to the application without any additional filtering or action.
This function executes synchronously.
GAP Central-only API function.

◆ Gap_StartScanning()

bleResult_t Gap_StartScanning ( gapScanningParameters_t pScanningParameters,
gapScanningCallback_t  scanningCallback 
)


Optionally sets the scanning parameters and begins scanning.

Parameters
[in]pScanningParametersThe scanning parameters; may be NULL.
[in]scanningCallbackThe scanning callback.
Returns
gBleSuccess_c or error.
Remarks
Use this API to both set the scanning parameters and start scanning. If pScanningParameters is NULL, scanning is started with the existing settings.
GAP Central-only API function.

◆ Gap_StopScanning()

bleResult_t Gap_StopScanning ( void  )


Commands the controller to stop scanning.

Returns
gBleSuccess_c or error.
Remarks
GAP Central-only API function.

◆ Gap_Connect()

bleResult_t Gap_Connect ( gapConnectionRequestParameters_t pParameters,
gapConnectionCallback_t  connCallback 
)


Connects to a scanned device.

Parameters
[in]pParametersCreate Connection command parameters.
[in]connCallbackCallback used to receive connection events.
Returns
gBleSuccess_c or error.
Remarks
GAP Central-only API function.

◆ Gap_Disconnect()

bleResult_t Gap_Disconnect ( deviceId_t  deviceId)


Initiates disconnection from a connected peer device.

Parameters
[in]deviceIdThe connected peer to disconnect from.
Returns
gBleSuccess_c or error.

◆ Gap_SaveCustomPeerInformation()

bleResult_t Gap_SaveCustomPeerInformation ( deviceId_t  deviceId,
void *  aInfo,
uint16_t  offset,
uint16_t  infoSize 
)


Saves custom peer information in raw data format.

Parameters
[in]deviceIdDevice ID of the GAP peer.
[in]aInfoPointer to the beginning of the data.
[in]offsetOffset from the beginning of the reserved memory area.
[in]infoSizeData size (maximum equal to gcReservedFlashSizeForCustomInformation_d).
Returns
gBleSuccess_c or error.
Remarks
This function can be called by the application to save custom information about the peer device, e.g., Service Discovery data (to avoid doing it again on reconnection).
This function executes synchronously.

◆ Gap_LoadCustomPeerInformation()

bleResult_t Gap_LoadCustomPeerInformation ( deviceId_t  deviceId,
void *  aOutInfo,
uint16_t  offset,
uint16_t  infoSize 
)


Loads the custom peer information in raw data format.

Parameters
[in]deviceIdDevice ID of the GAP peer.
[out]aOutInfoPointer to the beginning of the allocated memory.
[in]offsetOffset from the beginning of the reserved memory area.
[in]infoSizeData size (maximum equal to gcReservedFlashSizeForCustomInformation_d).
Returns
gBleSuccess_c or error.
Remarks
This function can be called by the application to load custom information about the peer device, e.g., Service Discovery data (to avoid doing it again on reconnection).
This function executes synchronously.

◆ Gap_CheckIfBonded()

bleResult_t Gap_CheckIfBonded ( deviceId_t  deviceId,
bool_t *  pOutIsBonded 
)


Returns whether or not a connected peer device is bonded.

Parameters
[in]deviceIdDevice ID of the GAP peer.
[out]pOutIsBondedBoolean to be filled with the bonded flag.
Returns
gBleSuccess_c or error.
Remarks
This function executes synchronously.

◆ Gap_ReadWhiteListSize()

bleResult_t Gap_ReadWhiteListSize ( void  )


Retrieves the size of the White List.

Returns
gBleSuccess_c or error.
Remarks
Response is received in the gWhiteListSizeReady_c generic event.

◆ Gap_ClearWhiteList()

bleResult_t Gap_ClearWhiteList ( void  )


Removes all addresses from the White List, if any.

Returns
gBleSuccess_c or error.
Remarks
Confirmation is received in the gWhiteListCleared_c generic event.

◆ Gap_AddDeviceToWhiteList()

bleResult_t Gap_AddDeviceToWhiteList ( bleAddressType_t  addressType,
bleDeviceAddress_t  address 
)


Adds a device address to the White List.

Parameters
[in]addressThe address of the white-listed device.
[in]addressTypeThe device address type (public or random).
Returns
gBleSuccess_c or error.

◆ Gap_RemoveDeviceFromWhiteList()

bleResult_t Gap_RemoveDeviceFromWhiteList ( bleAddressType_t  addressType,
bleDeviceAddress_t  address 
)


Removes a device address from the White List.

Parameters
[in]addressThe address of the white-listed device.
[in]addressTypeThe device address type (public or random).
Returns
gBleSuccess_c or error.

◆ Gap_ReadPublicDeviceAddress()

bleResult_t Gap_ReadPublicDeviceAddress ( void  )


Reads the device's public address from the controller.

Returns
gBleSuccess_c or error.
Remarks
The application should listen for the gPublicAddressRead_c generic event.

◆ Gap_CreateRandomDeviceAddress()

bleResult_t Gap_CreateRandomDeviceAddress ( uint8_t *  aIrk,
uint8_t *  aRandomPart 
)


Requests the controller to create a random address.

Parameters
[in]aIrkThe Identity Resolving Key to be used for a private resolvable address or NULL for a private non-resolvable address (fully random).
[in]aRandomPartIf aIrk is not NULL, this is a 3-byte array containing the Random Part of a Private Resolvable Address, in LSB to MSB order; the most significant two bits of the most significant byte (aRandomPart[3] & 0xC0) are ignored. This may be NULL, in which case the Random Part is randomly generated internally.
Returns
gBleSuccess_c or error.
Remarks
The application should listen for the gRandomAddressReady_c generic event. Note that this does not set the random address in the Controller. To set the random address, call Gap_SetRandomAddress() with the generated address contained in the event data.

◆ Gap_SaveDeviceName()

bleResult_t Gap_SaveDeviceName ( deviceId_t  deviceId,
uchar_t *  aName,
uint8_t  cNameSize 
)


Retrieves the name of a bonded device.

Parameters
[in]deviceIdDevice ID for the active peer which name is saved.
[in]aNameArray of characters holding the name.
[in]cNameSizeNumber of characters to be saved.
Returns
gBleSuccess_c or error.
Remarks
This function copies cNameSize characters from the aName array and adds the NULL character to terminate the string.
This function executes synchronously.

◆ Gap_GetBondedDevicesCount()

bleResult_t Gap_GetBondedDevicesCount ( uint8_t *  pOutBondedDevicesCount)


Retrieves the number of bonded devices.

Parameters
[out]pOutBondedDevicesCountPointer to integer to be written.
Returns
gBleSuccess_c or error.
Remarks
This function executes synchronously.

◆ Gap_GetBondedDeviceName()

bleResult_t Gap_GetBondedDeviceName ( uint8_t  nvmIndex,
uchar_t *  aOutName,
uint8_t  maxNameSize 
)


Retrieves the name of a bonded device.

Parameters
[in]nvmIndexIndex of the device in NVM bonding area.
[out]aOutNameDestination array to copy the name into.
[in]maxNameSizeMaximum number of characters to be copied, including the terminating NULL character.
Returns
gBleSuccess_c or error.
Remarks
nvmIndex is an integer ranging from 0 to N-1, where N is the number of bonded devices and can be obtained by calling Gap_GetBondedDevicesCount(&N).
This function executes synchronously.

◆ Gap_RemoveBond()

bleResult_t Gap_RemoveBond ( uint8_t  nvmIndex)


Removes the bond with a device.

Parameters
[in]nvmIndexIndex of the device in the NVM bonding area.
Returns
gBleSuccess_c or error.
Remarks
This API requires that there are no active connections at call time. nvmIndex is an integer ranging from 0 to N-1, where N is the number of bonded devices and can be obtained by calling Gap_GetBondedDevicesCount(&N).
This function executes synchronously.

◆ Gap_RemoveAllBonds()

bleResult_t Gap_RemoveAllBonds ( void  )


Removes all bonds with other devices.

Returns
gBleSuccess_c or error.
Remarks
This API requires that there are no active connections at call time.
This function executes synchronously.

◆ Gap_ReadRadioPowerLevel()

bleResult_t Gap_ReadRadioPowerLevel ( gapRadioPowerLevelReadType_t  txReadType,
deviceId_t  deviceId 
)


Reads the power level of the controller's radio.

Returns
gBleSuccess_c or error.
Remarks
The response is contained in the gConnEvtTxPowerLevelRead_c connection event when reading connection TX power level, the gAdvTxPowerLevelRead_c generic event when reading the advertising TX power level, or the gConnEvtRssiRead_c connection event when reading the RSSI.

◆ Gap_SetTxPowerLevel()

bleResult_t Gap_SetTxPowerLevel ( uint8_t  powerLevel,
bleTransmitPowerChannelType_t  channelType 
)


Sets the Tx power level on the controller's radio.

Parameters
[in]powerLevelPower level as specified in the controller interface.
[in]channelTypeThe advertising or connnection channel type.
Returns
gBleSuccess_c or error.
Remarks
The application should listen for the gTxPowerLevelSetComplete_c generic event.
This function executes synchronously.

◆ Gap_VerifyPrivateResolvableAddress()

bleResult_t Gap_VerifyPrivateResolvableAddress ( uint8_t  nvmIndex,
bleDeviceAddress_t  aAddress 
)


Verifies a Private Resolvable Address with a bonded device's IRK.

Parameters
[in]nvmIndexIndex of the device in NVM bonding area whose IRK must be checked.
[in]aAddressThe Private Resolvable Address to be verified.
Returns
gBleSuccess_c or error.
Remarks
nvmIndex is an integer ranging from 0 to N-1, where N is the number of bonded devices and can be obtained by calling Gap_GetBondedDevicesCount(&N); the application should listen to the gPrivateResolvableAddressVerified_c event.

◆ Gap_SetRandomAddress()

bleResult_t Gap_SetRandomAddress ( bleDeviceAddress_t  aAddress)


Sets a random address into the Controller.

Parameters
[in]aAddressThe Private Resolvable, Private Non-Resolvable, or Static Random Address.
Returns
gBleSuccess_c or error.
Remarks
The application should listen for the gRandomAddressSet_c generic event.

◆ Gap_SetDefaultPairingParameters()

bleResult_t Gap_SetDefaultPairingParameters ( gapPairingParameters_t pPairingParameters)


Sets the default pairing parameters to be used by automatic pairing procedures.

Parameters
[in]pPairingParametersPairing parameters as required by the SMP or NULL.
Returns
gBleSuccess_c or error.
Remarks
When these parameters are set, the Security Manager automatically responds to a Pairing Request or a Slave Security Request using these parameters. If NULL is provided, it returns to the default state where all security requests are sent to the application.
This function executes synchronously.

◆ Gap_UpdateConnectionParameters()

bleResult_t Gap_UpdateConnectionParameters ( deviceId_t  deviceId,
uint16_t  intervalMin,
uint16_t  intervalMax,
uint16_t  slaveLatency,
uint16_t  timeoutMultiplier,
uint16_t  minCeLength,
uint16_t  maxCeLength 
)


Request a set of new connection parameters

Parameters
[in]deviceIdThe DeviceID for which the command is intended
[in]intervalMinThe minimum value for the connection event interval
[in]intervalMaxThe maximum value for the connection event interval
[in]slaveLatencyThe slave latency parameter
[in]timeoutMultiplierThe connection timeout parameter
[in]minCeLengthThe minimum value for the connection event length
[in]maxCeLengthThe maximum value for the connection event length
Returns
gBleSuccess_c or error.
Precondition
A connection must be in place

◆ Gap_EnableUpdateConnectionParameters()

bleResult_t Gap_EnableUpdateConnectionParameters ( deviceId_t  deviceId,
bool_t  enable 
)


Update the connection parameters

Parameters
[in]deviceIdThe DeviceID for which the command is intended
[in]enableAllow/disallow the parameters update
Returns
Result of the operation
Precondition
A connection must be in place
Remarks
The LE master Host may accept the requested parameters or reject the request

◆ Gap_UpdateLeDataLength()

bleResult_t Gap_UpdateLeDataLength ( deviceId_t  deviceId,
uint16_t  txOctets,
uint16_t  txTime 
)


Update the Tx Data Length

Parameters
[in]deviceIdThe DeviceID for which the command is intended
[in]txOctetsMaximum transmission number of payload octets
[in]txTimeMaximum transmission time
Returns
Result of the operation
Precondition
A connection must be in place
Remarks
The response is contained in the gConnEvtLeDataLengthUpdated_c connection event.

◆ Gap_ControllerReset()

bleResult_t Gap_ControllerReset ( void  )


Resets the Controller.

Returns
gBleSuccess_c or error.
Remarks
The application should listen for the gControllerResetComplete_c generic event.
This function executes synchronously.

◆ Gap_EnableHostPrivacy()

bleResult_t Gap_EnableHostPrivacy ( bool_t  enable,
uint8_t *  aIrk 
)


Enables or disables Host Privacy (automatic regeneration of a Private Address).

Parameters
enableTRUE to enable, FALSE to disable.
aIrkLocal IRK to be used for Resolvable Private Address generation or NULL for Non-Resolvable Private Address generation. Ignored if enable is FALSE.
Returns
gBleSuccess_c or error.
Remarks
This function executes synchronously.

◆ Gap_EnableControllerPrivacy()

bleResult_t Gap_EnableControllerPrivacy ( bool_t  enable,
uint8_t *  aOwnIrk,
uint8_t  peerIdCount,
gapIdentityInformation_t aPeerIdentities 
)


Enables or disables Controller Privacy (Enhanced Privacy feature).

Parameters
enableTRUE to enable, FALSE to disable.
aOwnIrkLocal IRK. Ignored if enable is FALSE, otherwise shall not be NULL.
peerIdCountSize of aPeerIdentities array. Shall not be zero or greater than gcGapControllerResolvingListSize_c. Ignored if enable is FALSE.
aPeerIdentitiesArray of peer identity addresses and IRKs. Ignored if enable is FALSE, otherwise shall not be NULL.
Returns
gBleSuccess_c or error.
Remarks
The application should listen for the gControllerPrivacyStateChanged_c generic event.

◆ Gap_ControllerTest()

bleResult_t Gap_ControllerTest ( gapControllerTestCmd_t  testCmd,
uint8_t  radioChannel,
uint8_t  txDataLength,
gapControllerTestTxType_t  txPayloadType 
)


Commands a Controller Test procedure.

Parameters
testCmdCommand type - "start TX test", "start RX test" or "end test".
radioChannelRadio channel index. Valid range: 0-39. Frequency will be F[MHz] = 2402 + 2 * index. Effective range: 2402-2480 MHz. Ignored if command is "end test".
txDataLengthSize of packet payload for TX tests. Ignored if command is "start RX test" or "end test".
txPayloadTypeType of packet payload for TX tests. Ignored if command is "start RX test" or "end test".
Returns
gBleSuccess_c or error.
Remarks
The application should listen for the gControllerTestEvent_c generic event.
This API function is available only in the full-featured host library.