Beispiel #1
0
        private void DoIt(SensorOperation senopera)
        {
            try
            {
                switch (senopera.Action)
                {
                case Operations.Add:
                    this.AddSensor(senopera.Sensor);
                    _log.InfoFormat("Dtu {0} add a new sensor {1}", this.DtuCode, senopera.Sensor.SensorID);
                    break;

                case Operations.Delete:
                    RemoveSensor(senopera.OldSensorId);
                    break;

                case Operations.Update:
                    ModifySensor(senopera.Sensor);
                    break;
                }
            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Dtu {0} upDateSensors error {1}", DtuCode, ex.Message);
            }
        }
Beispiel #2
0
 public void AddSensorOperation(SensorOperation sensor)
 {
     if (sencache == null)
     {
         sencache = new ConcurrentQueue <SensorOperation>();
     }
     sencache.Enqueue(sensor);
 }