$first = false; } $result = $result . "" . $device->deviceInfo($item->id, $jsonString->user); } $result = $result . "]}"; } elseif ($cmd == 'remove') { $result = $device->removeDevice($jsonString->user, $jsonString->device); } elseif ($cmd == 'removeall') { $result = $device->removeAllDevice($jsonString->user); } elseif ($cmd == 'read') { if (isset($jsonString->date)) { $d = $jsonString->date; } else { $d = null; } $result = $device->read($jsonString->user, $jsonString->device, $d); } elseif ($cmd == 'getload') { $result = $device->getload($jsonString->template, $jsonString->unit); } elseif ($cmd == 'readinterval') { $result = $device->readInterval($jsonString->user, $jsonString->device, $jsonString->date1, $jsonString->date2); } elseif ($cmd == 'info') { $result = $device->deviceBehaviour($jsonString->device, $jsonString->user); } elseif ($cmd == 'deviceinfo') { $result = $device->deviceInfo($jsonString->device, $jsonString->user); } else { $result = "{'error': 'unsupported command'}"; } if (isset($_GET['standard'])) { $result = strtr($result, array("'" => '"')); } echo $result;
public function read($input) { $xfer = 0; $fname = null; $ftype = 0; $fid = 0; $xfer += $input->readStructBegin($fname); while (true) { $xfer += $input->readFieldBegin($fname, $ftype, $fid); if ($ftype == TType::STOP) { break; } switch ($fid) { case 0: if ($ftype == TType::LST) { $this->success = array(); $_size0 = 0; $_etype3 = 0; $xfer += $input->readListBegin($_etype3, $_size0); for ($_i4 = 0; $_i4 < $_size0; ++$_i4) { $elem5 = null; $elem5 = new \Device(); $xfer += $elem5->read($input); $this->success[] = $elem5; } $xfer += $input->readListEnd(); } else { $xfer += $input->skip($ftype); } break; default: $xfer += $input->skip($ftype); break; } $xfer += $input->readFieldEnd(); } $xfer += $input->readStructEnd(); return $xfer; }