Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
GAP Address types

Namespaces

namespace  lampda::hal::ble::services::battery
 OTA battery level service.
 
namespace  lampda::hal::ble::services::uart
 OTA UART connection.
 

Classes

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
 

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.
 

Enumerations

enum class  lampda::hal::ble::hal_ble_adress_type : uint8_t {
  lampda::hal::ble::hal_ble_adress_type::INVALID , lampda::hal::ble::hal_ble_adress_type::PUBLIC , lampda::hal::ble::hal_ble_adress_type::RANDOM_STATIC , lampda::hal::ble::hal_ble_adress_type::RANDOM_PRIVATE_RESOLVABLE ,
  lampda::hal::ble::hal_ble_adress_type::RANDOM_PRIVATE_NON_RESOLVABLE , lampda::hal::ble::hal_ble_adress_type::ANONYMOUS
}
 
enum class  lampda::hal::ble::hal_ble_feature_t { HAL_BLE_FEATURE_BONDING , HAL_BLE_FEATURE_LE_SECURE_CONNECTIONS , lampda::hal::ble::hal_ble_feature_t::HAL_BLE_FEATURE_DLE , lampda::hal::ble::hal_ble_feature_t::HAL_BLE_FEATURE_MULTI_ROLE }
 Query BLE Feature Support. More...
 

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)
 

Variables

hal_ble_uuid_type_t lampda::hal::ble::hal_ble_uuid_t::type
 
uint16_t   lampda::hal::ble::hal_ble_uuid_t::uuid16
 
uint8_t   lampda::hal::ble::hal_ble_uuid_t::uuid128 [16]
 
union {
   uint16_t   lampda::hal::ble::hal_ble_uuid_t::uuid16
 
   uint8_t   lampda::hal::ble::hal_ble_uuid_t::uuid128 [16]
 
} lampda::hal::ble::hal_ble_uuid_t::value
 
hal_ble_adress_type lampda::hal::ble::gap_addr_t::type = hal_ble_adress_type::INVALID
 address type
 
std::array< uint8_t, HAL_BLE_GAP_ADDR_LEN > lampda::hal::ble::gap_addr_t::addr = {0}
 48-bit address, LSB format
 
hal_ble_char_handle_t lampda::hal::ble::hal_ble_characteristic_t::handle
 
hal_ble_uuid_t lampda::hal::ble::hal_ble_characteristic_t::uuid
 
uint16_t lampda::hal::ble::hal_ble_characteristic_t::max_length
 
uint8_t * lampda::hal::ble::hal_ble_characteristic_t::initial_value
 
uint16_t lampda::hal::ble::hal_ble_characteristic_t::initial_length
 
hal_ble_gatt_prop_t lampda::hal::ble::hal_ble_characteristic_t::properties
 
hal_ble_gatt_perm_t lampda::hal::ble::hal_ble_characteristic_t::rPermissions
 
hal_ble_gatt_perm_t lampda::hal::ble::hal_ble_characteristic_t::wPermissions
 
hal_ble_read_callback_t lampda::hal::ble::hal_ble_characteristic_t::read_cb
 
hal_ble_write_callback_t lampda::hal::ble::hal_ble_characteristic_t::write_cb
 
const char * lampda::hal::ble::hal_ble_characteristic_t::descriptor
 
hal_ble_uuid_t lampda::hal::ble::hal_ble_service_t::uuid
 
hal_ble_pairing_complete_cb_t lampda::hal::ble::hal_ble_sec_config_t::on_pairing_done
 
hal_ble_secure_cb_t lampda::hal::ble::hal_ble_sec_config_t::on_secured
 
bool lampda::hal::ble::hal_ble_sec_config_t::mitm_required
 
uint16_t lampda::hal::ble::hal_ble_adv_params_t::interval_min_ms
 
uint16_t lampda::hal::ble::hal_ble_adv_params_t::interval_max_ms
 
bool lampda::hal::ble::hal_ble_adv_params_t::include_tx_power
 
uint16_t lampda::hal::ble::hal_ble_adv_params_t::timeout_s
 
bool lampda::hal::ble::hal_ble_adv_params_t::restartOnDisconnect
 
uint16_t lampda::hal::ble::hal_ble_conn_params_t::min_conn_interval_ms
 
uint16_t lampda::hal::ble::hal_ble_conn_params_t::max_conn_interval_ms
 
uint16_t lampda::hal::ble::hal_ble_conn_params_t::conn_latency
 
