<?php
/*********************************************************************
*
* api.php
*
* REST API definitions
*
* DO NOT EDIT THIS FILE DIRECTLY.
*
* This file was generated automatically by Yoctopuce Local Projects UI
* (pic24config.php). If you need to change a setting, use the UI to
* change it and save again. This will regenerate the file as needed.
*
*********************************************************************/

declare(strict_types=1);

include_once('APISupport.php');

$ApiAttrEdit = "function editHtml(n,v,t){e=editFreeText;switch(t){case 1:case 9:case 19:case 24:case 27:case 62:case 63:return e(n,v,20);case 3:return editSelect(n,v,['Revert','Save to flash']);case 4:return e(n,v.slice(0,-1),3);case 5:case 36:return editRadio(n,v,['OFF','ON']);case 8:case 11:case 14:case 28:return e(n,v,7);case 10:case 86:return (typeof eF=='undefined'?e:eF)(n,v,9);case 12:return editSelect(n,v,['IMMEDIATE','PERIOD_AVG','PERIOD_MIN','PERIOD_MAX']);case 16:case 25:case 32:case 18:case 49:case 51:case 60:case 67:case 6:case 74:case 81:case 83:case 88:case 89:return e(n,v,15);case 17:return editSelect(n,v,['ANALOG_FAST','DIGITAL4','ANALOG_SMOOTH']);case 15:return editRadio(n,v,['FALSE','TRUE']);case 26:return editSelect(n,v,['HOMENETWORK','ROAMING','NEVER','NEUTRALITY']);case 30:return editSelect(n,v,['RGB','RGBW','WS2811']);case 35:return editUTC(n,v);case 37:return e(n,v,10);case 39:return editSelect(n,v,['USB_5V','USB_3V','EXT_V']);case 40:return editSelect(n,v,['LEFT','UP','RIGHT','DOWN']);case 43:return editSelect(n,v,['AUTO','FROM_USB','FROM_EXT','OFF']);case 44:return editSelect(n,v,['HIGH_RATE','HIGH_RATE_FILTERED','LOW_NOISE','LOW_NOISE_FILTERED','HIGHEST_RATE','AC']);case 45:return editSelect(n,v,['GPS_DMS','GPS_DM','GPS_D']);case 46:return editSelect(n,v,['GNSS','GPS','GLONASS','GALILEO','GPS_GLONASS','GPS_GALILEO','GLONASS_GALILEO']);case 50:return editSelect(n,v,['OFF','3V3','1V8']);case 53:return editSelect(n,v,['STILL','RELAX','AWARE','RUN','CALL','PANIC']);case 54:return editSelect(n,v,['HUMAN_EYE','WIDE_SPECTRUM','INFRARED','HIGH_RATE','HIGH_ENERGY','HIGH_RESOLUTION']);case 57:return editSelect(n,v,['OFF','DC','AC']);case 58:return editSelect(n,v,['IDLE','BRAKE','FORWD','BACKWD','LOVOLT','HICURR','HIHEAT','FAILSF']);case 61:case 96:return e(n,v,33);case 64:return editSelect(n,v,['POST','GET','PUT']);case 65:return editSelect(n,v,['FORM','JSON','JSON_ARRAY','CSV','YOCTO_API','JSON_NUM','EMONCMS','AZURE','INFLUXDB','MQTT','YOCTO_API_JZON','PRTG','INFLUXDB_V2']);case 66:case 99:return e(n,v,50);case 68:return editSelect(n,v,['OFF','OUT3V3','OUT5V','OUT4V7','OUT1V8']);case 69:return editSelect(n,v,['INT','EXT']);case 70:return editSelect(n,v,['NUMERIC','PRESENCE','PULSECOUNT']);case 71:return editSelect(n,v,['PWM_DUTYCYCLE','PWM_FREQUENCY','PWM_PULSEDURATION','PWM_EDGECOUNT','PWM_PULSECOUNT','PWM_CPS','PWM_CPM','PWM_STATE','PWM_FREQ_CPS','PWM_FREQ_CPM','PWM_PERIODCOUNT']);case 72:return editSelect(n,v,['USB5V','USB3V','EXTV','OPNDRN']);case 73:return editSelect(n,v,['DEFAULT','LONG_RANGE','HIGH_ACCURACY','HIGH_SPEED']);case 75:return editSelect(n,v,['NDOF','NDOF_FMC_OFF','M4G','COMPASS','IMU','INCLIN_90DEG_1G8','INCLIN_90DEG_3G6','INCLIN_10DEG']);case 76:return editRadio(n,v,['A','B']);case 77:return editSelect(n,v,['UNCHANGED','A','B']);case 79:return editSelect(n,v,['DISCONNECTED','MANUAL','AUTO1','AUTO60']);case 80:return editSelect(n,v,['OFF','TTL3V','TTL3VR','TTL5V','TTL5VR','RS232','RS485','TTL1V8','SDI12']);case 82:return e(n,v.slice(0,-2),3);case 84:return editRadio(n,v,['ACTIVE_LOW','ACTIVE_HIGH']);case 87:return editRadio(n,v,['MICROSTEP16','MICROSTEP8','MICROSTEP4','HALFSTEP','FULLSTEP']);case 90:return editSelect(n,v,['DIGITAL','TYPE_K','TYPE_E','TYPE_J','TYPE_N','TYPE_R','TYPE_S','TYPE_T','PT100_4WIRES','PT100_3WIRES','PT100_2WIRES','RES_OHM','RES_NTC','RES_LINEAR','RES_INTERNAL','IR','RES_PT1000','CHANNEL_OFF']);case 92:return editSelect(n,v,['SLEEPING','AWAKE']);case 94:return e(n,v,26);case 95:return e(n,v,9);case 97:return e(n,v,14);}return e(n,v,32)}";

