|
ELEC-C7222
Libraries for ELEC C7222 Course Work
|
BLE GATT server example with AttributeServer and SecurityManager. More...
#include <assert.h>#include <cstdint>#include <cstdio>#include "advertisement_data.hpp"#include "gap_event_handler.hpp"#include "ble_onchip_temperature.hpp"#include "ble.hpp"#include "characteristic.hpp"#include "freertos_task.hpp"#include "freertos_timer.hpp"#include "gap.hpp"#include "onboard_led.hpp"#include "onchip_temperature_sensor.hpp"#include "pico/cyw43_arch.h"#include "pico/stdlib.h"#include "pico/time.h"#include "platform.hpp"#include "security_event_handler.hpp"#include "security_manager.hpp"#include "app_profile.h"
Functions | |
| static void | timer_callback () |
| Periodic timer callback to update temperature value. | |
| static void | on_turn_on () |
| Callback executed when the BLE stack is fully initialized. | |
| void | ble_app_task (void *params) |
| FreeRTOS task that owns BLE initialization and GATT server setup. | |
| int | main () |
| Program entry point. | |
Variables | |
| static c7222::OnBoardLED * | onboard_led = nullptr |
| On-board LED used as a heartbeat while advertising. | |
| static c7222::OnChipTemperatureSensor * | temp_sensor = nullptr |
| Temperature sensor wrapper used to read on-chip temperature. | |
| static c7222::FreeRtosTimer | app_timer |
| Periodic timer used to update the temperature characteristic. | |
| static c7222::Characteristic * | temperature_characteristic = nullptr |
| Temperature characteristic handle resolved from the ATT database. | |
| static c7222::Characteristic * | configuration_characteristic = nullptr |
| Configuration characteristic handle resolved from the ATT database. | |
| static c7222::Platform * | platform = nullptr |
| Platform abstraction (initializes CYW43/BTstack). | |
| static c7222::SecurityManager * | security_manager = nullptr |
| SecurityManager instance for pairing/authorization. | |
| static c7222::AttributeServer * | att_server = nullptr |
| AttributeServer instance providing GATT database access. | |
| static BleOnchipTemperature * | ble_temperature_manager = nullptr |
| Helper that binds characteristic event handlers for logging. | |
| static SecurityEventHandler | security_event_handler |
| Security event handler (minimal example policy). | |
| static GapEventHandler | gap_event_handler |
| GAP event handler (logging + restart advertising). | |
BLE GATT server example with AttributeServer and SecurityManager.
Demonstrates how to:
Dependencies:
GapEventHandler logs GAP events and restarts advertising on disconnect.SecurityEventHandler logs pairing/authorization and performs minimal policy.BleOnchipTemperature binds CharacteristicEventHandler instances to temperature/configuration characteristics for event logging.c7222::FreeRtosTask and c7222::FreeRtosTimer wrappers are used for task lifecycle and periodic callback scheduling. | void ble_app_task | ( | void * | params | ) |
FreeRTOS task that owns BLE initialization and GATT server setup.
Initializes platform, security manager, attribute server, resolves characteristics, and starts advertising. A timer periodically updates the temperature characteristic when connected.


| int main | ( | void | ) |
Program entry point.

|
static |
Callback executed when the BLE stack is fully initialized.
Configures advertising data/parameters and starts advertising.


|
static |
Periodic timer callback to update temperature value.
Reads the temperature sensor and writes a fixed-point value (C * 100) into the temperature characteristic when a connection is active.


|
static |
Periodic timer used to update the temperature characteristic.
|
static |
AttributeServer instance providing GATT database access.
|
static |
Helper that binds characteristic event handlers for logging.
|
static |
Configuration characteristic handle resolved from the ATT database.
|
static |
GAP event handler (logging + restart advertising).
|
static |
On-board LED used as a heartbeat while advertising.
|
static |
Platform abstraction (initializes CYW43/BTstack).
|
static |
Security event handler (minimal example policy).
|
static |
SecurityManager instance for pairing/authorization.
|
static |
Temperature sensor wrapper used to read on-chip temperature.
|
static |
Temperature characteristic handle resolved from the ATT database.