浏览代码

Merge pull request #25 from joaomfariamartins/feature/cmd_8900_0900

Write PassthroughData directly instead of using JT808_0x8900/0900_BodyBase implementation
tags/v2.4.5
SmallChi(Koike) 3 年前
committed by GitHub
父节点
当前提交
a4ac6b99c9
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 2 个文件被更改,包括 20 次插入3 次删除
  1. +10
    -2
      src/JT808.Protocol/MessageBody/JT808_0x0900.cs
  2. +10
    -1
      src/JT808.Protocol/MessageBody/JT808_0x8900.cs

+ 10
- 2
src/JT808.Protocol/MessageBody/JT808_0x0900.cs 查看文件

@@ -93,8 +93,16 @@ namespace JT808.Protocol.MessageBody
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0900 value, IJT808Config config) public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0900 value, IJT808Config config)
{ {
writer.WriteByte(value.PassthroughType); writer.WriteByte(value.PassthroughType);
object obj = config.GetMessagePackFormatterByType(value.JT808_0x0900_BodyBase.GetType());
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(obj, ref writer, value.JT808_0x0900_BodyBase, config);

if ( value.JT808_0x0900_BodyBase != null )
{
object obj = config.GetMessagePackFormatterByType( value.JT808_0x0900_BodyBase.GetType() );
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize( obj, ref writer, value.JT808_0x0900_BodyBase, config );
}
else
{
writer.WriteArray( value.PassthroughData );
}
} }
} }
} }

+ 10
- 1
src/JT808.Protocol/MessageBody/JT808_0x8900.cs 查看文件

@@ -63,7 +63,16 @@ namespace JT808.Protocol.MessageBody
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8900 value, IJT808Config config) public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8900 value, IJT808Config config)
{ {
writer.WriteByte(value.PassthroughType); writer.WriteByte(value.PassthroughType);
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(value.JT808_0X8900_BodyBase, ref writer, value.JT808_0X8900_BodyBase, config);

if ( value.JT808_0X8900_BodyBase != null )
{
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize( value.JT808_0X8900_BodyBase, ref writer, value.JT808_0X8900_BodyBase, config );
}
else
{
writer.WriteArray( value.PassthroughData );
}

} }
/// <summary> /// <summary>
/// ///


正在加载...
取消
保存