private void btnSetParam_Click(object sender, EventArgs e)
        {
            if (this.comboBox1.SelectedIndex < 0)
            {
                MessageBox.Show("请选择串口!");
                return;
            }
            string portName = this.comboBox1.Text;

            int  baudrate    = (int)this.cmbBaudRate.SelectedValue;
            int  respbeam    = (int)this.cmbRespBeam.SelectedValue;
            bool receipttype = ((int)this.cmbReceiptType.SelectedValue) == 0 ? false : true;

            var beidou = CPortDataMgr.Instance.FindBeidouNormal(this.comboBox1.Text);

            if (beidou != null && beidou.Port.IsOpen)
            {
                CSTSTStruct param = new CSTSTStruct()
                {
                    ServiceFrequency   = "60",
                    SerialBaudRate     = baudrate,
                    ResponseOfBeam     = respbeam,
                    AcknowledgmentType = receipttype
                };
                CSystemInfoMgr.Instance.AddInfo(string.Format("[{0}]---------------{1}----------------", EChannelType.BeiDou, "设置终端状态"));

                //CPortDataMgr.Instance.SendBeidouSTST(param);

                //CPortDataMgr.Instance.SendBeidouSTST(portName, param);
                beidou.SendSTST(param);
            }
        }
        public void SendSTST(CSTSTStruct param)
        {
            string text = BeidouHelper.GetSTSTStr(param);

            Debug.WriteLine("发送STST:" + text);
            InvokeMessage("设置终端状态  " + text, "发送");
            SendText(text);
        }
        // 调整波束
        private void AdjustBeam(int beam, int baudrate = 3)
        {
            var stst = new CSTSTStruct();

            stst.ServiceFrequency   = "60";     //  服务频度
            stst.SerialBaudRate     = baudrate; //  串口波特率,默认为为3,9.6Kbps
            stst.ResponseOfBeam     = beam;     //  响应波束为: 1~7波束,
            stst.AcknowledgmentType = false;    //  默认打开系统回执,关闭通信回执
            SendSTST(stst);                     //  发送调整波束命令
        }
            /// <summary>
            /// 设置终端状态,设置参数
            /// $STST
            /// </summary>
            public static String GetSTSTStr(CSTSTStruct param)
            {
                StringBuilder rawStr = new StringBuilder();

                rawStr.Append("$");
                rawStr.Append(CSTSTStruct.CMD_PREFIX);
                rawStr.Append(",");
                rawStr.Append(param.ServiceFrequency);               // 服务频度
                rawStr.Append(",");
                rawStr.Append(param.SerialBaudRate);                 // 串口波特率
                rawStr.Append(",");
                rawStr.Append(param.ResponseOfBeam);                 // 响应波束
                rawStr.Append(",");
                rawStr.Append(param.AcknowledgmentType ? "1" : "0"); // 回执类型
                rawStr.Append(",");
                rawStr.Append(GenerateCRC(rawStr.ToString()));       // 校验和
                rawStr.Append("\r\n");
                return(rawStr.ToString());
            }