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

don't understand what the handle do

Hi
I sit with light demo and can not understand what the handle and p_args do
static void handle_status_cb(access_model_handle_t handle, const access_message_rx_t *p_message, void *p_args) 
 gateway_client_t *p_client = p_args;
  p_message->meta_data.src;

  NRF_MESH_ASSERT(p_client->status_cb != NULL);
  if (!is_valid_source(p_client, p_message)) 
  {
    return;
  }

  gateway_msg_status_t *p_status = (gateway_status_t *)p_message->p_data;
  
  ...
  }
can someone explain it to me
Parents Reply Children
  • Hi,

    I am sorry for the delayed response.

    The handle is the same as the one returned through the p_model_handle parameter of access_model_add(), and it identifies the model instance that received the message. It only becomes useful once you have multiple instances of the same model. In the simple on/off model, the p_args argument is used for this purpose, but for more complex models, this isn't necessarily possible.

    In case you are familiar with BLE and the nRF5 SDK and SoftDevices, it is analogous to the concept of characteristic handles in BLE.

    Regards,
    Terje

Related