Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
lampda::bsp::ble Namespace Reference

Bluetooth high level handling. More...

Namespaces

namespace  services
 Define the services used in the BLE layer.
 

Functions

void load_bound_file ()
 
bool is_activated ()
 Return true if the bluetooth is activated.
 
bool is_advertising ()
 Return true is the bluetooth is visible by other devices.
 
bool is_open_to_all ()
 Return true if the device is advertising, and all can connect.
 
bool is_connected ()
 Return true if a bluetooth user is connected.
 
bool is_bounded ()
 Return true if the bluetooth connection is bounded to a pair.
 
bool is_bounded (std::array< uint8_t, 8 > &buffer)
 
void disconnect ()
 
bool is_connection_allowed (uint16_t connectionHandle)
 If this returns false, do not accept any actions from bluetooth.
 
void clear_bounded_devices ()
 Clear the bounded bluetooth devices.
 
bool set_bluetooth_name (const std::array< char, MaxBleNameLenght > &name)
 Set a new name for the bluetooth.
 
std::array< char, MaxBleNameLenght > get_ble_name ()
 Return the current bluetooth name.
 
void start_advertising (bool allowUnknownConnections)
 start the advertising sequence (with a timeout)
 
void force_pairing_mode ()
 Start the pairing mode (open to all devices), even if a device is connected. The connected device is disconnected first, then the pairing mode starts once the link is closed.
 
void stop_bluetooth_advertising ()
 disable the bluetooth advertising, but not the bluetooth
 
void write_battery_level (const uint8_t batteryLevel)
 update battery level
 
void notify_battery_level (const uint8_t batteryLevel)
 notify the connected device of a battery level
 
bool was_used ()
 Return tue if the bluetooth was used during lifetime.
 
void init ()
 Optional bypass to start the BLE device early, without advertising.
 
void shutdown ()
 shutdown the bluetooth and services
 

Variables

static constexpr size_t MaxBleNameLenght = 32
 

Detailed Description

Bluetooth high level handling.

Function Documentation

◆ start_advertising()

void lampda::bsp::ble::start_advertising ( bool  allowUnknownConnections)

start the advertising sequence (with a timeout)

Parameters
[in]allowUnknownConnectionsIf true, allow any device to be connected. If false, it will first check if a saved device exists, and if it's the case will only allow this device to connect.