Exemplo n.º 1
0
        internal IDevice Create(IDDK cmDDK, string name)
        {
            // Create our IDevice object
            m_MyCmDevice = cmDDK.CreateDevice(name, "Nelson NCI 900 Master Device");

            // Create our properties

            // ModelNo
            m_ModelNoProperty =
                m_MyCmDevice.CreateStandardProperty(StandardPropertyID.ModelNo, cmDDK.CreateString(20));

            // DebugCommand
            ITypeString tString = cmDDK.CreateString(255);

            m_DebugCommand = m_MyCmDevice.CreateProperty("DebugCommand",
                                                         "For internal use only.", tString);
            m_DebugCommand.AuditLevel     = AuditLevel.Message;
            m_DebugCommand.OnSetProperty += new SetPropertyEventHandler(OnDebugCommand);

            ITypeDouble tDouble = cmDDK.CreateDouble(0, 100, 1);

            tDouble.Unit = "%";

            IProperty dblProp =
                m_MyCmDevice.CreateProperty("DoubleProp", "DoubleHelp", tDouble);

            return(m_MyCmDevice);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create our Dionex.Chromeleon.Symbols.IDevice and our Properties and Commands
        /// </summary>
        /// <param name="cmDDK">The DDK instance</param>
        /// <param name="name">The name for our device</param>
        /// <returns>our IDevice object</returns>
        internal IDevice Create(IDDK cmDDK, string name)
        {
            m_MyCmDDK = cmDDK;

            // Create our Dionex.Chromeleon.Symbols.IDevice
            m_MyCmDevice = cmDDK.CreateDevice(name, "Autosampler device.");

            ITypeDouble tVolume = cmDDK.CreateDouble(0.1, 10.0, 1);

            tVolume.Unit = "µL";

            ITypeInt tPosition = cmDDK.CreateInt(1, 10);

            for (int i = 1; i <= 10; i++)
            {
                tPosition.AddNamedValue("RA" + i.ToString(), i);
            }
            tPosition.NamedValuesOnly = false;

            m_InjectHandler = m_MyCmDevice.CreateInjectHandler(tVolume, tPosition);

            m_InjectHandler.PositionProperty.OnSetProperty +=
                new SetPropertyEventHandler(OnSetPosition);

            m_InjectHandler.VolumeProperty.OnSetProperty +=
                new SetPropertyEventHandler(OnSetVolume);

            m_InjectHandler.InjectCommand.OnCommand += new CommandEventHandler(OnInject);

            ICommand simulateVialNotFoundCommand =
                m_MyCmDevice.CreateCommand("SimulateVialNotFound", "Simulate a vial not found error");

            simulateVialNotFoundCommand.OnCommand += new CommandEventHandler(simulateVialNotFoundCommand_OnCommand);

            ICommand modifyPositionTypeCommand =
                m_MyCmDevice.CreateCommand("ModifyPositionType", "Changes the data type of the Position property and the Inject.Position parameter");

            modifyPositionTypeCommand.OnCommand += new CommandEventHandler(modifyPositionTypeCommand_OnCommand);

            ICommand modifyVolumeTypeCommand =
                m_MyCmDevice.CreateCommand("ModifyVolumeType", "Changes the data type of the Volume property and the Inject.Volume parameter");

            modifyVolumeTypeCommand.OnCommand += new CommandEventHandler(modifyVolumeTypeCommand_OnCommand);

            ITypeString tTrayDescription = cmDDK.CreateString(500); // ensure length is sufficient, but don't be too generous

            m_TrayDesciptionProperty            = m_MyCmDevice.CreateStandardProperty(StandardPropertyID.TrayDescription, tTrayDescription);
            m_TrayDesciptionProperty.AuditLevel = AuditLevel.Service;
            m_TrayDesciptionProperty.Update(GenerateTrayDescription());

            // In this example driver, simulating the injection process
            // is handled by a timer started by the Inject command.
            // When the timer has elapsed the inject response is generated.
            m_InjectionTimer.Elapsed  += new System.Timers.ElapsedEventHandler(m_InjectionTimer_Elapsed);
            m_InjectionTimer.AutoReset = false;

            return(m_MyCmDevice);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create our Dionex.Chromeleon.Symbols.IDevice and our Properties and Commands
        /// </summary>
        /// <param name="cmDDK">The DDK instance</param>
        /// <param name="name">The name for our device</param>
        /// <returns>our IDevice object</returns>
        internal IDevice Create(IDDK cmDDK, string name)
        {
            // Create the Dionex.Chromeleon.Symbols.IDevice
            m_MyCmDevice = cmDDK.CreateDevice(name, "This is an example device.");

            // create a few example properties

            // A Data type for seconds ranging from 0 - 59
            ITypeInt tSeconds = cmDDK.CreateInt(0, 59);

            tSeconds.Unit = "s";

            // Create the "Clock" property
            m_ClockProperty = m_MyCmDevice.CreateProperty("Clock",
                                                          "This is a second counter",
                                                          tSeconds);

            // Attach the OnSetClockProperty handler to the "Clock" property
            m_ClockProperty.OnSetProperty += new SetPropertyEventHandler(OnSetClockProperty);

            // we will use a timer to update the clock property each second
            // Attach the OnTimedEvent handler to the timer.
            m_clockTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

            // A Data type with two values 0 and 1
            ITypeInt tEnable = cmDDK.CreateInt(0, 1);

            tEnable.AddNamedValue("false", 0);
            tEnable.AddNamedValue("true", 1);

            // Create the "EnableClock" property
            m_EnableClockProperty = m_MyCmDevice.CreateProperty("EnableClock",
                                                                "Enable / disable the clock",
                                                                tEnable);

            // Attach the OnEnableClock handler to the "EnableClock" property
            m_EnableClockProperty.OnSetProperty += new SetPropertyEventHandler(OnEnableClock);

            // A Data type for a percentage ranging from 0.0 - 100.0
            ITypeDouble tPercent = cmDDK.CreateDouble(0, 100, 2);

            tPercent.Unit = "%";

            // Create the "Percentage" property
            m_PercentageProperty = m_MyCmDevice.CreateProperty("Percentage",
                                                               "This is a percentage property",
                                                               tPercent);

            // Attach the OnSetProperty handler to the "Percentage" property
            m_PercentageProperty.OnSetProperty += new SetPropertyEventHandler(OnSetProperty);

            // A Data type for a time constant ranging from 1.0 - 10.0
            ITypeDouble tTimeConstant = cmDDK.CreateDouble(1.0, 10.0, 1);

            tTimeConstant.AddNamedValue("Off", 0.0);
            tTimeConstant.Unit = "s";

            // Create the "Percentage" property
            m_FilterTimeConstantProperty = m_MyCmDevice.CreateProperty("FilterTimeConstant",
                                                                       "This is a numeric property with one special named value.",
                                                                       tTimeConstant);

            // Attach the OnSetProperty handler to the "FilterTimeConstant" property
            m_FilterTimeConstantProperty.OnSetProperty += new SetPropertyEventHandler(OnSetProperty);

            // A Data type for the measurement range property
            ITypeDouble tMeasurementRange = cmDDK.CreateDouble(0.01, 100.0, 2);

            tMeasurementRange.LegalValues        = new double[] { 0.01, 0.1, 1.0, 10.0, 100.0 };
            tMeasurementRange.EnforceLegalValues = true;
            tMeasurementRange.Unit = "V";

            // Create the "Percentage" property
            m_MeasurementRangeProperty = m_MyCmDevice.CreateProperty("MeasurementRange",
                                                                     "This is a numeric property with 5 legal (valid) values.",
                                                                     tMeasurementRange);

            // Attach the OnSetProperty handler to the "FilterTimeConstant" property
            m_MeasurementRangeProperty.OnSetProperty += new SetPropertyEventHandler(OnSetProperty);

            // A Data type for a string with 20 characters at most
            ITypeString tString = cmDDK.CreateString(20);

            // Create the "AnyText" property
            m_AnyTextProperty = m_MyCmDevice.CreateProperty("AnyText",
                                                            "This is a string property",
                                                            tString);

            // Attach the OnSetProperty handler to the "AnyText" property
            m_AnyTextProperty.OnSetProperty += new SetPropertyEventHandler(OnSetProperty);


            // Create the "ToggleEnableClock" example command
            m_Command = m_MyCmDevice.CreateCommand("ToggleEnableClock", "This is a simple command that toggles the EnableClock property.");

            // Attach the OnToggleEnableClock handler to the "ToggleEnableClock" command
            m_Command.OnCommand += new CommandEventHandler(OnToggleEnableClock);

            // Create the "SetEnableClock" command which uses a parameter.
            m_SetEnableClockCommand = m_MyCmDevice.CreateCommand("SetEnableClock", "This is a command with one required parameter. Set true or false to enable/disable the clock.");

            // Add the "Enable" parameter to the "SetEnableClock" command
            IParameter parameter = m_SetEnableClockCommand.AddParameter("Enable", "Set true or false to enable/disable the clock", tEnable);

            // This is a required parameter.
            parameter.Required = true;

            // Attach the OnSetEnableClock handler to the "SetEnableClock" command
            m_SetEnableClockCommand.OnCommand += new CommandEventHandler(OnSetEnableClock);

            // Create the "SetPercentage" command which uses a parameter.
            m_SetPercentageCommand = m_MyCmDevice.CreateCommand("SetPercentage", "This is a command with one required parameter to set the \"Percentage\" property.");

            // Add the "Value" parameter to the "SetPercentage" command
            parameter = m_SetPercentageCommand.AddParameter("Value", "Set to 0.00 - 100.00", tPercent);

            // This is a required parameter.
            parameter.Required = true;

            // Attach the OnSetPercentage handler to the "SetPercentage" command
            m_SetPercentageCommand.OnCommand += new CommandEventHandler(OnSetPercentage);

            // Create the "CommandWith4Parameters" command which uses 4 optional parameters.
            m_CommandWith4Parameters = m_MyCmDevice.CreateCommand("CommandWith4Parameters", "This is a command with four optional parameters.");

            // Add the parameters to the "CommandWith4Parameters" command
            m_CommandWith4Parameters.AddParameter("Param1", "Set true or false", tEnable);
            m_CommandWith4Parameters.AddParameter("Param2", "Set to 0.00 - 100.00", tPercent);
            m_CommandWith4Parameters.AddParameter("Param3", "Set true or false", tEnable);
            m_CommandWith4Parameters.AddParameter("Param4", "A string with 20 characters", tString);

            // Attach the OnCommandWith4Parameters handler to the "CommandWith4Parameters" command
            m_CommandWith4Parameters.OnCommand += new CommandEventHandler(OnCommandWith4Parameters);

            return(m_MyCmDevice);
        }