5#ifndef HAL_BLUETOOTH_HPP
6#define HAL_BLUETOOTH_HPP
19static constexpr size_t MaxBleNameLenght = 32;
22void load_bound_file();
34bool is_bounded(std::array<uint8_t, 8>& buffer);
83size_t write(
const char*
const buffer,
size_t bufferSize);
uint16_t mtu_size()
Return the usable MTU size.
bool is_available()
Return true if a char is available to read.
size_t write(const char *const buffer, size_t bufferSize)
Write a buffer to bluetooth serial.
char read()
Read a character (blocking)
void clear_bounded_devices()
Clear the bounded bluetooth devices.
void shutdown()
shutdown the bluetooth and services
void write_battery_level(const uint8_t batteryLevel)
update battery level
bool is_open_to_all()
Return true if the device is advertising, and all can connect.
void stop_bluetooth_advertising()
disable the bluetooth advertising, but not the bluetooth
bool is_advertising()
Return true is the bluetooth is visible by other devices.
void start_advertising(bool allowUnknownConnections)
start the advertising sequence (with a timeout)
bool set_bluetooth_name(const std::array< char, MaxBleNameLenght > &name)
Set a new name for the bluetooth.
bool was_used()
Return tue if the bluetooth was used during lifetime.
bool is_connection_allowed(uint16_t connectionHandle)
If this returns false, do not accept any actions from bluetooth.
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.
void disconnect()
Force disconnection.
void notify_battery_level(const uint8_t batteryLevel)
notify the connected device of a battery level
void init()
Optional bypass to start the BLE device early, without advertising.
bool is_activated()
Return true if the bluetooth is activated.
Program scope.
Definition: control_fixed_modes.hpp:12