Example #1
0
    private bool GetCurrentBreakState()
    {
        using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName))
        {
            BreakStateEventHandler breakState = new BreakStateEventHandler();

            com2.PinChanged += breakState.HandleEvent;
            com2.Open();
            return(breakState.WaitForBreak(MAX_WAIT_FOR_BREAK));
        }
    }
Example #2
0
    private void SetBreakStateandVerify(SerialPort com1)
    {
        BreakStateEventHandler breakState;

        using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName))
        {
            breakState = new BreakStateEventHandler();

            com2.PinChanged += breakState.HandleEvent;
            com2.Open();

            com1.BreakState = true;
            Assert.True(breakState.WaitForBreak(MAX_WAIT_FOR_BREAK));
        }
    }
Example #3
0
    public bool GetCurrentBreakState()
    {
        SerialPort             com2       = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName);
        bool                   retValue   = true;
        BreakStateEventHandler breakState = new BreakStateEventHandler();

        com2.PinChanged += new SerialPinChangedEventHandler(breakState.HandleEvent);
        com2.Open();
        retValue = breakState.WaitForBreak(MAX_WAIT_FOR_BREAK);

        if (com2.IsOpen)
        {
            com2.Close();
        }

        return(retValue);
    }
Example #4
0
    public bool SetBreakStateandVerify(SerialPort com1)
    {
        SerialPort             com2       = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName);
        bool                   retValue   = true;
        BreakStateEventHandler breakState = new BreakStateEventHandler();

        com2.PinChanged += new SerialPinChangedEventHandler(breakState.HandleEvent);
        com2.Open();
        com1.BreakState = true;

        if (!breakState.WaitForBreak(MAX_WAIT_FOR_BREAK))
        {
            Console.WriteLine("Err_2078aspznd!!!: The PinChangedEvent handler never got called with SerialPinChanges.Break event type");
            retValue = false;
        }

        if (com2.IsOpen)
        {
            com2.Close();
        }

        return(retValue);
    }