Ejemplo n.º 1
0
        //IP 配置帧
        static public byte[] SendJoint_IPConfiguration(Frame_IPConfiguration IPConfiguration)
        {
            try
            {
                List <byte> msgTemp = new List <byte>();
                //头
                msgTemp.Add(0x7A);
                msgTemp.Add(0x7A);
                //协议版本号
                msgTemp.Add(0x01);
                msgTemp.Add(0x00);
                msgTemp.Add(0x02);
                //命令字
                msgTemp.Add(0x05);

                byte ipLength   = (byte)IPConfiguration.IP.Length;
                byte portLength = (byte)IPConfiguration.Port.Length;
                //数据长度
                byte length = (byte)(ipLength + portLength + 2);
                msgTemp.Add(length);
                msgTemp.Add(0x00);
                //ip或域名的长度
                msgTemp.Add(ipLength);
                //ip或域名
                byte[] ip = Encoding.ASCII.GetBytes(IPConfiguration.IP);
                msgTemp.AddRange(ip);
                //端口的长度
                msgTemp.Add(portLength);
                //端口
                byte[] port = Encoding.ASCII.GetBytes(IPConfiguration.Port);
                msgTemp.AddRange(port);
                //校验和
                byte[] byteTemp = new byte[msgTemp.Count];
                msgTemp.CopyTo(byteTemp);
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(byteTemp, 8, byteTemp.Length - 8));
                msgTemp.Add(crc16[0]);
                msgTemp.Add(crc16[1]);
                //结束符
                msgTemp.Add(0x7B);
                msgTemp.Add(0x7B);

                byteTemp = new byte[msgTemp.Count];
                msgTemp.CopyTo(byteTemp);
                return(byteTemp);
            }
            catch (Exception ex)
            {
                ToolAPI.XMLOperation.WriteLogXmlNoTail("GprsResolveDataV100.SendJoint_IPConfiguration:error", ex.Message + "|" + ex.StackTrace.ToString());
                return(null);
            }
        }
Ejemplo n.º 2
0
        //心跳
        static public byte[] SendJoint_Heartbeat()
        {
            try
            {
                List <byte> msgTemp = new List <byte>();
                //头
                msgTemp.Add(0x7A);
                msgTemp.Add(0x7A);
                //协议版本号
                msgTemp.Add(0x01);
                msgTemp.Add(0x00);
                msgTemp.Add(0x02);
                //命令字
                msgTemp.Add(0x00);
                //数据长度
                msgTemp.Add(0x07);
                msgTemp.Add(0x00);
                //需要校验
                msgTemp.Add(0x01);
                //RTC
                DateTime dt = DateTime.Now;
                msgTemp.Add(byte.Parse(dt.Year.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Month.ToString(), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Day.ToString(), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Hour.ToString(), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Minute.ToString(), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Second.ToString(), System.Globalization.NumberStyles.HexNumber));
                //校验和
                byte[] byteTemp = new byte[msgTemp.Count];
                msgTemp.CopyTo(byteTemp);
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(byteTemp, 8, byteTemp.Length - 8));
                msgTemp.Add(crc16[0]);
                msgTemp.Add(crc16[1]);
                //结束符
                msgTemp.Add(0x7B);
                msgTemp.Add(0x7B);

                byteTemp = new byte[msgTemp.Count];
                msgTemp.CopyTo(byteTemp);
                return(byteTemp);
            }
            catch (Exception ex)
            {
                ToolAPI.XMLOperation.WriteLogXmlNoTail("GprsResolveDataV100.SendJoint_Heartbeat:error", ex.Message + "|" + ex.StackTrace.ToString());
                return(null);
            }
        }
Ejemplo n.º 3
0
        //参数配置
        static public byte[] SendJoint_ParameterConfig(Frame_ParameterConfig ParameterConfig)
        {
            try
            {
                List <byte> msgTemp = new List <byte>();
                //头
                msgTemp.Add(0x7A);
                msgTemp.Add(0x7A);
                //协议版本号
                msgTemp.Add(0x01);
                msgTemp.Add(0x00);
                msgTemp.Add(0x02);
                //命令字
                msgTemp.Add(0x04);
                //数据长度
                msgTemp.Add(0x00);
                msgTemp.Add(0x00);
                //校验和
                byte[] byteTemp = new byte[msgTemp.Count];
                msgTemp.CopyTo(byteTemp);
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(byteTemp, 8, byteTemp.Length - 8));
                msgTemp.Add(crc16[0]);
                msgTemp.Add(crc16[1]);
                //结束符
                msgTemp.Add(0x7B);
                msgTemp.Add(0x7B);

                byteTemp = new byte[msgTemp.Count];
                msgTemp.CopyTo(byteTemp);
                return(byteTemp);
            }
            catch (Exception ex)
            {
                ToolAPI.XMLOperation.WriteLogXmlNoTail("GprsResolveDataV100.SendJoint_ParameterConfig:error", ex.Message + "|" + ex.StackTrace.ToString());
                return(null);
            }
        }
