case 'left': case 'right': $robot->setDuration(isset($_POST['duration']) ? intval($_POST['duration']) : 0); $robot->{$action}(); $response->performed = $action; break; case 'cam': $direction = isset($_POST['direction']) ? $_POST['direction'] : ''; $position = isset($_POST['position']) ? $_POST['position'] : ''; $response->performed = $robot->camera($direction, $position); break; case 'ping_dist': $response->performed = $robot->pingDist(); break; case 'status': $response->data = $robot->status(); $response->performed = 'status'; break; case 'radar_sweep': $response->performed = 'radar_sweep'; $response->data = $robot->sweep(); break; case 'show_clock': $response->performed = $robot->showClock(); break; case 'light': $num = isset($_POST['num']) ? intval($_POST['num']) : 0; $status = isset($_POST['status']) ? intval($_POST['status']) : 0; $response->performed = $robot->setLight($num, $status); break; case 'poweroff':