示例#1
0
        private void CreateTestInstruction(InstructionType argCmd, int argTimeDelayMS)
        {
            TestInstruction instruction = new TestInstruction();

            instruction.Command     = argCmd;
            instruction.TimeDelayMs = argTimeDelayMS;

            _InstructionList.Add(instruction);
        }
示例#2
0
        private void CreateTestInstruction(InstructionType argCmd, byte argIndex, bool argValue)
        {
            TestInstruction instruction = new TestInstruction();

            instruction.Command = argCmd;
            instruction.Index   = argIndex;
            instruction.Value   = argValue;

            _InstructionList.Add(instruction);
        }
示例#3
0
        private void ExecuteSetRelais(TestInstruction argInstruction)
        {
            // set output
            Log($"Set output {argInstruction.Index} to {argInstruction.Value}.");
            var result = SendRelais(ref _OuputMask, argInstruction.Index, argInstruction.Value);

            if (result != ProtocolResult.Ack && result != ProtocolResult.AckAck)
            {
                LogError($"Result: {result}");
            }
            else
            {
                Log($"Result: {result}");
            }
        }
示例#4
0
        private void ExecuteReadInput(TestInstruction argInstruction)
        {
            // read input
            Log($"Read input {argInstruction.Index}. Expected value {argInstruction.Value}.");

            switch (argInstruction.Index)
            {
            case 1:
                if (_ViewModel.InputState1 != argInstruction.Value)
                {
                    LogError($"Error - Input value {_ViewModel.InputState1}. Expected {argInstruction.Value}.");
                }
                break;

            case 2:
                if (_ViewModel.InputState2 != argInstruction.Value)
                {
                    LogError($"Error - Input value {_ViewModel.InputState2}. Expected {argInstruction.Value}.");
                }
                break;

            case 3:
                if (_ViewModel.InputState3 != argInstruction.Value)
                {
                    LogError($"Error - Input value {_ViewModel.InputState3}. Expected {argInstruction.Value}.");
                }
                break;

            case 4:
                if (_ViewModel.InputState4 != argInstruction.Value)
                {
                    LogError($"Error - Input value {_ViewModel.InputState4}. Expected {argInstruction.Value}.");
                }
                break;

            default:
                LogError($"Error - ExecuteReadInput for index {argInstruction.Index} not supported.");
                break;
            }
        }
示例#5
0
 private void ExecuteTimeDelay(TestInstruction argInstruction)
 {
     Thread.Sleep(argInstruction.TimeDelayMs);
     ExecuteNextStep();
 }