예제 #1
0
 /// <summary>
 /// Comstructor to set the properties of our
 /// serial port communicator to nothing
 /// </summary>
 public CommunicationManager()
 {
     _baudRate      = string.Empty;
     _parity        = string.Empty;
     _stopBits      = string.Empty;
     _dataBits      = string.Empty;
     _portName      = "COM1";
     _displayWindow = null;
     _serialPortConnectInformation = null;
 }
예제 #2
0
        public void OpenTest()
        {
            SerialPort target = new SerialPort();
            SerialPortConnectInformation serialPortConnectInformation = null;

            target.Open(serialPortConnectInformation);
            bool actual = target.IsOpen;

            Assert.AreEqual(false, actual);
        }
예제 #3
0
        /// <summary>
        /// Constructor to set the properties of our Manager Class
        /// </summary>
        /// <param name="baud">Desired BaudRate</param>
        /// <param name="par">Desired Parity</param>
        /// <param name="sBits">Desired StopBits</param>
        /// <param name="dBits">Desired DataBits</param>
        /// <param name="name">Desired PortName</param>
        /// <param name="rtb">Rich Textbox, to display messages.</param>
        public CommunicationManager(string baud, string par, string sBits, string dBits, string name, RichTextBox rtb)
        {
            _baudRate      = baud;
            _parity        = par;
            _stopBits      = sBits;
            _dataBits      = dBits;
            _portName      = name;
            _displayWindow = rtb;

            _serialPortConnectInformation = new SerialPortConnectInformation(
                name,
                int.Parse(_baudRate),
                (Parity)Enum.Parse(typeof(Parity), _parity),
                int.Parse(_dataBits),
                (StopBits)Enum.Parse(typeof(StopBits), _stopBits));

            //now add an event handler
            comNativePort.DataReceived   += new SerialDataReceivedEventHandler(comNativePort_DataReceived);
            comSerialPort.onDataReceived += new SerialPortEventHandler(comSerialPort_DataReceived);
        }
예제 #4
0
 /// <summary>
 /// Open method, to open a connection to the serial port.
 /// </summary>
 /// <param name="serialPortConnectInformation">Connection information, to open the serial port.</param>
 public void Open(SerialPortConnectInformation serialPortConnectInformation)
 {
     _serialPort.Open(serialPortConnectInformation);
 }
 public void Open(SerialPortConnectInformation serialPortConnectInformation)
 {
     _isOpen = true;
 }
예제 #6
0
 /// <summary>
 /// Open a connection.
 /// </summary>
 /// <param name="serialPortConnectInformation">Contains the serial connection information.</param>
 public void Open(SerialPortConnectInformation serialPortConnectInformation)
 {
     _nuvoTelegram.Open(serialPortConnectInformation);
 }
예제 #7
0
 public void Open(SerialPortConnectInformation serialPortConnectInformation)
 {
     _serialPortConnectInformation = serialPortConnectInformation;
     CreateSerialPort();
 }
예제 #8
0
 public void Open(SerialPortConnectInformation serialPortConnectInformation)
 {
     OpenQueues();
 }
예제 #9
0
 public void Open(SerialPortConnectInformation serialPortConnectInformation)
 {
     _log.Debug(m => m("Open called."));
 }
예제 #10
0
 public void Open(SerialPortConnectInformation serialPortConnectInformation)
 {
     _log.Debug(m => m("Open called. {0}", serialPortConnectInformation.ToString()));
     _openMethodCalled             = true;
     _serialPortConnectInformation = serialPortConnectInformation;
 }