Beispiel #1
0
        /// <summary>
        /// 收到上报数据给卫星回复
        /// </summary>
        /// <param name="CS"></param>
        public static void Reply(ComServer CS)
        {
            if (CS.sp.IsOpen)
            {
                lock (CS.sp)
                {
                    byte[] vBuffer = ASCIIEncoding.ASCII.GetBytes("$COSS,1,");
                    ComBussiness.XorSAT(ref vBuffer);
                    CS.sp.Write(vBuffer, 0, vBuffer.Length);


                    Service.ServiceControl.LogInfoToTxt(Service.ServiceEnum.NFOINDEX.COM, "", vBuffer, "ASC");
                    Service.ServiceControl.LogInfoToTxt(Service.ServiceEnum.NFOINDEX.COM, "", vBuffer);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 发送卫星时间问询命令
        /// </summary>
        public static void GetComTime()
        {
            foreach (ComServer item in Service.ServiceControl.com)
            {
                if (item.sp.IsOpen)
                {
                    lock (item.sp)
                    {
                        //item.sp.WriteLine("$TINF,13:56:41.00,   " + "\n");---返回的结果

                        byte[] vBuffer = ASCIIEncoding.ASCII.GetBytes("$TAPP,");
                        ComBussiness.XorSAT(ref vBuffer);
                        item.sp.Write(vBuffer, 0, vBuffer.Length);


                        Service.ServiceControl.LogInfoToTxt(Service.ServiceEnum.NFOINDEX.COM, "", vBuffer, "ASC");
                        Service.ServiceControl.LogInfoToTxt(Service.ServiceEnum.NFOINDEX.COM, "", vBuffer);
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 发送卫星状态问询命令
        /// </summary>
        public static void GetComState()
        {
            foreach (ComServer item in Service.ServiceControl.com)
            {
                if (item.sp.IsOpen)
                {
                    lock (item.sp)
                    {
                        byte[] vBuffer = ASCIIEncoding.ASCII.GetBytes("$QSTA,0,");
                        ComBussiness.XorSAT(ref vBuffer);
                        item.sp.Write(vBuffer, 0, vBuffer.Length);
                        //byte[] enter=ASCIIEncoding.ASCII.GetBytes(item.sp.NewLine); //加回车
                        //Array.Resize(ref vBuffer, vBuffer.Length + enter.Length );
                        //Array.Copy(enter, 0, vBuffer, vBuffer.Length - enter.Length, enter.Length);

                        Service.ServiceControl.LogInfoToTxt(Service.ServiceEnum.NFOINDEX.COM, "", vBuffer, "ASC");
                        Service.ServiceControl.LogInfoToTxt(Service.ServiceEnum.NFOINDEX.COM, "", vBuffer);
                    }
                }
            }
        }