public void TestAnalogTriggerOutputCreationNullTrigger()
 {
     Assert.Throws<ArgumentNullException>(() =>
     {
         AnalogTriggerOutput output = new AnalogTriggerOutput(null, AnalogTriggerType.State);
     });
 }
Exemplo n.º 2
0
 internal override InterruptableSensorBase GiveInterruptableSensorBase()
 {
     m_interruptTrigger = new AnalogTrigger(s_analogIo.GetInput());
     m_interruptTrigger.SetLimitsVoltage(2.0f, 3.0f);
     m_interruptTriggerOutput = new AnalogTriggerOutput(m_interruptTrigger, AnalogTriggerType.State);
     return(m_interruptTriggerOutput);
 }
Exemplo n.º 3
0
 internal override void FreeInterruptableSensorBase()
 {
     m_interruptTriggerOutput.CancelInterrupts();
     m_interruptTriggerOutput.Dispose();
     m_interruptTriggerOutput = null;
     m_interruptTrigger.Dispose();
     m_interruptTrigger = null;
 }
 public void TestAnalogTriggerOutputCreation()
 {
     using (AnalogTrigger trigger = new AnalogTrigger(0))
     {
         using (AnalogTriggerOutput output = new AnalogTriggerOutput(trigger, AnalogTriggerType.State))
         {
             Assert.That(SimData.Reports.ContainsKey((byte)ResourceType.kResourceType_AnalogTriggerOutput));
             Assert.That(SimData.Reports[(byte)ResourceType.kResourceType_AnalogTriggerOutput].Contains((byte)trigger.Index));
         }
     }
 }
        public void TestAnalogTriggerOutputRoutings(AnalogTriggerType type)
        {
            using (AnalogTrigger trigger = new AnalogTrigger(0))
            {
                using (AnalogTriggerOutput output = new AnalogTriggerOutput(trigger, type))
                {
                    Assert.That(output.AnalogTriggerForRouting, Is.True);
                    int routingChannel = (trigger.Index << 2) + (int)type;
                    byte routingModule = (byte)(trigger.Index >> 2);

                    Assert.That(output.ChannelForRouting, Is.EqualTo(routingChannel));
                    Assert.That(output.ModuleForRouting, Is.EqualTo(routingModule));
                }
            }
        }
 public void TestAnalogTriggerOutputGetInvalidType()
 {
     using (AnalogTrigger trigger = new AnalogTrigger(0))
     {
         using (AnalogTriggerOutput output = new AnalogTriggerOutput(trigger, AnalogTriggerType.FallingPulse))
         {
             Assert.Throws<UncleanStatusException>(() =>
             {
                 output.Get();
             });
         }
     }
 }
 public void TestAnalogTriggerOutputGetInWindow()
 {
     using (AnalogTrigger trigger = new AnalogTrigger(0))
     {
         using (AnalogTriggerOutput output = new AnalogTriggerOutput(trigger, AnalogTriggerType.InWindow))
         {
             HALAnalog.GetAnalogTriggerInWindow = (IntPtr pointer, ref int status) =>
             {
                 status = 0;
                 return false;
             };
             Assert.That(output.Get(), Is.False);
             HALAnalog.GetAnalogTriggerInWindow = (IntPtr pointer, ref int status) =>
             {
                 status = 0;
                 return true;
             };
             Assert.That(output.Get(), Is.True);
             HALAnalog.GetAnalogTriggerInWindow = global::HAL.SimulatorHAL.HALAnalog.getAnalogTriggerInWindow;
         }
     }
 }
Exemplo n.º 8
0
 internal override void FreeInterruptableSensorBase()
 {
     m_interruptTriggerOutput.CancelInterrupts();
     m_interruptTriggerOutput.Dispose();
     m_interruptTriggerOutput = null;
     m_interruptTrigger.Dispose();
     m_interruptTrigger = null;
 }
Exemplo n.º 9
0
 internal override InterruptableSensorBase GiveInterruptableSensorBase()
 {
     m_interruptTrigger = new AnalogTrigger(s_analogIo.GetInput());
     m_interruptTrigger.SetLimitsVoltage(2.0f, 3.0f);
     m_interruptTriggerOutput = new AnalogTriggerOutput(m_interruptTrigger, AnalogTriggerType.State);
     return m_interruptTriggerOutput;
 }