void IDriver.Init(IDDK ddk) { m_DDK = ddk; string driverFolder = AppDomain.CurrentDomain.BaseDirectory; Log.TaskBegin(Id, "Driver Folder \"" + driverFolder + "\""); try { #region Instrument Data List long instrumentsMap = ddk.InstrumentMap.Value; if (instrumentsMap == (long)InstrumentID.None) { throw new InvalidOperationException("DDK.InstrumentMap = " + instrumentsMap.ToString() + " must be != " + ((long)InstrumentID.None).ToString()); } string instrumentsMapBinary = InstrumentData.GetBitMapBinary(instrumentsMap); Log.WriteLine(Id, "DDK.InstrumentMap = " + instrumentsMap.ToString() + " = " + instrumentsMapBinary); InstrumentDataList instrumentDataList = new InstrumentDataList(); instrumentDataList.Init(ddk, instrumentsMap); if (instrumentDataList.Count < 1) { throw new InvalidOperationException("Failed to get the instruments from the DDK.InstrumentMap = " + instrumentsMap.ToString() + " = " + instrumentsMapBinary); } #endregion m_Demo = new Demo((IDriverEx)this, ddk, m_Config.Demo, Config.Driver.DeviceId.Demo, instrumentDataList, driverFolder); AddDevice(m_Demo); //m_Heater = new Heater((IDriverEx)this, ddk, m_Config.Heater, Config.Driver.DeviceId.Heater); //AddDevice(m_Heater); //m_Pump = new Pump((IDriverEx)this, ddk, m_Config.Pump, Config.Driver.DeviceId.Pump); //AddDevice(m_Pump); //m_AutoSampler = new AutoSampler((IDriverEx)this, ddk, m_Config.AutoSampler, Config.Driver.DeviceId.AutoSampler); //AddDevice(m_AutoSampler); //m_Detector = new Detector((IDriverEx)this, ddk, m_Config.Detector, Config.Driver.DeviceId.Detector); //AddDevice(m_Detector); Log.TaskEnd(Id); } catch (Exception ex) { Log.TaskEnd(Id, ex); throw; } }
public void Init(IInstrumentInfo instrumentInfo, string userText = null, int minInstruments = 0, int maxInstruments = 2) { if (instrumentInfo == null) { throw new ArgumentNullException("instrumentInfo"); } if (minInstruments < 0) { throw new ArgumentException("minInstruments cannot be < 0"); } if (maxInstruments > InstrumentData.MaxInstrumentCount) { throw new ArgumentException("maxInstruments cannot be > " + InstrumentData.MaxInstrumentCount.ToString()); } m_InstrumentInfo = instrumentInfo; m_LabelUserText.Text = userText; m_RequiredMinInstruments = minInstruments; m_RequiredMaxInstruments = maxInstruments; m_Instruments.Init(m_InstrumentInfo); }