// handler for ToggleLED action
int ToggleLED_Handler(char* args, char* actionId) {
// Log the recieved arguments and action id to serial for the reference
Serial.printf("*** args : %s , actionId : %s ***\n", args, actionId);
//
// Include command for toggling LED over here
//
bool status = true;
// This function allows platform to know about the completion of particuar action
status = Bytebeam.publishActionCompleted(actionId);
if(!status) {
//
// 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.
//
// ToggleLED_Hanlder : pointer to action handler
// ToggleLED : action
Bytebeam.addActionHandler(ToggleLED_Handler, "ToggleLED");