|
Lamp-Da 0.1
A compact lantern project
|
Hardware Abstraction Layer for Bluetooth Low Energy (BLE) Peripheral Role. More...
Go to the source code of this file.
Classes | |
| struct | lampda::hal::ble::hal_ble_uuid_t |
| UUID structure (supports both 16-bit and 128-bit) More... | |
| struct | lampda::hal::ble::gap_addr_t |
| struct | lampda::hal::ble::hal_ble_characteristic_t |
| GATT Characteristic Definition. More... | |
| struct | lampda::hal::ble::hal_ble_service_t |
| GATT Service Definition. More... | |
| struct | lampda::hal::ble::hal_ble_sec_config_t |
| Security Configuration. More... | |
| struct | lampda::hal::ble::hal_ble_adv_params_t |
| Advertising Parameters. More... | |
| struct | lampda::hal::ble::hal_ble_conn_params_t |
| Connection Parameters. More... | |
| struct | lampda::hal::ble::hal_ble_event_callbacks_t |
| BLE Event Callback Collection. More... | |
| struct | lampda::hal::ble::services::system_infos::Infos |
Namespaces | |
| namespace | lampda |
| Program scope. | |
| namespace | lampda::hal |
| Hardware Abstraction Layer, handle the platform specific interactions. Can be changed to support different platforms. | |
| namespace | lampda::hal::ble |
| Handle the platform specific bluetooth operations. | |
| namespace | lampda::hal::ble::services::battery |
| OTA battery level service. | |
| namespace | lampda::hal::ble::services::uart |
| OTA UART connection. | |
Typedefs | |
| using | lampda::hal::ble::hal_ble_conn_handle_t = uint16_t |
| Characteristic Read/Write Callback Context. | |
| using | lampda::hal::ble::hal_ble_write_callback_t = void(*)(hal_ble_conn_handle_t conn_handle, const uint8_t *data, uint16_t length) |
| Callback fired when Central writes to a characteristic. | |
| using | lampda::hal::ble::hal_ble_read_callback_t = int32_t(*)(hal_ble_conn_handle_t conn_handle, uint16_t char_handle, uint8_t *data, uint16_t max_length) |
| Callback fired when Central reads a characteristic. | |
| using | lampda::hal::ble::hal_ble_char_handle_t = uint16_t |
| Characteristic Descriptor Handle Storage. | |
| using | lampda::hal::ble::hal_ble_pairing_complete_cb_t = void(*)(hal_ble_conn_handle_t conn_handle, hal::ble::hal_ble_pairing_result code) |
| Pairing Completed Callback. | |
| using | lampda::hal::ble::hal_ble_secure_cb_t = void(*)(hal_ble_conn_handle_t conn_handle) |
| Connection secured Callback. | |
| using | lampda::hal::ble::hal_ble_advertising_stops_cb_t = void(*)() |
| Advertising stopped callback. | |
| using | lampda::hal::ble::hal_ble_conn_state_cb_t = void(*)(hal_ble_conn_handle_t conn_handle) |
| Connection State Change Callback. | |
| using | lampda::hal::ble::hal_ble_disconn_state_cb_t = void(*)(hal_ble_conn_handle_t conn_handle, uint8_t reason) |
| Disconnection State Change Callback. | |
Functions | |
| int32_t | lampda::hal::ble::hal_ble_init (const char *device_name, const hal_ble_event_callbacks_t *callbacks) |
| Initialize BLE Stack. | |
| int32_t | lampda::hal::ble::hal_ble_deinit (void) |
| Deinitialize BLE Stack. | |
| bool | lampda::hal::ble::hal_ble_is_initialized (void) |
| Check if BLE Stack is Initialized. | |
| int32_t | lampda::hal::ble::hal_ble_add_service (hal_ble_service_t *service, const bool addToAdvertised) |
| Add a Service to GATT Database. | |
| int32_t | lampda::hal::ble::hal_ble_add_characteristic (hal_ble_characteristic_t *characteristic) |
| Add a Characteristic to the Current Service. | |
| int32_t | lampda::hal::ble::hal_ble_set_characteristic_value (hal_ble_char_handle_t char_handle, const uint8_t *data, uint16_t length) |
| Update Characteristic Value. | |
| int32_t | lampda::hal::ble::hal_ble_get_characteristic_value (hal_ble_char_handle_t char_handle, uint8_t *data, uint16_t max_length) |
| Read Current Characteristic Value. | |
| int32_t | lampda::hal::ble::hal_ble_notify (hal_ble_char_handle_t char_handle, const uint8_t *data, uint16_t length) |
| Send Notification to All Connected Centrals. | |
| int32_t | lampda::hal::ble::hal_ble_indicate (hal_ble_conn_handle_t conn_handle, hal_ble_char_handle_t char_handle, const uint8_t *data, uint16_t length) |
| Send Indication to a Specific Connected Central. | |
| int32_t | lampda::hal::ble::hal_ble_start_advertising (const hal_ble_adv_params_t *adv_params) |
| Start Advertising (Peripheral Becomes Discoverable) | |
| int32_t | lampda::hal::ble::hal_ble_stop_advertising (void) |
| Stop Advertising. | |
| bool | lampda::hal::ble::hal_ble_is_advertising (void) |
| Check if Currently Advertising. | |
| int32_t | lampda::hal::ble::hal_ble_disconnect (hal_ble_conn_handle_t conn_handle) |
| Disconnect a Connected Central. | |
| hal_ble_conn_handle_t | lampda::hal::ble::hal_ble_get_connection_handle () |
| Return the current connection handle. | |
| int32_t | lampda::hal::ble::hal_ble_get_mtu (hal_ble_conn_handle_t conn_handle) |
| Get Current MTU (Maximum Transmission Unit) Size. | |
| int32_t | lampda::hal::ble::hal_ble_set_security_config (const hal_ble_sec_config_t *sec_config) |
| Configure Security Parameters. | |
| int32_t | lampda::hal::ble::hal_ble_start_pairing (hal_ble_conn_handle_t conn_handle) |
| Initiate Pairing from Peripheral Side. | |
| int32_t | lampda::hal::ble::hal_ble_clear_bonds (void) |
| Clear All Stored Bonds (Forget Paired Centrals) | |
| int32_t | lampda::hal::ble::hal_ble_set_device_name (const char *name) |
| Set Device Name. | |
| int32_t | lampda::hal::ble::hal_ble_get_device_name (char *name, uint16_t max_length) |
| Get Device Name. | |
| int32_t | lampda::hal::ble::hal_ble_set_tx_power (int8_t tx_power_dbm) |
| Set TX Power (Transmit Power) | |
| int8_t | lampda::hal::ble::hal_ble_get_tx_power (void) |
| Get TX Power. | |
| uint8_t | lampda::hal::ble::hal_ble_get_connection_count (void) |
| Get Number of Active Connections. | |
| bool | lampda::hal::ble::hal_ble_is_connected (hal_ble_conn_handle_t conn_handle) |
| Get Connection State. | |
| int8_t | lampda::hal::ble::hal_ble_get_rssi (hal_ble_conn_handle_t conn_handle) |
| Get Connection Signal Strength (RSSI) | |
| gap_addr_t | lampda::hal::ble::hal_ble_get_address (hal_ble_conn_handle_t conn_handle) |
| Return the adress of the connected device. | |
| bool | lampda::hal::ble::hal_ble_can_load_bound_key (hal_ble_conn_handle_t conn_handle) |
| bool | lampda::hal::ble::hal_ble_has_feature (hal_ble_feature_t feature) |
| Check if Feature is Supported. | |
| void | lampda::hal::ble::services::battery::init (const uint8_t batteryLevel, const bool addToAdvertised) |
| Init the service, with an initial value (0-100) | |
| void | lampda::hal::ble::services::battery::write_battery_level (const uint8_t batteryLevel) |
| update battery level (0-100) | |
| void | lampda::hal::ble::services::battery::notify_battery_level (const uint8_t batteryLevel) |
| notify the connected device of a battery level (0-100) | |
| void | lampda::hal::ble::services::uart::init (const bool addToAdvertised) |
| Start the uart service. | |
| bool | lampda::hal::ble::services::uart::is_notified_enabled () |
| Return true uart notify is activated. | |
| bool | lampda::hal::ble::services::uart::is_available () |
| Return true if a char is available to read. | |
| char | lampda::hal::ble::services::uart::read () |
| Read a character (blocking) | |
| void | lampda::hal::ble::services::uart::flush () |
| Flush the rx queue. | |
| size_t | lampda::hal::ble::services::uart::write (const char *const buffer, size_t bufferSize) |
| Write a buffer to connected device. | |
| void | lampda::hal::ble::services::system_infos::init (const Infos &sysInfos, const bool addToAdvertised) |
Hardware Abstraction Layer for Bluetooth Low Energy (BLE) Peripheral Role.
This header defines a platform-agnostic BLE Peripheral interface compatible with:
Peripheral Role: Device advertises and accepts connections from Central devices.
Terminology: