// handler for toggle led action
int handle_toggle_led(bytebeam_client_t *bytebeam_client, char *args, char *action_id)
{
// Log the received arguments and action id to serial for refrence
ESP_LOGI(TAG, "*** args : %s, action_id : %s ***", args, action_id);
//
// Include command for toggling LED over here
//
int ret_val = 0;
// This function allows platform to know about the completion of particular action
ret_val = bytebeam_publish_action_completed(bytebeam_client, action_id);
if(ret_val != 0)
{
//
// handle the publish action completed error here
//
return -1;
}
return 0;
}
/* Once you have created an action handler for particular action then it should
* be mapped with particular action. Below function call would do that mapping
*/
// bytebeam_client : Bytebeam Client object
// handle_toggle_led : pointer to action_handler
// toggle_board_led : action
bytebeam_add_action_handler(&bytebeam_client, handle_toggle_led, "toggle_board_led");