Ejemplo n.º 1
0
        public CSerial(bool debugOnOff)
        {
            communicationErrorBool = false;

            debugMessageOn         = debugOnOff;
            mserial                = new SerialPort();
            mserial.BaudRate       = 9600;
            mserial.DataBits       = 8;
            mserial.Parity         = Parity.None;
            mserial.Handshake      = Handshake.None;
            mserial.DtrEnable      = false; // For Arduino Leonardo
            mserial.RtsEnable      = false; // for using rs232
            mserial.DataReceived  += mserial_DataReceived;
            mserial.ErrorReceived += mserial_ErrorReceived;
            mserial.PinChanged    += mserial_PinChanged;

            arrRxStr     = new string[100];
            arrRxStrSize = 0;
            rxstr        = "";
            args         = new serialEventArgs();

            queryDone = 0x01;
            sxlist    = new serialRxList[100];
            for (byte a = 0; a < 100; a++)
            {
                sxlist[a] = new serialRxList();
            }
            //
        }
Ejemplo n.º 2
0
        protected virtual void OnSerialReached(serialEventArgs e)
        {  // event for update UI
            EventHandler <serialEventArgs> handler = serialReached;

            if (handler != null)
            {
                handler(this, e);
            }
        }