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

Solution of the "Challenge 1" (Nordic tutorial)

Hello,

I used this tutorial : devzone.nordicsemi.com/.../

But I can't resolve the "Challenge 1" (write 4 bytes on the characteristic). Can you explain me, please ? :-)

Thanks a lot !

Parents
  • ps : I tried to do it on the example "ble_lbs", so currently, I have :

    uint32_t ble_lbs_on_button_change(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(p_lbs->conn_handle, &params);
    }
    

    I think I have to modify this function, because when I use it, it only changes the first byte (and the 3 others are 34 56 78).

Reply
  • ps : I tried to do it on the example "ble_lbs", so currently, I have :

    uint32_t ble_lbs_on_button_change(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(p_lbs->conn_handle, &params);
    }
    

    I think I have to modify this function, because when I use it, it only changes the first byte (and the 3 others are 34 56 78).

Children
No Data
Related