コード例 #1
0
ファイル: RS232_42.cs プロジェクト: valoni/NETMF-Gadgeteer
        /// <summary>
        /// Initializes the serial port to the passed in parameters. If no parameters are passed, the defaults are used.
        /// </summary>
        /// <param name="baudRate">The baud rate for the serail port. Defaulted to 38400.</param>
        /// <param name="parity">Specifies the parity bit for the serial port. Defaulted to none.</param>
        /// <param name="stopBits">Specifies the number of stop bits used on the serial port. Defaulted to one.</param>
        /// <param name="dataBits">The number of data bits. Defaulted to 8.</param>
        /// <param name="flowControl">Specifies if the serial port should use flow control. Defaulted to not use.</param>
        public void Initialize(int baudRate = 38400, GTI.Serial.SerialParity parity = GTI.Serial.SerialParity.None,
                               GTI.Serial.SerialStopBits stopBits = GTI.Serial.SerialStopBits.One, int dataBits = 8, GTI.Serial.HardwareFlowControl flowControl = GTI.Serial.HardwareFlowControl.NotRequired)
        {
            // Set up serial port.
            serialPort = new GTI.Serial(socket, baudRate, parity, stopBits, dataBits, flowControl, this);

            serialPort.Open();

            // Subscribe to events.
            //serialPort.DataReceived += new GTI.Serial.DataReceivedEventHandler(serialPort_DataReceived);
            //serialPort.LineReceived += new GTI.Serial.LineReceivedEventHandler(serialPort_LineReceived);
        }
コード例 #2
0
        // Note: A constructor summary is auto-generated by the doc builder.
        /// <summary></summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public RFIDReader(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported('U', this);

            serialPort = new GTI.Serial(socket, 9600, GTI.Serial.SerialParity.None, GTI.Serial.SerialStopBits.Two, 8, GTI.Serial.HardwareFlowControl.NotRequired, this);
            serialPort.Open();

            System.Threading.Thread readThread = new System.Threading.Thread(_readThreadStart);

            readThread.Start();
        }
コード例 #3
0
        // Note: A constructor summary is auto-generated by the doc builder.
        /// <summary></summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public SerialCameraL1(int socketNumber)
        {
            // This finds the Socket instance from the user-specified socket number.
            // This will generate user-friendly error messages if the socket is invalid.
            // If there is more than one socket on this module, then instead of "null" for the last parameter,
            // put text that identifies the socket to the user (e.g. "S" if there is a socket type S)
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported('U', this);

            serialPort              = new GTI.Serial(socket, 115200, GTI.Serial.SerialParity.None, GTI.Serial.SerialStopBits.One, 8, GTI.Serial.HardwareFlowControl.NotRequired, this);
            serialPort.ReadTimeout  = 5000;
            serialPort.WriteTimeout = 5000;

            serialPort.Open();
            ResetCamera();
        }