コード例 #1
0
ファイル: JT809_0x9400_0x9402.cs プロジェクト: yezy-h/JT809
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9400_0x9402 value, IJT809Config config)
 {
     if (config.Version == JT809Version.JTT2011)
     {
         writer.WriteByte((byte)value.WarnSrc);
     }
     else
     {
         writer.WriteBigNumber(value.SourcePlatformId, 11);
     }
     writer.WriteUInt16((ushort)value.WarnType);
     writer.WriteUTCDateTime(value.WarnTime);
     if (config.Version == JT809Version.JTT2019)
     {
         writer.WriteUTCDateTime(value.StartTime);
         writer.WriteUTCDateTime(value.EndTime);
         writer.WriteStringPadRight(value.VehicleNo, 21);
         writer.WriteByte((byte)value.VehicleColor);
         writer.WriteBigNumber(value.DestinationPlatformId, 11);
         writer.WriteUInt32(value.DRVLineId);
     }
     // 先计算内容长度(汉字为两个字节)
     writer.Skip(4, out int lengthPosition);
     writer.WriteString(value.WarnContent);
     writer.WriteInt32Return(writer.GetCurrentPosition() - lengthPosition - 4, lengthPosition);
 }
コード例 #2
0
ファイル: JT809_0x9200_0x9202.cs プロジェクト: yezy-h/JT809
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9200_0x9202 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.WriteBigNumber(value.GNSSData.PlatformId1, 11);
         writer.WriteUInt32(value.GNSSData.Alarm1);
         writer.WriteBigNumber(value.GNSSData.PlatformId2, 11);
         writer.WriteUInt32(value.GNSSData.Alarm2);
         writer.WriteBigNumber(value.GNSSData.PlatformId3, 11);
         writer.WriteUInt32(value.GNSSData.Alarm3);
         writer.WriteUInt32Return((uint)(writer.GetCurrentPosition() - position - 4), position);
     }
 }
コード例 #3
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);
 }
コード例 #4
0
ファイル: JT809_0x1102.cs プロジェクト: yezy-h/JT809
 public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1102 value, IJT809Config config)
 {
     writer.WriteBigNumber(value.PlateformId, 11);
     writer.WriteUTCDateTime(value.StartTime);
     writer.WriteUTCDateTime(value.EndTime);
     writer.WriteUInt32(value.LoseDymamicSum);
     writer.WriteByte(value.DisconnectNum);
     writer.WriteUInt32(value.DisconnectTime);
 }
コード例 #5
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);
 }