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 !
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 !
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(¶ms, 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, ¶ms);
}
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).
I recommend doing the tutorial with the example files provided, or else at least this challenge doesn't make sense, because challenge 1 and 2 shouldn't be a problem while you get trouble with challenge 3.
What is len? Is it 4?
Also you have to change the max length (attr_char_value.max_len) of the button characteristic value.
Ok, I will do it. Yes, now, I've put len equal to 4. And I replace : uint32_t ble_lbs_on_button_change(ble_lbs_t * p_lbs, uint8_t button_state) by : uint32_t ble_lbs_on_button_change(ble_lbs_t * p_lbs, uint8_t button_state[4])
And now, it seems it works :-) (I'm going to do some tests to see if it always works good). Thanks !
Great! If it does, I would appreciate if you would accept my answer by clicking the circle next to it.
Yes of course ! ;-)