Example #1
0
        public AnalogInputInstance(ushort InstanceId, double?CurrentValue, double MinRange, double MaxRange, string ApplicationType, string SensorType)
            : base(3202, InstanceId)
        {
            this.current         = new Lwm2mResourceDouble("Analog Input Current Value", 3202, InstanceId, 5600, false, false, CurrentValue);
            this.min             = new Lwm2mResourceDouble("Min Measured Value", 3202, InstanceId, 5601, false, false, CurrentValue);
            this.max             = new Lwm2mResourceDouble("Max Measured Value", 3202, InstanceId, 5602, false, false, CurrentValue);
            this.minRange        = new Lwm2mResourceDouble("Min Range Value", 3202, InstanceId, 5603, false, false, MinRange);
            this.maxRange        = new Lwm2mResourceDouble("Max Range Value", 3202, InstanceId, 5604, false, false, MaxRange);
            this.resetMinMax     = new Lwm2mResourceCommand("Reset Min and Max Measured Values", 3202, InstanceId, 5605);
            this.applicationType = new Lwm2mResourceString("Application Type", 3202, InstanceId, 5750, true, true, ApplicationType);
            this.sensorType      = new Lwm2mResourceString("Sensor Type", 3202, InstanceId, 5751, false, false, SensorType);

            this.resetMinMax.OnExecute += (sender, e) =>
            {
                this.min.DoubleValue = this.current.DoubleValue;
                this.min.TriggerAll();

                this.max.DoubleValue = this.current.DoubleValue;
                this.max.TriggerAll();

                this.TriggerAll();
            };

            this.Add(this.current);
            this.Add(this.min);
            this.Add(this.max);
            this.Add(this.minRange);
            this.Add(this.maxRange);
            this.Add(this.resetMinMax);
            this.Add(this.applicationType);
            this.Add(this.sensorType);
        }
        public GenericSensorInstance(ushort ObjectInstanceId, ushort InstanceId, double?CurrentValue, string Unit, double MinRange, double MaxRange, string ApplicationType, string SensorType)
            : base(ObjectInstanceId, InstanceId)
        {
            this.current     = new Lwm2mResourceDouble("Sensor Value", ObjectInstanceId, InstanceId, 5700, false, false, CurrentValue);
            this.unit        = new Lwm2mResourceString("Unit", ObjectInstanceId, InstanceId, 5701, false, false, Unit);
            this.min         = new Lwm2mResourceDouble("Min Measured Value", ObjectInstanceId, InstanceId, 5601, false, false, CurrentValue);
            this.max         = new Lwm2mResourceDouble("Max Measured Value", ObjectInstanceId, InstanceId, 5602, false, false, CurrentValue);
            this.minRange    = new Lwm2mResourceDouble("Min Range Value", ObjectInstanceId, InstanceId, 5603, false, false, MinRange);
            this.maxRange    = new Lwm2mResourceDouble("Max Range Value", ObjectInstanceId, InstanceId, 5604, false, false, MaxRange);
            this.resetMinMax = new Lwm2mResourceCommand("Reset Min and Max Measured Values", ObjectInstanceId, InstanceId, 5605);

            if (ApplicationType != null)
            {
                this.applicationType = new Lwm2mResourceString("Application Type", ObjectInstanceId, InstanceId, 5750, true, true, ApplicationType);
            }

            if (SensorType != null)
            {
                this.sensorType = new Lwm2mResourceString("Sensor Type", ObjectInstanceId, InstanceId, 5751, false, false, SensorType);
            }

            this.resetMinMax.OnExecute += (sender, e) =>
            {
                this.min.DoubleValue = this.current.DoubleValue;
                this.min.TriggerAll();

                this.max.DoubleValue = this.current.DoubleValue;
                this.max.TriggerAll();

                this.TriggerAll();
            };

            this.Add(this.current);
            this.Add(this.unit);
            this.Add(this.min);
            this.Add(this.max);
            this.Add(this.minRange);
            this.Add(this.maxRange);
            this.Add(this.resetMinMax);

            if (this.applicationType != null)
            {
                this.Add(this.applicationType);
            }

            if (this.sensorType != null)
            {
                this.Add(this.sensorType);
            }
        }
Example #3
0
        public DigitalInputInstance(ushort ObjectInstanceId, ushort InstanceId, bool?CurrentState, string ApplicationType, string SensorType)
            : base(ObjectInstanceId, InstanceId)
        {
            this.state        = new Lwm2mResourceBoolean("Digital Input State", ObjectInstanceId, InstanceId, 5500, false, false, CurrentState);
            this.counter      = new Lwm2mResourceInteger("Digital Input Counter", ObjectInstanceId, InstanceId, 5501, false, false, 0, false);
            this.counterReset = new Lwm2mResourceCommand("Digital Input Counter Reset", ObjectInstanceId, InstanceId, 5505);

            if (ApplicationType != null)
            {
                this.applicationType = new Lwm2mResourceString("Application Type", ObjectInstanceId, InstanceId, 5750, true, true, ApplicationType);
            }

            if (SensorType != null)
            {
                this.sensorType = new Lwm2mResourceString("Sensor Type", ObjectInstanceId, InstanceId, 5751, false, false, SensorType);
            }

            this.counterReset.OnExecute += (sender, e) =>
            {
                this.counter.IntegerValue = 0;
                this.counter.TriggerAll();
                this.TriggerAll();
            };

            this.Add(this.state);
            this.Add(this.counter);
            this.Add(this.counterReset);

            if (this.applicationType != null)
            {
                this.Add(this.applicationType);
            }

            if (this.sensorType != null)
            {
                this.Add(this.sensorType);
            }
        }