Exemplo n.º 1
0
        public void SetAlarmState(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
        {
            //Gets all the current alarm info and modifies the state then sets the alarm data

            //Get TestStand Information
            PropertyObject seqContextPO = seqContext.AsPropertyObject();
            Step           activeStep   = seqContext.Step;
            string         stepID       = activeStep.UniqueStepId;

            Sequence       selectedTSSequence = seqContext.Sequence;
            PropertyObject stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            Factory        fact       = new Factory();
            string         alarmName  = StringUtilities.removeDoubleQuotesAroundString(stepPropertyObject.GetValString("Veristand.AlarmName", 0));
            string         alarmValue = StringUtilities.removeDoubleQuotesAroundString(stepPropertyObject.GetValString("Veristand.AlarmState", 0));
            IAlarm         thisAlarm  = fact.GetIAlarm(alarmName);
            AlarmInfo      alarmData;

            Error alarmError1 = thisAlarm.GetAlarmData(out alarmData, 5000);

            switch (alarmValue)
            {
            case "Disabled":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.Disabled;
                break;

            case "Enabled":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.Enabled;
                break;

            case "Tripped":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.Tripped;
                break;

            case "Delayed Trip":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.DelayedTripped;
                break;

            case "Indicate":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.Indicate;
                break;
            }
            thisAlarm.SetAlarmData(alarmData);
        }
Exemplo n.º 2
0
        public string GetAlarmState(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
        {
            //Gets all alarm information and returns just the state

            //Get TestStand Information
            PropertyObject seqContextPO       = seqContext.AsPropertyObject();
            Step           activeStep         = seqContext.Step;
            string         stepID             = activeStep.UniqueStepId;
            Sequence       selectedTSSequence = seqContext.Sequence;
            PropertyObject stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            Factory        fact      = new Factory();
            string         alarmName = StringUtilities.removeDoubleQuotesAroundString(stepPropertyObject.GetValString("Veristand.AlarmName", 0));


            IAlarm    thisAlarm = fact.GetIAlarm(alarmName);
            AlarmInfo alarmData;

            thisAlarm.GetAlarmData(out alarmData, 5000);
            return(alarmData.State.ToString());
        }