Exemplo n.º 1
0
        //如果收到机器人指令,发给track
        private void parserRobotMsg(String msg)
        {
            if (null == msg)
            {
                return;
            }
            // string xmlString = "<?xml version=\"1.0\" encoding=\"UTF - 8\"?><snd ts=\"xxxx\" rts=\"xxxx\"><lon n=\"123\"/></snd>";
            XmlOperator xmlOperator = new XmlOperator(msg);

            string[] command = xmlOperator.GetFirstChildNodeByTagName("snd");
            //for (int i = 0; i < command.Length; i++)
            //{
            //    if (command[i] != null)
            //        Console.WriteLine("{0}={1}", i, command[i]);
            //}

            try
            {
                if (command[0] == "elsr")
                {
                    startTrackerClient();
                    label10.Text = "断开";
                    laserstatus  = 0;
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();
                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';
                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'e';
                    toRobot[23] = (byte)'l';
                    toRobot[24] = (byte)'s';
                    toRobot[25] = (byte)'r';
                    toRobot[26] = (byte)' ';
                    toRobot[27] = (byte)'r';
                    toRobot[28] = (byte)'=';
                    toRobot[29] = (byte)'"';
                    toRobot[30] = (byte)'1';
                    toRobot[31] = (byte)'"';
                    toRobot[32] = (byte)'/';
                    toRobot[33] = (byte)'>';
                    toRobot[34] = (byte)'<';
                    toRobot[35] = (byte)'/';
                    toRobot[36] = (byte)'r';
                    toRobot[37] = (byte)'e';
                    toRobot[38] = (byte)'p';
                    toRobot[39] = (byte)'>';
                    sendMsg(robotStream, toRobot, 40);
                    // Console.WriteLine(ts);
                }
                else if (command[0] == "lon")
                {
                    trackerOpenLaser();
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();
                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';
                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'l';
                    toRobot[23] = (byte)'o';
                    toRobot[24] = (byte)'n';
                    toRobot[25] = (byte)' ';
                    toRobot[26] = (byte)'r';
                    toRobot[27] = (byte)'=';
                    toRobot[28] = (byte)'"';
                    toRobot[29] = (byte)'1';
                    toRobot[30] = (byte)'"';
                    toRobot[31] = (byte)'/';
                    toRobot[32] = (byte)'>';
                    toRobot[33] = (byte)'<';
                    toRobot[34] = (byte)'/';
                    toRobot[35] = (byte)'r';
                    toRobot[36] = (byte)'e';
                    toRobot[37] = (byte)'p';
                    toRobot[38] = (byte)'>';
                    sendMsg(robotStream, toRobot, 39);
                }
                else if (command[0] == "selj")
                {
                    trackerSetMode(Convert.ToInt32(command[1]));
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();
                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';
                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'s';
                    toRobot[23] = (byte)'e';
                    toRobot[24] = (byte)'l';
                    toRobot[25] = (byte)'j';
                    toRobot[26] = (byte)' ';
                    toRobot[27] = (byte)'r';
                    toRobot[28] = (byte)'=';
                    toRobot[29] = (byte)'"';
                    toRobot[30] = (byte)'1';
                    toRobot[31] = (byte)'"';
                    toRobot[32] = (byte)'/';
                    toRobot[33] = (byte)'>';
                    toRobot[34] = (byte)'<';
                    toRobot[35] = (byte)'/';
                    toRobot[36] = (byte)'r';
                    toRobot[37] = (byte)'e';
                    toRobot[38] = (byte)'p';
                    toRobot[39] = (byte)'>';
                    sendMsg(robotStream, toRobot, 40);
                }
                else if (command[0] == "btrk")
                {
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();
                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';
                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'b';
                    toRobot[23] = (byte)'t';
                    toRobot[24] = (byte)'r';
                    toRobot[25] = (byte)'k';
                    toRobot[26] = (byte)' ';
                    toRobot[27] = (byte)'r';
                    toRobot[28] = (byte)'=';
                    toRobot[29] = (byte)'"';
                    toRobot[30] = (byte)'1';
                    toRobot[31] = (byte)'"';
                    toRobot[32] = (byte)'/';
                    toRobot[33] = (byte)'>';
                    toRobot[34] = (byte)'<';
                    toRobot[35] = (byte)'/';
                    toRobot[36] = (byte)'r';
                    toRobot[37] = (byte)'e';
                    toRobot[38] = (byte)'p';
                    toRobot[39] = (byte)'>';
                    sendMsg(robotStream, toRobot, 40);
                }
                else if (command[0] == "gcp")
                {
                    Console.WriteLine("gcp");
                    trackerGetStatus();
                    Console.WriteLine("444444444");
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();

                    char[] str_x   = x_finlly.ToCharArray();   //推荐
                    char[] str_z   = z_finlly.ToCharArray();   //推荐
                    char[] str_gap = gap_finlly.ToCharArray(); //推荐
                    Console.WriteLine("5555555");
                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';
                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'g';
                    toRobot[23] = (byte)'c';
                    toRobot[24] = (byte)'p';

                    toRobot[25] = (byte)' ';
                    toRobot[26] = (byte)'r';
                    toRobot[27] = (byte)'=';
                    toRobot[28] = (byte)'"';
                    toRobot[29] = (byte)'1';
                    toRobot[30] = (byte)'"';
                    toRobot[31] = (byte)'/';
                    toRobot[32] = (byte)'>';

                    toRobot[33] = (byte)'<';
                    toRobot[34] = (byte)'t';
                    toRobot[35] = (byte)'p';
                    toRobot[36] = (byte)' ';

                    toRobot[37] = (byte)'x';
                    toRobot[38] = (byte)'=';
                    toRobot[39] = (byte)'"';
                    toRobot[40] = (byte)str_x[0];
                    toRobot[41] = (byte)str_x[1];
                    toRobot[42] = (byte)str_x[2];
                    toRobot[43] = (byte)str_x[3];
                    toRobot[44] = (byte)str_x[4];
                    toRobot[45] = (byte)str_x[5];
                    toRobot[46] = (byte)'"';
                    toRobot[47] = (byte)' ';

                    toRobot[48] = (byte)'y';
                    toRobot[49] = (byte)'=';
                    toRobot[50] = (byte)'"';
                    toRobot[51] = (byte)'0';
                    toRobot[52] = (byte)'0';
                    toRobot[53] = (byte)'0';
                    toRobot[54] = (byte)'.';
                    toRobot[55] = (byte)'0';
                    toRobot[56] = (byte)'0';
                    toRobot[57] = (byte)'"';
                    toRobot[58] = (byte)' ';

                    toRobot[59] = (byte)'z';
                    toRobot[60] = (byte)'=';
                    toRobot[61] = (byte)'"';
                    toRobot[62] = (byte)str_z[0];
                    toRobot[63] = (byte)str_z[1];
                    toRobot[64] = (byte)str_z[2];
                    toRobot[65] = (byte)str_z[3];
                    toRobot[66] = (byte)str_z[4];
                    toRobot[67] = (byte)str_z[5];
                    toRobot[68] = (byte)'"';
                    toRobot[69] = (byte)' ';

                    toRobot[70] = (byte)'a';
                    toRobot[71] = (byte)'=';
                    toRobot[72] = (byte)'"';
                    toRobot[73] = (byte)'0';
                    toRobot[74] = (byte)'0';
                    toRobot[75] = (byte)'0';
                    toRobot[76] = (byte)'.';
                    toRobot[77] = (byte)'0';
                    toRobot[78] = (byte)'0';
                    toRobot[79] = (byte)'"';
                    toRobot[80] = (byte)' ';

                    toRobot[81] = (byte)'b';
                    toRobot[82] = (byte)'=';
                    toRobot[83] = (byte)'"';
                    toRobot[84] = (byte)'0';
                    toRobot[85] = (byte)'0';
                    toRobot[86] = (byte)'0';
                    toRobot[87] = (byte)'.';
                    toRobot[88] = (byte)'0';
                    toRobot[89] = (byte)'0';
                    toRobot[90] = (byte)'"';
                    toRobot[91] = (byte)' ';

                    toRobot[92]  = (byte)'c';
                    toRobot[93]  = (byte)'=';
                    toRobot[94]  = (byte)'"';
                    toRobot[95]  = (byte)'0';
                    toRobot[96]  = (byte)'0';
                    toRobot[97]  = (byte)'0';
                    toRobot[98]  = (byte)'.';
                    toRobot[99]  = (byte)'0';
                    toRobot[100] = (byte)'0';
                    toRobot[101] = (byte)'"';
                    toRobot[102] = (byte)' ';

                    toRobot[103] = (byte)'/';
                    toRobot[104] = (byte)'>';
                    toRobot[105] = (byte)'<';
                    toRobot[106] = (byte)'g';
                    toRobot[107] = (byte)'p';
                    toRobot[108] = (byte)' ';
                    toRobot[109] = (byte)'a';
                    toRobot[110] = (byte)'r';
                    toRobot[111] = (byte)'e';
                    toRobot[112] = (byte)'a';
                    toRobot[113] = (byte)'=';
                    toRobot[114] = (byte)'"';
                    toRobot[115] = (byte)'0';
                    toRobot[116] = (byte)'0';
                    toRobot[117] = (byte)'0';
                    toRobot[118] = (byte)'.';
                    toRobot[119] = (byte)'0';
                    toRobot[120] = (byte)'0';
                    toRobot[121] = (byte)'"';
                    toRobot[122] = (byte)' ';

                    toRobot[123] = (byte)'g';
                    toRobot[124] = (byte)'a';
                    toRobot[125] = (byte)'p';
                    toRobot[126] = (byte)'=';
                    toRobot[127] = (byte)'"';
                    toRobot[128] = (byte)str_gap[0];
                    toRobot[129] = (byte)str_gap[1];
                    toRobot[130] = (byte)str_gap[2];
                    toRobot[131] = (byte)str_gap[3];
                    toRobot[132] = (byte)str_gap[4];
                    toRobot[133] = (byte)str_gap[5];
                    toRobot[134] = (byte)'"';
                    toRobot[135] = (byte)' ';

                    toRobot[136] = (byte)'m';
                    toRobot[137] = (byte)'i';
                    toRobot[138] = (byte)'s';
                    toRobot[139] = (byte)'m';
                    toRobot[140] = (byte)'=';
                    toRobot[141] = (byte)'"';
                    toRobot[142] = (byte)'0';
                    toRobot[143] = (byte)'0';
                    toRobot[144] = (byte)'0';
                    toRobot[145] = (byte)'.';
                    toRobot[146] = (byte)'0';
                    toRobot[147] = (byte)'0';
                    toRobot[148] = (byte)'"';
                    toRobot[149] = (byte)'/';
                    toRobot[150] = (byte)'>';



                    toRobot[151] = (byte)'<';
                    toRobot[152] = (byte)'/';
                    toRobot[153] = (byte)'g';
                    toRobot[154] = (byte)'c';
                    toRobot[155] = (byte)'p';
                    toRobot[156] = (byte)'>';

                    toRobot[157] = (byte)'<';
                    toRobot[158] = (byte)'/';
                    toRobot[159] = (byte)'r';
                    toRobot[160] = (byte)'e';
                    toRobot[161] = (byte)'p';
                    toRobot[162] = (byte)'>';

                    sendMsg(robotStream, toRobot, 163);
                    Console.WriteLine("66666666666");
                }
                else if (command[0] == "etrk")
                {
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();
                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';
                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'e';
                    toRobot[23] = (byte)'t';
                    toRobot[24] = (byte)'r';
                    toRobot[25] = (byte)'k';
                    toRobot[26] = (byte)' ';
                    toRobot[27] = (byte)'r';
                    toRobot[28] = (byte)'=';
                    toRobot[29] = (byte)'"';
                    toRobot[30] = (byte)'1';
                    toRobot[31] = (byte)'"';
                    toRobot[32] = (byte)'/';
                    toRobot[33] = (byte)'>';
                    toRobot[34] = (byte)'<';
                    toRobot[35] = (byte)'/';
                    toRobot[36] = (byte)'r';
                    toRobot[37] = (byte)'e';
                    toRobot[38] = (byte)'p';
                    toRobot[39] = (byte)'>';
                    sendMsg(robotStream, toRobot, 40);
                }
                else if (command[0] == "loff")
                {
                    trackerCLoseLaser();
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();
                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';
                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'l';
                    toRobot[23] = (byte)'o';
                    toRobot[24] = (byte)'f';
                    toRobot[25] = (byte)'f';
                    toRobot[26] = (byte)' ';
                    toRobot[27] = (byte)'r';
                    toRobot[28] = (byte)'=';
                    toRobot[29] = (byte)'"';
                    toRobot[30] = (byte)'1';
                    toRobot[31] = (byte)'"';
                    toRobot[32] = (byte)'/';
                    toRobot[33] = (byte)'>';
                    toRobot[34] = (byte)'<';
                    toRobot[35] = (byte)'/';
                    toRobot[36] = (byte)'r';
                    toRobot[37] = (byte)'e';
                    toRobot[38] = (byte)'p';
                    toRobot[39] = (byte)'>';
                    sendMsg(robotStream, toRobot, 40);
                }
                else if (command[0] == "dlsr")
                {
                    stopTrackerClient();
                    label10.Text = "连接";
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();
                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';
                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'d';
                    toRobot[23] = (byte)'l';
                    toRobot[24] = (byte)'s';
                    toRobot[25] = (byte)'r';
                    toRobot[26] = (byte)' ';
                    toRobot[27] = (byte)'r';
                    toRobot[28] = (byte)'=';
                    toRobot[29] = (byte)'"';
                    toRobot[30] = (byte)'1';
                    toRobot[31] = (byte)'"';
                    toRobot[32] = (byte)'/';
                    toRobot[33] = (byte)'>';
                    toRobot[34] = (byte)'<';
                    toRobot[35] = (byte)'/';
                    toRobot[36] = (byte)'r';
                    toRobot[37] = (byte)'e';
                    toRobot[38] = (byte)'p';
                    toRobot[39] = (byte)'>';
                    sendMsg(robotStream, toRobot, 40);
                }
                else if (command[0] == "ere")
                {
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();
                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';
                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'e';
                    toRobot[23] = (byte)'r';
                    toRobot[24] = (byte)'e';
                    toRobot[25] = (byte)' ';
                    toRobot[26] = (byte)'r';
                    toRobot[27] = (byte)'=';
                    toRobot[28] = (byte)'"';
                    toRobot[29] = (byte)'1';
                    toRobot[30] = (byte)'"';
                    toRobot[31] = (byte)'/';
                    toRobot[32] = (byte)'>';
                    toRobot[33] = (byte)'<';
                    toRobot[34] = (byte)'/';
                    toRobot[35] = (byte)'r';
                    toRobot[36] = (byte)'e';
                    toRobot[37] = (byte)'p';
                    toRobot[38] = (byte)'>';
                    sendMsg(robotStream, toRobot, 39);
                }
                else if (command[0] == "gets")
                {
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts              = (int)tr;
                    string str             = ts.ToString();
                    char[] st              = str.ToCharArray();
                    char[] str_pokou       = pokou.ToString().PadLeft(3, '0').ToCharArray();//推荐
                    char[] str_laserOn     = (laserOn.ToString()).ToCharArray();
                    char[] str_laserstatus = (laserstatus.ToString()).ToCharArray();


                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';

                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'g';
                    toRobot[23] = (byte)'e';
                    toRobot[24] = (byte)'t';
                    toRobot[25] = (byte)'s';
                    toRobot[26] = (byte)' ';
                    toRobot[27] = (byte)'r';
                    toRobot[28] = (byte)'=';
                    toRobot[29] = (byte)'"';
                    toRobot[30] = (byte)'1';
                    toRobot[31] = (byte)'"';

                    toRobot[32] = (byte)' ';
                    toRobot[33] = (byte)'s';
                    toRobot[34] = (byte)'t';
                    toRobot[35] = (byte)'a';
                    toRobot[36] = (byte)'t';
                    toRobot[37] = (byte)'u';
                    toRobot[38] = (byte)'s';

                    toRobot[39] = (byte)'=';
                    toRobot[40] = (byte)'"';
                    toRobot[41] = (byte)'1';
                    toRobot[42] = (byte)str_pokou[0];
                    toRobot[43] = (byte)str_pokou[1];
                    toRobot[44] = (byte)str_pokou[2];
                    toRobot[45] = (byte)str_laserOn[0];
                    toRobot[46] = (byte)str_laserstatus[0];
                    toRobot[47] = (byte)'"';
                    toRobot[48] = (byte)'/';
                    toRobot[49] = (byte)'>';
                    toRobot[50] = (byte)'<';
                    toRobot[51] = (byte)'/';
                    toRobot[52] = (byte)'r';
                    toRobot[53] = (byte)'e';
                    toRobot[54] = (byte)'p';
                    toRobot[55] = (byte)'>';
                    sendMsg(robotStream, toRobot, 56);
                }
                else if (command[0] == "ack")
                {
                    TimeSpan t1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    double   tr = t1.TotalSeconds;
                    // string[] str = new string[10];
                    int    ts  = (int)tr;
                    string str = ts.ToString();
                    char[] st  = str.ToCharArray();

                    toRobot[0]  = (byte)'<';
                    toRobot[1]  = (byte)'r';
                    toRobot[2]  = (byte)'e';
                    toRobot[3]  = (byte)'p';
                    toRobot[4]  = (byte)' ';
                    toRobot[5]  = (byte)'t';
                    toRobot[6]  = (byte)'s';
                    toRobot[7]  = (byte)'=';
                    toRobot[8]  = (byte)'"';
                    toRobot[9]  = (byte)st[0];
                    toRobot[10] = (byte)st[1];
                    toRobot[11] = (byte)st[2];
                    toRobot[12] = (byte)st[3];
                    toRobot[13] = (byte)st[4];
                    toRobot[14] = (byte)st[5];
                    toRobot[15] = (byte)st[6];
                    toRobot[16] = (byte)st[7];
                    toRobot[17] = (byte)st[8];
                    toRobot[18] = (byte)st[9];
                    toRobot[19] = (byte)'"';
                    toRobot[20] = (byte)'>';

                    toRobot[21] = (byte)'<';
                    toRobot[22] = (byte)'a';
                    toRobot[23] = (byte)'c';
                    toRobot[24] = (byte)'k';
                    toRobot[25] = (byte)' ';
                    toRobot[26] = (byte)'r';
                    toRobot[27] = (byte)'=';
                    toRobot[28] = (byte)'"';
                    toRobot[29] = (byte)'1';
                    toRobot[30] = (byte)'"';
                    toRobot[31] = (byte)'/';
                    toRobot[32] = (byte)'>';
                    toRobot[33] = (byte)'<';
                    toRobot[34] = (byte)'/';
                    toRobot[35] = (byte)'r';
                    toRobot[36] = (byte)'e';
                    toRobot[37] = (byte)'p';
                    toRobot[38] = (byte)'>';
                    sendMsg(robotStream, toRobot, 39);
                }
            }


            catch (Exception e)
            {
                showErrorMessage("Paser Robot Message fail:" + e.ToString());
            }
        }