//--- (YGenericSensor implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("signalValue"))
        {
            _signalValue = Math.Round(json_val.getDouble("signalValue") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("signalUnit"))
        {
            _signalUnit = json_val.getString("signalUnit");
        }
        if (json_val.has("signalRange"))
        {
            _signalRange = json_val.getString("signalRange");
        }
        if (json_val.has("valueRange"))
        {
            _valueRange = json_val.getString("valueRange");
        }
        if (json_val.has("signalBias"))
        {
            _signalBias = Math.Round(json_val.getDouble("signalBias") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("signalSampling"))
        {
            _signalSampling = json_val.getInt("signalSampling");
        }
        if (json_val.has("enabled"))
        {
            _enabled = json_val.getInt("enabled") > 0 ? 1 : 0;
        }
        base._parseAttr(json_val);
    }
Esempio n. 2
0
    //--- (generated code: YWireless implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("linkQuality"))
        {
            _linkQuality = json_val.getInt("linkQuality");
        }
        if (json_val.has("ssid"))
        {
            _ssid = json_val.getString("ssid");
        }
        if (json_val.has("channel"))
        {
            _channel = json_val.getInt("channel");
        }
        if (json_val.has("security"))
        {
            _security = json_val.getInt("security");
        }
        if (json_val.has("message"))
        {
            _message = json_val.getString("message");
        }
        if (json_val.has("wlanConfig"))
        {
            _wlanConfig = json_val.getString("wlanConfig");
        }
        if (json_val.has("wlanState"))
        {
            _wlanState = json_val.getInt("wlanState");
        }
        base._parseAttr(json_val);
    }
