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

don't understand the code

hi sitting and looking at the light demo example through and looking at

static void act_set_cb (access_model_handle_t act, const access_message_rx_t * p_message, void * p_args) 
where I do not quite understand what p_args is used to, so someone can explain that thanks: D

Parents
  • Maybe you could give the full context of the light demo example that you're referring to?

    Having a search around I only found a Thingy52 light demo but the code I examined didn't have that function.

    The code snippet appears to be setting a callback. In general, callback functions often take an argument of your choice to help your code to process the event - perhaps identifying a particular instance when several items use the same callback. The void* type allows anything to be passed in.

Reply
  • Maybe you could give the full context of the light demo example that you're referring to?

    Having a search around I only found a Thingy52 light demo but the code I examined didn't have that function.

    The code snippet appears to be setting a callback. In general, callback functions often take an argument of your choice to help your code to process the event - perhaps identifying a particular instance when several items use the same callback. The void* type allows anything to be passed in.

Children
Related