uint16_t lampda::hal::ble::hal_ble_conn_params_t::supervision_timeout_ms
 
hal_ble_conn_state_cb_t lampda::hal::ble::hal_ble_event_callbacks_t::on_connect
 
hal_ble_disconn_state_cb_t lampda::hal::ble::hal_ble_event_callbacks_t::on_disconnect
 
hal_ble_advertising_stops_cb_t lampda::hal::ble::hal_ble_event_callbacks_t::on_advertising_stops
 
const char * lampda::hal::ble::services::system_infos::Infos::model
 
const char * lampda::hal::ble::services::system_infos::Infos::firmwareRev
 
const char * lampda::hal::ble::services::system_infos::Infos::hardwareRev
 
const char * lampda::hal::ble::services::system_infos::Infos::softwareRev
 
const char * lampda::hal::ble::services::system_infos::Infos::manufacturer
 

Detailed Description

Typedef Documentation

◆ hal_ble_advertising_stops_cb_t

Advertising stopped callback.

Fired when a the advertising stops for any reason.

Parameters
[in]conn_handleConnection that paired

◆ hal_ble_char_handle_t

using lampda::hal::ble::hal_ble_char_handle_t = typedef uint16_t

Characteristic Descriptor Handle Storage.

Internal (opaque) for platform use.

◆ hal_ble_conn_handle_t

using lampda::hal::ble::hal_ble_conn_handle_t = typedef uint16_t

Characteristic Read/Write Callback Context.

Opaque handle to connection context for callbacks.

◆ hal_ble_conn_state_cb_t

Connection State Change Callback.

Fired when Central connects or disconnects.

Parameters
[in]conn_handleConnection handle (invalid after disconnect)

◆ hal_ble_disconn_state_cb_t

using lampda::hal::ble::hal_ble_disconn_state_cb_t = typedef void (*)(hal_ble_conn_handle_t conn_handle, uint8_t reason)

Disconnection State Change Callback.

Fired when Central connects or disconnects.

Parameters
[in]conn_handleConnection handle (invalid after disconnect)
[in]reasonDisconnect reason code (0 = normal, varies by platform)

◆ hal_ble_pairing_complete_cb_t

Pairing Completed Callback.

Fired when pairing finishes (success or failure).

Parameters
[in]conn_handleConnection that paired
[in]codepairing code

◆ hal_ble_read_callback_t

using lampda::hal::ble::hal_ble_read_callback_t = typedef 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.

Allows dynamic value generation at read time.

Parameters
[in]conn_handleConnection handle
[in]char_handleCharacteristic being read
[out]dataBuffer to fill with characteristic value
[in]max_lengthMaximum bytes to write
Returns
Number of bytes written to data, or negative error code

◆ hal_ble_secure_cb_t

using lampda::hal::ble::hal_ble_secure_cb_t = typedef void (*)(hal_ble_conn_handle_t conn_handle)

Connection secured Callback.

Fired when a secure connection is established.

Parameters
[in]conn_handleConnection that paired

◆ hal_ble_write_callback_t

using lampda::hal::ble::hal_ble_write_callback_t = typedef void (*)(hal_ble_conn_handle_t conn_handle, const uint8_t* data, uint16_t length)

Callback fired when Central writes to a characteristic.

Parameters
[in]conn_handleConnection handle (identifies which Central)
[in]dataPointer to received data
[in]lengthNumber of bytes received

Enumeration Type Documentation

◆ hal_ble_adress_type

enum class lampda::hal::ble::hal_ble_adress_type : uint8_t
strong
Enumerator
INVALID 

Public (identity) address.

PUBLIC 

Public (identity) address.

RANDOM_STATIC 

Random static (identity) address.

RANDOM_PRIVATE_RESOLVABLE 

Random private resolvable address.

RANDOM_PRIVATE_NON_RESOLVABLE 

Random private non-resolvable address.

ANONYMOUS 

An advertiser may advertise without its address. This type of advertising is called anonymous.

◆ hal_ble_feature_t

Query BLE Feature Support.

Some platforms may not support all features.

Enumerator
HAL_BLE_FEATURE_DLE 

Data Length Extension (larger packets)

HAL_BLE_FEATURE_MULTI_ROLE 

Simultaneous Peripheral + Central

Function Documentation

◆ hal_ble_add_characteristic()

int32_t lampda::hal::ble::hal_ble_add_characteristic ( hal_ble_characteristic_t *  characteristic)

Add a Characteristic to the Current Service.

Characteristics hold data values and define client interaction methods.

