Bluetooth Low Energy Host Stack  Rev. 4
API Reference Manual
ble_general.h File Reference
#include <stdint.h>
#include "EmbeddedTypes.h"
#include "FunctionLib.h"
#include "fsl_os_abstraction.h"
#include "ble_constants.h"
#include "ble_utils.h"
#include "ble_sig_defines.h"

Data Structures

struct  bleIdentityAddress_t
 
union  bleUuid_t
 
struct  bleAdvertisingChannelMap_t
 
struct  gapLeScOobData_t
 
struct  gapInternalError_t
 
struct  gapControllerTestEvent_t
 
struct  gapGenericEvent_t
 
struct  bleBondIdentityHeaderBlob_t
 
struct  bleBondDataDynamicBlob_t
 
struct  bleBondDataStaticBlob_t
 
struct  bleBondDataDeviceInfoBlob_t
 
struct  bleBondDataDescriptorBlob_t
 
struct  bleBondDataBlob_t
 
union  gapGenericEvent_t.eventData
 

Macros

#define gInvalidDeviceId_c
 
#define gcConnectionIntervalMin_c
 
#define gcConnectionIntervalMax_c
 
#define gcConnectionSlaveLatencyMax_c
 
#define gcConnectionSupervisionTimeoutMin_c
 
#define gcConnectionSupervisionTimeoutMax_c
 
#define gcConnectionIntervalMinDefault_c
 
#define gcConnectionIntervalMaxDefault_c
 
#define gcConnectionSlaveLatencyDefault_c
 
#define gcConnectionSupervisionTimeoutDefault_c
 
#define gcConnectionEventMinDefault_c
 
#define gcConnectionEventMaxDefault_c
 
#define Ble_IsPrivateResolvableDeviceAddress(bleAddress)
 
#define Ble_IsPrivateNonresolvableDeviceAddress(bleAddress)
 
#define Ble_IsRandomStaticDeviceAddress(bleAddress)
 
#define Ble_DeviceAddressesMatch(bleAddress1, bleAddress2)
 
#define Ble_CopyDeviceAddress(destinationAddress, sourceAddress)
 

Typedefs

typedef uint8_t deviceId_t
 
typedef uint8_t bleDeviceAddress_t[gcBleDeviceAddressSize_c]
 
typedef void(* gapGenericCallback_t) (gapGenericEvent_t *pGenericEvent)
 
typedef bleResult_t(* hciHostToControllerInterface_t) (hciPacketType_t packetType, void *pPacket, uint16_t packetSize)
 

Enumerations