Ejemplo n.º 4
0
 public static byte[] OnViolation(byte[] b, int bCount, TcpSocketClient client)
 {
     #region 应答
     List <byte> rb       = new List <byte>();
     byte[]      byteTemp = new byte[6];
     Array.Copy(b, byteTemp, 6);
     rb.AddRange(byteTemp);
     //长度
     rb.Add(1); rb.Add(0);
     rb.Add(1);
     byte[] byteT = new byte[rb.Count];
     rb.CopyTo(byteT);
     byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(byteT, 8, rb.Count - 8));
     rb.Add(crc16[0]);
     rb.Add(crc16[1]);
     //结束符
     rb.Add(0x7B);
     rb.Add(0x7B);
     byteT = new byte[rb.Count];
     rb.CopyTo(byteT);
     client.SendBuffer(byteT);
     #endregion
     return(null);
 }
Ejemplo n.º 5
0
        //时间校准
        static public byte[] SendJoint_TimeCalibration(Frame_TimeCalibration TimeCalibration)
        {
            try
            {
                List <byte> msgTemp = new List <byte>();
                //头
                msgTemp.Add(0x7A);
                msgTemp.Add(0x7A);
                //协议版本号
                msgTemp.Add(0x01);
                msgTemp.Add(0x00);
                msgTemp.Add(0x02);
                //命令字
                msgTemp.Add(0x08);
                //数据长度
                msgTemp.Add(0x07);
                msgTemp.Add(0x00);
                if (TimeCalibration.RTC == null)
                {
                    //时间标识
                    msgTemp.Add(0x01);
                }
                else
                {
                    double compare = Math.Abs((DateTime.Now - (DateTime)TimeCalibration.RTC).TotalMinutes);
                    if (compare > 1)//需要校验
                    {
                        //时间标识
                        msgTemp.Add(0x01);
                    }
                    else//不需要校验
                    {
                        //时间标识
                        msgTemp.Add(0x00);
                    }
                }
                //RTC
                DateTime dt = DateTime.Now;
                msgTemp.Add(byte.Parse(dt.Year.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Month.ToString(), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Day.ToString(), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Hour.ToString(), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Minute.ToString(), System.Globalization.NumberStyles.HexNumber));
                msgTemp.Add(byte.Parse(dt.Second.ToString(), System.Globalization.NumberStyles.HexNumber));
                //校验和
                byte[] byteTemp = new byte[msgTemp.Count];
                msgTemp.CopyTo(byteTemp);
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(byteTemp, 8, byteTemp.Length - 8));
                msgTemp.Add(crc16[0]);
                msgTemp.Add(crc16[1]);
                //结束符
                msgTemp.Add(0x7B);
                msgTemp.Add(0x7B);

                byteTemp = new byte[msgTemp.Count];
                msgTemp.CopyTo(byteTemp);
                return(byteTemp);
            }
            catch (Exception ex)
            {
                ToolAPI.XMLOperation.WriteLogXmlNoTail("GprsResolveDataV100.SendJoint_TimeCalibration:error", ex.Message + "|" + ex.StackTrace.ToString());
                return(null);
            }
        }