Parameters
[in,out]characteristicCharacteristic definition (handle will be filled)
Returns
HAL_BLE_SUCCESS or error code
Note
Must call between hal_ble_add_service() and hal_ble_start_advertising()
Read/Write callbacks are optional; if NULL, static value is used

◆ hal_ble_add_service()

int32_t lampda::hal::ble::hal_ble_add_service ( hal_ble_service_t *  service,
const bool  addToAdvertised 
)

Add a Service to GATT Database.

Services group related characteristics. Typically called before adding characteristics.

Parameters
[in,out]serviceService definition (handle will be filled)
Returns
HAL_BLE_SUCCESS or error code
Note
Must call before hal_ble_start_advertising()
Typical service UUIDs:
  • 0x180A = Device Information Service
  • 0x180F = Battery Service
  • 0x181A = Environmental Sensing

◆ hal_ble_can_load_bound_key()

bool lampda::hal::ble::hal_ble_can_load_bound_key ( hal_ble_conn_handle_t  conn_handle)

Fill a bound key if it exists

◆ hal_ble_clear_bonds()

int32_t lampda::hal::ble::hal_ble_clear_bonds ( void  )

Clear All Stored Bonds (Forget Paired Centrals)

Erases bonding information; next connection requires re-pairing. Useful for factory reset scenarios.

Returns
HAL_BLE_SUCCESS or error code

◆ hal_ble_deinit()

int32_t lampda::hal::ble::hal_ble_deinit ( void  )

Deinitialize BLE Stack.

Stops advertising, closes connections, releases resources.

Returns
HAL_BLE_SUCCESS or error code

◆ hal_ble_disconnect()

int32_t lampda::hal::ble::hal_ble_disconnect ( hal_ble_conn_handle_t  conn_handle)

Disconnect a Connected Central.

Forcefully closes the link to a specific Central.

Parameters
[in]conn_handleConnection handle
Returns
HAL_BLE_SUCCESS or error code

◆ hal_ble_get_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.

Retrieves value from GATT database (useful for non-callback characteristics).

Parameters
[in]char_handleCharacteristic handle
[out]dataBuffer to receive value
[in]max_lengthBuffer size
Returns
Number of bytes read, or negative error code

◆ hal_ble_get_connection_count()

uint8_t lampda::hal::ble::hal_ble_get_connection_count ( void  )

Get Number of Active Connections.

Returns
Number of currently connected Centrals (typically 0-8)

◆ hal_ble_get_device_name()

int32_t lampda::hal::ble::hal_ble_get_device_name ( char *  name,
uint16_t  max_length 
)

Get Device Name.

Parameters
[out]nameBuffer to receive device name
[in]max_lengthBuffer size
Returns
Number of bytes written, or negative error code

◆ hal_ble_get_mtu()

int32_t lampda::hal::ble::hal_ble_get_mtu ( hal_ble_conn_handle_t  conn_handle)

Get Current MTU (Maximum Transmission Unit) Size.

Default is 23 bytes; may increase after negotiation with Central.

Parameters
[in]conn_handleConnection handle
Returns
MTU size in bytes, or negative error code

◆ hal_ble_get_rssi()

int8_t lampda::hal::ble::hal_ble_get_rssi ( hal_ble_conn_handle_t  conn_handle)

Get Connection Signal Strength (RSSI)

RSSI (Received Signal Strength Indicator) indicates link quality.

Parameters
[in]conn_handleConnection handle
Returns
RSSI in dBm (typical: -100 to -20 dBm), or error code

◆ hal_ble_get_tx_power()

int8_t lampda::hal::ble::hal_ble_get_tx_power ( void  )

Get TX Power.

Returns
Current TX power in dBm

◆ hal_ble_has_feature()

bool lampda::hal::ble::hal_ble_has_feature ( hal_ble_feature_t  feature)

Check if Feature is Supported.

Parameters
[in]featureFeature to query
Returns
true if supported, false otherwise

◆ hal_ble_indicate()

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.

Indication: Server sends value; Central must send acknowledgment. Slower but reliable (guaranteed delivery).

Parameters
[in]conn_handleConnection handle (target Central)
[in]char_handleCharacteristic handle
[in]dataUpdated value
[in]lengthNumber of bytes
Returns
HAL_BLE_SUCCESS or error code
Note
Only works for characteristics with HAL_BLE_GATT_PROP_INDICATE property
Client must have enabled indications via CCCD

◆ hal_ble_init()

