/// <summary>
        /// Create new GM862GPS instance
        /// </summary>
        /// <param name="Port">Serial Port to use</param>
        public GM862GPS(String Port)
        {
            // We begin in IDLE state
            _CurrentState           = GM862GPSStates.Idle;
            _SerialFIFO_CommandMode = "";
            _SerialFIFI_IdleMode    = "";

            try
            {
                // Create new SerialPort Object
                _ComPort           = new SerialPort(Port, 19200, Parity.None, 8, StopBits.One);
                _ComPort.Handshake = Handshake.None;
                _ComPort.Open();
            }
            catch
            {
                // If failed throw error
                throw new GM862GPSException(GM862GPSException.FAILED_TO_CREATE);
            }

            // DataRecieved Handler
            _ComPort.DataReceived += new SerialDataReceivedEventHandler(_ComPort_DataReceived);

            // Create thread that handles Unsolicited Responses
            _ParseUnsolicitatedResponses          = new Thread(new ThreadStart(ParseUnsolicitedResponse));
            _ParseUnsolicitatedResponses.Priority = ThreadPriority.AboveNormal;
            _ParseUnsolicitatedResponses.Start();

            // Add onUnsolicitedResponse Handler to check for incomming SMS and Call
            OnUnsolicitedResponse += new UnsolicitedResponseEvent(CheckForNewSMS);
            OnUnsolicitedResponse += new UnsolicitedResponseEvent(CheckForCall);
        }
Beispiel #2
0
        /// <summary>
        /// Create new GM862GPS instance
        /// </summary>
        /// <param name="Port">Serial Port to use</param>
        public GM862GPS(String Port)
        {
            // We begin in IDLE state
            _CurrentState = GM862GPSStates.Idle;
            _SerialFIFO_CommandMode = "";
            _SerialFIFI_IdleMode = "";

            try
            {
                // Create new SerialPort Object
                _ComPort = new SerialPort(Port, 19200, Parity.None, 8, StopBits.One);
                _ComPort.Handshake = Handshake.None;
                _ComPort.Open();
            }
            catch
            {
                // If failed throw error
                throw new GM862GPSException(GM862GPSException.FAILED_TO_CREATE);
            }

            // DataRecieved Handler
            _ComPort.DataReceived += new SerialDataReceivedEventHandler(_ComPort_DataReceived);

            // Create thread that handles Unsolicited Responses
            _ParseUnsolicitatedResponses = new Thread(new ThreadStart(ParseUnsolicitedResponse));
            _ParseUnsolicitatedResponses.Priority = ThreadPriority.AboveNormal;
            _ParseUnsolicitatedResponses.Start();

            // Add onUnsolicitedResponse Handler to check for incomming SMS and Call
            OnUnsolicitedResponse += new UnsolicitedResponseEvent(CheckForNewSMS);
            OnUnsolicitedResponse += new UnsolicitedResponseEvent(CheckForCall);
        }