This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

about feature value

1. As a slave device, how do I update the content of a feature value when I set a feature value to the property of read?
2. The local setting can set the data of the feature value to be greater than 20 bytes. When the peer device reads a certain feature value of the local device, it reads data greater than 20 bytes at a time.

Parents
  • Hi,

    Not sure if I understand the question, but you may take a look at the blinky example in the SDK:

    \nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\ble_app_blinky\
    (http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/ble_sdk_app_blinky.html?cp=4_0_0_4_1_2_3)

    You can find in ble_lbs_init() that the read propery is set in:

        // Add Button characteristic.
        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid              = LBS_UUID_BUTTON_CHAR;
        add_char_params.uuid_type         = p_lbs->uuid_type;
        add_char_params.init_len          = sizeof(uint8_t);
        add_char_params.max_len           = sizeof(uint8_t);
        add_char_params.char_props.read   = 1;  // Here read property is set.
        add_char_params.char_props.notify = 1;
    
        add_char_params.read_access       = SEC_OPEN;
        add_char_params.cccd_write_access = SEC_OPEN;
    
        err_code = characteristic_add(p_lbs->service_handle,
                                      &add_char_params,
                                      &p_lbs->button_char_handles);

    The value is updated in ble_lbs_on_button_change() by calling sd_ble_gatts_hvx(), this will update the value and also send a notification if enabled.

Reply
  • Hi,

    Not sure if I understand the question, but you may take a look at the blinky example in the SDK:

    \nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\ble_app_blinky\
    (http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/ble_sdk_app_blinky.html?cp=4_0_0_4_1_2_3)

    You can find in ble_lbs_init() that the read propery is set in:

        // Add Button characteristic.
        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid              = LBS_UUID_BUTTON_CHAR;
        add_char_params.uuid_type         = p_lbs->uuid_type;
        add_char_params.init_len          = sizeof(uint8_t);
        add_char_params.max_len           = sizeof(uint8_t);
        add_char_params.char_props.read   = 1;  // Here read property is set.
        add_char_params.char_props.notify = 1;
    
        add_char_params.read_access       = SEC_OPEN;
        add_char_params.cccd_write_access = SEC_OPEN;
    
        err_code = characteristic_add(p_lbs->service_handle,
                                      &add_char_params,
                                      &p_lbs->button_char_handles);

    The value is updated in ble_lbs_on_button_change() by calling sd_ble_gatts_hvx(), this will update the value and also send a notification if enabled.

Children
No Data
Related