Ejemplo n.º 1
0
        protected internal LogHandler(string logFile)
        {
            var reference = logFile.GetMatchPattern(referencePattern);

            sensorFactory = new SensorFactory();
            _logFile      = logFile;
            sensorFactory.Setup(reference);
            //InitialiseSensors(logFile);   //this is an intitalizer used in an alternative solution
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a webmodule listening to the get requests for all the sensors.
 /// </summary>
 /// <param name="serializer"></param>
 /// <param name="sensorFactory"></param>
 public WebModule(Serializer.ISerializer serializer, ISensorFactory sensorFactory)
 {
     _serializer = serializer;
     foreach (var sensor in sensorFactory.GetSensors())
     {
         string getPath = $"/{sensor.Name}";
         Console.WriteLine($"Listening for get on {getPath}");
         Get[getPath] = paramaters => QuerySensor(sensor);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a webmodule listening to the get requests for all the sensors.
 /// </summary>
 /// <param name="serializer"></param>
 /// <param name="sensorFactory"></param>
 public WebModule(Serializer.ISerializer serializer, ISensorFactory sensorFactory)
 {
     _serializer = serializer;
     foreach (var sensor in sensorFactory.GetSensors())
     {
         string getPath = $"/{sensor.Name}";
         Console.WriteLine($"Listening for get on {getPath}");
         Get[getPath] = paramaters => QuerySensor(sensor);
     }
 }
Ejemplo n.º 4
0
        public FloodingSimulator()
        {
            environment = new Environment();
            BuildSimulation();

            sensorFactory    = new DummySensorFactory(environment);
            actuatorFactory  = new DummyActuatorFactory(environment);
            estimatorFactory = new EstimatorFactory(sensorFactory, actuatorFactory);
            warnerFactory    = new WarnerFactory(actuatorFactory);

            var speedEstimator = estimatorFactory.GetUltrasoundSpeedEstimator();
            var depthEstimator = estimatorFactory.GetRadarDepthEstimator();

            warner = warnerFactory.GetSMSWarner();

            controller = new FloodingWarningSystem(speedEstimator, depthEstimator, warner);
        }
Ejemplo n.º 5
0
 private static void RegisterBuiltInSensors(ISensorFactory sensorFactory)
 {
     sensorFactory.RegisterSensor("thermometer", (name, refs, calc) => new ThermometerSensor(name, refs["temperature"], calc));
     sensorFactory.RegisterSensor("humidity", (name, refs, calc) => new HumiditySensor(name, (decimal)refs["humidity"]));
     sensorFactory.RegisterSensor("monoxide", (name, refs, calc) => new MonoxideSensor(name, (int)refs["ppm"]));
 }
 public EstimatorFactory(ISensorFactory sensorFactory,
                         IActuatorFactory actuatorFactory)
 {
     this.sensorFactory   = sensorFactory;
     this.actuatorFactory = actuatorFactory;
 }
Ejemplo n.º 7
0
 public StringSensorLogParser(ISensorFactory sensorFactory)
 {
     _sensorFactory = sensorFactory;
 }
Ejemplo n.º 8
0
 public PresenceManager(ISensorFactory sensonsFactory)
 {
     this.sensorsFactory = sensonsFactory;
     Helper.StartRepetativeTask(monitorPresence, TimeSpan.FromMilliseconds(PRESENCE_MONITOR_INTERVAL_MS));
 }