int32_t lampda::hal::ble::hal_ble_init ( const char *  device_name,
const hal_ble_event_callbacks_t *  callbacks 
)

Initialize BLE Stack.

Must be called before any other hal_ble_* function.

Parameters
[in]device_namePeripheral device name (max 31 characters for advertising)
[in]callbacksEvent handler callbacks
Returns
HAL_BLE_SUCCESS or error code

◆ hal_ble_is_advertising()

bool lampda::hal::ble::hal_ble_is_advertising ( void  )

Check if Currently Advertising.

Returns
true if advertising, false otherwise

◆ hal_ble_is_connected()

bool lampda::hal::ble::hal_ble_is_connected ( hal_ble_conn_handle_t  conn_handle)

Get Connection State.

Parameters
[in]conn_handleConnection handle
Returns
true if connected, false otherwise

◆ hal_ble_is_initialized()

bool lampda::hal::ble::hal_ble_is_initialized ( void  )

Check if BLE Stack is Initialized.

Returns
true if initialized, false otherwise

◆ hal_ble_notify()

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.

Notification: Server sends value change without waiting for acknowledgment. Faster but unreliable (client may miss it).

Parameters
[in]char_handleCharacteristic handle
[in]dataUpdated value
[in]lengthNumber of bytes
Returns
HAL_BLE_SUCCESS or error code
Note
Only works for characteristics with HAL_BLE_GATT_PROP_NOTIFY property
Client must have enabled notifications via CCCD (Client Characteristic Config Descriptor)

◆ hal_ble_set_characteristic_value()

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.

Changes the current value stored in GATT database. Use for non-callback characteristics or when value changes internally.

Parameters
[in]char_handleCharacteristic handle (from hal_ble_add_characteristic)
[in]dataNew value
[in]lengthNumber of bytes
Returns
HAL_BLE_SUCCESS or error code
Note
Does not trigger notifications automatically; call hal_ble_notify() instead

◆ hal_ble_set_device_name()

int32_t lampda::hal::ble::hal_ble_set_device_name ( const char *  name)

Set Device Name.

Public name shown in advertisements and GATT Device Information Service.

Parameters
[in]nameDevice name (max 31 characters recommended)
Returns
HAL_BLE_SUCCESS or error code

◆ hal_ble_set_security_config()

int32_t lampda::hal::ble::hal_ble_set_security_config ( const hal_ble_sec_config_t *  sec_config)

Configure Security Parameters.

Set encryption level, bonding mode, MITM protection, etc. Must be called before starting advertising.

Parameters
[in]sec_configSecurity configuration
Returns
HAL_BLE_SUCCESS or error code

◆ hal_ble_set_tx_power()

int32_t lampda::hal::ble::hal_ble_set_tx_power ( int8_t  tx_power_dbm)

Set TX Power (Transmit Power)

Controls radio transmission strength (affects range and power consumption).

Parameters
[in]tx_power_dbmTransmit power in dBm (typical: -40 to +4 dBm)
Returns
HAL_BLE_SUCCESS or error code
Note
Higher power = greater range but higher battery drain

◆ hal_ble_start_advertising()

int32_t lampda::hal::ble::hal_ble_start_advertising ( const hal_ble_adv_params_t *  adv_params)

Start Advertising (Peripheral Becomes Discoverable)

Begins broadcasting BLE advertisements periodically. Centrals can discover and connect to this device.

Parameters
[in]adv_paramsAdvertising interval and mode
Returns
HAL_BLE_SUCCESS or error code
Note
Will continue until hal_ble_stop_advertising() is called
Device name and GATT database must be set before calling

◆ hal_ble_start_pairing()

int32_t lampda::hal::ble::hal_ble_start_pairing ( hal_ble_conn_handle_t  conn_handle)

Initiate Pairing from Peripheral Side.

Requests the connected Central to start pairing (security exchange).

Parameters
[in]conn_handleConnection handle
Returns
HAL_BLE_SUCCESS or error code
Note
More common for Central to initiate; this is rarely used
Result via on_pairing_request callback

◆ hal_ble_stop_advertising()

int32_t lampda::hal::ble::hal_ble_stop_advertising ( void  )

Stop Advertising.

Stops broadcasting; existing connections remain active.

Returns
HAL_BLE_SUCCESS or error code

Variable Documentation

◆ conn_latency

uint16_t lampda::hal::ble::hal_ble_conn_params_t::conn_latency

Slave latency (skip N connection events, 0-499)

◆ descriptor

