BSB Developer Docs
Loading...
Searching...
No Matches
ble_connection.h File Reference

Represents connection parameters between bsb and remote. More...

#include "ble_device_base.h"

Go to the source code of this file.

Data Structures

struct  BleConnectionTimings
 Connection timings. More...
 
struct  BleConnectionDataLength
 Connection data length. More...
 
union  BlePhy
 Ble PHY representation. More...
 

Typedefs

typedef void(* BleConnectionUpdateParametersDoneCallback) (void *ctx)
 Type definition for callback to be triggered when connection parameters updated.
 
typedef struct BleConnectionContext BleConnectionContext
 Opaque BleConnectionContext type declaration.
 

Functions

BleConnectionContext * ble_connection_alloc (BleDeviceAddressType type, const uint8_t *const peer_address)
 Creates connection instance.
 
void ble_connection_free (BleConnectionContext *instance)
 Free connection instance when disconnect happened.
 
BleDeviceBase * ble_connection_get_peer (BleConnectionContext *instance)
 Get pointer to connected remote peer instance for future use.
 
const BleConnectionTimings * ble_connection_get_timings (BleConnectionContext *instance)
 Getter for accessing BleConnectionTimings from the connection.
 
void ble_connection_set_timings (BleConnectionContext *instance, const BleConnectionTimings *const timings)
 Set connection timing data from outside.
 
const BleConnectionDataLength * ble_connection_get_data_length (BleConnectionContext *instance)
 Getter for accessing BleConnectionDataLength from the connection.
 
void ble_connection_set_data_length (BleConnectionContext *instance, const BleConnectionDataLength *const data_length)
 Set data length from outside.
 
const BlePhy * ble_connection_get_tx_phy (BleConnectionContext *instance)
 Get Tx PHY info from the connection.
 
const BlePhy * ble_connection_get_rx_phy (BleConnectionContext *instance)
 Get Rx PHY info from the connection.
 
void ble_connection_set_phy (BleConnectionContext *instance, const uint8_t tx_phy, const uint8_t rx_phy)
 Set both Rx and Tx PHY infos to the connection.
 
void ble_connection_start_update_parameters (BleConnectionContext *instance, FuriEventLoop *event_loop, BleConnectionUpdateParametersDoneCallback done_cb, void *ctx)
 Start process of updating connection parameters.
 

Detailed Description

Represents connection parameters between bsb and remote.

Typedef Documentation

◆ BleConnectionUpdateParametersDoneCallback

typedef void(* BleConnectionUpdateParametersDoneCallback) (void *ctx)

Type definition for callback to be triggered when connection parameters updated.

Parameters
[in]ctxcontext for callback call

Function Documentation

◆ ble_connection_alloc()

BleConnectionContext * ble_connection_alloc ( BleDeviceAddressType type,
const uint8_t *const peer_address )

Creates connection instance.

New connection instance is created by ble_device.h everytime when nwp sends a connection event

Parameters
[in]typeremote device address type
[in]peer_addressremote device address
Returns
pointer to connection instance

◆ ble_connection_free()

void ble_connection_free ( BleConnectionContext * instance)

Free connection instance when disconnect happened.

Parameters
[in]instanceto connection to be deleted

◆ ble_connection_get_data_length()

const BleConnectionDataLength * ble_connection_get_data_length ( BleConnectionContext * instance)

Getter for accessing BleConnectionDataLength from the connection.

Parameters
[in]instanceto connection
Returns
pointer to BleConnectionDataLength struct

◆ ble_connection_get_peer()

BleDeviceBase * ble_connection_get_peer ( BleConnectionContext * instance)

Get pointer to connected remote peer instance for future use.

Parameters
[in]instanceto connection containing information about remote peer
Returns
Opaque instance to remote peer

◆ ble_connection_get_rx_phy()

const BlePhy * ble_connection_get_rx_phy ( BleConnectionContext * instance)

Get Rx PHY info from the connection.

Parameters
[in]instanceto connection
Returns
pointer to BlePhy struct

◆ ble_connection_get_timings()

const BleConnectionTimings * ble_connection_get_timings ( BleConnectionContext * instance)

Getter for accessing BleConnectionTimings from the connection.

Parameters
[in]instanceto connection
Returns
pointer to BleConnectionTimings struct

◆ ble_connection_get_tx_phy()

const BlePhy * ble_connection_get_tx_phy ( BleConnectionContext * instance)

Get Tx PHY info from the connection.

Parameters
[in]instanceto connection
Returns
pointer to BlePhy struct

◆ ble_connection_set_data_length()

void ble_connection_set_data_length ( BleConnectionContext * instance,
const BleConnectionDataLength *const data_length )

Set data length from outside.

Parameters
[in]instanceto connection
[in]data_lengthstruct filled with data to set into the connection

◆ ble_connection_set_phy()

void ble_connection_set_phy ( BleConnectionContext * instance,
const uint8_t tx_phy,
const uint8_t rx_phy )

Set both Rx and Tx PHY infos to the connection.

Parameters
[in]instanceto connection
[in]tx_phyvalue of Tx PHY
[in]rx_phyvalue of Rx PHY

◆ ble_connection_set_timings()

void ble_connection_set_timings ( BleConnectionContext * instance,
const BleConnectionTimings *const timings )

Set connection timing data from outside.

Parameters
[in]instanceto connection
[in]timingsstruct filled with data to set into the connection

◆ ble_connection_start_update_parameters()

void ble_connection_start_update_parameters ( BleConnectionContext * instance,
FuriEventLoop * event_loop,
BleConnectionUpdateParametersDoneCallback done_cb,
void * ctx )

Start process of updating connection parameters.

This starts a series of request/responses to the remote device in order to finalize connection parameters. When all operations are completed a done callback will be called

Parameters
[in]instanceto connection
[in]event_loopinstance, through which processing is done
[in]done_cbcallback which will be triggered once all parameters will be agreed
[in]ctxcallback context