Infineon Logo AIROC BTSDK v4.6 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
Controller Manager

Bluetooth LE Controller Manager functions. More...

Functions

void blecm_init (void)
 BLECM Initialization. More...
 
void blecm_start (void)
 BLECM Start. More...
 
void blecm_setFilterEnable (UINT8 enable)
 Enable/Disable CFA filter. More...
 
UINT8 blecm_getFilterEnable (void)
 Reading current CFA filter value. More...
 
void blecm_regAppEvtHandler (BLECM_APP_EVT_ENUM, BLECM_NO_PARAM_FUNC func)
 Register Event Handler. More...
 
void blecm_regAclRxHandler (void *)
 Register for ACL Data receive. More...
 
void blecm_regEncryptionChangedHandler (void *)
 Register for Encryption Changed event. More...
 
void blecm_startTimerSource (INT32 id, BLECM_FUNC_WITH_PARAM appCb, UINT32 ticks)
 Starts a software timer. More...
 
void blecm_stopTimerSource (INT32 id)
 Stopps a software timer. More...
 
void blecm_refreshConnIdletimer (void)
 Restarts the connection idle timer. More...
 
void blecm_startConnIdleTimer (BLEAPP_TIMER_CB cb)
 Starts the connection idle timer. More...
 
void blecm_stopConnIdleTimer (void)
 Stops the connection idle timer. More...
 
void blecm_enableRandomAddressResolution (void)
 Enable address resolution. More...
 
void blecm_disableRandomAddressResolution (void)
 Disable address resolution. More...
 
void blecm_storeRPA (UINT8 *rpa, INT32 idx)
 Stores random public address. More...
 
int blecm_lookupAddress (INT32 type, UINT32 *rpa)
 Looks up the given random public address in the key store. More...
 
int blecm_resolveRPA (INT32 type, UINT32 *rpa)
 Lookup and resolve address. More...
 
void blecm_startScan (INT32 scanType, INT32 scanInterval, INT32 scanWindow, INT32 scanAdrType, INT32 scanFilterPolicy, INT32 filterDuplicates)
 Configure LE scan parameters and start LE scan. More...
 
void blecm_setScanEnable (INT32 enableFlag, INT32 filterDuplicates)
 Configure controller for LE scan. More...
 
void blecm_CreateConnection (INT32 scanInterval, INT32 scanWindow, INT32 initiatorFilterPolicy, INT32 peerAddressType, char *peerAddress, INT32 ownAddressType, INT32 connMinInterval, INT32 connMaxInterval, INT32 connLatency, INT32 supervisionTimeout, INT32 connMinEventLen, INT32 connMaxEventLen)
 Create a Link Layer connection to a connectable advertiser. More...
 
void blecm_CreateConnectionCancel (void)
 Cancel attempt to create a Link Layer connection. More...
 
void blecm_ConnectionUpdate (INT32 connHandle, INT32 connMinInterval, INT32 connMaxInterval, INT32 connLatency, INT32 supervisionTimeout, INT32 connMinEventLen, INT32 connMaxEventLen)
 Connection update request. More...
 
void blecm_RegleAdvReportCb (BLECM_FUNC_WITH_PARAM cb)
 Register to receive advertisement report. More...
 

Detailed Description

Bluetooth LE Controller Manager functions.

Function Documentation

void blecm_ConnectionUpdate ( INT32  connHandle,
INT32  connMinInterval,
INT32  connMaxInterval,
INT32  connLatency,
INT32  supervisionTimeout,
INT32  connMinEventLen,
INT32  connMaxEventLen 
)

Connection update request.

This function issues HCI LE Connection Update Command. This command may be used in the client application if it needs to update connection parameters when connection is already established and required parameters are different than ones requested by the peripheral. When peripheral device requests some parameters using L2CAP message, stack automatically replies and sets controller appropriately and there is no need to use this function call.

Parameters
connHandleHCI handle of established connection
connMinIntervalMinimum value for the connection event interval
connMaxIntervalMaximum value for the connection event interval
connLatencyPeripheral latency for the connection in number of connection events
supervisionTimeoutSupervision timeout for the LE Link
connMinEventLenMinimum length of connection needed for this LE connection
connMaxEventLenMaximum length of connection needed for this LE connection
void blecm_CreateConnection ( INT32  scanInterval,
INT32  scanWindow,
INT32  initiatorFilterPolicy,
INT32  peerAddressType,
char *  peerAddress,
INT32  ownAddressType,
INT32  connMinInterval,
INT32  connMaxInterval,
INT32  connLatency,
INT32  supervisionTimeout,
INT32  connMinEventLen,
INT32  connMaxEventLen 
)