const char* lampda::hal::ble::hal_ble_characteristic_t::descriptor

User descriptor

◆ handle

hal_ble_char_handle_t lampda::hal::ble::hal_ble_characteristic_t::handle

◆ include_tx_power

bool lampda::hal::ble::hal_ble_adv_params_t::include_tx_power

Include TX power in advertising packet

◆ initial_length

uint16_t lampda::hal::ble::hal_ble_characteristic_t::initial_length

Length of initial value

◆ initial_value

uint8_t* lampda::hal::ble::hal_ble_characteristic_t::initial_value

Optional initial value (NULL = empty)

◆ interval_max_ms

uint16_t lampda::hal::ble::hal_ble_adv_params_t::interval_max_ms

Max advertising interval (milliseconds)

◆ interval_min_ms

uint16_t lampda::hal::ble::hal_ble_adv_params_t::interval_min_ms

Min advertising interval (milliseconds, typical 20-10240)

◆ max_conn_interval_ms

uint16_t lampda::hal::ble::hal_ble_conn_params_t::max_conn_interval_ms

Maximum connection interval

◆ max_length

uint16_t lampda::hal::ble::hal_ble_characteristic_t::max_length

Max value size in bytes

◆ min_conn_interval_ms

uint16_t lampda::hal::ble::hal_ble_conn_params_t::min_conn_interval_ms

Minimum connection interval (7.5 to 4000 ms)

◆ mitm_required

bool lampda::hal::ble::hal_ble_sec_config_t::mitm_required

Require MITM (Man-In-The-Middle) protection

◆ on_advertising_stops

hal_ble_advertising_stops_cb_t lampda::hal::ble::hal_ble_event_callbacks_t::on_advertising_stops

Called on advertising stopped

◆ on_connect

hal_ble_conn_state_cb_t lampda::hal::ble::hal_ble_event_callbacks_t::on_connect

Called on connection established

◆ on_disconnect

hal_ble_disconn_state_cb_t lampda::hal::ble::hal_ble_event_callbacks_t::on_disconnect

Called on connection lost

◆ on_pairing_done

hal_ble_pairing_complete_cb_t lampda::hal::ble::hal_ble_sec_config_t::on_pairing_done

Called when pairing finishes

◆ on_secured

hal_ble_secure_cb_t lampda::hal::ble::hal_ble_sec_config_t::on_secured

Called when connection is secured

◆ properties

hal_ble_gatt_prop_t lampda::hal::ble::hal_ble_characteristic_t::properties

Read/Write/Notify/Indicate flags

◆ read_cb

hal_ble_read_callback_t lampda::hal::ble::hal_ble_characteristic_t::read_cb

Optional callback on read

◆ restartOnDisconnect

bool lampda::hal::ble::hal_ble_adv_params_t::restartOnDisconnect

Restart Advertising on disconnection

◆ rPermissions

hal_ble_gatt_perm_t lampda::hal::ble::hal_ble_characteristic_t::rPermissions

Read Access control (encrypted, etc.)

◆ supervision_timeout_ms

uint16_t lampda::hal::ble::hal_ble_conn_params_t::supervision_timeout_ms

Timeout before link is dropped (100-32000 ms)

◆ timeout_s

uint16_t lampda::hal::ble::hal_ble_adv_params_t::timeout_s

Advertizing timeout

◆ uuid [1/2]

hal_ble_uuid_t lampda::hal::ble::hal_ble_characteristic_t::uuid

Characteristic UUID

◆ uuid [2/2]

hal_ble_uuid_t lampda::hal::ble::hal_ble_service_t::uuid

Service UUID (e.g., 0x180A for Device Info)

◆  [1/2]

uint8_t { ... } ::uuid128[16]

128-bit UUID (little-endian, LSB first)

◆ uuid128 [2/2]

uint8_t lampda::hal::ble::hal_ble_uuid_t::uuid128[16]

128-bit UUID (little-endian, LSB first)

◆  [1/2]

uint16_t { ... } ::uuid16

16-bit UUID (little-endian)

◆ uuid16 [2/2]

uint16_t lampda::hal::ble::hal_ble_uuid_t::uuid16

16-bit UUID (little-endian)

◆ wPermissions

hal_ble_gatt_perm_t lampda::hal::ble::hal_ble_characteristic_t::wPermissions

Write Access control (encrypted, etc.)

◆ write_cb

hal_ble_write_callback_t lampda::hal::ble::hal_ble_characteristic_t::write_cb

Optional callback on write