public void setSerial(SerialPort _port)
        {
            SerialPort old = mSerial;
            mSerial = _port;

            if (old != mSerial)
            {
                if (old != null)
                {
                    old.close();
                }
                if (mSerial != null)
                {
                    mSerial.open();
                    mLog.logType("SYSTEM", "Serial configuration: " + mSerial.ToString());
                }
            }
        }
        public List<String> scan()
        {
            const String prefix = "COM";

            List<String> found = new List<String>();

            for (int i = mStartPort; i != mEndPort; i = ((mStartPort < mEndPort) ? (i + 1) : (i - 1)))
            {
                string portName = prefix + i.ToString();
                SerialPort port = new SerialPort(portName, mBaudRate, mParityBits, mDataBits, mStopBits);

                if (port.open())
                {
                    port.close();
                    found.Add(portName);
                }

                ScanProgressed(i, Math.Abs(mEndPort - mStartPort));
            }

            return found;
        }