Skip to content

RaftBLEManagerSysMod

Rob Dobson edited this page Oct 29, 2024 · 2 revisions

BLEManager SysMod

Overview

Handles BLE (Bluetooth Low Energy) connectivity and data for the system.

BLEManager Settings

When constructed normally (in RaftCoreApp for instance) the BLEManager is configured using the contents of the SysTypes key BLEMan. The settings available to configure BLE are described in BLE Manager Settings

Constructor

BLEManager(const char *pModuleName, RaftJsonIF& sysConfig)
  • pModuleName: Name of the module.
  • sysConfig: Configuration settings for the system.

Setup

void setup();

This function configures and sets up the BLE functionality according to the settings provided in the BLE Manager Settings.

BLE can operate in peripheral and/or central modes which are enabled by separate flags in the BLE Manager Settings.

Supported Standard Services

Standard services (except for DeviceInfo) use the SysMod Named-Value access mechanism to get up-to-date data - the SysMod and named-value are specified in the BLE Manager Settings. The following services are supported:

  • Battery: Enables the Battery Service.
  • DeviceInfo: Enables the Device Information Service.
  • HeartRate: Enables the Heart Rate Service.

Loop

void loop();

The main loop function checks if BLE is enabled and services the BLE GAP (Generic Access Profile).

REST API Endpoints

/blerestart

Description:
Restarts the BLE service.

  • Method: GET
  • Response:
    { "rslt": "ok" } if successful.

Status and Debug Information

getStatusJSON

String getStatusJSON() const;

Returns a JSON string with the status of the BLE Manager.

getDebugJSON

String getDebugJSON() const;

Returns a more detailed JSON string with debug information about the BLE Manager.

Named Value Access

double getNamedValue(const char* valueName, bool& isValid);

This function allows access to certain named values:

  • R or r: Retrieves the current RSSI (signal strength) value.
  • C or c: Returns whether the BLE connection is active.

BLE Advertising Name

String getAdvertisingName();

Returns the advertising name for the BLE device. If not configured, it uses the system's friendly name or system name.


This documentation covers the main aspects of the BLEManager module, including its configuration, API endpoints, and key functions.

Clone this wiki locally