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
  • Hi Petter,

    Thanks for your reply.

    I'm checking that this is a GATTS_EVT_WRITE before sending to my on_write function which is called.

    void ble_acs_on_ble_evt(ble_acs_t * p_acs, ble_evt_t * p_ble_evt)
    {
      if ((p_acs == NULL) || (p_ble_evt == NULL)) {
        return;
      }
    
      switch (p_ble_evt->header.evt_id) {
      case BLE_GAP_EVT_CONNECTED:
        on_connect(p_acs, p_ble_evt);
        break;
    
      case BLE_GAP_EVT_DISCONNECTED:
        on_disconnect(p_acs, p_ble_evt);
        break;
    
      case BLE_GATTS_EVT_WRITE:
      on_write(p_acs, p_ble_evt);
      break;
    
      default:
        // No implementation needed.
        break;
      }
    }
    

    Everything seems to be good to me on ble_evt_dispatch.

    I will create a case and send you the whole project. Tha will be simpler do discuss.

Reply
  • Hi Petter,

    Thanks for your reply.

    I'm checking that this is a GATTS_EVT_WRITE before sending to my on_write function which is called.

    void ble_acs_on_ble_evt(ble_acs_t * p_acs, ble_evt_t * p_ble_evt)
    {
      if ((p_acs == NULL) || (p_ble_evt == NULL)) {
        return;
      }
    
      switch (p_ble_evt->header.evt_id) {
      case BLE_GAP_EVT_CONNECTED:
        on_connect(p_acs, p_ble_evt);
        break;
    
      case BLE_GAP_EVT_DISCONNECTED:
        on_disconnect(p_acs, p_ble_evt);
        break;
    
      case BLE_GATTS_EVT_WRITE:
      on_write(p_acs, p_ble_evt);
      break;
    
      default:
        // No implementation needed.
        break;
      }
    }
    

    Everything seems to be good to me on ble_evt_dispatch.

    I will create a case and send you the whole project. Tha will be simpler do discuss.

Children
No Data
Related