//---------------------------------------------------------------------------------------// /// <summary> /// /// </summary> /// <param name="labEquipmentConfiguration"></param> public EquipmentEngine(LabEquipmentConfiguration labEquipmentConfiguration) : base(labEquipmentConfiguration) { const String methodName = "EquipmentEngine"; Logfile.WriteCalled(logLevel, STR_ClassName, methodName); try { /* * Create instances of the simulation devices to be used by the simulation drivers * so that both the hardware drivers and simulation drivers are available for the setups */ this.deviceFlexMotionSimulation = new DeviceFlexMotionSimulation(this.labEquipmentConfiguration); this.deviceST360CounterSimulation = new DeviceST360CounterSimulation(this.labEquipmentConfiguration); this.deviceSerialLcdSimulation = new DeviceSerialLcdSimulation(this.labEquipmentConfiguration); /* * Initialise the simulated devices */ this.deviceFlexMotionSimulation.Initialise(); this.deviceST360CounterSimulation.Initialise(); this.deviceSerialLcdSimulation.Initialise(); /* * Determine FlexMotion device to use */ XmlDocument xmlDocument = XmlUtilities.GetDocumentFromString(labEquipmentConfiguration.GetXmlDeviceConfiguration(DeviceFlexMotion.ClassName)); XmlNode xmlNodeDevice = XmlUtilities.GetRootNode(xmlDocument, LabConsts.STRXML_Device); String deviceType = XmlUtilities.GetChildValue(xmlNodeDevice, Consts.STRXML_Type); /* * Create instance of the FlexMotion device to use */ switch (deviceType) { case Consts.STRXML_TypeNone: this.deviceFlexMotion = new DeviceFlexMotion(this.labEquipmentConfiguration); break; case Consts.STRXML_TypeSimulation: this.deviceFlexMotion = this.deviceFlexMotionSimulation; break; case Consts.STRXML_TypeHardware: this.deviceFlexMotion = new DeviceFlexMotionHardware(this.labEquipmentConfiguration); break; default: throw new ApplicationException(String.Format(STRERR_InvalidDeviceType_arg2, DeviceFlexMotion.ClassName, deviceType)); } /* * Determine ST360Counter device to use */ xmlDocument = XmlUtilities.GetDocumentFromString(labEquipmentConfiguration.GetXmlDeviceConfiguration(DeviceST360Counter.ClassName)); xmlNodeDevice = XmlUtilities.GetRootNode(xmlDocument, LabConsts.STRXML_Device); deviceType = XmlUtilities.GetChildValue(xmlNodeDevice, Consts.STRXML_Type); /* * Create instance of the ST360Counter device to use */ switch (deviceType) { case Consts.STRXML_TypeNone: this.deviceST360Counter = new DeviceST360Counter(this.labEquipmentConfiguration); break; case Consts.STRXML_TypeSimulation: this.deviceST360Counter = this.deviceST360CounterSimulation; break; case Consts.STRXML_TypeSerial: this.deviceST360Counter = new DeviceST360CounterSerial(this.labEquipmentConfiguration); break; case Consts.STRXML_TypeNetwork: this.deviceST360Counter = new DeviceST360CounterNetwork(this.labEquipmentConfiguration); break; default: throw new ApplicationException(String.Format(STRERR_InvalidDeviceType_arg2, DeviceST360Counter.ClassName, deviceType)); } /* * Determine DeviceSerialLcd device to use */ xmlDocument = XmlUtilities.GetDocumentFromString(labEquipmentConfiguration.GetXmlDeviceConfiguration(DeviceSerialLcd.ClassName)); xmlNodeDevice = XmlUtilities.GetRootNode(xmlDocument, LabConsts.STRXML_Device); deviceType = XmlUtilities.GetChildValue(xmlNodeDevice, Consts.STRXML_Type); /* * Create instance of the DeviceSerialLcd device to use */ switch (deviceType) { case Consts.STRXML_TypeNone: this.deviceSerialLcd = new DeviceSerialLcd(this.labEquipmentConfiguration); break; case Consts.STRXML_TypeSimulation: this.deviceSerialLcd = this.deviceSerialLcdSimulation; break; case Consts.STRXML_TypeSerial: this.deviceSerialLcd = new DeviceSerialLcdSerial(this.labEquipmentConfiguration); break; case Consts.STRXML_TypeNetwork: this.deviceSerialLcd = new DeviceSerialLcdNetwork(this.labEquipmentConfiguration); break; default: throw new ApplicationException(String.Format(STRERR_InvalidDeviceType_arg2, DeviceSerialLcd.ClassName, deviceType)); } /* * Initialise properties */ this.initialiseDelay = this.deviceFlexMotion.InitialiseDelay + this.deviceST360Counter.InitialiseDelay + this.deviceSerialLcd.InitialiseDelay; this.disablePowerdown = false; } catch (Exception ex) { Logfile.WriteError(ex.Message); throw ex; } Logfile.WriteCompleted(logLevel, STR_ClassName, methodName); }
public void SetDeviceFlexMotion(DeviceFlexMotion deviceFlexMotion) { this.deviceFlexMotion = deviceFlexMotion; }