17#include <bm/bluetooth/ble_common.h>
18#include <bm/softdevice_handler/nrf_sdh_ble.h>
24#define BLE_UUID_LBS_BASE { 0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, \
25 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00 }
26#define BLE_UUID_LBS_SERVICE 0x1523
27#define BLE_UUID_LBS_BUTTON_CHAR 0x1524
28#define BLE_UUID_LBS_LED_CHAR 0x1525
38#define BLE_LBS_DEF(_name) \
39 static struct ble_lbs _name; \
40 NRF_SDH_BLE_OBSERVER(_name##_obs, ble_lbs_on_ble_evt, &_name, HIGH)
43#define BLE_LBS_CONFIG_SEC_MODE_DEFAULT \
45 .lbs_button_char = { \
46 .read = BLE_GAP_CONN_SEC_MODE_OPEN, \
47 .cccd_write = BLE_GAP_CONN_SEC_MODE_OPEN, \
50 .read = BLE_GAP_CONN_SEC_MODE_OPEN, \
51 .write = BLE_GAP_CONN_SEC_MODE_OPEN, \
107 ble_gap_conn_sec_mode_t
read;
void(* lbs_evt_handler_t)(struct ble_lbs *lbs, const struct ble_lbs_evt *lbs_evt)
LED button Service event handler.
Definition ble_lbs.h:87
uint32_t ble_lbs_on_button_change(struct ble_lbs *lbs, uint16_t conn_handle, uint8_t button_state)
Function for sending a button state notification.
ble_lbs_evt_type
Definition ble_lbs.h:55
@ BLE_LBS_EVT_LED_WRITE
LED write event.
Definition ble_lbs.h:59
@ BLE_LBS_EVT_ERROR
Error event.
Definition ble_lbs.h:63
void ble_lbs_on_ble_evt(const ble_evt_t *ble_evt, void *ble_lbs)
Bluetooth LE event handler for the LED Button Service.
uint32_t ble_lbs_init(struct ble_lbs *lbs, const struct ble_lbs_config *cfg)
Function for initializing the LED Button Service.
ble_gap_conn_sec_mode_t write
Definition ble_lbs.h:109
struct ble_lbs_config::@106 sec_mode
ble_gap_conn_sec_mode_t read
Definition ble_lbs.h:101
lbs_evt_handler_t evt_handler
Event handler to be called when the LED Characteristic is written.
Definition ble_lbs.h:95
struct ble_lbs_config::@106::@107 lbs_button_char
ble_gap_conn_sec_mode_t cccd_write
Definition ble_lbs.h:103
struct ble_lbs_config::@106::@108 lbs_led_char
LED Button Service init structure. This structure contains all options and data needed for initializa...
Definition ble_lbs.h:93
uint8_t value
Definition ble_lbs.h:76
struct ble_lbs_evt::@102::@105 error
enum ble_lbs_evt_type evt_type
Definition ble_lbs.h:67
struct ble_lbs_evt::@102::@104 led_write
uint32_t reason
Definition ble_lbs.h:81
uint16_t conn_handle
Connection handle for which the event applies.
Definition ble_lbs.h:71
ble_gatts_char_handles_t button_char_handles
Handles related to the Button Characteristic.
Definition ble_lbs.h:123
uint8_t uuid_type
UUID type for the LED Button Service.
Definition ble_lbs.h:125
lbs_evt_handler_t evt_handler
Event handler to be called when the LED Characteristic is written.
Definition ble_lbs.h:127
ble_gatts_char_handles_t led_char_handles
Handles related to the LED Characteristic.
Definition ble_lbs.h:121
uint16_t service_handle
Handle of LED Button Service (as provided by the Bluetooth LE stack).
Definition ble_lbs.h:119
Bluetooth LE Button Service structure.
Definition ble_lbs.h:117