Ejemplo n.º 1
0
        public RedNodePort(string portName)
        {
            portSettings = new SerialPortSettings(portName, BaudRate.baudRate9600, Parity.None, DataBits.dataBits8, StopBits.One, Handshake.None);
            //portSettings = new SerialPortSettings(portName, BaudRate.baudRate115200, Parity.None, DataBits.dataBits8, StopBits.One, Handshake.None);

            #region timers

            timer        = new PrecisionTimer();
            timer.Mode   = Mode.Periodic;
            timer.Period = 2000;
            timer.Tick  += new EventHandler(timer_Tick);

            #endregion

            #region Handlers

            port = new NMEASerialPort(portSettings);
            port.NewNMEAMessage += new EventHandler <NewNMEAMessageEventArgs>(port_NewNMEAMessage);
            port.PortError      += new EventHandler <SerialErrorReceivedEventArgs>(port_PortError);

            #endregion

            #region NMEA

            NMEAInit();

            #endregion

            #region other

            RedBASE_1 = new RedBASEState();
            RedBASE_2 = new RedBASEState();
            RedBASE_3 = new RedBASEState();
            RedBASE_4 = new RedBASEState();

            #endregion
        }
Ejemplo n.º 2
0
        public GNSSReceiverWrapper(SerialPortSettings portSettings)
        {
            #region port initialization

            port = new NMEASerialPort(portSettings);

            port.PortError      += new EventHandler <System.IO.Ports.SerialErrorReceivedEventArgs>(port_PortError);
            port.NewNMEAMessage += new EventHandler <NewNMEAMessageEventArgs>(port_NewMessage);

            #endregion

            #region parsers initialization

            cmdProcessor = new Dictionary <SentenceIdentifiers, ProcessCommandDelegate>()
            {
                { UCNLNMEA.SentenceIdentifiers.GGA, new ProcessCommandDelegate(ProcessGGA) },
                { UCNLNMEA.SentenceIdentifiers.GSV, new ProcessCommandDelegate(ProcessGSV) },
                { UCNLNMEA.SentenceIdentifiers.GLL, new ProcessCommandDelegate(ProcessGLL) },
                { UCNLNMEA.SentenceIdentifiers.RMC, new ProcessCommandDelegate(ProcessRMC) },
                { UCNLNMEA.SentenceIdentifiers.VTG, new ProcessCommandDelegate(ProcessVTG) }
            };

            #endregion
        }