Exemple #1
0
    //--- (YWakeUpMonitor implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("powerDuration"))
        {
            _powerDuration = json_val.getInt("powerDuration");
        }
        if (json_val.has("sleepCountdown"))
        {
            _sleepCountdown = json_val.getInt("sleepCountdown");
        }
        if (json_val.has("nextWakeUp"))
        {
            _nextWakeUp = json_val.getLong("nextWakeUp");
        }
        if (json_val.has("wakeUpReason"))
        {
            _wakeUpReason = json_val.getInt("wakeUpReason");
        }
        if (json_val.has("wakeUpState"))
        {
            _wakeUpState = json_val.getInt("wakeUpState");
        }
        if (json_val.has("rtcTime"))
        {
            _rtcTime = json_val.getLong("rtcTime");
        }
        base._parseAttr(json_val);
    }
Exemple #2
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);
    }
    //--- (YAnButton implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("calibratedValue"))
        {
            _calibratedValue = json_val.getInt("calibratedValue");
        }
        if (json_val.has("rawValue"))
        {
            _rawValue = json_val.getInt("rawValue");
        }
        if (json_val.has("analogCalibration"))
        {
            _analogCalibration = json_val.getInt("analogCalibration") > 0 ? 1 : 0;
        }
        if (json_val.has("calibrationMax"))
        {
            _calibrationMax = json_val.getInt("calibrationMax");
        }
        if (json_val.has("calibrationMin"))
        {
            _calibrationMin = json_val.getInt("calibrationMin");
        }
        if (json_val.has("sensitivity"))
        {
            _sensitivity = json_val.getInt("sensitivity");
        }
        if (json_val.has("isPressed"))
        {
            _isPressed = json_val.getInt("isPressed") > 0 ? 1 : 0;
        }
        if (json_val.has("lastTimePressed"))
        {
            _lastTimePressed = json_val.getLong("lastTimePressed");
        }
        if (json_val.has("lastTimeReleased"))
        {
            _lastTimeReleased = json_val.getLong("lastTimeReleased");
        }
        if (json_val.has("pulseCounter"))
        {
            _pulseCounter = json_val.getLong("pulseCounter");
        }
        if (json_val.has("pulseTimer"))
        {
            _pulseTimer = json_val.getLong("pulseTimer");
        }
        if (json_val.has("inputType"))
        {
            _inputType = json_val.getInt("inputType");
        }
        base._parseAttr(json_val);
    }
Exemple #4
0
    //--- (YProximity 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("detectionThreshold"))
        {
            _detectionThreshold = json_val.getInt("detectionThreshold");
        }
        if (json_val.has("detectionHysteresis"))
        {
            _detectionHysteresis = json_val.getInt("detectionHysteresis");
        }
        if (json_val.has("presenceMinTime"))
        {
            _presenceMinTime = json_val.getInt("presenceMinTime");
        }
        if (json_val.has("removalMinTime"))
        {
            _removalMinTime = json_val.getInt("removalMinTime");
        }
        if (json_val.has("isPresent"))
        {
            _isPresent = json_val.getInt("isPresent") > 0 ? 1 : 0;
        }
        if (json_val.has("lastTimeApproached"))
        {
            _lastTimeApproached = json_val.getLong("lastTimeApproached");
        }
        if (json_val.has("lastTimeRemoved"))
        {
            _lastTimeRemoved = json_val.getLong("lastTimeRemoved");
        }
        if (json_val.has("pulseCounter"))
        {
            _pulseCounter = json_val.getLong("pulseCounter");
        }
        if (json_val.has("pulseTimer"))
        {
            _pulseTimer = json_val.getLong("pulseTimer");
        }
        if (json_val.has("proximityReportMode"))
        {
            _proximityReportMode = json_val.getInt("proximityReportMode");
        }
        base._parseAttr(json_val);
    }
Exemple #5
0
    //--- (YRelay implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("state"))
        {
            _state = json_val.getInt("state") > 0 ? 1 : 0;
        }
        if (json_val.has("stateAtPowerOn"))
        {
            _stateAtPowerOn = json_val.getInt("stateAtPowerOn");
        }
        if (json_val.has("maxTimeOnStateA"))
        {
            _maxTimeOnStateA = json_val.getLong("maxTimeOnStateA");
        }
        if (json_val.has("maxTimeOnStateB"))
        {
            _maxTimeOnStateB = json_val.getLong("maxTimeOnStateB");
        }
        if (json_val.has("output"))
        {
            _output = json_val.getInt("output") > 0 ? 1 : 0;
        }
        if (json_val.has("pulseTimer"))
        {
            _pulseTimer = json_val.getLong("pulseTimer");
        }
        if (json_val.has("delayedPulseTimer"))
        {
            YAPI.YJSONObject subjson = json_val.getYJSONObject("delayedPulseTimer");
            if (subjson.has("moving"))
            {
                _delayedPulseTimer.moving = subjson.getInt("moving");
            }
            if (subjson.has("target"))
            {
                _delayedPulseTimer.target = subjson.getInt("target");
            }
            if (subjson.has("ms"))
            {
                _delayedPulseTimer.ms = subjson.getInt("ms");
            }
        }
        if (json_val.has("countdown"))
        {
            _countdown = json_val.getLong("countdown");
        }
        base._parseAttr(json_val);
    }
    //--- (YWakeUpSchedule implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        if (json_val.has("minutesA"))
        {
            _minutesA = json_val.getInt("minutesA");
        }
        if (json_val.has("minutesB"))
        {
            _minutesB = json_val.getInt("minutesB");
        }
        if (json_val.has("hours"))
        {
            _hours = json_val.getInt("hours");
        }
        if (json_val.has("weekDays"))
        {
            _weekDays = json_val.getInt("weekDays");
        }
        if (json_val.has("monthDays"))
        {
            _monthDays = json_val.getInt("monthDays");
        }
        if (json_val.has("months"))
        {
            _months = json_val.getInt("months");
        }
        if (json_val.has("nextOccurence"))
        {
            _nextOccurence = json_val.getLong("nextOccurence");
        }
        base._parseAttr(json_val);
    }
    //--- (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);
    }
    //--- (YPwmInput implementation)

    protected override void _parseAttr(YAPI.YJSONObject json_val)
    {
        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("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("pulseCounter"))
        {
            _pulseCounter = json_val.getLong("pulseCounter");
        }
        if (json_val.has("pulseTimer"))
        {
            _pulseTimer = json_val.getLong("pulseTimer");
        }
        if (json_val.has("pwmReportMode"))
        {
            _pwmReportMode = json_val.getInt("pwmReportMode");
        }
        if (json_val.has("debouncePeriod"))
        {
            _debouncePeriod = json_val.getInt("debouncePeriod");
        }
        if (json_val.has("bandwidth"))
        {
            _bandwidth = json_val.getInt("bandwidth");
        }
        if (json_val.has("edgesPerPeriod"))
        {
            _edgesPerPeriod = json_val.getInt("edgesPerPeriod");
        }
        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);
        }