$ApiDef = [
    "DataLogger" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "currentRunIndex"    => 14,
        "timeUTC"            => -35,
        "recording"          => -36,
        "autoStart"          => -5,
        "beaconDriven"       => -5,
        "usage"              => 4,
        "clearHistory"       => -15
    ],
    "Qt" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8
    ],
    "Module" => [
        "productName"        => 1,
        "serialNumber"       => 1,
        "logicalName"        => -1,
        "productId"          => 2,
        "productRelease"     => 2,
        "firmwareRelease"    => 1,
        "persistentSettings" => -3,
        "luminosity"         => -4,
        "beacon"             => -5,
        "upTime"             => 6,
        "usbCurrent"         => 7,
        "rebootCountdown"    => -8,
        "userVar"            => -8
    ],
    "Accelerometer" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "bandwidth"          => -14,
        "xValue"             => 10,
        "yValue"             => 10,
        "zValue"             => 10,
        "gravityCancellation" => -5
    ],
    "Altitude" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => -10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "qnh"                => -10,
        "technology"         => 1
    ],
    "AnButton" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "calibratedValue"    => 14,
        "rawValue"           => 14,
        "analogCalibration"  => -5,
        "calibrationMax"     => -14,
        "calibrationMin"     => -14,
        "sensitivity"        => -14,
        "isPressed"          => 15,
        "lastTimePressed"    => 6,
        "lastTimeReleased"   => 6,
        "pulseCounter"       => -16,
        "pulseTimer"         => 6,
        "inputType"          => -17
    ],
    "ArithmeticSensor" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => -1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "description"        => 1,
        "command"            => -1
    ],
    "AudioIn" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "volume"             => -4,
        "mute"               => -15,
        "volumeRange"        => 18,
        "signal"             => 8,
        "noSignalFor"        => 8
    ],
    "AudioOut" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "volume"             => -4,
        "mute"               => -15,
        "volumeRange"        => 18,
        "signal"             => 8,
        "noSignalFor"        => 8
    ],
    "BluetoothLink" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "ownAddress"         => 19,
        "pairingPin"         => -1,
        "remoteAddress"      => -19,
        "remoteName"         => 1,
        "mute"               => -15,
        "preAmplifier"       => -4,
        "volume"             => -4,
        "linkState"          => 20,
        "linkQuality"        => 4,
        "command"            => -1
    ],
    "Buzzer" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "frequency"          => -10,
        "volume"             => -4,
        "playSeqSize"        => 14,
        "playSeqMaxSize"     => 14,
        "playSeqSignature"   => 14,
        "command"            => -1
    ],
    "CarbonDioxide" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "abcPeriod"          => -14,
        "command"            => -1
    ],
    "Cellular" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "linkQuality"        => 4,
        "cellOperator"       => 1,
        "cellIdentifier"     => 1,
        "cellType"           => 21,
        "imsi"               => 22,
        "message"            => 23,
        "pin"                => -24,
        "radioConfig"        => -25,
        "lockedOperator"     => -1,
        "airplaneMode"       => -5,
        "enableData"         => -26,
        "apn"                => -1,
        "apnSecret"          => -27,
        "pingInterval"       => -14,
        "dataSent"           => -14,
        "dataReceived"       => -14,
        "command"            => -1
    ],
    "ColorLed" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "rgbColor"           => -28,
        "hslColor"           => -28,
        "rgbMove"            => -29,
        "hslMove"            => -29,
        "rgbColorAtPowerOn"  => -28,
        "blinkSeqSize"       => 14,
        "blinkSeqMaxSize"    => 14,
        "blinkSeqSignature"  => 14,
        "command"            => -1
    ],
    "ColorLedCluster" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "activeLedCount"     => -14,
        "ledType"            => -30,
        "maxLedCount"        => 14,
        "dynamicLedCount"    => 14,
        "blinkSeqMaxCount"   => 14,
        "blinkSeqMaxSize"    => 14,
        "command"            => -1
    ],
    "Compass" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "bandwidth"          => -14,
        "axis"               => 31,
        "magneticHeading"    => 10
    ],
    "Current" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "enabled"            => -15
    ],
    "CurrentLoopOutput" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "current"            => -10,
        "currentTransition"  => -32,
        "currentAtStartUp"   => -10,
        "loopPower"          => 33
    ],
    "DaisyChain" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "daisyState"         => 34,
        "childCount"         => 14,
        "requiredChildCount" => -14
    ],
    "DigitalIO" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "portState"          => -37,
        "portDirection"      => -37,
        "portOpenDrain"      => -37,
        "portPolarity"       => -37,
        "portDiags"          => 38,
        "portSize"           => 14,
        "outputVoltage"      => -39,
        "command"            => -1
    ],
    "Display" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "enabled"            => -15,
        "startupSeq"         => -1,
        "brightness"         => -4,
        "orientation"        => -40,
        "displayWidth"       => 14,
        "displayHeight"      => 14,
        "displayType"        => 41,
        "layerWidth"         => 14,
        "layerHeight"        => 14,
        "layerCount"         => 14,
        "command"            => -1
    ],
    "DualPower" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "powerState"         => 42,
        "powerControl"       => -43,
        "extVoltage"         => 14
    ],
    "Files" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "filesCount"         => 14,
        "freeSpace"          => 14
    ],
    "GenericSensor" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => -1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "signalValue"        => 10,
        "signalUnit"         => 1,
        "signalRange"        => -18,
        "valueRange"         => -18,
        "signalBias"         => -10,
        "signalSampling"     => -44,
        "enabled"            => -15
    ],
    "Gps" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "isFixed"            => 15,
        "satCount"           => 16,
        "satPerConst"        => 16,
        "gpsRefreshRate"     => 10,
        "coordSystem"        => -45,
        "constellation"      => -46,
        "latitude"           => 1,
        "longitude"          => 1,
        "dilution"           => 10,
        "altitude"           => 10,
        "groundSpeed"        => 10,
        "direction"          => 10,
        "unixTime"           => 35,
        "dateTime"           => 1,
        "utcOffset"          => -8,
        "command"            => -1
    ],
    "GroundSpeed" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8
    ],
    "Gyro" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "bandwidth"          => -14,
        "xValue"             => 10,
        "yValue"             => 10,
        "zValue"             => 10
    ],
    "HubPort" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "enabled"            => -15,
        "portState"          => 47,
        "baudRate"           => 48
    ],
    "Humidity" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => -1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "relHum"             => 10,
        "absHum"             => 10
    ],
    "I2cPort" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "rxCount"            => 14,
        "txCount"            => 14,
        "errCount"           => 14,
        "rxMsgCount"         => 14,
        "txMsgCount"         => 14,
        "lastMsg"            => 1,
        "currentJob"         => -1,
        "startupJob"         => -1,
        "jobMaxTask"         => 14,
        "jobMaxSize"         => 14,
        "command"            => -1,
        "protocol"           => -49,
        "i2cVoltageLevel"    => -50,
        "i2cMode"            => -51
    ],
    "InputChain" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "expectedNodes"      => -14,
        "detectedNodes"      => 14,
        "loopbackTest"       => -5,
        "refreshRate"        => -14,
        "bitChain1"          => 1,
        "bitChain2"          => 1,
        "bitChain3"          => 1,
        "bitChain4"          => 1,
        "bitChain5"          => 1,
        "bitChain6"          => 1,
        "bitChain7"          => 1,
        "watchdogPeriod"     => -14,
        "chainDiags"         => 52
    ],
    "Latitude" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8
    ],
    "Longitude" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8
    ],
    "Led" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "power"              => -5,
        "luminosity"         => -4,
        "blinking"           => -53
    ],
    "LightSensor" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => -10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "measureType"        => -54
    ],
    "Magnetometer" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "bandwidth"          => -14,
        "xValue"             => 10,
        "yValue"             => 10,
        "zValue"             => 10
    ],
    "MessageBox" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "slotsInUse"         => 14,
        "slotsCount"         => 14,
        "slotsBitmap"        => 55,
        "pduSent"            => -14,
        "pduReceived"        => -14,
        "command"            => -1
    ],
    "MultiAxisController" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "nAxis"              => -14,
        "globalState"        => 56,
        "command"            => -1
    ],
    "MultiCellWeighScale" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => -1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "cellCount"          => -14,
        "externalSense"      => -15,
        "excitation"         => -57,
        "tempAvgAdaptRatio"  => -10,
        "tempChgAdaptRatio"  => -10,
        "compTempAvg"        => 10,
        "compTempChg"        => 10,
        "compensation"       => 10,
        "zeroTracking"       => -10,
        "command"            => -1
    ],
    "MultiSensController" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "nSensors"           => -14,
        "maxSensors"         => 14,
        "maintenanceMode"    => -15,
        "lastAddressDetected" => 14,
        "command"            => -1
    ],
    "Motor" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "motorStatus"        => -58,
        "drivingForce"       => -10,
        "brakingForce"       => -10,
        "cutOffVoltage"      => -10,
        "overCurrentLimit"   => -14,
        "frequency"          => -10,
        "starterTime"        => -14,
        "failSafeTimeout"    => -14,
        "command"            => -1
    ],
    "Network" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "readiness"          => 59,
        "macAddress"         => 19,
        "ipAddress"          => 60,
        "subnetMask"         => 60,
        "router"             => 60,
        "currentDNS"         => 60,
        "ipConfig"           => -61,
        "primaryDNS"         => -60,
        "secondaryDNS"       => -60,
        "ntpServer"          => -60,
        "userPassword"       => -62,
        "adminPassword"      => -63,
        "httpPort"           => -14,
        "defaultPage"        => -1,
        "discoverable"       => -15,
        "wwwWatchdogDelay"   => -14,
        "callbackUrl"        => -1,
        "callbackMethod"     => -64,
        "callbackEncoding"   => -65,
        "callbackCredentials" => -66,
        "callbackInitialDelay" => -14,
        "callbackSchedule"   => -67,
        "callbackMinDelay"   => -14,
        "callbackMaxDelay"   => -14,
        "poeCurrent"         => 7
    ],
    "OsControl" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "shutdownCountdown"  => -14
    ],
    "Power" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "cosPhi"             => 10,
        "meter"              => -10,
        "deliveredEnergyMeter" => 10,
        "receivedEnergyMeter" => 10,
        "meterTimer"         => 14
    ],
    "Pressure" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8
    ],
    "PowerOutput" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "voltage"            => -68
    ],
    "PowerSupply" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "voltageSetPoint"    => -10,
        "currentLimit"       => -10,
        "powerOutput"        => -5,
        "voltageSense"       => -69,
        "measuredVoltage"    => 10,
        "measuredCurrent"    => 10,
        "inputVoltage"       => 10,
        "vInt"               => 10,
        "ldoTemperature"     => 10,
        "voltageTransition"  => -32,
        "voltageAtStartUp"   => -10,
        "currentAtStartUp"   => -10,
        "command"            => -1
    ],
    "Proximity" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "signalValue"        => 10,
        "detectionThreshold" => -14,
        "detectionHysteresis" => -14,
        "presenceMinTime"    => -14,
        "removalMinTime"     => -14,
        "isPresent"          => 15,
        "lastTimeApproached" => 6,
        "lastTimeRemoved"    => 6,
        "pulseCounter"       => -16,
        "pulseTimer"         => 6,
        "proximityReportMode" => -70
    ],
    "PwmInput" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => -1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "dutyCycle"          => 10,
        "pulseDuration"      => 10,
        "frequency"          => 10,
        "period"             => 10,
        "pulseCounter"       => -16,
        "pulseTimer"         => 6,
        "pwmReportMode"      => -71,
        "debouncePeriod"     => -14,
        "bandwidth"          => -14,
        "edgesPerPeriod"     => 14
    ],
    "PwmOutput" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "enabled"            => -15,
        "frequency"          => -10,
        "period"             => -10,
        "dutyCycle"          => -10,
        "pulseDuration"      => -10,
        "pwmTransition"      => -1,
        "enabledAtPowerOn"   => -15,
        "dutyCycleAtPowerOn" => -10
    ],
    "PwmPowerSource" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "powerMode"          => -72
    ],
    "QuadratureDecoder" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => -10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "speed"              => 10,
        "decoding"           => -5,
        "edgesPerCycle"      => -14
    ],
    "RangeFinder" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => -1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "rangeFinderMode"    => -73,
        "timeFrame"          => -6,
        "quality"            => 4,
        "hardwareCalibration" => -74,
        "currentTemperature" => 10,
        "command"            => -1
    ],
    "RealTimeClock" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unixTime"           => -35,
        "dateTime"           => 1,
        "utcOffset"          => -8,
        "timeSet"            => 15,
        "disableHostSync"    => -15
    ],
    "RefFrame" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "mountPos"           => -14,
        "bearing"            => -10,
        "calibrationParam"   => -13,
        "fusionMode"         => -75
    ],
    "Relay" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "state"              => -76,
        "stateAtPowerOn"     => -77,
        "maxTimeOnStateA"    => -6,
        "maxTimeOnStateB"    => -6,
        "output"             => -5,
        "pulseTimer"         => -6,
        "delayedPulseTimer"  => -78,
        "countdown"          => 6
    ],
    "SegmentedDisplay" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "displayedText"      => -1,
        "displayMode"        => -79
    ],
    "SerialPort" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "rxCount"            => 14,
        "txCount"            => 14,
        "errCount"           => 14,
        "rxMsgCount"         => 14,
        "txMsgCount"         => 14,
        "lastMsg"            => 1,
        "currentJob"         => -1,
        "startupJob"         => -1,
        "jobMaxTask"         => 14,
        "jobMaxSize"         => 14,
        "command"            => -1,
        "protocol"           => -49,
        "voltageLevel"       => -80,
        "serialMode"         => -81
    ],
    "Servo" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "position"           => -8,
        "enabled"            => -15,
        "range"              => -4,
        "neutral"            => -82,
        "move"               => -29,
        "positionAtPowerOn"  => -8,
        "enabledAtPowerOn"   => -15
    ],
    "SpiPort" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "rxCount"            => 14,
        "txCount"            => 14,
        "errCount"           => 14,
        "rxMsgCount"         => 14,
        "txMsgCount"         => 14,
        "lastMsg"            => 1,
        "currentJob"         => -1,
        "startupJob"         => -1,
        "jobMaxTask"         => 14,
        "jobMaxSize"         => 14,
        "command"            => -1,
        "protocol"           => -49,
        "voltageLevel"       => -80,
        "spiMode"            => -83,
        "ssPolarity"         => -84,
        "shiftSampling"      => -5
    ],
    "StepperMotor" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "motorState"         => 56,
        "diags"              => 85,
        "stepPos"            => -86,
        "speed"              => 10,
        "pullinSpeed"        => -10,
        "maxAccel"           => -10,
        "maxSpeed"           => -10,
        "stepping"           => -87,
        "overcurrent"        => -14,
        "tCurrStop"          => -14,
        "tCurrRun"           => -14,
        "alertMode"          => -88,
        "auxMode"            => -89,
        "auxSignal"          => -8,
        "command"            => -1
    ],
    "Temperature" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => -1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "sensorType"         => -90,
        "signalValue"        => 10,
        "signalUnit"         => 1,
        "command"            => -1
    ],
    "Tilt" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "bandwidth"          => -14,
        "axis"               => 31
    ],
    "Tvoc" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8
    ],
    "Voc" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8
    ],
    "Voltage" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => 1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "enabled"            => -15
    ],
    "VoltageOutput" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "currentVoltage"     => -10,
        "voltageTransition"  => -32,
        "voltageAtStartUp"   => -10
    ],
    "WakeUpMonitor" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "powerDuration"      => -14,
        "sleepCountdown"     => -14,
        "nextWakeUp"         => -35,
        "wakeUpReason"       => 91,
        "wakeUpState"        => -92,
        "rtcTime"            => 35
    ],
    "WakeUpSchedule" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "minutesA"           => -93,
        "minutesB"           => -93,
        "hours"              => -94,
        "weekDays"           => -95,
        "monthDays"          => -96,
        "months"             => -97,
        "nextOccurence"      => 35
    ],
    "Watchdog" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "state"              => -76,
        "stateAtPowerOn"     => -77,
        "maxTimeOnStateA"    => -6,
        "maxTimeOnStateB"    => -6,
        "output"             => -5,
        "pulseTimer"         => -6,
        "delayedPulseTimer"  => -78,
        "countdown"          => 6,
        "autoStart"          => -5,
        "running"            => -5,
        "triggerDelay"       => -6,
        "triggerDuration"    => -6,
        "lastTrigger"        => 14
    ],
    "WeighScale" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "unit"               => -1,
        "currentValue"       => 10,
        "lowestValue"        => -10,
        "highestValue"       => -10,
        "currentRawValue"    => 10,
        "logFrequency"       => -11,
        "reportFrequency"    => -11,
        "advMode"            => -12,
        "calibrationParam"   => -13,
        "resolution"         => -10,
        "sensorState"        => 8,
        "excitation"         => -57,
        "tempAvgAdaptRatio"  => -10,
        "tempChgAdaptRatio"  => -10,
        "compTempAvg"        => 10,
        "compTempChg"        => 10,
        "compensation"       => 10,
        "zeroTracking"       => -10,
        "command"            => -1
    ],
    "Wireless" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9,
        "linkQuality"        => 4,
        "ssid"               => 1,
        "channel"            => 14,
        "security"           => 98,
        "message"            => 23,
        "wlanConfig"         => -99,
        "wlanState"          => 100
    ],
    "TestSuite" => [
        "logicalName"        => -1,
        "advertisedValue"    => -9
    ],
    "DeviceInfo" => [
        "serialNumber"       => 101,
        "logicalName"        => 101,
        "productName"        => 101,
        "productId"          => 2,
        "networkUrl"         => 102,
        "beacon"             => 5,
        "index"              => 8
    ],
    "Provider" => [
        "baseType"           => 103,
        "hardwareId"         => 104,
        "logicalName"        => 101,
        "advertisedValue"    => 105,
        "index"              => 8
    ]
];

