|
UWB-Tracking
|
Represents a Bluetooth Server for ESP32. More...
#include <ble-server.h>
Classes | |
| struct | Characteristic |
| Represents a Bluetooth characteristic with a name, UUID, and descriptor UUID. More... | |
| struct | Service |
| Represents a Bluetooth service with a UUID and an array of characteristics. More... | |
Public Member Functions | |
| BleServer () | |
| Constructor for BleServer class. More... | |
| void | init_server () |
| Initializes the Bluetooth Server. More... | |
| std::string | read_value (const std::string uuid) |
| Reads the value from a characteristic with the given UUID. More... | |
| void | send_value (std::string uuid, const std::string data) |
| Sends a new value to a Characteristic with the given UUID. The Characteristic can be referenced without specifying the Service. More... | |
| size_t | getConnectedCount () |
| Get the number of connected devices. More... | |
Private Member Functions | |
| void | add_Characteristic (BLEService *service, BleServer::Characteristic characteristic) |
| Adds a new characteristic with the given UUID to a service. More... | |
| void | init_services () |
| Initializes all services for the BLE server. More... | |
Private Attributes | |
| BLEServer * | pServer |
| BLEAdvertising * | pAdvertising |
| std::list< BLEService * > | mServices |
| const std::array< Service, 2 > | my_services |
Represents a Bluetooth Server for ESP32.
|
private |
Adds a new characteristic with the given UUID to a service.
| service | The service to which the characteristic should be added. |
| characteristic | A Caracteristic struct, containing uuids and name of the caracteriistic. |
|
inline |
Get the number of connected devices.
| void init_server | ( | ) |
Initializes the Bluetooth Server.
This function initializes the Bluetooth Server, creates the services, and starts advertising. The UUIDs of the services are defined through the constants BLE_SERVICE_*. The device name is set through the constant BLE_NAME. The advertising intervals are set through the constants BLE_MIN_INTERVAL and BLE_MAX_INTERVAL.
|
private |
Initializes all services for the BLE server.
Creates a BLEService for each service UUID specified in the header file and creates a BLECharacteristic for each characteristic UUID specified in the header. Finally, each created service is started.
| std::string read_value | ( | const std::string | uuid | ) |
Reads the value from a characteristic with the given UUID.
| uuid | The UUID of the characteristic to read from. |
| void send_value | ( | std::string | uuid, |
| const std::string | data | ||
| ) |
Sends a new value to a Characteristic with the given UUID. The Characteristic can be referenced without specifying the Service.
| uuid | The UUID of the Characteristic to which the value should be sent. |
| data | The value to be sent. |
|
private |
List of BLE services.
|
private |
|
private |
Pointer to the BLE advertising object.
|
private |
Pointer to the BLE server object.