enum  bleResult_t {
  gBleStatusBase_c, gBleSuccess_c, gBleInvalidParameter_c, gBleOverflow_c,
  gBleUnavailable_c, gBleFeatureNotSupported_c, gBleOutOfMemory_c, gBleAlreadyInitialized_c,
  gBleOsError_c, gBleUnexpectedError_c, gBleInvalidState_c, gHciStatusBase_c,
  gHciSuccess_c, gHciUnknownHciCommand_c, gHciUnknownConnectionIdentifier_c, gHciHardwareFailure_c,
  gHciPageTimeout_c, gHciAuthenticationFailure_c, gHciPinOrKeyMissing_c, gHciMemoryCapacityExceeded_c,
  gHciConnectionTimeout_c, gHciConnectionLimitExceeded_c, gHciSynchronousConnectionLimitToADeviceExceeded_c, gHciAclConnectionAlreadyExists_c,
  gHciCommandDisallowed_c, gHciConnectionRejectedDueToLimitedResources_c, gHciConnectionRejectedDueToSecurityReasons_c, gHciConnectionRejectedDueToUnacceptableBdAddr_c,
  gHciConnectionAcceptTimeoutExceeded_c, gHciUnsupportedFeatureOrParameterValue_c, gHciInvalidHciCommandParameters_c, gHciRemoteUserTerminatedConnection_c,
  gHciRemoteDeviceTerminatedConnectionLowResources_c, gHciRemoteDeviceTerminatedConnectionPowerOff_c, gHciConnectionTerminatedByLocalHost_c, gHciRepeatedAttempts_c,
  gHciPairingNotAllowed_c, gHciUnknownLpmPdu_c, gHciUnsupportedRemoteFeature_c, gHciScoOffsetRejected_c,
  gHciScoIntervalRejected_c, gHciScoAirModeRejected_c, gHciInvalidLpmParameters_c, gHciUnspecifiedError_c,
  gHciUnsupportedLpmParameterValue_c, gHciRoleChangeNotAllowed_c, gHciLLResponseTimeout_c, gHciLmpErrorTransactionCollision_c,
  gHciLmpPduNotAllowed_c, gHciEncryptionModeNotAcceptable_c, gHciLinkKeyCannotBeChanged_c, gHciRequestedQosNotSupported_c,
  gHciInstantPassed_c, gHciPairingWithUnitKeyNotSupported_c, gHciDifferentTransactionCollision_c, gHciReserved_0x2B_c,
  gHciQosNotAcceptableParameter_c, gHciQosRejected_c, gHciChannelClassificationNotSupported_c, gHciInsufficientSecurity_c,
  gHciParameterOutOfMandatoryRange_c, gHciReserved_0x31_c, gHciRoleSwitchPending_c, gHciReserved_0x33_c,
  gHciReservedSlotViolation_c, gHciRoleSwitchFailed_c, gHciExtendedInquiryResponseTooLarge_c, gHciSecureSimplePairingNotSupportedByHost_c,
  gHciHostBusyPairing_c, gHciConnectionRejectedDueToNoSuitableChannelFound_c, gHciControllerBusy_c, gHciUnacceptableConnectionParameters_c,
  gHciDirectedAdvertisingTimeout_c, gHciConnectionTerminatedDueToMicFailure_c, gHciConnectionFailedToBeEstablished_c, gHciMacConnectionFailed_c,
  gHciCoarseClockAdjustmentRejected_c, gHciAlreadyInit_c, gHciInvalidParameter_c, gHciCallbackNotInstalled_c,
  gHciCallbackAlreadyInstalled_c, gHciCommandNotSupported_c, gHciEventNotSupported_c, gHciTransportError_c,
  gCtrlStatusBase_c, gCtrlSuccess_c, gL2caStatusBase_c, gL2caSuccess_c,
  gL2caAlreadyInit_c, gL2caInsufficientResources_c, gL2caCallbackNotInstalled_c, gL2caCallbackAlreadyInstalled_c,
  gL2caLePsmInvalid_c, gL2caLePsmAlreadyRegistered_c, gL2caLePsmNotRegistered_c, gL2caLePsmInsufficientResources_c,
  gL2caChannelInvalid_c, gL2caChannelClosed_c, gL2caChannelAlreadyConnected_c, gL2caConnectionParametersRejected_c,
  gL2caChannelBusy_c, gL2caInvalidParameter_c, gL2caError_c, gSmStatusBase_c,
  gSmSuccess_c, gSmNullCBFunction_c, gSmCommandNotSupported_c, gSmUnexpectedCommand_c,
  gSmInvalidCommandCode_c, gSmInvalidCommandLength_c, gSmInvalidCommandParameter_c, gSmInvalidDeviceId_c,
  gSmInvalidInternalOperation_c, gSmInvalidConnectionHandle_c, gSmInproperKeyDistributionField_c, gSmUnexpectedKeyType_c,
  gSmUnexpectedPairingTerminationReason_c, gSmUnexpectedKeyset_c, gSmSmpTimeoutOccurred_c, gSmUnknownSmpPacketType_c,
  gSmInvalidSmpPacketLength_c, gSmInvalidSmpPacketParameter_c, gSmReceivedUnexpectedSmpPacket_c, gSmReceivedSmpPacketFromUnknownDevice_c,
  gSmReceivedUnexpectedHciEvent_c, gSmReceivedHciEventFromUnknownDevice_c, gSmInvalidHciEventParameter_c, gSmLlConnectionEncryptionInProgress_c,
  gSmLlConnectionEncryptionFailure_c, gSmInsufficientResources_c, gSmOobDataAddressMismatch_c, gSmSmpPacketReceivedAfterTimeoutOccurred_c,
  gSmReceivedTimerEventForUnknownDevice_c, gSmUnattainableLocalDeviceSecRequirements_c, gSmUnattainableLocalDeviceMinKeySize_c, gSmUnattainableSlaveSecReqRequirements_c,
  gSmPairingErrorPasskeyEntryFailed_c, gSmPairingErrorConfirmValueFailed_c, gSmPairingErrorCommandNotSupported_c, gSmPairingErrorInvalidParameters_c,
  gSmPairingErrorUnknownReason_c, gSmTbResolvableAddressDoesNotMatchIrk_c, gSmTbInvalidDataSignature_c, gAttStatusBase_c,
  gAttSuccess_c, gGattStatusBase_c, gGattSuccess_c, gGattAnotherProcedureInProgress_c,
  gGattLongAttributePacketsCorrupted_c, gGattMultipleAttributesOverflow_c, gGattUnexpectedReadMultipleResponseLength_c, gGattInvalidValueLength_c,
  gGattServerTimeout_c, gGattIndicationAlreadyInProgress_c, gGattClientConfirmationTimeout_c, gGapStatusBase_c,
  gGapSuccess_c, gGapAdvDataTooLong_c, gGapScanRspDataTooLong_c, gGapDeviceNotBonded_c,
  gDevDbStatusBase_c, gDevDbSuccess_c, gDevDbCccdLimitReached_c, gDevDbCccdNotFound_c,
  gGattDbStatusBase_c, gGattDbSuccess_c, gGattDbInvalidHandle_c, gGattDbCharacteristicNotFound_c,
  gGattDbCccdNotFound_c, gGattDbServiceNotFound_c, gGattDbDescriptorNotFound_c
}
 
