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

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

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