Ejemplo n.º 6
0
        //数据接收
        private static byte[] OnResolveTime(byte[] b, int bCount)
        {
            if (bCount != 0x1A)
            {
                return(null);
            }
            if (BitConverter.ToUInt16(b, 22) != ConvertData.CRC16(b, 8, 14))//检验和
            {
                return(null);
            }
            string tStr = ConvertData.ToHexString(b, 0, 2);//获取帧头

            if (tStr != "7A7A")
            {
                return(null);
            }
            tStr = ConvertData.ToHexString(b, 16, 6);//获取时间

            DateTime getdate = new DateTime();

            byte[] bytes = new byte[19];
            try
            {
                getdate = DateTime.ParseExact(tStr, "yyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
            }
            catch (Exception ex)
            {
                bytes[0] = 0x7A;
                bytes[1] = 0x7A;
                //协议版本
                bytes[2] = 0x01;
                bytes[3] = 0x04;
                bytes[4] = 0x00;
                //命令字
                bytes[5] = 0x00;

                //数据长度
                bytes[6] = 0x07;
                bytes[7] = 0x00;
                //////////时间校准标示////
                bytes[8] = 0x01;

                DateTime nowTime = DateTime.Now;
                //时间
                bytes[9]  = byte.Parse(nowTime.Year.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
                bytes[10] = byte.Parse(nowTime.Month.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[11] = byte.Parse(nowTime.Day.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[12] = byte.Parse(nowTime.Hour.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[13] = byte.Parse(nowTime.Minute.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[14] = byte.Parse(nowTime.Second.ToString(), System.Globalization.NumberStyles.HexNumber);
                //校验和
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 7));
                bytes[15] = crc16[0];//0x00;//算校验和
                bytes[16] = crc16[1];
                //结束
                bytes[17] = 0x7B;
                bytes[18] = 0x7B;

                return(bytes);
            }

            DateTime now     = System.DateTime.Now;
            double   compare = (now - getdate).TotalMinutes;

            if (compare > 1 || compare < 0)  //需要
            {
                bytes = new byte[19];
                //数据长度
                bytes[6] = 0x07;
                bytes[7] = 0x00;
                //////////时间校准标示////
                bytes[8] = 0x01;
                //时间
                bytes[9]  = byte.Parse(now.Year.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
                bytes[10] = byte.Parse(now.Month.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[11] = byte.Parse(now.Day.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[12] = byte.Parse(now.Hour.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[13] = byte.Parse(now.Minute.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[14] = byte.Parse(now.Second.ToString(), System.Globalization.NumberStyles.HexNumber);
                //校验和
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 7));
                bytes[15] = crc16[0];//0x00;//算校验和
                bytes[16] = crc16[1];
                //结束
                bytes[17] = 0x7B;
                bytes[18] = 0x7B;
            }
            else   //不需要
            {
                bytes = new byte[13];

                //长度
                bytes[6] = 0x01;
                bytes[7] = 0x00;
                //数据区
                bytes[8] = 0x00;
                //校验和
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 1));
                bytes[9]  = crc16[0];//0x00;//算校验和
                bytes[10] = crc16[1];
                //结束
                bytes[11] = 0x7B;
                bytes[12] = 0x7B;
            }

            bytes[0] = 0x7A;
            bytes[1] = 0x7A;
            //协议版本
            bytes[2] = 0x01;
            bytes[3] = 0x04;
            bytes[4] = 0x00;
            //命令字
            bytes[5] = 0x08;
            return(bytes);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 身份验证
        /// </summary>
        /// <param name="b"></param>
        /// <param name="c"></param>
        /// <param name="client"></param>
        private static void AuthenticationDispose(byte[] b, int c, TcpSocketClient client)
        {
            List <byte> rb = new List <byte>();

            try
            {
                switch (b[17])
                {
                case 1:
                    byte[] byteTemp = new byte[26];
                    Array.Copy(b, byteTemp, 26);
                    rb.AddRange(byteTemp);
                    rb.Add(1);
                    //长度
                    rb[6] = 19; rb[7] = 0;
                    break;

                case 2:
                    byte[] byteTemp2 = new byte[20];
                    Array.Copy(b, byteTemp2, 20);
                    rb.AddRange(byteTemp2);
                    rb.Add(1);
                    //长度
                    rb[6] = 13; rb[7] = 0;
                    break;

                case 6:    //ZT 20170322
                    byte[] byteTemp6 = new byte[18];
                    Array.Copy(b, byteTemp6, 18);
                    rb.AddRange(byteTemp6);
                    //长度
                    rb[6] = 10; rb[7] = 0;
                    break;

                default: break;
                }
                byte[] byteT = new byte[rb.Count];
                rb.CopyTo(byteT);
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(byteT, 8, rb.Count - 8));
                rb.Add(crc16[0]);
                rb.Add(crc16[1]);
                //结束符
                rb.Add(0x7B);
                rb.Add(0x7B);
                byteT = new byte[rb.Count];
                rb.CopyTo(byteT);
                client.SendBuffer(byteT);

                if (b[17] == 2)
                {
                    rb.Clear();
                    byte[] byteTemp2 = new byte[18];
                    Array.Copy(b, byteTemp2, 18);
                    rb.AddRange(byteTemp2);
                    rb.Add(1);  //验证结果
                    //子命令字
                    rb[17] = 3; //验证结果下发
                    //长度
                    rb[6] = 81; rb[7] = 0;


                    byte[] sn = new byte[8];   //司机卡号
                    for (int l = 20, j = 0; l < 28; l++, j++)
                    {
                        sn[j] = b[l];
                    }
                    //工号
                    rb.AddRange(sn);
                    //卡号
                    rb.AddRange(sn);

                    for (int i = 0; i < 54; i++)
                    {
                        rb.Add(0xff);
                    }

                    byteT = new byte[rb.Count];
                    rb.CopyTo(byteT);
                    crc16 = BitConverter.GetBytes(ConvertData.CRC16(byteT, 8, rb.Count - 8));
                    rb.Add(crc16[0]);
                    rb.Add(crc16[1]);
                    //结束符
                    rb.Add(0x7B);
                    rb.Add(0x7B);
                    byteT = new byte[rb.Count];
                    rb.CopyTo(byteT);
                    client.SendBuffer(byteT);
                }
            }
            catch (Exception) { }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 心跳接收数据
        /// </summary>
        /// <param name="b"></param>
        public static byte[] OnResolveHeabert(byte[] b, int bCount, TcpSocketClient client)//1.2.1
        {
            if (bCount != 0x1A)
            {
                return(null);
            }
            if (BitConverter.ToUInt16(b, 22) != ConvertData.CRC16(b, 8, 14))//检验和
            {
                return(null);
            }
            string tStr = ConvertData.ToHexString(b, 0, 2);//获取帧头

            if (tStr != "7A7A")
            {
                return(null);
            }
            byte[] t = new byte[8];
            for (int i = 8, j = 0; i < 16; i++, j++)
            {
                t[j] = b[i];
            }
            string SN = Encoding.ASCII.GetString(t);

            tStr = ConvertData.ToHexString(b, 16, 6);//获取时间
            DateTime getdate = new DateTime();

            byte[] bytes = new byte[19];
            try
            {
                getdate = DateTime.ParseExact(tStr, "yyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
            }
            catch (Exception ex)
            {
                bytes[0] = 0x7A;
                bytes[1] = 0x7A;
                //协议版本
                bytes[2] = 0x01;
                bytes[3] = 0x04;
                bytes[4] = 0x00;
                //命令字
                bytes[5] = 0x00;

                //数据长度
                bytes[6] = 0x07;
                bytes[7] = 0x00;
                //////////时间校准标示////
                bytes[8] = 0x01;

                DateTime nowTime = DateTime.Now;
                //时间
                bytes[9]  = byte.Parse(nowTime.Year.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
                bytes[10] = byte.Parse(nowTime.Month.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[11] = byte.Parse(nowTime.Day.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[12] = byte.Parse(nowTime.Hour.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[13] = byte.Parse(nowTime.Minute.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[14] = byte.Parse(nowTime.Second.ToString(), System.Globalization.NumberStyles.HexNumber);
                //校验和
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 7));
                bytes[15] = crc16[0];//0x00;//算校验和
                bytes[16] = crc16[1];
                //结束
                bytes[17] = 0x7B;
                bytes[18] = 0x7B;

                //更新redis
                DPC.Lift_operation.Update_equminet_last_online_time(SN, DPC_Tool.GetTimeStamp(nowTime));
                return(bytes);
            }

            DateTime now     = System.DateTime.Now;
            double   compare = (now - getdate).TotalMinutes;

            if (compare > 1 || compare < 0)  //需要
            {
                bytes = new byte[19];
                //数据长度
                bytes[6] = 0x07;
                bytes[7] = 0x00;
                //////////时间校准标示////
                bytes[8] = 0x01;
                //时间
                bytes[9]  = byte.Parse(now.Year.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
                bytes[10] = byte.Parse(now.Month.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[11] = byte.Parse(now.Day.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[12] = byte.Parse(now.Hour.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[13] = byte.Parse(now.Minute.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[14] = byte.Parse(now.Second.ToString(), System.Globalization.NumberStyles.HexNumber);
                //校验和
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 7));
                bytes[15] = crc16[0];//0x00;//算校验和
                bytes[16] = crc16[1];
                //结束
                bytes[17] = 0x7B;
                bytes[18] = 0x7B;
                getdate   = DateTime.Now;
                ToolAPI.XMLOperation.WriteLogXmlNoTail("时间校验V1.4.0", "包内解析时间:" + getdate + "当前时间:" + now);
            }
            else   //不需要
            {
                bytes = new byte[13];

                //长度
                bytes[6] = 0x01;
                bytes[7] = 0x00;
                //数据区
                bytes[8] = 0x00;
                //校验和
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 1));
                bytes[9]  = crc16[0];//0x00;//算校验和
                bytes[10] = crc16[1];
                //结束
                bytes[11] = 0x7B;
                bytes[12] = 0x7B;
            }

            bytes[0] = 0x7A;
            bytes[1] = 0x7A;
            //协议版本
            bytes[2] = 0x01;
            bytes[3] = 0x04;
            bytes[4] = 0x00;
            //命令字
            bytes[5] = 0x00;


            //更新redis
            DPC.Lift_operation.Update_equminet_last_online_time(SN, DPC_Tool.GetTimeStamp(getdate));
            return(bytes);
        }
        /// <summary>
        /// 心跳
        /// </summary>
        /// <param name="b"></param>
        /// <param name="bCount"></param>
        /// <param name="client"></param>
        /// <param name="df"></param>
        /// <returns></returns>
        public static byte[] OnResolveHeabert(byte[] b, int bCount, TcpSocketClient client)
        {
            if (bCount != 0x1A)
            {
                return(null);
            }
            gdust_Heartbeat data = new gdust_Heartbeat();
            string          tStr = ConvertData.ToHexString(b, 0, 2);//获取帧头

            if (tStr != "7A7A")
            {
                return(null);
            }
            byte[] t = new byte[8];
            for (int i = 8, j = 0; i < 16; i++, j++)
            {
                t[j] = b[i];
            }
            data.sn = Encoding.ASCII.GetString(t);
            tStr    = ConvertData.ToHexString(b, 16, 6);//获取时间
            DateTime getdate = DateTime.ParseExact(tStr, "yyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
            DateTime now     = System.DateTime.Now;
            double   compare = (now - getdate).TotalMinutes;

            byte[] bytes = new byte[19];
            if (compare > 1 || compare < 0)  //需要
            {
                bytes = new byte[19];
                //数据长度
                bytes[6] = 0x07;
                bytes[7] = 0x00;
                //////////时间校准标示////
                bytes[8] = 0x01;
                //时间
                bytes[9]  = byte.Parse(now.Year.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
                bytes[10] = byte.Parse(now.Month.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[11] = byte.Parse(now.Day.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[12] = byte.Parse(now.Hour.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[13] = byte.Parse(now.Minute.ToString(), System.Globalization.NumberStyles.HexNumber);
                bytes[14] = byte.Parse(now.Second.ToString(), System.Globalization.NumberStyles.HexNumber);
                //校验和
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 7));
                bytes[15] = crc16[0];//0x00;//算校验和
                bytes[16] = crc16[1];
                //结束
                bytes[17] = 0x7B;
                bytes[18] = 0x7B;
                data.Rtc  = now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else   //不需要
            {
                bytes = new byte[13];

                //长度 //7A7A0100000001000000007B7B
                bytes[6] = 0x01;
                bytes[7] = 0x00;
                //数据区
                bytes[8] = 0x00;
                //校验和
                byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 1));
                bytes[9]  = crc16[0];//0x00;//算校验和
                bytes[10] = crc16[1];
                //结束
                bytes[11] = 0x7B;
                bytes[12] = 0x7B;
                data.Rtc  = DateTime.ParseExact(tStr, "yyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm:ss");
            }

            bytes[0] = 0x7A;
            bytes[1] = 0x7A;
            //协议版本
            bytes[2] = 0x01;
            bytes[3] = 0x00;
            bytes[4] = 0x04;
            //命令字
            bytes[5] = 0x00;
            //包装

            //更新在线时间
            Dust_noise_operation.Update_equminet_last_online_time(data.sn, DPC.DPC_Tool.GetTimeStamp(DateTime.Now));
            return(bytes);
        }