Create a Link Layer connection to a connectable advertiser.

This function issues HCI LE Create Connection Command. Typically this command will be used after client application receives advertisement from a peripheral device

Parameters
LE_Scan_IntervalTime interval from when the Controller started its last LE scan until it begins the subsequent LE scan.
LE_Scan_WindowThe duration of the LE scan.
Initiator_Filter_Policy
scanFilterPolicy
  • HCIULP_INITIATOR_FILTER_POLICY_ACCEPT_LIST_NOT_USED
  • HCIULP_INITIATOR_FILTER_POLICY_ACCEPT_LIST_USED
Peer_Address_Type
  • HCIULP_PUBLIC_ADDRESS
  • HCIULP_RANDOM_ADDRESS
ownAddressType
  • HCIULP_PUBLIC_ADDRESS
  • HCIULP_RANDOM_ADDRESS
PeerAddressPublic Device Address or Random Device Address of the device to be connected
connMinIntervalMinimum value for the connection event interval
connMaxIntervalMaximum value for the connection event interval
connLatencyPeripheral latency for the connection in number of connection events
supervisionTimeoutSupervision timeout for the LE Link
connMinEventLenMinimum length of connection needed for this LE connection
connMaxEventLenMaximum length of connection needed for this LE connection
void blecm_CreateConnectionCancel ( void  )

Cancel attempt to create a Link Layer connection.

This function may be issued by the client application to send HCI LE Create Connection Cancel Command.

void blecm_disableRandomAddressResolution ( void  )

Disable address resolution.

Disable peripheral address resolution.

void blecm_enableRandomAddressResolution ( void  )

Enable address resolution.

Enables peripheral address resolution.

UINT8 blecm_getFilterEnable ( void  )

Reading current CFA filter value.

This function returns current CFA filter state. When CFA filter is set, all HCI commands, events and data are passed to the CFA/profile/application. When CFA filter is not set, all HCI commands, events and data are passed to the transport (UART).

Returns
enable If 0, CFA filter is not set. if 1, CFA filter is set.
void blecm_init ( void  )

BLECM Initialization.

This function performs BLECM variables initialization. The function is called once during booting up. Application typically does not need to call this function.

int blecm_lookupAddress ( INT32  type,
UINT32 *  rpa 
)

Looks up the given random public address in the key store.

Looks up the given random public address in the key store.

Parameters
typeThe type of the address.
rpaThe Bluetooth address to look up for.
Returns
Index of the match or -1 if not found.
void blecm_refreshConnIdletimer ( void  )

Restarts the connection idle timer.

When a connection is idle (withou data in either direction), the app may choose to disconnect after while of inactivity. This restarts the idle timer if enabled.

void blecm_regAclRxHandler ( void *  )

Register for ACL Data receive.

This function will register a ACL Rx data handler.

Parameters
functionCallback function that is called whenever Rx data packet is received
void blecm_regAppEvtHandler ( BLECM_APP_EVT_ENUM  ,
BLECM_NO_PARAM_FUNC  func 
)

Register Event Handler.

This function should be used before blecm_start is called. This function register the start up function for app. Registered callback functions are called whenever related event happens.

Parameters
event_numberBLECM_APP_EVT_ENUM
  • BLECM_APP_EVT_START_UP - callback will be called during startup
  • BLECM_APP_EVT_LINK_UP - callback will be called when the radio link comes up.
  • BLECM_APP_EVT_LINK_DOWN - callback will be called radio link goes down.
  • BLECM_APP_EVT_ADV_TIMEOUT - callback will be called when adv stop based on timeout
  • BLECM_APP_EVT_ENTERING_HIDOFF - callback will be called to indicate device is preparing to enter hid-ff
  • BLECM_APP_EVT_ABORTING_HIDOFF - callback will be called to indicate that the device had to abort entering hid-off
functionCallback function that is called whenever event happens
void blecm_regEncryptionChangedHandler ( void *  )

Register for Encryption Changed event.

This function will register a callback handler for Encryption changed Event. Application can use this indication if it needs to send a packet over encrypted link.

Parameters
functionCallback function that is called whenever encryption is changed.
void blecm_RegleAdvReportCb ( BLECM_FUNC_WITH_PARAM  cb)

