Ejemplo n.º 1
0
 /// <summary>
 /// 关闭GPS时钟串口
 /// </summary>
 /// <returns></returns>
 public bool CloseGpsCom()
 {
     GpsCom.Close();
     IsClockOpened = GpsCom.IsOpen;
     if (GpsCom.IsOpen)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 打开GPS时钟串口
        /// </summary>
        /// <returns></returns>
        public bool OpenGpsClockCom()
        {
            try
            {
                GpsCom.Open();
            }
            catch { }
            IsClockOpened = GpsCom.IsOpen;

            if (GpsCom.IsOpen)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// GPS时钟接收处理程序B
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void GpsClock_DataReceivedB(object sender, SerialDataReceivedEventArgs e)
 {
     try
     {
         StringBuilder currentline = new StringBuilder();
         //循环接收数据
         while (GpsCom.BytesToRead > 0)
         {
             char ch = (char)GpsCom.ReadByte();
             currentline.Append(ch);
         }
         //在这里对接收到的数据进行处理
         //
         currentline = new StringBuilder();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message.ToString());
     }
 }