COMMON IO-BLE v1.0.0
Hardware abstraction layer for Bluetooth
 
Loading...
Searching...
No Matches
bt_hal_manager.h File Reference

BT provides the interfaces to control the Bluetooth device. ,local device control and device discovery functionalities. More...

#include <stdint.h>
#include <stddef.h>
#include "bt_hal_manager_types.h"

Go to the source code of this file.

Data Structures

struct  BTPinCode_t
 Bluetooth PinKey Code, Valid only for BT legacy. More...
 
struct  BTProperty_t
 Bluetooth Adapter Property data structure. More...
 
struct  BTOutOfBandData_t
 Bluetooth Out Of Band data for bonding. More...
 
struct  BTActivityEnergyInfo
 Energy info. More...
 
struct  BTUidTraffic_t
 UUID traffic info. More...
 
struct  BTCallbacks_t
 Bluetooth DM callback structure. More...
 
struct  BTInterface_t
 Represents the standard SAL device management interface. More...
 

Macros

#define btMAJOR_VERSION   5
 Incompatible API changes without backward compatibility.
 
#define btMINOR_VERSION   1
 Add new functionality with backward compatibility.
 
#define btPATCH_VERSION   0
 Make changes in the API with backward compatibility.
 
#define btSTRING_VERSION   btSTR( btMAJOR_VERSION, btMINOR_VERSION, btPATCH_VERSION )
 Stringified version number.
 
#define btBLE_ADD_BLOB_SERVICE_SUPPORTED_BIT   0x0001
 
#define btBLE_ADD_BLE_DYNAMIC_PRIVACY   0x0002
 
#define btBLE_BLE_CENTRAL_WHITELISTING   0x0004
 

Typedefs

typedef uint8_t BTSecurityLevel_t
 
typedef uint8_t BTAuthReq_t
 
typedef void(* BTDeviceStateChangedCallback_t) (BTState_t xState)
 Bluetooth state change Callback. Invoked on pxEnable/pxDisable.
 
typedef void(* BTDevicePropertiesCallback_t) (BTStatus_t xStatus, uint32_t ulNumProperties, BTProperty_t *pxProperties)
 GET/SET local device Properties callback.
 
typedef void(* BTRemoteDevicePropertiesCallback_t) (BTStatus_t xStatus, BTBdaddr_t *pxBdAddr, uint32_t ulNumProperties, BTProperty_t *pxProperties)
 GET/SET Remote Device Properties callback. Invoked on pxGetRemoteDeviceProperty, pxSetRemoteDeviceProperty, pxGetAllRemoteDeviceProperties.
 
typedef void(* BTPinRequestCallback_t) (BTBdaddr_t *pxRemoteBdAddr, BTBdname_t *pxBdName, uint32_t ulCod, uint8_t ucMin16Digit)
 Callback Invoked on Pin Request.
 
typedef void(* BTSspRequestCallback_t) (BTBdaddr_t *pxRemoteBdAddr, BTBdname_t *pxRemoteBdName, uint32_t ulCod, BTSspVariant_t xPairingVariant, uint32_t ulPassKey)
 Callback Invoked on SSP event.
 
typedef void(* BTPairingStateChangedCallback_t) (BTStatus_t xStatus, BTBdaddr_t *pxRemoteBdAddr, BTBondState_t xState, BTSecurityLevel_t xSecurityLevel, BTAuthFailureReason_t xReason)
 Bluetooth pairing state changed event callback. Invoked in response to create_bond, cancel_bond or remove_bond reason field is valid only in case of xStatus == eBTStatusFail. Invoked on pairing event.
 
typedef void(* BTEnergyInfoCallback_t) (BTActivityEnergyInfo *pxEnergyInfo, BTUidTraffic_t *pxUidData)
 Callback invoked on pxReadEnergyInfo. Invoked on pxReadEnergyInfo.
 
typedef void(* BTDutModeRecvCallback_t) (uint16_t usOpcode, uint8_t *pucBuf, size_t xLen)
 Bluetooth Test Mode Callback. Invoked when remote device uses pxDutModeSend.
 
typedef void(* BTLeTestModeCallback_t) (BTStatus_t xStatus, uint16_t usNumPackets)
 LE Test mode callbacks. Invoked on pxLeTestMode.
 
typedef void(* BTReadRssiCallback_t) (BTBdaddr_t *pxBda, uint32_t ulRssi, BTStatus_t xStatus)
 Read RSSI Callback. Invoked on pxReadRssi.
 
typedef void(* BTSlaveSecurityRequestCallBack_t) (BTBdaddr_t *pxBda, BTSecurityLevel_t xSecurityLevel, bool bBonding)
 Security request callback. Invoked on master from remote slave security request event.
 
typedef void(* BTTxPowerCallback_t) (BTBdaddr_t *pxBda, BTTransport_t xTransport, uint8_t ucTxPowerValue, BTStatus_t xStatus)
 TX power Callback. Invoked on pxGetTxpower.
 