enum  bleAddressType_t { gBleAddrTypePublic_c, gBleAddrTypeRandom_c }
 
enum  bleUuidType_t { gBleUuidType16_c, gBleUuidType128_c, gBleUuidType32_c }
 
enum  bleAdvertisingType_t {
  gAdvConnectableUndirected_c, gAdvDirectedHighDutyCycle_c, gAdvScannable_c, gAdvNonConnectable_c,
  gAdvDirectedLowDutyCycle_c
}
 
enum  bleAdvertisingFilterPolicy_t { gBleAdvFilterAllowScanFromAnyAllowConnFromAny_c, gBleAdvFilterAllowScanFromWLAllowConnFromAny_c, gBleAdvFilterAllowScanFromAnyAllowConnFromWL_c, gBleAdvFilterAllowScanFromWLAllowConnFromWL_c }
 
enum  bleLlConnectionRole_t { gBleLlConnectionMaster_c, gBleLlConnectionSlave_c }
 
enum  bleMasterClockAccuracy_t {
  gBleMasterClkAcc500ppm_c, gBleMasterClkAcc250ppm_c, gBleMasterClkAcc150ppm_c, gBleMasterClkAcc100ppm_c,
  gBleMasterClkAcc75ppm_c, gBleMasterClkAcc50ppm_c, gBleMasterClkAcc30ppm_c, gBleMasterClkAcc20ppm_c
}
 
enum  bleAdvertisingReportEventType_t {
  gBleAdvRepAdvInd_c, gBleAdvRepAdvDirectInd_c, gBleAdvRepAdvScanInd_c, gBleAdvRepAdvNonconnInd_c,
  gBleAdvRepScanRsp_c
}
 
enum  hciPacketType_t { gHciCommandPacket_c, gHciDataPacket_c, gHciSynchronousDataPacket_c, gHciEventPacket_c }
 
enum  bleScanType_t { gScanTypePassive_c, gScanTypeActive_c }
 
enum  bleScanningFilterPolicy_t { gScanAll_c, gScanWithWhiteList_c }
 
enum  bleInitiatorFilterPolicy_t { gUseDeviceAddress_c, gUseWhiteList_c }
 
enum  bleTransmitPowerLevelType_t { gReadCurrentTxPowerLevel_c, gReadMaximumTxPowerLevel_c }
 
enum  bleTransmitPowerChannelType_t { gTxPowerAdvChannel_c, gTxPowerConnChannel_c }
 
