Ejemplo n.º 1
0
        public void ReadUInt64Test()
        {
            byte[] bytes = "00 00 00 00 00 0F 63 E3".ToHexBytes();
            JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes);

            Assert.Equal((ulong)1008611, jT808MessagePackReader.ReadUInt64());
        }
Ejemplo n.º 2
0
        public JT808_0x9205 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x9205 jT808_0x9205 = new JT808_0x9205();

            jT808_0x9205.LogicChannelNo = reader.ReadByte();
            jT808_0x9205.BeginTime      = reader.ReadDateTime6();
            jT808_0x9205.EndTime        = reader.ReadDateTime6();
            jT808_0x9205.AlarmFlag      = reader.ReadUInt64();
            jT808_0x9205.AVResourceType = reader.ReadByte();
            jT808_0x9205.StreamType     = reader.ReadByte();
            jT808_0x9205.MemoryType     = reader.ReadByte();
            return(jT808_0x9205);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public JT808_0x1205_AVResouce Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x1205_AVResouce jT808_0x1205_AVResouce = new JT808_0x1205_AVResouce();

            jT808_0x1205_AVResouce.LogicChannelNo = reader.ReadByte();
            jT808_0x1205_AVResouce.BeginTime      = reader.ReadDateTime_yyMMddHHmmss();
            jT808_0x1205_AVResouce.EndTime        = reader.ReadDateTime_yyMMddHHmmss();
            jT808_0x1205_AVResouce.AlarmFlag      = reader.ReadUInt64();
            jT808_0x1205_AVResouce.AVResourceType = reader.ReadByte();
            jT808_0x1205_AVResouce.StreamType     = reader.ReadByte();
            jT808_0x1205_AVResouce.MemoryType     = reader.ReadByte();
            jT808_0x1205_AVResouce.FileSize       = reader.ReadUInt32();
            return(jT808_0x1205_AVResouce);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x9206 value = new JT808_0x9206();

            value.ServerIpLength = reader.ReadByte();
            writer.WriteNumber($"[{value.ServerIpLength.ReadNumber()}]服务器IP地址长度", value.ServerIpLength);
            string ipHex = reader.ReadVirtualArray(value.ServerIpLength).ToArray().ToHexString();

            value.ServerIp = reader.ReadString(value.ServerIpLength);
            writer.WriteString($"[{ipHex}]服务器IP地址", value.ServerIp);
            value.Port = reader.ReadUInt16();
            writer.WriteNumber($"[{value.Port.ReadNumber()}]服务器端口", value.Port);
            value.UserNameLength = reader.ReadByte();
            writer.WriteNumber($"[{value.UserNameLength.ReadNumber()}]用户名长度", value.UserNameLength);
            string userNameHex = reader.ReadVirtualArray(value.UserNameLength).ToArray().ToHexString();

            value.UserName = reader.ReadString(value.UserNameLength);
            writer.WriteString($"[{userNameHex}]用户名", value.UserName);
            value.PasswordLength = reader.ReadByte();
            writer.WriteNumber($"[{value.PasswordLength.ReadNumber()}]密码长度", value.PasswordLength);
            string passwordHex = reader.ReadVirtualArray(value.PasswordLength).ToArray().ToHexString();

            value.Password = reader.ReadString(value.PasswordLength);
            writer.WriteString($"[{passwordHex}]密码", value.Password);
            value.FileUploadPathLength = reader.ReadByte();
            writer.WriteNumber($"[{value.FileUploadPathLength.ReadNumber()}]文件上传路径长度", value.FileUploadPathLength);
            string fileUploadPathHex = reader.ReadVirtualArray(value.FileUploadPathLength).ToArray().ToHexString();

            value.FileUploadPath = reader.ReadString(value.FileUploadPathLength);
            writer.WriteString($"[{fileUploadPathHex}]文件上传路径", value.FileUploadPath);

            value.ChannelNo = reader.ReadByte();
            writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo));
            value.BeginTime = reader.ReadDateTime_yyMMddHHmmss();
            writer.WriteString($"[{value.BeginTime.ToString("yyMMddHHmmss")}]起始时间", value.BeginTime.ToString("yyyy-MM-dd HH:mm:ss"));
            value.EndTime = reader.ReadDateTime_yyMMddHHmmss();
            writer.WriteString($"[{value.EndTime.ToString("yyMMddHHmmss")}]起始时间", value.EndTime.ToString("yyyy-MM-dd HH:mm:ss"));
            value.AlarmFlag = reader.ReadUInt64();
            writer.WriteNumber($"[{value.AlarmFlag.ReadNumber()}]报警标志", value.AlarmFlag);
            value.MediaType = reader.ReadByte();
            writer.WriteString($"[{value.MediaType.ReadNumber()}]音视频类型", AVResourceTypeDisplay(value.MediaType));
            value.StreamType = reader.ReadByte();
            writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType));
            value.MemoryPositon = reader.ReadByte();
            writer.WriteString($"[{value.MemoryPositon.ReadNumber()}]存储器类型", MemoryPositonDisplay(value.MemoryPositon));
            value.TaskExcuteCondition = reader.ReadByte();
            writer.WriteString($"[{value.TaskExcuteCondition.ReadNumber()}]任务执行条件", TaskExcuteConditionDisplay(value.TaskExcuteCondition));