Register to receive advertisement report.

Client application may use this function to receive notification when controller receives advertisement from the peripheral device.

Parameters
functionCallback function that is called whenever advertisement is received. HCIULP_ADV_PACKET_REPORT_WDATA structure with advertisement data is passed as a parameter to this function.
int blecm_resolveRPA ( INT32  type,
UINT32 *  rpa 
)

Lookup and resolve address.

Looks up the given random public address in the key store and if not found, resolves it and adds to the key store.

Parameters
typeThe type of the address.
rpaThe Bluetooth address to look up for.
Returns
Index of the match when added; -1 when unable to resolve.
void blecm_setFilterEnable ( UINT8  enable)

Enable/Disable CFA filter.

This function enables/disables CFA filter. When CFA filter is set, all HCI commands, events and data are passed to the CFA/profile/application. When CFA filter is not set, all HCI commands, events and data are passed to the transport (UART).

Parameters
enableIf 0, CFA filter is not set. if 1, CFA filter is set.
void blecm_setScanEnable ( INT32  enableFlag,
INT32  filterDuplicates 
)

Configure controller for LE scan.

This function issues HCI LE Set Scan Enable Command. This command may be used to start and configure, or stop LE scans.

Parameters
LE_Scan_Enable
  • HCIULP_SCAN_MODE_OFF LE scanninig disabled
  • HCIULP_SCAN_MODE_ON LE scanninig enabled
FilterDuplicates
  • HCIULP_SCAN_DUPLICATE_FILTER_OFF Duplicate filtering disabled
  • HCIULP_SCAN_DUPLICATE_FILTER_ON Duplicate filtering enabled
void blecm_start ( void  )

BLECM Start.

This function starts BLECM. The function is called once during booting up. Application typically does not need to call this function.

void blecm_startConnIdleTimer ( BLEAPP_TIMER_CB  cb)

Starts the connection idle timer.

When a connection is idle (withou data in either direction), the app may choose to disconnect after while of inactivity. This starts the idle timer if enabled.

Parameters
cbThe callback function that will be invoked when the timer expires.
void blecm_startScan ( INT32  scanType,
INT32  scanInterval,
INT32  scanWindow,
INT32  scanAdrType,
INT32  scanFilterPolicy,
INT32  filterDuplicates 
)

Configure LE scan parameters and start LE scan.

This function will start LE Scan with the given parameters. The Scan will start shortly after but not immediately after this function call returns.

Parameters
LE_Scan_Type
  • HCIULP_PASSIVE_SCAN Passive Scanning. No SCAN_REQ packets shall be sent.
  • HCIULP_ACTIVE_SCAN Active scanning. SCAN_REQ packets may be sent.
LE_Scan_IntervalTime interval from when the Controller started its last LE scan until it begins the subsequent LE scan.
LE_Scan_WindowThe duration of the LE scan.
Own_Address_Type
  • HCIULP_PUBLIC_ADDRESS
  • HCIULP_RANDOM_ADDRESS
scanFilterPolicy
  • HCIULP_SCAN_FILTER_POLICY_ACCEPT_LIST_NOT_USED
  • HCIULP_SCAN_FILTER_POLICY_ACCEPT_LIST_USED
FilterDuplicates
  • HCIULP_SCAN_DUPLICATE_FILTER_OFF Duplicate filtering disabled
  • HCIULP_SCAN_DUPLICATE_FILTER_ON Duplicate filtering enabled
void blecm_startTimerSource ( INT32  id,
BLECM_FUNC_WITH_PARAM  appCb,
UINT32  ticks 
)

Starts a software timer.

Starts a low level software timer.

Parameters
idID of the software timer.
appCbApplication callback function.
ticksThe interval of the timer in OS ticks (12.5mS units).
void blecm_stopConnIdleTimer ( void  )

Stops the connection idle timer.

When a connection is idle (withou data in either direction), the app may choose to disconnect after while of inactivity. This Stops the idle timer if enabled.

void blecm_stopTimerSource ( INT32  id)

Stopps a software timer.

Stops a low level software timer.

Parameters
idID of the software timer.
void blecm_storeRPA ( UINT8 *  rpa,
INT32  idx 
)

Stores random public address.

Allows the app to provide a random public address for storage in internal IRK.

Parameters
rpaThe random public address to store.
idxThe index at which to store.