typedef void(* BTBondedCallback_t) (BTStatus_t xStatus, BTBdaddr_t *pxRemoteBdAddr, bool bIsBonded)
 
typedef void(* BTAclStateChangedCallback_t) (BTStatus_t xStatus, const BTBdaddr_t *pxRemoteBdAddr, BTAclState_t xState, BTTransport_t xTransport, BTAclDisconnectReason_t xReason)
 Callback invoked in response to ACL connection state change.
 

Enumerations

enum  { eBTSecLevelNoSecurity = 0x01 , eBTSecLevelUnauthenticatedPairing = 0x02 , eBTSecLevelAuthenticatedPairing = 0x03 , eBTSecLevelSecureConnect = 0x04 }
 Security Level. More...
 
enum  { eBTAuthReqBonding = 0x01 , eBTAuthReqMitm = 0x03 , eBTAuthReqSecureConnect = 0x04 , eBTAuthReqKeyPress = 0x05 }
 Authentication requirement. More...
 
enum  BTTransport_t { BTTransportAuto = 0 , BTTransportBredr = 1 , BTTransportLe = 2 }
 Preferred physical Transport for GATT connection . More...
 
enum  BTState_t { eBTstateOff , eBTstateOn }
 Bluetooth power State. More...
 
enum  BTAuthFailureReason_t {
  eBTauthSuccess = 0x00 , eBTauthFailLmpRespTimeout = 0x01 , eBTauthFailKeyMissing = 0x02 , eBTauthFailEncrypMode = 0x03 ,
  eBTauthFailUnitKey = 0x04 , eBTauthFailSmpCfrmValue = 0x05 , eBTauthFailSmpEnc = 0x06 , eBTauthFailSmpTimeout = 0x07 ,
  eBTauthFailPageTimeout = 0x08 , eBTauthFailSmpPasskeyFail = 0x09 , eBTauthFailSmpOobFail = 0x0A , eBTauthFailSmpFail = 0x0B ,
  eBTauthFailConnTimeout = 0x0C , eBTauthFailSmp = 0x0D , eBTauthFailSmpPairNotSupport = 0x0E , eBTauthFailSmpUnknownIo = 0x0F ,
  eBTauthFailSmpUnknown = 0x10 , eBTauthFailHostRejectSecurity = 0x11 , eBTauthFailInsuffSecurity = 0x12 , eBTauthFailPeerUser = 0x13 ,
  eBTauthFailUnspecified = 0x14 , eBTauthFailSmpAuthReqFail = 0x15 , eBTauthFailSmpEncKeySize = 0x16 , eBTauthFailSmpCmdNotSupport = 0x17 ,
  eBTauthFailSmpRepeatedAttempt = 0x18 , eBTauthFailSmpInvalidParameters = 0x19 , eBTauthFailSmpDhkeyCheckFail = 0x1A , eBTauthFailSmpNumericComparFail = 0x1B ,
  eBTauthFailSmpBrPairInProg = 0x1C , eBTauthFailSmpXtransDeriveNotAllow = 0x1D , eBTauthFailStackErr = 0x100 , eBTauthFailHciErr = 0x200
}
 Authentication failure reasons. More...
 
enum  BTPropertyType_t {
  eBTpropertyBdname = 0x1 , eBTpropertyBdaddr , eBTpropertyTypeOfDevice , eBTpropertyAdapterBondedDevices ,
  eBTpropertyRemoteFriendlyName , eBTpropertyRemoteRssi , eBTpropertyRemoteVersionInfo , eBTpropertyLocalMTUSize ,
  eBTpropertyBondable , eBTpropertyIO , eBTpropertyConnectable , eBTpropertySecureConnectionOnly
}
 Bluetooth local device and Remote Device property types. Properties common to both adapter and remote device. More...
 
enum  BTDeviceType_t { eBTdeviceDevtypeBredr = 0x1 , eBTdeviceDevtypeBle , eBTdeviceDevtypeDual }
 Bluetooth Device Type. More...
 
enum  BTBondState_t { eBTbondStateNone , eBTbondStateBonding , eBTbondStateBonded }
 Bluetooth Bond state. More...
 
enum  BTSspVariant_t { eBTsspVariantPasskeyConfirmation , eBTsspVariantPasskeyEntry , eBTsspVariantConsent , eBTsspVariantPasskeyNotification }
 Bluetooth SSP Bonding Variant. More...
 
enum  BTAclState_t { eBTaclConnected = 0 , eBTaclDisconnected = 1 }
 Bluetooth ACL connection state. More...
 