$ApiTypes = ["","Text","XWord","enumFlashSettings","Percent","enumOnOff","Time","UsedCurrent","Int","PubText","MeasureVal","YFrequency","enumAdvertisingMode","CalibParams","UInt31","enumBool","UInt","enumInputType","ValueRange","MACAddress","enumBtState","enumCellType","IMSI","YFSText","PinPassword","RadioConfig","enumServiceScope","APNPassword","U24Color","Move","enumLedType","enumAxis","AnyFloatTransition","enumLoopPwrState","enumDaisyState","UTCTime","enumOffOnPending","BitByte","DigitalIODiags","enumIOVoltage","enumOrientation","enumDisplayType","enumDualPwrState","enumDualPwrControl","enumSignalSampling","enumGPSCoordinateSystem","enumGPSConstellation","enumPortState","BaudRate","Protocol","enumI2cVoltageLevel","I2cMode","InputChainDiags","enumBlink","enumLightSensorTypeAll","BinaryBuffer","enumStepperState","enumExcitationMode","enumMotorState","enumReadiness","IPAddress","IPConfig","UserPassword","AdminPassword","enumHTTPMethod","enumCallbackEncoding","Credentials","CallbackSchedule","enumPowerOuputVoltage","enumVoltageSense","enumProximityReportModeType","enumPwmReportModeType","enumPwmPwrState","enumRangeFinderMode","RangeFinderCalib","enumFusionModeTypeAll","enumToggle","enumToggleAtPowerOn","DelayedPulse","enumDisplayMode","enumSerialVoltageLevel","SerialMode","MicroSeconds","SpiMode","enumPolarity","StepperDiags","StepPos","enumSteppingMode","AlertMode","AuxMode","enumTempSensorTypeAll","enumWakeUpReason","enumWakeUpState","MinOfHalfHourBits","HoursOfDayBits","DaysOfWeekBits","DaysOfMonthBits","MonthsOfYearBits","enumWLANSec","WLANConfig","enumWLANState","HText","ApiURL","enumBaseType","HwId","PubStrText"];

