예제 #1
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x120C value, IJT809Config config)
 {
     writer.WriteStringPadRight(value.DriverName, 16);
     writer.WriteStringPadRight(value.DriverID, 20);
     writer.WriteStringPadRight(value.Licence, 40);
     writer.WriteStringPadRight(value.OrgName, 200);
 }
예제 #2
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1001 value, IJT809Config config)
 {
     writer.WriteUInt32(value.UserId);
     writer.WriteStringPadRight(value.Password, 8);
     writer.WriteStringPadRight(value.DownLinkIP, 32);
     writer.WriteUInt16(value.DownLinkPort);
 }
예제 #3
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x1202 value, IJT809Config config)
 {
     if (config.Version == JT809Version.JTT2011)
     {
         writer.WriteByte((byte)value.VehiclePosition.Encrypt);
         writer.WriteByte(value.VehiclePosition.Day);
         writer.WriteByte(value.VehiclePosition.Month);
         writer.WriteUInt16(value.VehiclePosition.Year);
         writer.WriteByte(value.VehiclePosition.Hour);
         writer.WriteByte(value.VehiclePosition.Minute);
         writer.WriteByte(value.VehiclePosition.Second);
         writer.WriteUInt32(value.VehiclePosition.Lon);
         writer.WriteUInt32(value.VehiclePosition.Lat);
         writer.WriteUInt16(value.VehiclePosition.Vec1);
         writer.WriteUInt16(value.VehiclePosition.Vec2);
         writer.WriteUInt32(value.VehiclePosition.Vec3);
         writer.WriteUInt16(value.VehiclePosition.Direction);
         writer.WriteUInt16(value.VehiclePosition.Altitude);
         writer.WriteUInt32(value.VehiclePosition.State);
         writer.WriteUInt32(value.VehiclePosition.Alarm);
     }
     else
     {
         writer.WriteByte((byte)value.GNSSData.Encrypt);
         writer.Skip(4, out int position);
         writer.WriteArray(value.GNSSData.GnssData);
         writer.WriteUInt32Return((uint)(writer.GetCurrentPosition() - position - 4), position);
         writer.WriteStringPadRight(value.GNSSData.PlatformId1, 11);
         writer.WriteUInt32(value.GNSSData.Alarm1);
         writer.WriteStringPadRight(value.GNSSData.PlatformId2, 11);
         writer.WriteUInt32(value.GNSSData.Alarm2);
         writer.WriteStringPadRight(value.GNSSData.PlatformId3, 11);
         writer.WriteUInt32(value.GNSSData.Alarm3);
     }
 }
예제 #4
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400_0x1402 value, IJT809Config config)
 {
     if (config.Version == JT809Version.JTT2011)
     {
         writer.WriteByte((byte)value.WarnSrc);
     }
     else
     {
         writer.WriteStringPadRight(value.SourcePlatformId, 11);
     }
     writer.WriteUInt16((ushort)value.WarnType);
     writer.WriteUTCDateTime(value.WarnTime);
     if (config.Version == JT809Version.JTT2011)
     {
         writer.WriteUInt32(value.InfoID);
     }
     else
     {
         writer.WriteUTCDateTime(value.StartTime);
         writer.WriteUTCDateTime(value.EndTime);
         writer.WriteStringPadRight(value.VehicleNo, 21);
         writer.WriteByte((byte)value.VehicleColor);
         writer.WriteStringPadRight(value.DestinationPlatformId, 11);
         writer.WriteUInt32(value.DRVLineId);
     }
     // 先计算内容长度(汉字为两个字节)
     writer.Skip(4, out int lengthPosition);
     writer.WriteString(value.InfoContent);
     writer.WriteInt32Return(writer.GetCurrentPosition() - lengthPosition - 4, lengthPosition);
 }
예제 #5
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x1201 value, IJT809Config config)
 {
     writer.WriteBigNumber(value.PlateformId, 11);
     writer.WriteBigNumber(value.ProducerId, 11);
     writer.WriteStringPadRight(value.TerminalModelType, 20);
     writer.WriteStringPadRight(value.TerminalId.ToUpper(), 7);
     writer.WriteStringPadRight(value.TerminalSimCode, 12);
 }
예제 #6
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9500_0x9505 value, IJT809Config config)
 {
     writer.WriteBCD(value.AuthenticationCode, 20);
     writer.WriteStringPadRight(value.AccessPointName, 20);
     writer.WriteStringPadRight(value.UserName, 49);
     writer.WriteStringPadRight(value.Password, 22);
     writer.WriteStringPadRight(value.ServerIP, 32);
     writer.WriteUInt16(value.TcpPort);
     writer.WriteUInt16(value.UdpPort);
     writer.WriteUTCDateTime(value.EndTime);
 }
