BLE Peer Manager Peripheral#

Peer Manager for Bluetooth Low Energy. Responsible for advertising and creating connections. The user can set the advertising parameters.

Functions#

sl_status_t
ble_peer_manager_peripheral_set_advertiser_discovery_mode(sl_bt_advertiser_discovery_mode_t adv_discovery_mode)
sl_status_t
sl_status_t
sl_status_t
sl_status_t

Macros#

#define
BLE_PEER_MANAGER_PERIPHERAL_CONFIG_DEFAULT_ADV_DISCOVERY_MODE sl_bt_advertiser_general_discoverable
#define
BLE_PEER_MANAGER_PERIPHERAL_CONFIG_DEFAULT_ADV_CONNECTION_MODE sl_bt_legacy_advertiser_connectable
#define
BLE_PEER_MANAGER_PERIPHERAL_CONFIG_ADV_TIMING_INTERVAL_MIN 160
#define
BLE_PEER_MANAGER_PERIPHERAL_CONFIG_ADV_TIMING_INTERVAL_MAX 160
#define
BLE_PEER_MANAGER_PERIPHERAL_CONFIG_ADV_TIMING_DURATION 0
#define
BLE_PEER_MANAGER_PERIPHERAL_CONFIG_ADV_TIMING_MAX_EVENTS 0
#define
BLE_PEER_MANAGER_PERIPHERAL_CONFIG_ADV_PHY sl_bt_gap_phy_1m

Function Documentation#

ble_peer_manager_peripheral_init#

void ble_peer_manager_peripheral_init (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Initialize the Peer Manager.

Set default values for advertiser, set state to IDLE and create an emtpy connection array.


ble_peer_manager_peripheral_set_advertiser_discovery_mode#

sl_status_t ble_peer_manager_peripheral_set_advertiser_discovery_mode (sl_bt_advertiser_discovery_mode_t adv_discovery_mode)
Parameters
TypeDirectionArgument NameDescription
sl_bt_advertiser_discovery_mode_t[in]adv_discovery_mode

Advertising discovery mode. Should be one of the following:

  • sl_bt_advertiser_non_discoverable

  • sl_bt_advertiser_limited_discoverable

  • sl_bt_advertiser_general_discoverable

  • sl_bt_advertiser_broadcast

  • sl_bt_advertiser_user_data

Set advertiser parameters.

Set the advertiser parameters if the Peer Manager is in IDLE state. Call this function before starting the advertiser.


ble_peer_manager_peripheral_set_advertiser_phy#

sl_status_t ble_peer_manager_peripheral_set_advertiser_phy (sl_bt_gap_phy_t adv_phy)
Parameters
TypeDirectionArgument NameDescription
sl_bt_gap_phy_t[in]adv_phy

Advertising PHY. Should be one of the following:

  • sl_bt_gap_phy_1m

  • sl_bt_gap_phy_2m

Set advertiser parameters.

Set the advertiser PHY if the Peer Manager is in IDLE state. Call this function before starting the advertiser.


ble_peer_manager_peripheral_create_connection#

sl_status_t ble_peer_manager_peripheral_create_connection (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Create a central connection.

The Peer Manager will start the advertiser. If a connection opened event is received, and the advertising handle is the same as in the sl_bt_legacy_advertiser_start() function, the Peer Manager will stop the advertiser and save the connection.


ble_peer_manager_peripheral_start_advertising#

sl_status_t ble_peer_manager_peripheral_start_advertising (uint8_t advertising_handle)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]advertising_handle

Advertising handle to use for advertising.

Start advertising.

If handle is SL_BT_INVALID_ADVERTISING_SET_HANDLE the peer manager will create an advertising handle and generate data using the default value for discovery mode, or the value that was set using the ble_peer_manager_peripheral_set_advertiser_discovery_mode() function and the default value for advertiser timing. If the handle is not invalid, it will use the given handle to start advertising.


ble_peer_manager_peripheral_stop_advertising#

sl_status_t ble_peer_manager_peripheral_stop_advertising (uint8_t advertising_handle)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]advertising_handle

Advertising handle to stop.

Stop advertising.


ble_peer_manager_peripheral_close_connection#

sl_status_t ble_peer_manager_peripheral_close_connection (uint8_t conn_handle)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]conn_handle

Connection handle of the connection which needs to be closed.

Close connection.