enum  BTAclDisconnectReason_t {
  eBTaclSuccess = 0x00 , eBTaclIllegalCommand = 0x01 , eBTaclNoConnection = 0x02 , eBTaclHwFailure = 0x03 ,
  eBTaclPageTimeout = 0x04 , eBTaclAuthFailure = 0x05 , eBTaclKeyMissing = 0x06 , eBTaclMemFull = 0x07 ,
  eBTaclConnectionTimeout = 0x08 , eBTaclMaxNumOfConnections = 0x09 , eBTaclMaxNumOfScos = 0x0A , eBTaclConnectionExists = 0x0B ,
  eBTaclCommandDisallowed = 0x0C , eBTaclHostRejectResource = 0x0D , eBTaclHostRejectSecurity = 0x0E , eBTaclHostRejectDevice = 0x0F ,
  eBTaclHostTimeout = 0x10 , eBTaclUnsupportedValue = 0x11 , eBTaclIllegalParameterFmt = 0x12 , eBTaclPeerUser = 0x13 ,
  eBTaclPeerLowResources = 0x14 , eBTaclPeerPowerOff = 0x15 , eBTaclHostUser = 0x16 , eBTaclRepeatedAttempts = 0x17 ,
  eBTaclPairingNotAllowed = 0x18 , eBTaclUnknownLmpPdu = 0x19 , eBTaclUnsupportedRemFeature = 0x1A , eBTaclScoOffsetRejected = 0x1B ,
  eBTaclScoIntervalRejected = 0x1C , eBTaclScoAirRejected = 0x1D , eBTaclInvalidLmpParam = 0x1E , eBTaclUnspecified = 0x1F ,
  eBTaclUnsupportedLmpFeature = 0x20 , eBTaclRoleChangeNotAllowed = 0x21 , eBTaclLmpResponseTimeout = 0x22 , eBTaclLmpErrTransCollision = 0x23 ,
  eBTaclLmpPduNotAllowed = 0x24 , eBTaclEncryModeNotAcceptable = 0x25 , eBTaclUnitKeyUsed = 0x26 , eBTaclQosNotSupported = 0x27 ,
  eBTaclInstantPassed = 0x28 , eBTaclPairingWithUnitKeyNotSupported = 0x29 , eBTaclDiffTransactionCollision = 0x2A , eBTaclQosUnacceptableParam = 0x2C ,
  eBTaclQosRejected = 0x2D , eBTaclChanClassifNotSupported = 0x2E , eBTaclInsuffcientSecurity = 0x2F , eBTaclParamOutOfRange = 0x30 ,
  eBTaclRoleSwitchPending = 0x32 , eBTaclReservedSlotViolation = 0x34 , eBTaclRoleSwitchFailed = 0x35 , eBTaclInqRspDataTooLarge = 0x36 ,
  eBTaclSimplePairingNotSupported = 0x37 , eBTaclHostBusyPairing = 0x38 , eBTaclRejNoSuitableChannel = 0x39 , eBTaclControllerBusy = 0x3A ,
  eBTaclUnacceptConnInterval = 0x3B , eBTaclDirectedAdvertisingTimeout = 0x3C , eBTaclConnToutDueToMicFailure = 0x3D , eBTaclConnFailedEstablishment = 0x3E ,
  eBTaclMacConnectionFailed = 0x3F
}
 Bluetooth ACL Disconnect Reason From Bluetooth Core Spec 5.0 Vol 2, Part D Error Codes Unknown disconnect reason will be treated as eBTaclUnspecified. More...
 

Functions

const BTInterface_tBTGetBluetoothInterface (void)
 

Detailed Description

BT provides the interfaces to control the Bluetooth device. ,local device control and device discovery functionalities.

The common generic access profile is the starting point of Bluetooth API. The flow is the following:

  1. pxBtManagerInit
  2. pxEnable (if wished)
  3. pxGetClassicAdapter or/and pxGetLEAdapter to initialize them

Macro Definition Documentation

◆ btBLE_ADD_BLOB_SERVICE_SUPPORTED_BIT

#define btBLE_ADD_BLOB_SERVICE_SUPPORTED_BIT   0x0001

Stack feature support bit mask Support GATT server database decleration as a blob.

◆ btBLE_ADD_BLE_DYNAMIC_PRIVACY

#define btBLE_ADD_BLE_DYNAMIC_PRIVACY   0x0002

Stack can dynamicall enable or disable privacy.

◆ btBLE_BLE_CENTRAL_WHITELISTING

#define btBLE_BLE_CENTRAL_WHITELISTING   0x0004

Provide a mechanism to manage whitelist for Gatt server.

Typedef Documentation

◆ BTSecurityLevel_t

typedef uint8_t BTSecurityLevel_t

BT Security Level.

◆ BTAuthReq_t

typedef uint8_t BTAuthReq_t

BT Authentication Requirement.

◆ BTBondedCallback_t

typedef void(* BTBondedCallback_t) (BTStatus_t xStatus, BTBdaddr_t *pxRemoteBdAddr, bool bIsBonded)

Function Documentation

◆ BTGetBluetoothInterface()

const BTInterface_t * BTGetBluetoothInterface ( void  )

Gets the BT Adapter interface.

Returns
BTInterface_t if the operation is successful, else NULL.