Exemplo n.º 1
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);
     }
 }
Exemplo n.º 2
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);
 }