$ApiEnums = [
    "enumBool"           => ["FALSE","TRUE"],
    "enumOnOff"          => ["OFF","ON"],
    "enumToggle"         => ["A","B"],
    "enumOffOnPending"   => ["OFF","ON","PENDING"],
    "enumBlink"          => ["STILL","RELAX","AWARE","RUN","CALL","PANIC"],
    "enumMotorState"     => ["IDLE","BRAKE","FORWD","BACKWD","LOVOLT","HICURR","HIHEAT","FAILSF"],
    "enumPwrCtrl"        => ["AUTO","FROM_USB","FROM_EXT","OFF"],
    "enumPwrState"       => ["OFF","FROM_USB","FROM_EXT"],
    "enumPwmPwrMode"     => ["USB_5V","USB_3V","EXT_V","OPNDRN"],
    "enumLoopPwrState"   => ["NOPWR","LOWPWR","POWEROK"],
    "enumPortState"      => ["OFF","OVRLD","ON","RUN","PROG"],
    "enumIOVoltage"      => ["USB_5V","USB_3V","EXT_V"],
    "enumBaseType"       => ["FUNCTION","SENSOR"],
    "enumReadiness"      => ["DOWN","EXISTS","LINKED","LAN_OK","WWW_OK"],
    "enumWLANState"      => ["DOWN","SCANNING","CONNECTED","REJECTED"],
    "enumBtState"        => ["DOWN","FREE","SEARCH","EXISTS","LINKED","PLAY"],
    "enumWLANSec"        => ["UNKNOWN","OPEN","WEP","WPA","WPA2"],
    "enumCellType"       => ["GPRS","EGPRS","WCDMA","HSDPA","NONE","CDMA","LTE_M","NB_IOT","EC_GSM_IOT"],
    "enumTempSensorTypeAll" => ["DIGITAL","TYPE_K","TYPE_E","TYPE_J","TYPE_N","TYPE_R","TYPE_S","TYPE_T","PT100_4WIRES","PT100_3WIRES","PT100_2WIRES","RES_OHM","RES_NTC","RES_LINEAR","RES_INTERNAL","IR","RES_PT1000","CHANNEL_OFF"],
    "enumPwmReportModeType" => ["PWM_DUTYCYCLE","PWM_FREQUENCY","PWM_PULSEDURATION","PWM_EDGECOUNT","PWM_PULSECOUNT","PWM_CPS","PWM_CPM","PWM_STATE","PWM_FREQ_CPS","PWM_FREQ_CPM","PWM_PERIODCOUNT"],
    "enumLightSensorTypeAll" => ["HUMAN_EYE","WIDE_SPECTRUM","INFRARED","HIGH_RATE","HIGH_ENERGY","HIGH_RESOLUTION"],
    "enumSignalSampling" => ["HIGH_RATE","HIGH_RATE_FILTERED","LOW_NOISE","LOW_NOISE_FILTERED","HIGHEST_RATE","AC"],
    "enumHTTPMethod"     => ["POST","GET","PUT"],
    "enumCallbackEncoding" => ["FORM","JSON","JSON_ARRAY","CSV","YOCTO_API","JSON_NUM","EMONCMS","AZURE","INFLUXDB","MQTT","YOCTO_API_JZON","PRTG","INFLUXDB_V2"],
    "enumDisplayType"    => ["MONO","GRAY","RGB"],
    "enumOrientation"    => ["LEFT","UP","RIGHT","DOWN"],
    "enumDisplayMode"    => ["DISCONNECTED","MANUAL","AUTO1","AUTO60"],
    "enumWakeUpReason"   => ["USBPOWER","EXTPOWER","ENDOFSLEEP","EXTSIG1","SCHEDULE1","SCHEDULE2"],
    "enumWakeUpState"    => ["SLEEPING","AWAKE"],
    "enumToggleAtPowerOn" => ["UNCHANGED","A","B"],
    "enumAxis"           => ["X","Y","Z"],
    "enumFusionModeTypeAll" => ["NDOF","NDOF_FMC_OFF","M4G","COMPASS","IMU","INCLIN_90DEG_1G8","INCLIN_90DEG_3G6","INCLIN_10DEG"],
    "enumSerialVoltageLevel" => ["OFF","TTL3V","TTL3VR","TTL5V","TTL5VR","RS232","RS485","TTL1V8","SDI12"],
    "enumI2cVoltageLevel" => ["OFF","3V3","1V8"],
    "enumPowerOuputVoltage" => ["OFF","OUT3V3","OUT5V","OUT4V7","OUT1V8"],
    "enumServiceScope"   => ["HOMENETWORK","ROAMING","NEVER","NEUTRALITY"],
    "enumGPSCoordinateSystem" => ["GPS_DMS","GPS_DM","GPS_D"],
    "enumGPSConstellation" => ["GNSS","GPS","GLONASS","GALILEO","GPS_GLONASS","GPS_GALILEO","GLONASS_GALILEO"],
    "enumPolarity"       => ["ACTIVE_LOW","ACTIVE_HIGH"],
    "enumStepperState"   => ["ABSENT","ALERT","HI_Z","STOP","RUN","BATCH"],
    "enumSteppingMode"   => ["MICROSTEP16","MICROSTEP8","MICROSTEP4","HALFSTEP","FULLSTEP"],
    "enumRangeFinderMode" => ["DEFAULT","LONG_RANGE","HIGH_ACCURACY","HIGH_SPEED"],
    "enumDaisyState"     => ["READY","IS_CHILD","FIRMWARE_MISMATCH","CHILD_MISSING","CHILD_LOST"],
    "enumProximityReportModeType" => ["NUMERIC","PRESENCE","PULSECOUNT"],
    "enumExcitationMode" => ["OFF","DC","AC"],
    "enumVoltageSense"   => ["INT","EXT"],
    "enumLedType"        => ["RGB","RGBW","WS2811"],
    "enumAdvertisingMode" => ["IMMEDIATE","PERIOD_AVG","PERIOD_MIN","PERIOD_MAX"],
    "enumInputType"      => ["ANALOG_FAST","DIGITAL4","ANALOG_SMOOTH"],
    "enumFlashSettings"  => ["LOADED","SAVED","MODIFIED"]
];

