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); }
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; }
public fSensorUI() { InitializeComponent(); ArduinoAPI = new SensorHub(); ArduinoAPI.Start(); }