public static void Send_apply(string terminalstr)//申请命令 { DateTime StartTime = new DateTime(1970, 1, 1, 00, 00, 00); byte[] info = new byte[21]; info[0] = 0x11;//实时数据 info[1] = 0x00; info[2] = 0xAA; // info[3] = 0x84;//卫星型号 info[3] = FunComm.myTCP.mark; UInt32 Seconds = (UInt32)(DateTime.Now - StartTime).TotalSeconds; info[4] = (byte)((Seconds >> 24) & (0x000000FF)); info[5] = (byte)((Seconds >> 16) & (0x000000FF)); info[6] = (byte)((Seconds >> 8) & (0x000000FF)); info[7] = (byte)(Seconds & 0x000000FF); string[] bb = new string[10]; bb = terminalstr.Split('.'); info[8] = byte.Parse(bb[0]); info[9] = byte.Parse(bb[1]); info[10] = byte.Parse(bb[2]); info[11] = byte.Parse(bb[3]); // info[12] = 0x61;//申请数据类型 11...61 info[12] = FunComm.myTCP.equ; info[13] = 0x00; info[14] = 0x13;//地面设备 // info[15] = 0x84;//卫星代号 info[15] = FunComm.myTCP.mark; info[16] = 0x00;//原码或者物理量 info[17] = (byte)((Seconds >> 24) & (0x000000FF)); info[18] = (byte)((Seconds >> 16) & (0x000000FF)); info[19] = (byte)((Seconds >> 8) & (0x000000FF)); info[20] = (byte)(Seconds & 0x000000FF); FunComm.DataSend(info); }
public static void Send_sta(byte [] data, string terminalstr)//发送命令执行状态 { DateTime StartTime = new DateTime(1970, 1, 1, 00, 00, 00); byte[] info = new byte[21]; // info[0] = 0x61;//数据源或属性定义字段 11.....61 info[0] = FunComm.myTCP.equ; info[1] = 0x00; info[2] = 0x55; // info[3] = 0x84;//卫星型号 info[3] = FunComm.myTCP.mark; UInt32 Seconds = (UInt32)(DateTime.Now - StartTime).TotalSeconds; info[4] = (byte)((Seconds >> 24) & (0x000000FF)); info[5] = (byte)((Seconds >> 16) & (0x000000FF)); info[6] = (byte)((Seconds >> 8) & (0x000000FF)); info[7] = (byte)(Seconds & 0x000000FF); string[] bb = new string[10]; bb = terminalstr.Split('.'); info[8] = byte.Parse(bb[0]); info[9] = byte.Parse(bb[1]); info[10] = byte.Parse(bb[2]); info[11] = byte.Parse(bb[3]); info[12] = data[0]; info[13] = data[1]; info[14] = (byte)((serial_num >> 24) & (0x000000FF)); info[15] = (byte)((serial_num >> 16) & (0x000000FF)); info[16] = (byte)((serial_num >> 8) & (0x000000FF)); info[17] = (byte)(serial_num & 0x000000FF); info[18] = 0x01; info[19] = 0x00; info[20] = data[2]; FunComm.DataSend(info); }