Ejemplo n.º 1
0
        public override SensorResult Read(string sensorType, string sensorName)
        {
            sensorType = string.IsNullOrWhiteSpace(sensorType) ? "Time" : sensorType;

            sensorName = string.IsNullOrWhiteSpace(sensorName) ? DefaultTimeZone.Id : sensorName;

            SensorResult result = base.Read(sensorType, sensorName);

            try
            {
                EnsureSupported(sensorType, sensorName);

                var tz = DateTimeZoneProviders.Tzdb.GetZoneOrNull(sensorName);
                result.Attribute    = tz.Id;
                result.Result       = SystemClock.Instance.GetCurrentInstant().InZone(tz);
                result.IsSuccessful = true;
            }
            catch (Exception ex)
            {
                result.Exception = ex;
                result.Message   = ex.Message;
            }

            return(result);
        }
Ejemplo n.º 2
0
        public virtual SensorResult Read(string sensorType, string sensorName)
        {
            var result = new SensorResult()
            {
                Sensor = this._mapper.Map <SensorPoco>(this)
            };

            return(result);
        }