/// <summary> /// Creates the logical layer with a reference to the physical layer /// </summary> /// <param name="inPhysicalDevice">The physical layer object</param> public LogicalLayer(PhysicalLayer inPhysicalLayer) { log.Debug(string.Format("Creating logical layer with reference to physical layer:{0}", inPhysicalLayer)); _physicalLayer = inPhysicalLayer; _deviceConnected = false; _ledHigh = false; _pinStates = new ConcurrentDictionary <DIOPins, bool>(); _newTempReadingNotification = new AutoResetEvent(false); _currentWaterTemp = 0; _waterTempLock = new object(); _currentFlowRate = -1; _flowRateLock = new object(); _currentPressureValue = -1; _pressureLock = new object(); //!@#Assumes the starting state for the device is all high. //I set this is the physical device start up //Make sure if you change something here, change it in the physical //device too log.Debug("Setting starting states of the outputs"); _pinStates.TryAdd(DIOPins.AirSolenoid_AN0, !(HelperMethods.getDeviceOnState(DIOPins.AirSolenoid_AN0))); _pinStates.TryAdd(DIOPins.WaterPump_AN2, !(HelperMethods.getDeviceOnState(DIOPins.WaterPump_AN2))); _pinStates.TryAdd(DIOPins.Heater_AN1, !(HelperMethods.getDeviceOnState(DIOPins.Heater_AN1))); _pinStates.TryAdd(DIOPins.AirPump_AN3, !(HelperMethods.getDeviceOnState(DIOPins.AirPump_AN3))); }
private void Application_Startup(object sender, StartupEventArgs e) { log.Info("Application Starting"); log.Info(String.Format("Using config file : {0}", configFile)); log.Info("----------------------------------------------------"); //Get the config file log.Debug("Setup configuration"); SystemConfig systemConfig = new SystemConfig(configFile); //Set up all the objects and delegates necesary to run the program log.Debug("Setup objects"); _physicalLayer = new PhysicalLayer(systemConfig.getDeviceConfig()); LogicalLayer logicalLayer = new LogicalLayer(_physicalLayer); _physicalLayer.setDelegate(logicalLayer); _uiHandle = new UIHandle_LLSL(logicalLayer); _sequencerLayer = new SequencerLayer(_uiHandle, logicalLayer, systemConfig.getSequencerConfig()); //Setup main window log.Debug("Setup main window"); MainWindow wnd = new MainWindow(); logicalLayer.setUIDelegate(wnd); _sequencerLayer.setUIDelegate(wnd); wnd.setDelegate(_uiHandle); wnd.Show(); }