Ejemplo n.º 5
0
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x9205 value = new JT808_0x9205();

            value.ChannelNo = reader.ReadByte();
            writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo));
            value.BeginTime = reader.ReadDateTime_yyMMddHHmmss();
            writer.WriteString($"[{value.BeginTime.ToString("yyMMddHHmmss")}]起始时间", value.BeginTime.ToString("yyyy-MM-dd HH:mm:ss"));
            value.EndTime = reader.ReadDateTime_yyMMddHHmmss();
            writer.WriteString($"[{value.EndTime.ToString("yyMMddHHmmss")}]起始时间", value.EndTime.ToString("yyyy-MM-dd HH:mm:ss"));
            value.AlarmFlag = reader.ReadUInt64();
            writer.WriteNumber($"[{value.AlarmFlag.ReadNumber()}]报警标志", value.AlarmFlag);
            value.MediaType = reader.ReadByte();
            writer.WriteString($"[{value.MediaType.ReadNumber()}]音视频类型", AVResourceTypeDisplay(value.MediaType));
            value.StreamType = reader.ReadByte();
            writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType));
            value.MemoryType = reader.ReadByte();
            writer.WriteString($"[{value.MemoryType.ReadNumber()}]存储器类型", MemoryTypeDisplay(value.MemoryType));
Ejemplo n.º 6
0
        public JT808_0x9206 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x9206 jT808_0x9206 = new JT808_0x9206();

            jT808_0x9206.ServerIpLength       = reader.ReadByte();
            jT808_0x9206.ServerIp             = reader.ReadString(jT808_0x9206.ServerIpLength);
            jT808_0x9206.Port                 = reader.ReadUInt16();
            jT808_0x9206.UserNameLength       = reader.ReadByte();
            jT808_0x9206.UserName             = reader.ReadString(jT808_0x9206.UserNameLength);
            jT808_0x9206.PasswordLength       = reader.ReadByte();
            jT808_0x9206.Password             = reader.ReadString(jT808_0x9206.PasswordLength);
            jT808_0x9206.FileUploadPathLength = reader.ReadByte();
            jT808_0x9206.FileUploadPath       = reader.ReadString(jT808_0x9206.FileUploadPathLength);
            jT808_0x9206.LogicChannelNo       = reader.ReadByte();
            jT808_0x9206.BeginTime            = reader.ReadDateTime6();
            jT808_0x9206.EndTime              = reader.ReadDateTime6();
            jT808_0x9206.AlarmFlag            = reader.ReadUInt64();
            jT808_0x9206.AVResourceType       = reader.ReadByte();
            jT808_0x9206.StreamType           = reader.ReadByte();
            jT808_0x9206.MemoryPositon        = reader.ReadByte();
            jT808_0x9206.TaskExcuteCondition  = reader.ReadByte();
            return(jT808_0x9206);
        }
Ejemplo n.º 7
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x9205 value = new JT808_0x9205();

            value.LogicChannelNo = reader.ReadByte();
            writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo));
            value.BeginTime = reader.ReadDateTime6();
            writer.WriteString($"[{value.BeginTime.ToString("yyMMddHHmmss")}]起始时间", value.BeginTime.ToString("yyyy-MM-dd HH:mm:ss"));
            value.EndTime = reader.ReadDateTime6();
            writer.WriteString($"[{value.EndTime.ToString("yyMMddHHmmss")}]起始时间", value.EndTime.ToString("yyyy-MM-dd HH:mm:ss"));
            value.AlarmFlag = reader.ReadUInt64();
            writer.WriteNumber($"[{value.AlarmFlag.ReadNumber()}]报警标志", value.AlarmFlag);
            value.AVResourceType = reader.ReadByte();
            writer.WriteString($"[{value.AVResourceType.ReadNumber()}]音视频类型", AVResourceTypeDisplay(value.AVResourceType));
            value.StreamType = reader.ReadByte();
            writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType));
            value.MemoryType = reader.ReadByte();
            writer.WriteString($"[{value.MemoryType.ReadNumber()}]存储器类型", MemoryTypeDisplay(value.MemoryType));

            string AVResourceTypeDisplay(byte AVResourceType)
            {
                switch (AVResourceType)
                {
                case 0:
                    return("音视频");

                case 1:
                    return("音频");

                case 2:
                    return("视频");

                case 3:
                    return("音频或视频");

                default:
                    return("未知");
                }
            }

            string StreamTypeDisplay(byte StreamType)
            {
                switch (StreamType)
                {
                case 0:
                    return("所有码流");

                case 1:
                    return("主码流");

                case 2:
                    return("子码流");

                default:
                    return("未知");
                }
            }

            string MemoryTypeDisplay(byte MemType)
            {
                switch (MemType)
                {
                case 0:
                    return("所有存储器");

                case 1:
                    return("主存储器");

                case 2:
                    return("灾备服务器");

                default:
                    return("未知");
                }
            }

            string LogicalChannelNoDisplay(byte LogicalChannelNo)
            {
                switch (LogicalChannelNo)
                {
                case 1:
                    return("驾驶员");

                case 2:
                    return("车辆正前方");

                case 3:
                    return("车前门");

                case 4:
                    return("车厢前部");

                case 5:
                    return("车厢后部");

                case 7:
                    return("行李舱");

                case 8:
                    return("车辆左侧");

                case 9:
                    return("车辆右侧");

                case 10:
                    return("车辆正后方");

                case 11:
                    return("车厢中部");

                case 12:
                    return("车中门");

                case 13:
                    return("驾驶席车门");

                case 33:
                    return("驾驶员");

                case 36:
                    return("车厢前部");

                case 37:
                    return("车厢后部");

                default:
                    return("预留");
                }
            }
        }