예제 #7
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x120C value, IJT809Config config)
 {
     writer.WriteStringPadRight(value.DriverName, 16);
     writer.WriteStringPadRight(value.DriverID, 20);
     writer.WriteStringPadRight(value.Licence, 40);
     writer.WriteStringPadRight(value.OrgName, 200);
     if (config.Version == JT809Version.JTT2019)
     {
         writer.WriteUTCDateTime(value.ValidDate);
     }
 }
예제 #8
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1001 value, IJT809Config config)
 {
     writer.WriteUInt32(value.UserId);
     writer.WriteStringPadRight(value.Password, 8);
     if (config.Version == JT809Version.JTT2019)
     {
         writer.WriteUInt32(value.MsgGNSSCENTERID);
     }
     writer.WriteStringPadRight(value.DownLinkIP, 32);
     writer.WriteUInt16(value.DownLinkPort);
 }
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9400_0x9401 value, IJT809Config config)
 {
     writer.WriteByte((byte)value.WarnSrc);
     writer.WriteUInt16((ushort)value.WarnType);
     writer.WriteUTCDateTime(value.WarnTime);
     writer.WriteHex(value.SupervisionID, 4);
     writer.WriteUTCDateTime(value.SupervisionEndTime);
     writer.WriteByte(value.SupervisionLevel);
     writer.WriteStringPadRight(value.Supervisor, 16);
     writer.WriteStringPadRight(value.SupervisorTel, 20);
     writer.WriteStringPadRight(value.SupervisorEmail, 32);
 }
예제 #10
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400_0x1413 value, IJT809Config config)
 {
     writer.WriteBigNumber(value.SourcePlatformId, 11);
     writer.WriteUTCDateTime(value.WarnTime);
     writer.WriteUInt16(value.SourceDataType);
     writer.WriteUInt32(value.SourceMsgSn);
     writer.WriteUTCDateTime(value.SupervisionEndTime);
     writer.WriteByte((byte)value.SupervisionLevel);
     writer.WriteStringPadRight(value.Supervisor, 16);
     writer.WriteStringPadRight(value.SupervisorTel, 20);
     writer.WriteStringPadRight(value.SupervisorEmail, 32);
 }
예제 #11
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809VehiclePositionProperties_2019 value, IJT809Config config)
 {
     writer.WriteByte((byte)value.Encrypt);
     writer.Skip(4, out int position);
     writer.WriteArray(value.GnssData);
     writer.WriteUInt32Return((uint)(writer.GetCurrentPosition() - position - 4), position);
     writer.WriteStringPadRight(value.PlatformId1, 11);
     writer.WriteUInt32(value.Alarm1);
     writer.WriteStringPadRight(value.PlatformId2, 11);
     writer.WriteUInt32(value.Alarm2);
     writer.WriteStringPadRight(value.PlatformId3, 11);
     writer.WriteUInt32(value.Alarm3);
 }
예제 #12
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9800_0x9801 value, IJT809Config config)
 {
     writer.WriteByte(value.ChannelId);
     writer.WriteByte(value.AVitemType);
     writer.WriteStringPadRight(value.AuthorizeCode, 64);
     writer.WriteArray(value.GnssData);
 }
예제 #13
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9600 value, IJT809Config config)
 {
     writer.WriteStringPadRight(value.VehicleNo, 21);
     writer.WriteByte((byte)value.VehicleColor);
     writer.WriteUInt16(value.SubBusinessType);
     try
     {
         // 先写入内容,然后在根据内容反写内容长度
         writer.Skip(4, out int subContentLengthPosition);
         if (value.SubBodies != null)
         {
             if (!value.SubBodies.SkipSerialization)
             {
                 JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize(
                     value.SubBodies,
                     ref writer, value.SubBodies,
                     config);
             }
         }
         writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition);
     }
     catch
     {
         throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}");
     }
 }
예제 #14
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9102 value, IJT809Config config)
 {
     writer.WriteUInt16(value.SubBusinessType);
     writer.Skip(4, out int subContentLengthPosition);
     writer.WriteStringPadRight(value.PlateformId, 11);
     writer.WriteUTCDateTime(value.StartTime);
     writer.WriteUTCDateTime(value.EndTime);
     writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition);
 }
예제 #15
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1300_0x1301 value, IJT809Config config)
 {
     writer.WriteByte((byte)value.ObjectType);
     writer.WriteStringPadRight(value.ObjectID, 12);
     writer.WriteUInt32(value.InfoID);
     // 先计算内容长度(汉字为两个字节)
     writer.Skip(4, out int lengthPosition);
     writer.WriteString(value.InfoContent);
     writer.WriteInt32Return(writer.GetCurrentPosition() - lengthPosition - 4, lengthPosition);
 }