enum  bleChannelFrequency_t {
  gBleFreq2402MHz_c, gBleFreq2404MHz_c, gBleFreq2406MHz_c, gBleFreq2408MHz_c,
  gBleFreq2410MHz_c, gBleFreq2412MHz_c, gBleFreq2414MHz_c, gBleFreq2416MHz_c,
  gBleFreq2418MHz_c, gBleFreq2420MHz_c, gBleFreq2422MHz_c, gBleFreq2424MHz_c,
  gBleFreq2426MHz_c, gBleFreq2428MHz_c, gBleFreq2430MHz_c, gBleFreq2432MHz_c,
  gBleFreq2434MHz_c, gBleFreq2436MHz_c, gBleFreq2438MHz_c, gBleFreq2440MHz_c,
  gBleFreq2442MHz_c, gBleFreq2444MHz_c, gBleFreq2446MHz_c, gBleFreq2448MHz_c,
  gBleFreq2450MHz_c, gBleFreq2452MHz_c, gBleFreq2454MHz_c, gBleFreq2456MHz_c,
  gBleFreq2458MHz_c, gBleFreq2460MHz_c, gBleFreq2462MHz_c, gBleFreq2464MHz_c,
  gBleFreq2466MHz_c, gBleFreq2468MHz_c, gBleFreq2470MHz_c, gBleFreq2472MHz_c,
  gBleFreq2474MHz_c, gBleFreq2476MHz_c, gBleFreq2478MHz_c, gBleFreq2480MHz_c
}
 
enum  bleTxTestPacketPayload_t {
  gBleTestPacketPayloadPrbs9_c, gBleTestPacketPayloadPattern11110000_c, gBleTestPacketPayloadPattern10101010_c, gBleTestPacketPayloadPrbs15_c,
  gBleTestPacketPayloadPatternAllBits1_c, gBleTestPacketPayloadPatternAllBits0_c, gBleTestPacketPayloadPattern00001111_c, gBleTestPacketPayloadPattern01010101_c
}
 
enum  bleHardwareErrorCode_t { bleHwErrCodeNoError_c }
 
enum  gapGenericEventType_t {
  gInitializationComplete_c, gInternalError_c, gAdvertisingSetupFailed_c, gAdvertisingParametersSetupComplete_c,
  gAdvertisingDataSetupComplete_c, gWhiteListSizeRead_c, gDeviceAddedToWhiteList_c, gDeviceRemovedFromWhiteList_c,
  gWhiteListCleared_c, gRandomAddressReady_c, gCreateConnectionCanceled_c, gPublicAddressRead_c,
  gAdvTxPowerLevelRead_c, gPrivateResolvableAddressVerified_c, gRandomAddressSet_c, gControllerResetComplete_c,
  gLeScPublicKeyRegenerated_c, gLeScLocalOobData_c, gControllerPrivacyStateChanged_c, gControllerTestEvent_c,
  gTxPowerLevelSetComplete_c
}
 
enum  gapInternalErrorSource_t {
  gHciCommandStatus_c, gCheckPrivateResolvableAddress_c, gVerifySignature_c, gAddNewConnection_c,
  gResetController_c, gSetEventMask_c, gReadLeBufferSize_c, gSetLeEventMask_c,
  gReadDeviceAddress_c, gReadLocalSupportedFeatures_c, gReadWhiteListSize_c, gClearWhiteList_c,
  gAddDeviceToWhiteList_c, gRemoveDeviceFromWhiteList_c, gCancelCreateConnection_c, gReadRadioPower_c,
  gSetRandomAddress_c, gCreateRandomAddress_c, gEncryptLink_c, gProvideLongTermKey_c,
  gDenyLongTermKey_c, gConnect_c, gDisconnect_c, gTerminatePairing_c,
  gSendSlaveSecurityRequest_c, gEnterPasskey_c, gProvideOob_c, gSendSmpKeys_c,
  gWriteSuggestedDefaultDataLength_c, gReadSuggestedDefaultDataLength_c, gUpdateLeDataLength_c, gEnableControllerPrivacy_c,
  gLeScSendKeypressNotification_c, gLeScSetPeerOobData_c, gLeScGetLocalOobData_c, gLeScValidateNumericValue_c,
  gLeScRegeneratePublicKey_c, gLeSetResolvablePrivateAddressTimeout_c, gDefaultPairingProcedure_c, gLeControllerTest_c
}
 
enum  gapControllerTestEventType_t { gControllerReceiverTestStarted_c, gControllerTransmitterTestStarted_c, gControllerTestEnded_c }
 

Functions

bleResult_t Ble_HostInitialize (gapGenericCallback_t genericCallback, hciHostToControllerInterface_t hostToControllerInterface)
 
bleResult_t Ble_HciRecv (hciPacketType_t packetType, void *pPacket, uint16_t packetSize)
 

Detailed Description

Copyright (c) 2014, Freescale Semiconductor, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

o Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

o Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

o Neither the name of Freescale Semiconductor, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.