コード例 #1
2
function _submit($stationTag = null)
{
    if ($stationTag === null) {
        trace("brata missing stationId", __FILE__, __LINE__, __METHOD__);
        rest_sendBadRequestResponse(400, "missing stationId");
        // doesn't return
    }
    $station = Station::getFromTag($stationTag);
    if ($station === false) {
        trace("brata can't find station stationTag=" . $stationTag, __FILE__, __LINE__, __METHOD__);
        rest_sendBadRequestResponse(404, "can't find station stationTag=" . $stationTag);
        // doesn't return
    }
    $json = json_getObjectFromRequest("POST");
    // won't return if an error happens
    json_checkMembers("message,team_id", $json);
    $team = Team::getFromPin($json['team_id']);
    if ($team === false) {
        trace("can't find team from team " . $json['team_id']);
        rest_sendBadRequestResponse(404, "can't find team pin=" . $json['team_id']);
    }
    $stationType = new StationType($station->get('typeId'), -1);
    if ($stationType === false) {
        trace("can't find station type stationTag = " . $stationTag, __FILE__, __LINE__, __METHOD__);
        rest_sendBadRequestResponse(500, "can't find station type stationTag=" . $stationTag);
    }
    try {
        $xxxData = XXXData::factory($stationType->get('typeCode'));
        $msg = $xxxData->brataSubmit($json['message'], $team, $station, $stationType);
        json_sendObject(array('message' => $msg));
    } catch (InternalError $ie) {
        rest_sendBadRequestResponse($ie->getCode(), $ie->getMessage());
    }
}
コード例 #2
1
 function __construct($oid = 0, $cid = 0)
 {
     parent::__construct('OID', 'CID', 't_ext_data');
     $this->rs['OID'] = $oid;
     $this->rs['CID'] = $cid;
     $this->rs['a_lat'] = 0;
     $this->rs['a_lng'] = 0;
     $this->rs['b_lat'] = 0;
     $this->rs['b_lng'] = 0;
     $this->rs['c_lat'] = 0;
     $this->rs['c_lng'] = 0;
     $this->rs['t_lat'] = 0;
     $this->rs['t_lng'] = 0;
     $this->rs['height'] = 0;
     if ($oid && $cid) {
         $this->retrieve($oid, $cid);
     }
 }
コード例 #3
0
function _start_challenge($stationTag = null)
{
    if ($stationTag === null) {
        rest_sendBadRequestResponse(400, "missing station Tag");
        // doesn't return
    }
    $station = Station::getFromTag($stationTag);
    if ($station === false) {
        rest_sendBadRequestResponse(404, "can find station stationTag=" . $stationTag);
        // doesn't return
    }
    $stationType = new StationType($station->get('typeId'), -1);
    if ($stationType === false) {
        trace("can't find station type stationTag = " . $stationTag, __FILE__, __LINE__, __METHOD__);
        rest_sendBadRequestResponse(500, "can't find station type stationTag=" . $stationTag);
    }
    $json = json_getObjectFromRequest("POST");
    json_checkMembers("team_id,message", $json);
    $teamPIN = $json['team_id'];
    $team = Team::getFromPin($teamPIN);
    if ($team === false) {
        trace("_start_challenge can't find team teamPin=" . $teamPIN, __FILE__, __LINE__, __METHOD__);
        rest_sendBadRequestResponse(404, "team not found PIN=" . $teamPIN);
        // doesn't return
    }
    try {
        $xxxData = XXXData::factory($stationType->get('typeCode'));
        $msg = $xxxData->startChallenge($team, $station, $stationType);
        json_sendObject(array('message' => $msg));
    } catch (InternalError $ie) {
        rest_sendBadRequestResponse($ie->getCode(), $ie->getMessage());
    }
}
コード例 #4
0
 function __construct($oid = 0, $cid = 0)
 {
     parent::__construct('OID', 'CID', 't_cpa_data');
     $this->rs['OID'] = $oid;
     $this->rs['CID'] = $cid;
     $this->rs['label'] = 0;
     $this->rs['fence'] = 0;
     $this->rs['building'] = 0;
     $this->rs['sum'] = 0;
     if ($oid && $cid) {
         $this->retrieve($oid, $cid);
     }
 }
コード例 #5
0
 function __construct($oid = 0, $cid = 0)
 {
     parent::__construct('OID', 'CID', 't_hmb_data');
     $this->rs['OID'] = $oid;
     $this->rs['CID'] = $cid;
     $this->rs['_1st_on'] = 0;
     $this->rs['_1st_off'] = 0;
     $this->rs['_2nd_on'] = 0;
     $this->rs['_2nd_off'] = 0;
     $this->rs['_3rd_on'] = 0;
     $this->rs['_3rd_off'] = 0;
     $this->rs['cycle'] = 0;
     if ($oid && $cid) {
         $this->retrieve($oid, $cid);
     }
 }
コード例 #6
0
 function __construct($oid = 0, $cid = 0)
 {
     parent::__construct('OID', 'CID', 't_cts_data');
     $this->rs['OID'] = $oid;
     $this->rs['CID'] = $cid;
     $this->rs['stationId'] = "";
     $this->rs['_1st'] = 0.0;
     $this->rs['_2nd'] = 0.0;
     $this->rs['_3rd'] = 0.0;
     $this->rs['_4th'] = 0.0;
     $this->rs['_5th'] = 0.0;
     $this->rs['tolerance'] = 0.0;
     if ($oid && $cid) {
         $this->retrieve($oid, $cid);
     }
 }
コード例 #7
0
 function __construct($oid = 0, $cid = 0)
 {
     parent::__construct('OID', 'CID', 't_fsl_data');
     $this->rs['OID'] = $oid;
     $this->rs['CID'] = $cid;
     $this->rs['a_tag'] = "";
     $this->rs['a_lat'] = 0;
     $this->rs['a_lng'] = 0;
     $this->rs['b_tag'] = "";
     $this->rs['b_lat'] = 0;
     $this->rs['b_lng'] = 0;
     $this->rs['c_tag'] = "";
     $this->rs['c_lat'] = 0;
     $this->rs['c_lng'] = 0;
     $this->rs['l_tag'] = 0;
     $this->rs['l_lat'] = 0;
     $this->rs['l_lng'] = 0;
     $this->rs['a_rad'] = 0;
     $this->rs['b_rad'] = 0;
     $this->rs['c_rad'] = 0;
     if ($oid && $cid) {
         $this->retrieve($oid, $cid);
     }
 }