/// Create our Chromeleon symbols internal IPDAChannel OnCreate(IDDK cmDDK, IDevice master, string name) { // Create a data type for the wavelength range ITypeDouble tWavelength = cmDDK.CreateDouble(200.0, 600.0, 1); tWavelength.Unit = "nm"; // Create a data type for the reference wavelength range ITypeDouble tRefWavelength = cmDDK.CreateDouble(200.0, 600.0, 1); tRefWavelength.Unit = "nm"; tRefWavelength.AddNamedValue("Off", 0.0); // Create a data type for the reference bandwidth ITypeDouble tReferenceBandwidth = cmDDK.CreateDouble(0.0, 20.0, 1); tReferenceBandwidth.Unit = "nm"; // Create a data type for the bunch width ITypeDouble tBunchWidth = cmDDK.CreateDouble(0.0, 10.0, 1); tBunchWidth.Unit = "nm"; // Create the channel symbol m_MyCmDevice = cmDDK.CreatePDAChannel(name, "This is a channel that can generate a spectrum.", tWavelength, tRefWavelength, tReferenceBandwidth, tBunchWidth, 400, PDAWriteMode.AbsorbanceDirect); // We will be a subdevice of the master device m_MyCmDevice.SetOwner(master); // Attach our handlers to the AcquisitionOffCommand and AcquisitionOnCommand of the channel m_MyCmDevice.AcquisitionOffCommand.OnCommand += new CommandEventHandler(OnAcqOff); m_MyCmDevice.AcquisitionOnCommand.OnCommand += new CommandEventHandler(OnAcqOn); m_MyCmDevice.OnDataFinished += new DataFinishedEventHandler(m_MyCmDevice_OnDataFinished); // Usually, TimeStepFactor and TimeStepFactor are read-only properties and the driver updates them. // In this driver we allow to change these values manually for illustration purposes. m_MyCmDevice.TimeStepFactorProperty.DataType.Minimum = 1; m_MyCmDevice.TimeStepFactorProperty.DataType.Maximum = 10000; m_MyCmDevice.TimeStepFactorProperty.OnSetProperty += new SetPropertyEventHandler(TimeStepFactorProperty_OnSetProperty); m_MyCmDevice.TimeStepDivisorProperty.DataType.Minimum = 1; m_MyCmDevice.TimeStepDivisorProperty.DataType.Maximum = 10000; m_MyCmDevice.TimeStepDivisorProperty.OnSetProperty += new SetPropertyEventHandler(TimeStepDivisorProperty_OnSetProperty); ITypeDouble tRateType = cmDDK.CreateDouble(0.1, 1000.0, 1); tRateType.Unit = "Hz"; m_RateProperty = m_MyCmDevice.CreateProperty("FixedRate", "The data collection rate in Hz.", tRateType); m_RateProperty.OnSetProperty += new SetPropertyEventHandler(m_RateProperty_OnSetProperty); ITypeInt tDataIndexType = cmDDK.CreateInt(0, int.MaxValue); m_SpectraIndexProperty = m_MyCmDevice.CreateProperty("TotalSpectra", "Total number of spectra.", tDataIndexType); ICommand noMoreDataCommand = m_MyCmDevice.CreateCommand("NoMoreData", "Send IChannel.NoMoreData to stop data acquisition immediately."); noMoreDataCommand.OnCommand += new CommandEventHandler(noMoreDataCommand_OnCommand); ITypeDouble tChannelTimeType = cmDDK.CreateDouble(0, 1000, 3); tChannelTimeType.Unit = "min"; m_ChannelTimeProperty = m_MyCmDevice.CreateProperty("ChannelTime", "Internal time of the channel.", tChannelTimeType); return(m_MyCmDevice); }