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

P_evt_write handle doesn't match

Hi,

I have a basic characteristic on which I would like to write. I did this on so many projects without any problem but here, the value handle of my characteristic doesn't match with the expected one.

static void on_write(ble_acs_t * p_acs, ble_evt_t * p_ble_evt)
{
  ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;
  NRF_LOG_ERROR("p_evt_write handle %d  reset handle %d\n",p_evt_write->handle, p_acs->reset_handles.value_handle);
  if ( (p_evt_write->handle == p_acs->reset_handles.value_handle) && (p_evt_write->len == ACCEL_RESET_CHAR_MAX_LEN) ) {

    if(p_evt_write->data[0] == 0x01)
    {
        reset_flag = true;
    }

  } 
  
}

Example : p_evt_write_handle is equal to 24 and p_acs->reset_handles.value_handle is equal to 117. Furthermore, this value is really weird because it seems to be too high. I only have 1 service and 3 characteristics so 117 ...

Any idea? I think that I missed something

Parents
  • In fact it seems to be a biggest problem that what I thought. When I try to update a value with sd_ble_gatts_value_set, somtimes it's ok and sometimes error 0x05.

    err_code = sd_ble_gatts_value_set(p_acs->conn_handle, p_acs->accumulated_steps_handles.value_handle, &gatts_value);

    Sometimes I have p_acs conn handle 0 and p_acs->accumulated_steps_handles.value_handle 18 (success) and sometimes I have p_acs conn handle 0 and p_acs->accumulated_steps_handles.value_handle 349 (error).

    As explained before, it seems to be random when I connect / disconnect the device multiple times. I'm using nRF connect on Android phone for information.

Reply
  • In fact it seems to be a biggest problem that what I thought. When I try to update a value with sd_ble_gatts_value_set, somtimes it's ok and sometimes error 0x05.

    err_code = sd_ble_gatts_value_set(p_acs->conn_handle, p_acs->accumulated_steps_handles.value_handle, &gatts_value);

    Sometimes I have p_acs conn handle 0 and p_acs->accumulated_steps_handles.value_handle 18 (success) and sometimes I have p_acs conn handle 0 and p_acs->accumulated_steps_handles.value_handle 349 (error).

    As explained before, it seems to be random when I connect / disconnect the device multiple times. I'm using nRF connect on Android phone for information.

Children
No Data
Related