LED Button Service Server module.
More...
|
struct | ble_lbs_init_t |
| LED Button Service init structure. This structure contains all options and data needed for initialization of the service. More...
|
|
struct | ble_lbs_s |
| LED Button Service structure. This structure contains various status information for the service. More...
|
|
|
#define | LBS_UUID_BASE |
|
#define | LBS_UUID_SERVICE 0x1523 |
|
#define | LBS_UUID_BUTTON_CHAR 0x1524 |
|
#define | LBS_UUID_LED_CHAR 0x1525 |
|
|
typedef struct ble_lbs_s | ble_lbs_t |
|
typedef void(* | ble_lbs_led_write_handler_t )(ble_lbs_t *p_lbs, uint8_t new_state) |
|
LED Button Service Server module.
This module implements a custom LED Button Service with an LED and Button Characteristics. During initialization, the module adds the LED Button Service and Characteristics to the BLE stack database.
The application must supply an event handler for receiving LED Button Service events. Using this handler, the service notifies the application when the LED value changes.
The service also provides a function for letting the application notify the state of the Button Characteristic to connected peers.
- Note
- The application must propagate BLE stack events to the LED Button Service module by calling ble_lbs_on_ble_evt() from the SoftDevice Event Handler callback.
Value:{0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, \
0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00}
Function for initializing the LED Button Service.
- Parameters
-
[out] | p_lbs | LED Button Service structure. This structure must be supplied by the application. It is initialized by this function and will later be used to identify this particular service instance. |
[in] | p_lbs_init | Information needed to initialize the service. |
- Return values
-
NRF_SUCCESS | If the service was initialized successfully. Otherwise, an error code is returned. |
Function for handling the application's BLE stack events.
This function handles all events from the BLE stack that are of interest to the LED Button Service.
- Parameters
-
[in] | p_lbs | LED Button Service structure. |
[in] | p_ble_evt | Event received from the BLE stack. |
uint32_t ble_lbs_on_button_change |
( |
ble_lbs_t * |
p_lbs, |
|
|
uint8_t |
button_state |
|
) |
| |
Function for sending a button state notification.
- Parameters
-
[in] | p_lbs | LED Button Service structure. |
[in] | button_state | New button state. |
- Return values
-
NRF_SUCCESS | If the notification was sent successfully. Otherwise, an error code is returned. |