예제 #16
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9A00_0x9A01 value, IJT809Config config)
 {
     writer.WriteByte(value.ChannelId);
     writer.WriteByte(value.AVItemType);
     writer.WriteByte(value.StreamType);
     writer.WriteByte(value.MemType);
     writer.WriteUTCDateTime(value.PlayBackStartTime);
     writer.WriteUTCDateTime(value.PlayBackEndTime);
     writer.WriteStringPadRight(value.AuthorizeCode, 64);
     writer.WriteArray(value.GnssData);
 }
예제 #17
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x1201 value, IJT809Config config)
 {
     if (config.Version == JT809Version.JTT2011)
     {
         writer.WriteStringPadRight(value.PlateformId, 11);
         writer.WriteStringPadRight(value.ProducerId, 11);
         writer.WriteStringPadRight(value.TerminalModelType, 20);
         writer.WriteStringPadRight(value.TerminalId.ToUpper(), 7);
         writer.WriteStringPadLeft(value.TerminalSimCode, 12);
     }
     else
     {
         writer.WriteStringPadRight(value.PlateformId, 11);
         writer.WriteStringPadRight(value.ProducerId, 11);
         writer.WriteStringPadRight(value.TerminalModelType, 30);
         writer.WriteStringPadRight(value.IMIEId, 15);
         writer.WriteStringPadRight(value.TerminalId.ToUpper(), 30);
         writer.WriteStringPadRight(value.TerminalSimCode, 13);
     }
 }
예제 #18
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1102 value, IJT809Config config)
 {
     writer.WriteUInt16(value.SubBusinessType);
     writer.WriteUInt32(value.DataLength);
     writer.WriteStringPadRight(value.PlateformId, 11);
     writer.WriteUTCDateTime(value.StartTime);
     writer.WriteUTCDateTime(value.EndTime);
     writer.WriteUInt32(value.LoseDymamicSum);
     writer.WriteByte(value.DisconnectNum);
     writer.WriteUInt32(value.DisconnectTime);
 }
예제 #19
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1300_0x1301 value, IJT809Config config)
 {
     writer.WriteByte((byte)value.ObjectType);
     if (config.Version == JT809Version.JTT2011)
     {
         writer.WriteStringPadRight(value.ObjectID, 12);
         writer.WriteUInt32(value.InfoID);
     }
     else
     {
         writer.WriteStringPadRight(value.Responder, 16);
         writer.WriteStringPadRight(value.ResponderTel, 20);
         writer.WriteStringPadRight(value.ObjectID, 20);
         writer.WriteUInt16(value.SourceDataType);
         writer.WriteUInt32(value.SourceMsgSn);
     }
     // 先计算内容长度(汉字为两个字节)
     writer.Skip(4, out int lengthPosition);
     writer.WriteString(value.InfoContent);
     writer.WriteInt32Return(writer.GetCurrentPosition() - lengthPosition - 4, lengthPosition);
 }
예제 #20
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9200 value, IJT809Config config)
 {
     //1078qq群808432702:大兄弟提供的
     //由于车辆注册信息应答消息0x9201子业务不存在车牌号和颜色需要跳过
     if (config.Version == JT809Version.JTT2019)
     {
         if (value.SubBusinessType != JT809SubBusinessType.车辆注册信息应答消息.ToUInt16Value())
         {
             writer.WriteStringPadRight(value.VehicleNo, 21);
             writer.WriteByte((byte)value.VehicleColor);
         }
     }
     else
     {
         writer.WriteStringPadRight(value.VehicleNo, 21);
         writer.WriteByte((byte)value.VehicleColor);
     }
     writer.WriteUInt16(value.SubBusinessType);
     try
     {
         // 先写入内容,然后在根据内容反写内容长度
         writer.Skip(4, out int subContentLengthPosition);
         if (value.SubBodies != null)
         {
             if (!value.SubBodies.SkipSerialization)
             {
                 JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize(
                     value.SubBodies,
                     ref writer, value.SubBodies,
                     config);
             }
         }
         writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition);
     }
     catch
     {
         throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}");
     }
 }
예제 #21
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9102 value, IJT809Config config)
 {
     writer.WriteStringPadRight(value.PlateformId, 11);
     writer.WriteUTCDateTime(value.StartTime);
     writer.WriteUTCDateTime(value.EndTime);
 }
예제 #22
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1700_0x1701 value, IJT809Config config)
 {
     writer.WriteStringPadRight(value.PlateFormId, 11);
     writer.WriteStringPadRight(value.AuthorizeCode1, 64);
     writer.WriteStringPadRight(value.AuthorizeCode2, 64);
 }
예제 #23
0
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9500_0x9501 value, IJT809Config config)
 {
     writer.WriteStringPadRight(value.MonitorTel, 20);
 }