Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE Characteristic Value - BLE blinky example

Hi,

On button press, the button handler event calls the "ble_lbs_on_button_change" function which sends notification to the BLE client.

uint32_t ble_lbs_on_button_change(uint16_t conn_handle, ble_lbs_t * p_lbs, uint8_t button_state)
{
    ble_gatts_hvx_params_t params;
    uint16_t len = sizeof(button_state);

    memset(&params, 0, sizeof(params));
    params.type   = BLE_GATT_HVX_NOTIFICATION;
    params.handle = p_lbs->button_char_handles.value_handle;
    params.p_data = &button_state;
    params.p_len  = &len;

    return sd_ble_gatts_hvx(conn_handle, &params);
}

The value of the button state parameter in the function call is either 0 or 1 (0 corresponds to button press and 1 corresponds to button release).

The value shown in the client side is "Button pressed" and "Button released"

Can you tell where the strings corresponding to the button states added in the SDK?

Parents Reply Children
No Data
Related