// Decode an attribute value received from REST API
function ApiRestDecodeAttribute(int $attrtype, string $ystr): mixed
{
    global $ApiTypes, $ApiEnums;
    
    $typename = $ApiTypes[abs($attrtype)];
    if(isset($ApiEnums[$typename])) {
        return parseEnum($ystr, $ApiEnums[$typename]);
    }
    switch(abs($attrtype)) {
    case 2:                             // XWord
        return parseUInt($ystr);
    case 10:                            // MeasureVal
        return parseMeasure($ystr);
    case 28:                            // U24Color
        return parseUInt($ystr);
    case 29:                            // Move
        return parseMove($ystr);
    case 78:                            // DelayedPulse
        return parseMove($ystr);
    case 86:                            // StepPos
        return parseStepPos($ystr);
    default:
        if(is_numeric($ystr)) {
            return floatVal($ystr);
        }
        return $ystr;
    }
}

// Encode an attribute value for setting a new value using REST API
function ApiRestEncodeAttribute(int $attrtype, mixed $php_val): string
{
    switch(abs($attrtype)) {
    case 2:                             // XWord
        return sprintf("0x%04x", $php_val);
    case 10:                            // MeasureVal
        return strval(round($php_val * 65536.0));
    case 28:                            // U24Color
        return sprintf("0x%06x", $php_val);
    case 29:                            // Move
        return $php_val["target"].':'.$php_val["ms"];
    case 78:                            // DelayedPulse
        return $php_val["target"].':'.$php_val["ms"];
    case 86:                            // StepPos
        return strval(round($php_val * 100.0)/100.0);
    default:
        return strVal($php_val);
    }
}

