示例#1
0
        //发送数据
        public static void SendData(byte startbit, ROV rov)
        {
            byte[] TXData = DataToSendProcessor(startbit, rov);

            if (serialconnection == true)
            {
                try
                {
                    sp1.Write(TXData, 0, TXData.Length);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    sp1.Close();
                }
            }
            else
            {
                try
                {
                    socketControl.Send(TXData, TXData.Length, 0);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    socketControl.Close();
                }
            }
        }
示例#2
0
        private void btn_sendsetpara_Click(object sender, EventArgs e)
        {
            ROV rovsetpara = rov;

            rovsetpara.setpara.depth_set = Convert.ToSingle(tb_depthset.Text);
            rovsetpara.setpara.pitch_set = Convert.ToSingle(tb_pitchset.Text);

            SendData(Startbit_Motion_Control, rovsetpara);
        }