Thingy User Interface Service module.
More...
|
struct | ble_uis_init_t |
| LED Button Service init structure. This structure contains all options and data needed for initialization of the service. More...
|
|
struct | ble_uis_s |
| LED Button Service structure. This structure contains various status information for the service. More...
|
|
Thingy User Interface Service 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_uis_on_ble_evt() from the softdevice_handler callback.
◆ BLE_UIS_LED_COLOR_MIX_MAX
#define BLE_UIS_LED_COLOR_MIX_MAX 7 |
Maximum value for color mix.
◆ BLE_UIS_LED_COLOR_MIX_MIN
#define BLE_UIS_LED_COLOR_MIX_MIN 1 |
Minimum value for color mix.
◆ BLE_UIS_LED_DELAY_MAX
#define BLE_UIS_LED_DELAY_MAX 10000 |
Maximum delay for breathe sequence [ms].
◆ BLE_UIS_LED_DELAY_MIN
#define BLE_UIS_LED_DELAY_MIN 50 |
Minimum delay for breathe sequence [ms].
◆ BLE_UIS_LED_INTENSITY_MAX
#define BLE_UIS_LED_INTENSITY_MAX 100 |
◆ BLE_UIS_LED_INTENSITY_MIN
#define BLE_UIS_LED_INTENSITY_MIN 1 |
◆ BLE_UIS_LED_MODE_BREATHE_LENGTH
#define BLE_UIS_LED_MODE_BREATHE_LENGTH 5 |
Breahte mode command length [bytes].
◆ BLE_UIS_LED_MODE_BREATHE_ONE_SHOT_LENGTH
#define BLE_UIS_LED_MODE_BREATHE_ONE_SHOT_LENGTH 3 |
One shot mode command length [bytes].
◆ BLE_UIS_LED_MODE_CONST_LENGTH
#define BLE_UIS_LED_MODE_CONST_LENGTH 4 |
Const mode command length [bytes].
◆ BLE_UIS_LED_MODE_MAX
◆ BLE_UIS_LED_MODE_MIN
◆ BLE_UIS_LED_MODE_OFF_LENGTH
#define BLE_UIS_LED_MODE_OFF_LENGTH 1 |
Off mode command length [bytes].
◆ BLE_UIS_UUID_BUTTON_CHAR
#define BLE_UIS_UUID_BUTTON_CHAR 0x0302 |
UUID for button characteristic.
◆ BLE_UIS_UUID_LED_CHAR
#define BLE_UIS_UUID_LED_CHAR 0x0301 |
UUID for LED characteristic.
◆ BLE_UIS_UUID_PIN_CHAR
#define BLE_UIS_UUID_PIN_CHAR 0x0303 |
UUID for pin characteristic.
◆ BLE_UIS_UUID_SERVICE
#define BLE_UIS_UUID_SERVICE 0x0300 |
◆ ble_uis_led_mode_t
The available LED operation modes.
Enumerator |
---|
BLE_UIS_LED_MODE_OFF | LED off.
|
BLE_UIS_LED_MODE_CONST | LED on with a given R, G and B color mix.
|
BLE_UIS_LED_MODE_BREATHE | LED breathe cycle (fade in, on, fade out, off).
|
BLE_UIS_LED_MODE_BREATHE_ONE_SHOT | Similar to BREATHE, but only a single cycle is performed.
|
◆ ble_uis_init()
Function for initializing the LED Button Service.
- Parameters
-
[out] | p_uis | 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_uis_init | Information needed to initialize the service. |
- Return values
-
NRF_SUCCESS | If the service was initialized successfully. Otherwise, an error code is returned. |
◆ ble_uis_on_ble_evt()
void ble_uis_on_ble_evt |
( |
ble_uis_t * |
p_uis, |
|
|
ble_evt_t * |
p_ble_evt |
|
) |
| |
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_uis | LED Button Service structure. |
[in] | p_ble_evt | Event received from the BLE stack. |
◆ ble_uis_on_button_change()
uint32_t ble_uis_on_button_change |
( |
ble_uis_t * |
p_uis, |
|
|
uint8_t |
buttons_state |
|
) |
| |
Function for sending a button state notification.
- Parameters
-
[in] | p_uis | LED Button Service structure. |
[in] | buttons_state | New button state. |
- Return values
-
NRF_SUCCESS | If the notification was sent successfully. Otherwise, an error code is returned. |