// Decode an attribute value received from JSON API
function ApiJsonDecodeAttribute(mixed $json_val, int $attrtype): mixed
{
    switch(abs($attrtype)) {
    case 10:                            // MeasureVal
        return round($json_val / 65.536) / 1000.0;
    case 86:                            // StepPos
        return $json_val / 16.0;
    default:
        return $json_val;
    }
}

// Encode an attribute value for pushing as JSON API
function ApiJsonEncodeAttribute(VHubServerHTTPRequest $httpReq, mixed $php_val, int $attrtype): mixed
{
    switch(abs($attrtype)) {
    case 10:                            // MeasureVal
        return round($php_val * 65536.0);
    case 24:                            // PinPassword
        return APIPassword($httpReq, $php_val);
    case 27:                            // APNPassword
        return APIPassword($httpReq, $php_val);
    case 62:                            // UserPassword
        return APIPassword($httpReq, $php_val);
    case 63:                            // AdminPassword
        return APIPassword($httpReq, $php_val);
    case 86:                            // StepPos
        return round($php_val * 16.0);
    default:
        return $php_val;
    }
}

// Encode an attribute value for pushing as TXT (or XML) API
function ApiTxtEncodeAttribute(VHubServerHTTPRequest $httpReq, mixed $val, int $attrtype): string
{
    global $ApiTypes, $ApiEnums;
    
    $typename = $ApiTypes[abs($attrtype)];
    if(isset($ApiEnums[$typename])) {
        if(isset($ApiEnums[$typename][$val])) {
            return $ApiEnums[$typename][$val];
        }
        return $typename.'_'.$val;
    }
    switch(abs($attrtype)) {
    case 2:                             // XWord
        return sprintf("0x%04x", $val);
    case 4:                             // Percent
        return $val.'%';
    case 6:                             // Time
        return ($val / 1000.0).' [s]';
    case 7:                             // UsedCurrent
        return ($val).' [mA]';
    case 10:                            // MeasureVal
        return strval(round($val * 1000.0) / 1000.0);
    case 24:                            // PinPassword
        return APIPassword($httpReq, $val);
    case 27:                            // APNPassword
        return APIPassword($httpReq, $val);
    case 28:                            // U24Color
        return sprintf("0x%06x", $val);
    case 29:                            // Move
        return ($val->moving ? "{$val->target} in {$val->ms} [ms]" : 'none');
    case 37:                            // BitByte
        return APIBitString("11111111", $val);
    case 38:                            // DigitalIODiags
        return APIBitString("012345678TP", $val);
    case 48:                            // BaudRate
        return ($val).' [kbps]';
    case 52:                            // InputChainDiags
        return APIBitString("NW5CDLRT", $val);
    case 62:                            // UserPassword
        return APIPassword($httpReq, $val);
    case 63:                            // AdminPassword
        return APIPassword($httpReq, $val);
    case 78:                            // DelayedPulse
        return ($val->moving ? "{$val->target} in {$val->ms} [ms]" : 'none');
    case 82:                            // MicroSeconds
        return $val.' [us]';
    case 85:                            // StepperDiags
        return APIBitString("VCTXLHOStho!", $val);
    case 93:                            // MinOfHalfHourBits
        return APIBitString("012345678901234567890123456789", $val);
    case 94:                            // HoursOfDayBits
        return APIBitString("012345678901234567890123", $val);
    case 95:                            // DaysOfWeekBits
        return APIBitString("MTWTFSS", $val);
    case 96:                            // DaysOfMonthBits
        return APIBitString("1234567890123456789012345678901", $val);
    case 97:                            // MonthsOfYearBits
        return APIBitString("JFMAMJJASOND", $val);
    default:
        return strVal($val);
    }
}

