Ejemplo n.º 1
0
        public static App Create(AppConfig appConfig)
        {
            string rootDirectoryPath        = getRootDirectoryPath();
            string sensorsDirectoryPath     = rootDirectoryPath + "\\Sensors";
            string controllersDirectoryPath = rootDirectoryPath + "\\Controllers";

            var sensorNames = appConfig.Sensors.Select(x => x.SensorName);

            var sensorLoader     = new SensorLoader(sensorsDirectoryPath);
            var controllerLoader = new ControllerLoader(controllersDirectoryPath);
            var sensorBuilders   = sensorLoader.Load(sensorNames);
            var controllers      = controllerLoader.Load();
            var sensors          = buildSensors(sensorBuilders, appConfig);

            var stateStore = new StateStore();

            stateStore.SetModes(appConfig.Modes);

            var sensorHub     = new SensorHub(sensors);
            var controllerHub = new ControllerHub(controllers);

            var app = new App(stateStore, sensorHub, controllerHub);

            app.Initialize(appConfig);
            return(app);
        }
Ejemplo n.º 2
0
        public App(IStateStore stateStore, SensorHub sensorHub, ControllerHub controllerHub)
        {
            _stateStore    = stateStore;
            _sensorHub     = sensorHub;
            _controllerHub = controllerHub;

            _sensorHub.StatusChanged   += _sensorHub_StatusChanged;
            _sensorHub.ModeChanged     += _sensorHub_ModeChanged;
            _sensorHub.ApplicationExit += _sensorHub_ApplicationExit;
        }
Ejemplo n.º 3
0
 public fSensorUI()
 {
     InitializeComponent();
     ArduinoAPI = new SensorHub();
     ArduinoAPI.Start();
 }