Esempio n. 3
0
    //--- (YRangeFinder implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("rangeFinderMode"))
        {
            _rangeFinderMode = json_val.getInt("rangeFinderMode");
        }
        if (json_val.has("timeFrame"))
        {
            _timeFrame = json_val.getLong("timeFrame");
        }
        if (json_val.has("quality"))
        {
            _quality = json_val.getInt("quality");
        }
        if (json_val.has("hardwareCalibration"))
        {
            _hardwareCalibration = json_val.getString("hardwareCalibration");
        }
        if (json_val.has("currentTemperature"))
        {
            _currentTemperature = Math.Round(json_val.getDouble("currentTemperature") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
Esempio n. 4
0
    //--- (YGps implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("isFixed"))
        {
            _isFixed = json_val.getInt("isFixed") > 0 ? 1 : 0;
        }
        if (json_val.has("satCount"))
        {
            _satCount = json_val.getLong("satCount");
        }
        if (json_val.has("coordSystem"))
        {
            _coordSystem = json_val.getInt("coordSystem");
        }
        if (json_val.has("constellation"))
        {
            _constellation = json_val.getInt("constellation");
        }
        if (json_val.has("latitude"))
        {
            _latitude = json_val.getString("latitude");
        }
        if (json_val.has("longitude"))
        {
            _longitude = json_val.getString("longitude");
        }
        if (json_val.has("dilution"))
        {
            _dilution = Math.Round(json_val.getDouble("dilution") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("altitude"))
        {
            _altitude = Math.Round(json_val.getDouble("altitude") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("groundSpeed"))
        {
            _groundSpeed = Math.Round(json_val.getDouble("groundSpeed") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("direction"))
        {
            _direction = Math.Round(json_val.getDouble("direction") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("unixTime"))
        {
            _unixTime = json_val.getLong("unixTime");
        }
        if (json_val.has("dateTime"))
        {
            _dateTime = json_val.getString("dateTime");
        }
        if (json_val.has("utcOffset"))
        {
            _utcOffset = json_val.getInt("utcOffset");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
        //--- (YPowerSupply implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("voltageSetPoint"))
            {
                _voltageSetPoint = Math.Round(json_val.getDouble("voltageSetPoint") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("currentLimit"))
            {
                _currentLimit = Math.Round(json_val.getDouble("currentLimit") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("powerOutput"))
            {
                _powerOutput = json_val.getInt("powerOutput") > 0 ? 1 : 0;
            }
            if (json_val.has("voltageSense"))
            {
                _voltageSense = json_val.getInt("voltageSense");
            }
            if (json_val.has("measuredVoltage"))
            {
                _measuredVoltage = Math.Round(json_val.getDouble("measuredVoltage") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("measuredCurrent"))
            {
                _measuredCurrent = Math.Round(json_val.getDouble("measuredCurrent") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("inputVoltage"))
            {
                _inputVoltage = Math.Round(json_val.getDouble("inputVoltage") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("vInt"))
            {
                _vInt = Math.Round(json_val.getDouble("vInt") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("ldoTemperature"))
            {
                _ldoTemperature = Math.Round(json_val.getDouble("ldoTemperature") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("voltageTransition"))
            {
                _voltageTransition = json_val.getString("voltageTransition");
            }
            if (json_val.has("voltageAtStartUp"))
            {
                _voltageAtStartUp = Math.Round(json_val.getDouble("voltageAtStartUp") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("currentAtStartUp"))
            {
                _currentAtStartUp = Math.Round(json_val.getDouble("currentAtStartUp") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("command"))
            {
                _command = json_val.getString("command");
            }
            base._parseAttr(json_val);
        }
Esempio n. 6
0
    //--- (end of generated code: YWlanRecord definitions)

    public YWlanRecord(string data)
    {
        //--- (generated code: YWlanRecord attributes initialization)
        //--- (end of generated code: YWlanRecord attributes initialization)
        YAPI.YJSONObject p = new YAPI.YJSONObject(data);
        p.parse();
        this._ssid    = p.getString("ssid");
        this._sec     = p.getString("sec");
        this._rssi    = p.getInt("rssi");
        this._channel = p.getInt("channel");
    }
Esempio n. 7
0
    //--- (YArithmeticSensor implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("description"))
        {
            _description = json_val.getString("description");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
Esempio n. 8
0
    //--- (YBuzzer implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("frequency"))
        {
            _frequency = Math.Round(json_val.getDouble("frequency") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("volume"))
        {
            _volume = json_val.getInt("volume");
        }
        if (json_val.has("playSeqSize"))
        {
            _playSeqSize = json_val.getInt("playSeqSize");
        }
        if (json_val.has("playSeqMaxSize"))
        {
            _playSeqMaxSize = json_val.getInt("playSeqMaxSize");
        }
        if (json_val.has("playSeqSignature"))
        {
            _playSeqSignature = json_val.getInt("playSeqSignature");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
    //--- (YBluetoothLink implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("ownAddress"))
        {
            _ownAddress = json_val.getString("ownAddress");
        }
        if (json_val.has("pairingPin"))
        {
            _pairingPin = json_val.getString("pairingPin");
        }
        if (json_val.has("remoteAddress"))
        {
            _remoteAddress = json_val.getString("remoteAddress");
        }
        if (json_val.has("remoteName"))
        {
            _remoteName = json_val.getString("remoteName");
        }
        if (json_val.has("mute"))
        {
            _mute = json_val.getInt("mute") > 0 ? 1 : 0;
        }
        if (json_val.has("preAmplifier"))
        {
            _preAmplifier = json_val.getInt("preAmplifier");
        }
        if (json_val.has("volume"))
        {
            _volume = json_val.getInt("volume");
        }
        if (json_val.has("linkState"))
        {
            _linkState = json_val.getInt("linkState");
        }
        if (json_val.has("linkQuality"))
        {
            _linkQuality = json_val.getInt("linkQuality");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
Esempio n. 10
0
    //--- (end of generated code: YFileRecord definitions)

    public YFileRecord(string data)
    {
        //--- (generated code: YFileRecord attributes initialization)
        //--- (end of generated code: YFileRecord attributes initialization)
        YAPI.YJSONObject p = new YAPI.YJSONObject(data);
        p.parse();
        this._name = p.getString("name");
        this._size = p.getInt("size");
        this._crc  = p.getInt("crc");
    }
Esempio n. 11
0
    //--- (YTemperature implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("sensorType"))
        {
            _sensorType = json_val.getInt("sensorType");
        }
        if (json_val.has("signalValue"))
        {
            _signalValue = Math.Round(json_val.getDouble("signalValue") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("signalUnit"))
        {
            _signalUnit = json_val.getString("signalUnit");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
        //--- (YInputChain implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("expectedNodes"))
            {
                _expectedNodes = json_val.getInt("expectedNodes");
            }
            if (json_val.has("detectedNodes"))
            {
                _detectedNodes = json_val.getInt("detectedNodes");
            }
            if (json_val.has("loopbackTest"))
            {
                _loopbackTest = json_val.getInt("loopbackTest") > 0 ? 1 : 0;
            }
            if (json_val.has("refreshRate"))
            {
                _refreshRate = json_val.getInt("refreshRate");
            }
            if (json_val.has("bitChain1"))
            {
                _bitChain1 = json_val.getString("bitChain1");
            }
            if (json_val.has("bitChain2"))
            {
                _bitChain2 = json_val.getString("bitChain2");
            }
            if (json_val.has("bitChain3"))
            {
                _bitChain3 = json_val.getString("bitChain3");
            }
            if (json_val.has("bitChain4"))
            {
                _bitChain4 = json_val.getString("bitChain4");
            }
            if (json_val.has("bitChain5"))
            {
                _bitChain5 = json_val.getString("bitChain5");
            }
            if (json_val.has("bitChain6"))
            {
                _bitChain6 = json_val.getString("bitChain6");
            }
            if (json_val.has("bitChain7"))
            {
                _bitChain7 = json_val.getString("bitChain7");
            }
            if (json_val.has("watchdogPeriod"))
            {
                _watchdogPeriod = json_val.getInt("watchdogPeriod");
            }
            if (json_val.has("chainDiags"))
            {
                _chainDiags = json_val.getInt("chainDiags");
            }
            base._parseAttr(json_val);
        }
    //--- (YSegmentedDisplay implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("displayedText"))
        {
            _displayedText = json_val.getString("displayedText");
        }
        if (json_val.has("displayMode"))
        {
            _displayMode = json_val.getInt("displayMode");
        }
        base._parseAttr(json_val);
    }
        //--- (YAltitude implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("qnh"))
            {
                _qnh = Math.Round(json_val.getDouble("qnh") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("technology"))
            {
                _technology = json_val.getString("technology");
            }
            base._parseAttr(json_val);
        }
        //--- (YCarbonDioxide implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("abcPeriod"))
            {
                _abcPeriod = json_val.getInt("abcPeriod");
            }
            if (json_val.has("command"))
            {
                _command = json_val.getString("command");
            }
            base._parseAttr(json_val);
        }
Esempio n. 16
0
    //--- (YMultiAxisController implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("nAxis"))
        {
            _nAxis = json_val.getInt("nAxis");
        }
        if (json_val.has("globalState"))
        {
            _globalState = json_val.getInt("globalState");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
Esempio n. 17
0
    //--- (YVoltageOutput implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("currentVoltage"))
        {
            _currentVoltage = Math.Round(json_val.getDouble("currentVoltage") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("voltageTransition"))
        {
            _voltageTransition = json_val.getString("voltageTransition");
        }
        if (json_val.has("voltageAtStartUp"))
        {
            _voltageAtStartUp = Math.Round(json_val.getDouble("voltageAtStartUp") * 1000.0 / 65536.0) / 1000.0;
        }
        base._parseAttr(json_val);
    }
Esempio n. 18
0
        //--- (YMultiCellWeighScale implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("cellCount"))
            {
                _cellCount = json_val.getInt("cellCount");
            }
            if (json_val.has("externalSense"))
            {
                _externalSense = json_val.getInt("externalSense") > 0 ? 1 : 0;
            }
            if (json_val.has("excitation"))
            {
                _excitation = json_val.getInt("excitation");
            }
            if (json_val.has("tempAvgAdaptRatio"))
            {
                _tempAvgAdaptRatio = Math.Round(json_val.getDouble("tempAvgAdaptRatio") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("tempChgAdaptRatio"))
            {
                _tempChgAdaptRatio = Math.Round(json_val.getDouble("tempChgAdaptRatio") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("compTempAvg"))
            {
                _compTempAvg = Math.Round(json_val.getDouble("compTempAvg") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("compTempChg"))
            {
                _compTempChg = Math.Round(json_val.getDouble("compTempChg") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("compensation"))
            {
                _compensation = Math.Round(json_val.getDouble("compensation") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("zeroTracking"))
            {
                _zeroTracking = Math.Round(json_val.getDouble("zeroTracking") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("command"))
            {
                _command = json_val.getString("command");
            }
            base._parseAttr(json_val);
        }
    //--- (YRefFrame implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("mountPos"))
        {
            _mountPos = json_val.getInt("mountPos");
        }
        if (json_val.has("bearing"))
        {
            _bearing = Math.Round(json_val.getDouble("bearing") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("calibrationParam"))
        {
            _calibrationParam = json_val.getString("calibrationParam");
        }
        if (json_val.has("fusionMode"))
        {
            _fusionMode = json_val.getInt("fusionMode");
        }
        base._parseAttr(json_val);
    }
Esempio n. 20
0
        //--- (YCurrentLoopOutput implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("current"))
            {
                _current = Math.Round(json_val.getDouble("current") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("currentTransition"))
            {
                _currentTransition = json_val.getString("currentTransition");
            }
            if (json_val.has("currentAtStartUp"))
            {
                _currentAtStartUp = Math.Round(json_val.getDouble("currentAtStartUp") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("loopPower"))
            {
                _loopPower = json_val.getInt("loopPower");
            }
            base._parseAttr(json_val);
        }
        //--- (YRealTimeClock implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("unixTime"))
            {
                _unixTime = json_val.getLong("unixTime");
            }
            if (json_val.has("dateTime"))
            {
                _dateTime = json_val.getString("dateTime");
            }
            if (json_val.has("utcOffset"))
            {
                _utcOffset = json_val.getInt("utcOffset");
            }
            if (json_val.has("timeSet"))
            {
                _timeSet = json_val.getInt("timeSet") > 0 ? 1 : 0;
            }
            base._parseAttr(json_val);
        }
    //--- (YMultiSensController implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("nSensors"))
        {
            _nSensors = json_val.getInt("nSensors");
        }
        if (json_val.has("maxSensors"))
        {
            _maxSensors = json_val.getInt("maxSensors");
        }
        if (json_val.has("maintenanceMode"))
        {
            _maintenanceMode = json_val.getInt("maintenanceMode") > 0 ? 1 : 0;
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
Esempio n. 23
0
    //--- (YMotor implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("motorStatus"))
        {
            _motorStatus = json_val.getInt("motorStatus");
        }
        if (json_val.has("drivingForce"))
        {
            _drivingForce = Math.Round(json_val.getDouble("drivingForce") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("brakingForce"))
        {
            _brakingForce = Math.Round(json_val.getDouble("brakingForce") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("cutOffVoltage"))
        {
            _cutOffVoltage = Math.Round(json_val.getDouble("cutOffVoltage") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("overCurrentLimit"))
        {
            _overCurrentLimit = json_val.getInt("overCurrentLimit");
        }
        if (json_val.has("frequency"))
        {
            _frequency = Math.Round(json_val.getDouble("frequency") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("starterTime"))
        {
            _starterTime = json_val.getInt("starterTime");
        }
        if (json_val.has("failSafeTimeout"))
        {
            _failSafeTimeout = json_val.getInt("failSafeTimeout");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
Esempio n. 24
0
        //--- (YAudioOut implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("volume"))
            {
                _volume = json_val.getInt("volume");
            }
            if (json_val.has("mute"))
            {
                _mute = json_val.getInt("mute") > 0 ? 1 : 0;
            }
            if (json_val.has("volumeRange"))
            {
                _volumeRange = json_val.getString("volumeRange");
            }
            if (json_val.has("signal"))
            {
                _signal = json_val.getInt("signal");
            }
            if (json_val.has("noSignalFor"))
            {
                _noSignalFor = json_val.getInt("noSignalFor");
            }
            base._parseAttr(json_val);
        }
Esempio n. 25
0
        //--- (YPwmOutput implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("enabled"))
            {
                _enabled = json_val.getInt("enabled") > 0 ? 1 : 0;
            }
            if (json_val.has("frequency"))
            {
                _frequency = Math.Round(json_val.getDouble("frequency") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("period"))
            {
                _period = Math.Round(json_val.getDouble("period") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("dutyCycle"))
            {
                _dutyCycle = Math.Round(json_val.getDouble("dutyCycle") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("pulseDuration"))
            {
                _pulseDuration = Math.Round(json_val.getDouble("pulseDuration") * 1000.0 / 65536.0) / 1000.0;
            }
            if (json_val.has("pwmTransition"))
            {
                _pwmTransition = json_val.getString("pwmTransition");
            }
            if (json_val.has("enabledAtPowerOn"))
            {
                _enabledAtPowerOn = json_val.getInt("enabledAtPowerOn") > 0 ? 1 : 0;
            }
            if (json_val.has("dutyCycleAtPowerOn"))
            {
                _dutyCycleAtPowerOn = Math.Round(json_val.getDouble("dutyCycleAtPowerOn") * 1000.0 / 65536.0) / 1000.0;
            }
            base._parseAttr(json_val);
        }
Esempio n. 26
0
    //--- (YDigitalIO implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("portState"))
        {
            _portState = json_val.getInt("portState");
        }
        if (json_val.has("portDirection"))
        {
            _portDirection = json_val.getInt("portDirection");
        }
        if (json_val.has("portOpenDrain"))
        {
            _portOpenDrain = json_val.getInt("portOpenDrain");
        }
        if (json_val.has("portPolarity"))
        {
            _portPolarity = json_val.getInt("portPolarity");
        }
        if (json_val.has("portDiags"))
        {
            _portDiags = json_val.getInt("portDiags");
        }
        if (json_val.has("portSize"))
        {
            _portSize = json_val.getInt("portSize");
        }
        if (json_val.has("outputVoltage"))
        {
            _outputVoltage = json_val.getInt("outputVoltage");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
    //--- (generated code: YCellular implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("linkQuality"))
        {
            _linkQuality = json_val.getInt("linkQuality");
        }
        if (json_val.has("cellOperator"))
        {
            _cellOperator = json_val.getString("cellOperator");
        }
        if (json_val.has("cellIdentifier"))
        {
            _cellIdentifier = json_val.getString("cellIdentifier");
        }
        if (json_val.has("cellType"))
        {
            _cellType = json_val.getInt("cellType");
        }
        if (json_val.has("imsi"))
        {
            _imsi = json_val.getString("imsi");
        }
        if (json_val.has("message"))
        {
            _message = json_val.getString("message");
        }
        if (json_val.has("pin"))
        {
            _pin = json_val.getString("pin");
        }
        if (json_val.has("lockedOperator"))
        {
            _lockedOperator = json_val.getString("lockedOperator");
        }
        if (json_val.has("airplaneMode"))
        {
            _airplaneMode = json_val.getInt("airplaneMode") > 0 ? 1 : 0;
        }
        if (json_val.has("enableData"))
        {
            _enableData = json_val.getInt("enableData");
        }
        if (json_val.has("apn"))
        {
            _apn = json_val.getString("apn");
        }
        if (json_val.has("apnSecret"))
        {
            _apnSecret = json_val.getString("apnSecret");
        }
        if (json_val.has("pingInterval"))
        {
            _pingInterval = json_val.getInt("pingInterval");
        }
        if (json_val.has("dataSent"))
        {
            _dataSent = json_val.getInt("dataSent");
        }
        if (json_val.has("dataReceived"))
        {
            _dataReceived = json_val.getInt("dataReceived");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }
        //--- (YColorLed implementation)

        protected override void _parseAttr(YAPI.YJSONObject json_val)
        {
            if (json_val.has("rgbColor"))
            {
                _rgbColor = json_val.getInt("rgbColor");
            }
            if (json_val.has("hslColor"))
            {
                _hslColor = json_val.getInt("hslColor");
            }
            if (json_val.has("rgbMove"))
            {
                YAPI.YJSONObject subjson = json_val.getYJSONObject("rgbMove");
                if (subjson.has("moving"))
                {
                    _rgbMove.moving = subjson.getInt("moving");
                }
                if (subjson.has("target"))
                {
                    _rgbMove.target = subjson.getInt("target");
                }
                if (subjson.has("ms"))
                {
                    _rgbMove.ms = subjson.getInt("ms");
                }
            }
            if (json_val.has("hslMove"))
            {
                YAPI.YJSONObject subjson = json_val.getYJSONObject("hslMove");
                if (subjson.has("moving"))
                {
                    _hslMove.moving = subjson.getInt("moving");
                }
                if (subjson.has("target"))
                {
                    _hslMove.target = subjson.getInt("target");
                }
                if (subjson.has("ms"))
                {
                    _hslMove.ms = subjson.getInt("ms");
                }
            }
            if (json_val.has("rgbColorAtPowerOn"))
            {
                _rgbColorAtPowerOn = json_val.getInt("rgbColorAtPowerOn");
            }
            if (json_val.has("blinkSeqSize"))
            {
                _blinkSeqSize = json_val.getInt("blinkSeqSize");
            }
            if (json_val.has("blinkSeqMaxSize"))
            {
                _blinkSeqMaxSize = json_val.getInt("blinkSeqMaxSize");
            }
            if (json_val.has("blinkSeqSignature"))
            {
                _blinkSeqSignature = json_val.getInt("blinkSeqSignature");
            }
            if (json_val.has("command"))
            {
                _command = json_val.getString("command");
            }
            base._parseAttr(json_val);
        }
Esempio n. 29
0
    //--- (YStepperMotor implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("motorState"))
        {
            _motorState = json_val.getInt("motorState");
        }
        if (json_val.has("diags"))
        {
            _diags = json_val.getInt("diags");
        }
        if (json_val.has("stepPos"))
        {
            _stepPos = json_val.getDouble("stepPos") / 16.0;
        }
        if (json_val.has("speed"))
        {
            _speed = Math.Round(json_val.getDouble("speed") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("pullinSpeed"))
        {
            _pullinSpeed = Math.Round(json_val.getDouble("pullinSpeed") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("maxAccel"))
        {
            _maxAccel = Math.Round(json_val.getDouble("maxAccel") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("maxSpeed"))
        {
            _maxSpeed = Math.Round(json_val.getDouble("maxSpeed") * 1000.0 / 65536.0) / 1000.0;
        }
        if (json_val.has("stepping"))
        {
            _stepping = json_val.getInt("stepping");
        }
        if (json_val.has("overcurrent"))
        {
            _overcurrent = json_val.getInt("overcurrent");
        }
        if (json_val.has("tCurrStop"))
        {
            _tCurrStop = json_val.getInt("tCurrStop");
        }
        if (json_val.has("tCurrRun"))
        {
            _tCurrRun = json_val.getInt("tCurrRun");
        }
        if (json_val.has("alertMode"))
        {
            _alertMode = json_val.getString("alertMode");
        }
        if (json_val.has("auxMode"))
        {
            _auxMode = json_val.getString("auxMode");
        }
        if (json_val.has("auxSignal"))
        {
            _auxSignal = json_val.getInt("auxSignal");
        }
        if (json_val.has("command"))
        {
            _command = json_val.getString("command");
        }
        base._parseAttr(json_val);
    }