function handle_hmb_submission($delay, $is_correct, $challenge_complete) { $json = array("message_version" => 0, "message_timestamp" => date("Y-m-d H:i:s"), "theatric_delay_ms" => $delay, "is_correct" => $is_correct, "challenge_complete" => $challenge_complete); trace("handle_submission sending " . json_encode($json), __FILE__, __LINE__, __METHOD__); // todo remove this is just for testing don't send it URL start with test if (substr($this->rs['URL'], 0, 4) == "test") { return true; } return RPI::do_post_request($this->rs['URL'] . "/handle_submission", $json); }
function _sim_register() { $teamId = $_POST['teamId']; $json = array("team_id" => $teamId, "message" => "hello"); // hack just to reuse do_post_request code $json = RPI::do_post_request("http://localhost/m/brata/register", $json); if ($json === false) { mock_set_brata_response("error"); } else { mock_set_brata_response(json_encode($json)); } redirect("mock_brata/index", "done with register "); }
function _sim_atwaypoint() { $waypointId = $_POST['waypointId']; $teamId = $_POST['teamId']; $json = array("team_id" => $teamId, "message" => ""); // hack just to reuse do_post_request code $json = RPI::do_post_request("http://localhost/m/brata/at_waypoint/" . $waypointId, $json); if ($json === false) { mock_set_brata_response("error"); } else { mock_set_brata_response(json_encode($json)); } redirect("mock_brata/index", "done with sim_atwaypoint"); }
function _sim_join() { $stationId = $_POST['stationId']; $stationType = $_POST['stationType']; $json = array("message_version" => 0, "station_type" => $stationType, "station_url" => $_POST['station_url']); // hack just to reuse do_post_request code $json = RPI::do_post_request("http://localhost/m/rpi/join/{$stationId}", $json); if ($json === false) { mock_set_rpi_response("error"); } else { mock_set_rpi_response(json_encode($json)); } redirect("mock_rpi/index", "done with join "); }
function _sim_submit() { $stationTag = $_POST['stationTag']; $teamId = $_POST['teamId']; $candidateAnswer = $_POST['candidateAnswer']; $json = array("team_id" => $teamId, "message" => $candidateAnswer); // hack just to reuse do_post_request code $json = RPI::do_post_request("http://localhost/m/brata/submit/" . $stationTag, $json); if ($json === false) { mock_set_brata_response("error"); } else { mock_set_brata_response(json_encode($json)); } redirect("mock_brata/index", "done with sim submit"); }
function _sim_start_challenge() { $stationTag = $_POST['stationTag']; $teamId = $_POST['teamId']; $json = array("team_id" => $teamId, "message" => ""); // hack just to reuse do_post_request code $json = RPI::do_post_request("http://localhost/m/brata/start_challenge/" . $stationTag, $json); //trace("json ".$json); if ($json === false) { mock_set_brata_response("error"); } else { mock_set_brata_response(json_encode($json)); } redirect("mock_brata/index", "done with start challenge"); }
function _sim_submit() { $stationId = $_POST['stationId']; $candidate_answer = $_POST['candidate_answer']; $is_correct = isset($_POST['is_correct']) ? true : false; $fail_message = $_POST['fail_message']; $json = array("message_version" => 0, "candidate_answer" => $candidate_answer, "is_correct" => $is_correct, "fail_message" => $fail_message); // hack just to reuse do_post_request code $json = RPI::do_post_request("http://localhost/m/rpi/submit/{$stationId}", $json); if ($json === false) { mock_set_rpi_response("error"); } else { mock_set_rpi_response(json_encode($json)); } redirect("mock_rpi/index", "done with submit "); }