From a87d0b379d4dddc55a40b0ced0d7c2961475127f Mon Sep 17 00:00:00 2001 From: waterliu99 Date: Thu, 21 Nov 2019 18:46:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=8F=E5=88=97=E5=8C=96?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/JT808.Protocol/Enums/JT808MsgId.cs | 6 +- .../Extensions/JT808EnumExtensions.cs | 2 +- src/JT808.Protocol/JT808.Protocol.csproj | 86 -- src/JT808.Protocol/JT808.Protocol.xml | 1340 ++++++++++++++++- .../MessageBody/JT808_0x8103.cs | 64 +- .../MessageBody/JT808_0x8103_0x0001.cs | 22 +- .../MessageBody/JT808_0x8103_0x0002.cs | 21 +- .../MessageBody/JT808_0x8103_0x0003.cs | 22 +- .../MessageBody/JT808_0x8103_0x0004.cs | 21 +- .../MessageBody/JT808_0x8103_0x0005.cs | 21 +- .../MessageBody/JT808_0x8103_0x0006.cs | 21 +- .../MessageBody/JT808_0x8103_0x0007.cs | 21 +- .../MessageBody/JT808_0x8103_0x0010.cs | 23 +- .../MessageBody/JT808_0x8103_0x0011.cs | 23 +- .../MessageBody/JT808_0x8103_0x0012.cs | 23 +- .../MessageBody/JT808_0x8103_0x0013.cs | 23 +- .../MessageBody/JT808_0x8103_0x0014.cs | 23 +- .../MessageBody/JT808_0x8103_0x0015.cs | 23 +- .../MessageBody/JT808_0x8103_0x0016.cs | 23 +- .../MessageBody/JT808_0x8103_0x0017.cs | 23 +- .../MessageBody/JT808_0x8103_0x0018.cs | 21 +- .../MessageBody/JT808_0x8103_0x0019.cs | 21 +- .../MessageBody/JT808_0x8103_0x001A.cs | 23 +- .../MessageBody/JT808_0x8103_0x001B.cs | 21 +- .../MessageBody/JT808_0x8103_0x001C.cs | 21 +- .../MessageBody/JT808_0x8103_0x001D.cs | 23 +- .../MessageBody/JT808_0x8103_0x0020.cs | 21 +- .../MessageBody/JT808_0x8103_0x0021.cs | 21 +- .../MessageBody/JT808_0x8103_0x0022.cs | 21 +- .../MessageBody/JT808_0x8103_0x0027.cs | 21 +- .../MessageBody/JT808_0x8103_0x0028.cs | 21 +- .../MessageBody/JT808_0x8103_0x0029.cs | 21 +- .../MessageBody/JT808_0x8103_0x002C.cs | 21 +- .../MessageBody/JT808_0x8103_0x002D.cs | 21 +- .../MessageBody/JT808_0x8103_0x002E.cs | 21 +- .../MessageBody/JT808_0x8103_0x002F.cs | 21 +- .../MessageBody/JT808_0x8103_0x0030.cs | 21 +- .../MessageBody/JT808_0x8103_0x0031.cs | 21 +- .../MessageBody/JT808_0x8103_0x0040.cs | 23 +- .../MessageBody/JT808_0x8103_0x0041.cs | 23 +- .../MessageBody/JT808_0x8103_0x0042.cs | 23 +- .../MessageBody/JT808_0x8103_0x0043.cs | 23 +- .../MessageBody/JT808_0x8103_0x0044.cs | 23 +- .../MessageBody/JT808_0x8103_0x0045.cs | 21 +- .../MessageBody/JT808_0x8103_0x0046.cs | 21 +- .../MessageBody/JT808_0x8103_0x0047.cs | 21 +- .../MessageBody/JT808_0x8103_0x0048.cs | 23 +- .../MessageBody/JT808_0x8103_0x0049.cs | 23 +- .../MessageBody/JT808_0x8103_0x0050.cs | 21 +- .../MessageBody/JT808_0x8103_0x0051.cs | 21 +- .../MessageBody/JT808_0x8103_0x0052.cs | 21 +- .../MessageBody/JT808_0x8103_0x0053.cs | 21 +- .../MessageBody/JT808_0x8103_0x0054.cs | 21 +- .../MessageBody/JT808_0x8103_0x0055.cs | 21 +- .../MessageBody/JT808_0x8103_0x0056.cs | 21 +- .../MessageBody/JT808_0x8103_0x0057.cs | 21 +- .../MessageBody/JT808_0x8103_0x0058.cs | 21 +- .../MessageBody/JT808_0x8103_0x0059.cs | 21 +- .../MessageBody/JT808_0x8103_0x005A.cs | 21 +- .../MessageBody/JT808_0x8103_0x005B.cs | 21 +- .../MessageBody/JT808_0x8103_0x005C.cs | 21 +- .../MessageBody/JT808_0x8103_0x005D.cs | 21 +- .../MessageBody/JT808_0x8103_0x005E.cs | 21 +- .../MessageBody/JT808_0x8103_0x0064.cs | 21 +- .../MessageBody/JT808_0x8103_0x0065.cs | 21 +- .../MessageBody/JT808_0x8103_0x0070.cs | 21 +- .../MessageBody/JT808_0x8103_0x0071.cs | 21 +- .../MessageBody/JT808_0x8103_0x0072.cs | 21 +- .../MessageBody/JT808_0x8103_0x0073.cs | 21 +- .../MessageBody/JT808_0x8103_0x0074.cs | 21 +- .../MessageBody/JT808_0x8103_0x0080.cs | 21 +- .../MessageBody/JT808_0x8103_0x0081.cs | 21 +- .../MessageBody/JT808_0x8103_0x0082.cs | 21 +- .../MessageBody/JT808_0x8103_0x0083.cs | 23 +- .../MessageBody/JT808_0x8103_0x0084.cs | 21 +- .../MessageBody/JT808_0x8103_0x0090.cs | 21 +- .../MessageBody/JT808_0x8103_0x0091.cs | 21 +- .../MessageBody/JT808_0x8103_0x0092.cs | 21 +- .../MessageBody/JT808_0x8103_0x0093.cs | 21 +- .../MessageBody/JT808_0x8103_0x0094.cs | 21 +- .../MessageBody/JT808_0x8103_0x0095.cs | 21 +- .../MessageBody/JT808_0x8103_0x0100.cs | 21 +- .../MessageBody/JT808_0x8103_0x0101.cs | 21 +- .../MessageBody/JT808_0x8103_0x0102.cs | 21 +- .../MessageBody/JT808_0x8103_0x0103.cs | 21 +- .../MessageBody/JT808_0x8103_0x0110.cs | 21 +- 86 files changed, 2900 insertions(+), 337 deletions(-) diff --git a/src/JT808.Protocol/Enums/JT808MsgId.cs b/src/JT808.Protocol/Enums/JT808MsgId.cs index e5e226e..ed62b0a 100644 --- a/src/JT808.Protocol/Enums/JT808MsgId.cs +++ b/src/JT808.Protocol/Enums/JT808MsgId.cs @@ -69,21 +69,21 @@ namespace JT808.Protocol.Enums /// 设置终端参数 /// 0x8103 /// - //[JT808BodiesType(typeof(JT808_0x8103))] + [JT808BodiesType(typeof(JT808_0x8103))] [JT808MsgIdDescription("0x8103", "设置终端参数")] 设置终端参数 = 0x8103, /// /// 查询终端参数 /// 0x8104 /// - //[JT808BodiesType(typeof(JT808_0x8104))] + [JT808BodiesType(typeof(JT808_0x8104))] [JT808MsgIdDescription("0x8104", "查询终端参数")] 查询终端参数 = 0x8104, /// /// 查询终端参数应答 /// 0x0104 /// - //[JT808BodiesType(typeof(JT808_0x0104))] + [JT808BodiesType(typeof(JT808_0x0104))] [JT808MsgIdDescription("0x0104", "查询终端参数应答")] 查询终端参数应答 = 0x0104, /// diff --git a/src/JT808.Protocol/Extensions/JT808EnumExtensions.cs b/src/JT808.Protocol/Extensions/JT808EnumExtensions.cs index f2492d8..4667129 100644 --- a/src/JT808.Protocol/Extensions/JT808EnumExtensions.cs +++ b/src/JT808.Protocol/Extensions/JT808EnumExtensions.cs @@ -99,7 +99,7 @@ namespace JT808.Protocol.Extensions /// /// 获取DescriptionAttribute特性枚举及描述 /// - /// + /// /// public static Dictionary GetDescriptionAttributeDictionary(this Enum value) { diff --git a/src/JT808.Protocol/JT808.Protocol.csproj b/src/JT808.Protocol/JT808.Protocol.csproj index 713c008..710d85a 100644 --- a/src/JT808.Protocol/JT808.Protocol.csproj +++ b/src/JT808.Protocol/JT808.Protocol.csproj @@ -53,92 +53,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/JT808.Protocol/JT808.Protocol.xml b/src/JT808.Protocol/JT808.Protocol.xml index 86be106..233ace5 100644 --- a/src/JT808.Protocol/JT808.Protocol.xml +++ b/src/JT808.Protocol/JT808.Protocol.xml @@ -867,7 +867,7 @@ 获取DescriptionAttribute特性枚举及描述 - + @@ -2399,6 +2399,27 @@ 鉴权码 + + + 查询终端参数应答 + + + + + 应答流水号 + 查询指定终端参数的流水号 + + + + + 应答参数个数 + + + + + 参数列表 + + 查询终端属性应答 @@ -3186,6 +3207,1323 @@ 只有在成功后才有该字段 + + + 设置终端参数 + + + + + 参数总数 + + + + + 参数列表 + + + + + 终端心跳发送间隔,单位为秒(s) + 0x8103_0x0001 + + + + + 数据 长度 + + + + + 终端心跳发送间隔,单位为秒(s) + + + + + TCP 消息应答超时时间,单位为秒(s) + 0x8103_0x0002 + + + + + 数据 长度 + + + + + TCP 消息应答超时时间,单位为秒(s) + + + + + TCP 消息重传次数 + 0x8103_0x0003 + + + + + 数据 长度 + + + + + TCP 消息重传次数 + + + + + UDP 消息应答超时时间,单位为秒(s) + 0x8103_0x0004 + + + + + 数据 长度 + + + + + UDP 消息应答超时时间,单位为秒(s) + + + + + UDP 消息重传次数 + 0x8103_0x0005 + + + + + 数据 长度 + + + + + UDP 消息重传次数 + + + + + SMS 消息应答超时时间,单位为秒(s) + 0x8103_0x0006 + + + + + 数据 长度 + + + + + SMS 消息应答超时时间,单位为秒(s) + + + + + SMS 消息重传次数 + 0x8103_0x0007 + + + + + 数据 长度 + + + + + SMS 消息重传次数 + + + + + 主服务器 APN,无线通信拨号访问点。若网络制式为 CDMA,则该处为PPP 拨号号码 + + + + + 数据 长度 + + + + + 主服务器 APN,无线通信拨号访问点。若网络制式为 CDMA,则该处为PPP 拨号号码 + + + + + 主服务器无线通信拨号用户名 + + + + + 数据 长度 + + + + + 主服务器无线通信拨号用户名 + + + + + 主服务器无线通信拨号密码 + + + + + 数据 长度 + + + + + 主服务器无线通信拨号密码 + + + + + 主服务器地址,IP 或域名 + + + + + 数据 长度 + + + + + 主服务器地址,IP 或域名 + + + + + 备份服务器 APN,无线通信拨号访问点 + + + + + 数据 长度 + + + + + 备份服务器 APN,无线通信拨号访问点 + + + + + 备份服务器无线通信拨号用户名 + + + + + 数据 长度 + + + + + 备份服务器无线通信拨号用户名 + + + + + 备份服务器无线通信拨号密码 + + + + + 数据 长度 + + + + + 备份服务器无线通信拨号密码 + + + + + 备份服务器地址,IP 或域名 + + + + + 数据 长度 + + + + + 备份服务器地址,IP 或域名 + + + + + 服务器 TCP 端口 + + + + + 数据 长度 + + + + + 服务器 TCP 端口 + + + + + 服务器 UDP 端口 + + + + + 数据 长度 + + + + + 服务器 TCP 端口 + + + + + 道路运输证 IC 卡认证主服务器 IP 地址或域名 + + + + + 数据 长度 + + + + + 道路运输证 IC 卡认证主服务器 IP 地址或域名 + + + + + 道路运输证 IC 卡认证主服务器 TCP 端口 + + + + + 数据 长度 + + + + + 道路运输证 IC 卡认证主服务器 TCP 端口 + + + + + 道路运输证 IC 卡认证主服务器 UDP 端口 + + + + + 数据 长度 + + + + + 道路运输证 IC 卡认证主服务器 UDP 端口 + + + + + 道路运输证 IC 卡认证备份服务器 IP 地址或域名,端口同主服务器 + + + + + 数据 长度 + + + + + 道路运输证 IC 卡认证备份服务器 IP 地址或域名,端口同主服务器 + + + + + 位置汇报策略,0:定时汇报;1:定距汇报;2:定时和定距汇报 + + + + + 数据 长度 + + + + + 位置汇报策略,0:定时汇报;1:定距汇报;2:定时和定距汇报 + + + + + 位置汇报方案,0:根据 ACC 状态; 1:根据登录状态和 ACC 状态,先判断登录状态,若登录再根据 ACC 状态 + + + + + 数据 长度 + + + + + 位置汇报方案,0:根据 ACC 状态; 1:根据登录状态和 ACC 状态,先判断登录状态,若登录再根据 ACC 状态 + + + + + 驾驶员未登录汇报时间间隔,单位为秒(s),>0 + + + + + 数据 长度 + + + + + 驾驶员未登录汇报时间间隔,单位为秒(s),>0 + + + + + 休眠时汇报时间间隔,单位为秒(s),>0 + + + + + 数据 长度 + + + + + 休眠时汇报时间间隔,单位为秒(s),>0 + + + + + 紧急报警时汇报时间间隔,单位为秒(s),>0 + + + + + 数据 长度 + + + + + 紧急报警时汇报时间间隔,单位为秒(s),>0 + + + + + 缺省时间汇报间隔,单位为秒(s),>0 + + + + + 数据 长度 + + + + + 缺省时间汇报间隔,单位为秒(s),>0 + + + + + 缺省距离汇报间隔,单位为米(m),>0 + + + + + 数据 长度 + + + + + 缺省距离汇报间隔,单位为米(m),>0 + + + + + 驾驶员未登录汇报距离间隔,单位为米(m),>0 + + + + + 数据 长度 + + + + + 驾驶员未登录汇报距离间隔,单位为米(m),>0 + + + + + 休眠时汇报距离间隔,单位为米(m),>0 + + + + + 数据 长度 + + + + + 休眠时汇报距离间隔,单位为米(m),>0 + + + + + 紧急报警时汇报距离间隔,单位为米(m),>0 + + + + + 数据 长度 + + + + + 紧急报警时汇报距离间隔,单位为米(m),>0 + + + + + + 数据 长度 + + + + + + 电子围栏半径(非法位移阈值),单位为米 + + + + + 数据 长度 + + + + + 电子围栏半径(非法位移阈值),单位为米 + + + + + 监控平台电话号码 + + + + + 数据 长度 + + + + + 监控平台电话号码 + + + + + 复位电话号码,可采用此电话号码拨打终端电话让终端复位 + + + + + 数据 长度 + + + + + 复位电话号码,可采用此电话号码拨打终端电话让终端复位 + + + + + 恢复出厂设置电话号码,可采用此电话号码拨打终端电话让终端恢复出厂设置 + + + + + 数据 长度 + + + + + 恢复出厂设置电话号码,可采用此电话号码拨打终端电话让终端恢复出厂设置 + + + + + 监控平台 SMS 电话号码 + + + + + 数据 长度 + + + + + 监控平台 SMS 电话号码 + + + + + 接收终端 SMS 文本报警号码 + + + + + 数据 长度 + + + + + 接收终端 SMS 文本报警号码 + + + + + 终端电话接听策略,0:自动接听;1:ACC ON 时自动接听,OFF 时手动接听 + + + + + 数据 长度 + + + + + 终端电话接听策略,0:自动接听;1:ACC ON 时自动接听,OFF 时手动接听 + + + + + 每次最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 + + + + + 数据 长度 + + + + + 每次最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 + + + + + 当月最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 + + + + + 数据 长度 + + + + + 当月最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 + + + + + 监听电话号码 + + + + + 数据 长度 + + + + + 监听电话号码 + + + + + 监管平台特权短信号码 + + + + + 数据 长度 + + + + + 监管平台特权短信号码 + + + + + 报警屏蔽字,与位置信息汇报消息中的报警标志相对应,相应位为 1则相应报警被屏蔽 + + + + + 数据 长度 + + + + + 报警屏蔽字,与位置信息汇报消息中的报警标志相对应,相应位为 1则相应报警被屏蔽 + + + + + 报警发送文本 SMS 开关,与位置信息汇报消息中的报警标志相对应,相应位为 1 则相应报警时发送文本 SMS + + + + + 数据 长度 + + + + + 报警发送文本 SMS 开关,与位置信息汇报消息中的报警标志相对应,相应位为 1 则相应报警时发送文本 SMS + + + + + 报警拍摄开关,与位置信息汇报消息中的报警标志相对应,相应位为1 则相应报警时摄像头拍摄 + + + + + 数据 长度 + + + + + 报警拍摄开关,与位置信息汇报消息中的报警标志相对应,相应位为1 则相应报警时摄像头拍摄 + + + + + 报警拍摄存储标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警时拍的照片进行存储,否则实时上传 + + + + + 数据 长度 + + + + + 报警拍摄存储标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警时拍的照片进行存储,否则实时上传 + + + + + 关键标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警为关键报警 + + + + + 数据 长度 + + + + + 关键标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警为关键报警 + + + + + 最高速度,单位为公里每小时(km/h) + + + + + 数据 长度 + + + + + 最高速度,单位为公里每小时(km/h) + + + + + 超速持续时间,单位为秒(s) + + + + + 数据 长度 + + + + + 超速持续时间,单位为秒(s) + + + + + 连续驾驶时间门限,单位为秒(s) + + + + + 数据 长度 + + + + + 连续驾驶时间门限,单位为秒(s) + + + + + 当天累计驾驶时间门限,单位为秒(s) + + + + + 数据 长度 + + + + + 当天累计驾驶时间门限,单位为秒(s) + + + + + 最小休息时间,单位为秒(s) + + + + + 数据 长度 + + + + + 最小休息时间,单位为秒(s) + + + + + 最长停车时间,单位为秒(s) + + + + + 数据 长度 + + + + + 最长停车时间,单位为秒(s) + + + + + 超速报警预警差值,单位为 1/10Km/h + + + + + 数据 长度 + + + + + 超速报警预警差值,单位为 1/10Km/h + + + + + 疲劳驾驶预警差值,单位为秒(s),>0 + + + + + 数据 长度 + + + + + 疲劳驾驶预警差值,单位为秒(s),>0 + + + + + 碰撞报警参数设置 + b7-b0: 碰撞时间,单位 4ms; + b15-b8:碰撞加速度,单位 0.1g,设置范围在:0-79 之间,默认为10。 + + + + + 数据 长度 + + + + + 碰撞报警参数设置 + b7-b0: 碰撞时间,单位 4ms; + b15-b8:碰撞加速度,单位 0.1g,设置范围在:0-79 之间,默认为10。 + + + + + 侧翻报警参数设置: + 侧翻角度,单位 1 度,默认为 30 度 + + + + + 数据 长度 + + + + + 侧翻报警参数设置: + 侧翻角度,单位 1 度,默认为 30 度 + + + + + 定时拍照控制,见 表 13 + + + + + 数据 长度 + + + + + 定时拍照控制,见 表 13 + + + + + 定距拍照控制,见 表 14 + + + + + 数据 长度 + + + + + 定距拍照控制,见 表 14 + + + + + 图像/视频质量,1-10,1 最好 + + + + + 数据 长度 + + + + + 图像/视频质量,1-10,1 最好 + + + + + 亮度,0-255 + + + + + 数据 长度 + + + + + 亮度,0-255 + + + + + 对比度,0-127 + + + + + 数据 长度 + + + + + 对比度,0-127 + + + + + 饱和度,0-127 + + + + + 数据 长度 + + + + + 饱和度,0-127 + + + + + 色度,0-255 + + + + + 数据 长度 + + + + + 饱和度,0-127 + + + + + 车辆里程表读数,1/10km + + + + + 数据 长度 + + + + + 车辆里程表读数,1/10km + + + + + 车辆所在的省域 ID + + + + + 数据 长度 + + + + + 车辆所在的省域 ID + + + + + 车辆所在的市域 ID + + + + + 数据 长度 + + + + + 车辆所在的市域 ID + + + + + 公安交通管理部门颁发的机动车号牌 + + + + + 数据 长度 + + + + + 公安交通管理部门颁发的机动车号牌 + + + + + 车牌颜色,按照 JT/T415-2006 的 5.4.12 + + + + + 数据 长度 + + + + + 车牌颜色,按照 JT/T415-2006 的 5.4.12 + + + + + GNSS 定位模式,定义如下: + bit0,0:禁用 GPS 定位, 1:启用 GPS 定位; + bit1,0:禁用北斗定位, 1:启用北斗定位; + bit2,0:禁用 GLONASS 定位, 1:启用 GLONASS 定位; + bit3,0:禁用 Galileo 定位, 1:启用 Galileo 定位。 + + + + + 数据 长度 + + + + + GNSS 定位模式,定义如下: + bit0,0:禁用 GPS 定位, 1:启用 GPS 定位; + bit1,0:禁用北斗定位, 1:启用北斗定位; + bit2,0:禁用 GLONASS 定位, 1:启用 GLONASS 定位; + bit3,0:禁用 Galileo 定位, 1:启用 Galileo 定位。 + + + + + GNSS 波特率,定义如下: + 0x00:4800;0x01:9600; + 0x02:19200;0x03:38400; + 0x04:57600;0x05:115200。 + + + + + 数据 长度 + + + + + GNSS 波特率,定义如下: + 0x00:4800;0x01:9600; + 0x02:19200;0x03:38400; + 0x04:57600;0x05:115200。 + + + + + GNSS 模块详细定位数据输出频率,定义如下: + 0x00:500ms;0x01:1000ms(默认值); + 0x02:2000ms;0x03:3000ms; + 0x04:4000ms。 + + + + + 数据 长度 + + + + + GNSS 模块详细定位数据输出频率,定义如下: + 0x00:500ms;0x01:1000ms(默认值); + 0x02:2000ms;0x03:3000ms; + 0x04:4000ms。 + + + + + GNSS 模块详细定位数据采集频率,单位为秒,默认为 1。 + + + + + 数据 长度 + + + + + GNSS 模块详细定位数据采集频率,单位为秒,默认为 1。 + + + + + GNSS 模块详细定位数据上传方式 + 0x00,本地存储,不上传(默认值); + 0x01,按时间间隔上传; + 0x02,按距离间隔上传; + 0x0B,按累计时间上传,达到传输时间后自动停止上传; + 0x0C,按累计距离上传,达到距离后自动停止上传; + 0x0D,按累计条数上传,达到上传条数后自动停止上传。 + + + + + 数据 长度 + + + + + GNSS 模块详细定位数据上传方式 + 0x00,本地存储,不上传(默认值); + 0x01,按时间间隔上传; + 0x02,按距离间隔上传; + 0x0B,按累计时间上传,达到传输时间后自动停止上传; + 0x0C,按累计距离上传,达到距离后自动停止上传; + 0x0D,按累计条数上传,达到上传条数后自动停止上传。 + + + + + GNSS 模块详细定位数据上传设置: + 上传方式为 0x01 时,单位为秒; + 上传方式为 0x02 时,单位为米; + 上传方式为 0x0B 时,单位为秒; + 上传方式为 0x0C 时,单位为米; + 上传方式为 0x0D 时,单位为条。 + + + + + 数据 长度 + + + + + GNSS 模块详细定位数据上传设置: + 上传方式为 0x01 时,单位为秒; + 上传方式为 0x02 时,单位为米; + 上传方式为 0x0B 时,单位为秒; + 上传方式为 0x0C 时,单位为米; + 上传方式为 0x0D 时,单位为条。 + + + + + CAN 总线通道 1 采集时间间隔(ms),0 表示不采集 + + + + + 数据 长度 + + + + + CAN 总线通道 1 采集时间间隔(ms),0 表示不采集 + + + + + CAN 总线通道 1 上传时间间隔(s),0 表示不上传 + + + + + 数据 长度 + + + + + CAN 总线通道 1 上传时间间隔(s),0 表示不上传 + + + + + CAN 总线通道 2 采集时间间隔(ms),0 表示不采集 + + + + + 数据 长度 + + + + + CAN 总线通道 2 采集时间间隔(ms),0 表示不采集 + + + + + CAN 总线通道 2 上传时间间隔(s),0 表示不上传 + + + + + 数据 长度 + + + + + CAN 总线通道 2 上传时间间隔(s),0 表示不上传 + + + + + CAN 总线 ID 单独采集设置: + bit63-bit32 表示此 ID 采集时间间隔(ms),0 表示不采集; + bit31 表示 CAN 通道号,0:CAN1,1:CAN2; + bit30 表示帧类型,0:标准帧,1:扩展帧; + bit29 表示数据采集方式,0:原始数据,1:采集区间的计算值; + bit28-bit0 表示 CAN 总线 ID。 + + + + + 数据 长度 + + + + + CAN 总线 ID 单独采集设置: + bit63-bit32 表示此 ID 采集时间间隔(ms),0 表示不采集; + bit31 表示 CAN 通道号,0:CAN1,1:CAN2; + bit30 表示帧类型,0:标准帧,1:扩展帧; + bit29 表示数据采集方式,0:原始数据,1:采集区间的计算值; + bit28-bit0 表示 CAN 总线 ID。 + + + + + 参数 ID + + + + + 参数长度 + + + + + 参数 ID + + + + + 参数长度 + + + + + 查询终端参数 + + + + + 跳过数据体序列化 + + 终端控制 diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103.cs index c0816c5..8a371a7 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103.cs @@ -1,5 +1,8 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Extensions; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; +using System; using System.Collections.Generic; using System.Linq; @@ -8,8 +11,7 @@ namespace JT808.Protocol.MessageBody /// /// 设置终端参数 /// - [JT808Formatter(typeof(JT808_0x8103_Formatter))] - public class JT808_0x8103 : JT808Bodies + public class JT808_0x8103 : JT808Bodies, IJT808MessagePackFormatter { /// /// 参数总数 @@ -32,5 +34,61 @@ namespace JT808.Protocol.MessageBody public List ParamList { get; set; } public List CustomParamList { get; set; } + + public JT808_0x8103 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103 jT808_0x8103 = new JT808_0x8103 + { + ParamList = new List(), + CustomParamList = new List() + }; + var paramCount = reader.ReadByte();//参数总数 + try + { + for (int i = 0; i < paramCount; i++) + { + var paramId = reader.ReadVirtualUInt32();//参数ID + if (config.JT808_0X8103_Factory.ParamMethods.TryGetValue(paramId, out Type type)) + { + object attachImplObj = config.GetMessagePackFormatterByType(type); + dynamic attachImpl = JT808MessagePackFormatterResolverExtensions.JT808DynamicDeserialize(attachImplObj, ref reader, config); + jT808_0x8103.ParamList.Add(attachImpl); + } + else if (config.JT808_0X8103_Custom_Factory.ParamMethods.TryGetValue(paramId, out Type customType)) + { + object attachImplObj = config.GetMessagePackFormatterByType(customType); + dynamic attachImpl = JT808MessagePackFormatterResolverExtensions.JT808DynamicDeserialize(attachImplObj, ref reader, config); + jT808_0x8103.CustomParamList.Add(attachImpl); + } + } + } + catch (Exception ex) + { + + } + return jT808_0x8103; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103 value, IJT808Config config) + { + writer.WriteByte(value.ParamCount); + try + { + foreach (var item in value.ParamList) + { + object attachImplObj = config.GetMessagePackFormatterByType(item.GetType()); + JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(attachImplObj, ref writer, item, config); + } + if (value.CustomParamList != null) + { + foreach (var item in value.CustomParamList) + { + object attachImplObj = config.GetMessagePackFormatterByType(item.GetType()); + JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(attachImplObj, ref writer, item, config); + } + } + } + catch (Exception ex) { } + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0001.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0001.cs index 803f672..1a1bc1e 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0001.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0001.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -7,8 +8,7 @@ namespace JT808.Protocol.MessageBody /// 终端心跳发送间隔,单位为秒(s) /// 0x8103_0x0001 /// - [JT808Formatter(typeof(JT808_0x8103_0x0001_Formatter))] - public class JT808_0x8103_0x0001 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0001 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0001; /// @@ -19,5 +19,21 @@ namespace JT808.Protocol.MessageBody /// 终端心跳发送间隔,单位为秒(s) /// public uint ParamValue { get; set; } + + public JT808_0x8103_0x0001 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0001 jT808_0x8103_0x0001 = new JT808_0x8103_0x0001(); + jT808_0x8103_0x0001.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0001.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0001.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0001; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0001 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0002.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0002.cs index d5329b7..67d62e8 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0002.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0002.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -7,8 +8,7 @@ namespace JT808.Protocol.MessageBody /// TCP 消息应答超时时间,单位为秒(s) /// 0x8103_0x0002 /// - [JT808Formatter(typeof(JT808_0x8103_0x0002_Formatter))] - public class JT808_0x8103_0x0002 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0002 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0002; /// @@ -19,5 +19,20 @@ namespace JT808.Protocol.MessageBody /// TCP 消息应答超时时间,单位为秒(s) /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0002 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0002 jT808_0x8103_0x0002 = new JT808_0x8103_0x0002(); + jT808_0x8103_0x0002.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0002.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0002.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0002; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0002 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0003.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0003.cs index bf91318..7ef249a 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0003.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0003.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -7,8 +8,7 @@ namespace JT808.Protocol.MessageBody /// TCP 消息重传次数 /// 0x8103_0x0003 /// - [JT808Formatter(typeof(JT808_0x8103_0x0003_Formatter))] - public class JT808_0x8103_0x0003 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0003 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0003; /// @@ -19,5 +19,21 @@ namespace JT808.Protocol.MessageBody /// TCP 消息重传次数 /// public uint ParamValue { get; set; } + + public JT808_0x8103_0x0003 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0003 jT808_0x8103_0x0003 = new JT808_0x8103_0x0003(); + jT808_0x8103_0x0003.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0003.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0003.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0003; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0003 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0004.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0004.cs index e3e5501..ddce8fa 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0004.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0004.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -7,8 +8,7 @@ namespace JT808.Protocol.MessageBody /// UDP 消息应答超时时间,单位为秒(s) /// 0x8103_0x0004 /// - [JT808Formatter(typeof(JT808_0x8103_0x0004_Formatter))] - public class JT808_0x8103_0x0004 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0004 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0004; /// @@ -19,5 +19,20 @@ namespace JT808.Protocol.MessageBody /// UDP 消息应答超时时间,单位为秒(s) /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0004 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0004 jT808_0x8103_0x0004 = new JT808_0x8103_0x0004(); + jT808_0x8103_0x0004.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0004.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0004.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0004; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0004 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0005.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0005.cs index 4833c36..4a61ae8 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0005.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0005.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -7,8 +8,7 @@ namespace JT808.Protocol.MessageBody /// UDP 消息重传次数 /// 0x8103_0x0005 /// - [JT808Formatter(typeof(JT808_0x8103_0x0005_Formatter))] - public class JT808_0x8103_0x0005 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0005 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0005; /// @@ -19,5 +19,20 @@ namespace JT808.Protocol.MessageBody /// UDP 消息重传次数 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0005 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0005 jT808_0x8103_0x0005 = new JT808_0x8103_0x0005(); + jT808_0x8103_0x0005.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0005.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0005.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0005; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0005 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0006.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0006.cs index 1718568..4e1b506 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0006.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0006.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -7,8 +8,7 @@ namespace JT808.Protocol.MessageBody /// SMS 消息应答超时时间,单位为秒(s) /// 0x8103_0x0006 /// - [JT808Formatter(typeof(JT808_0x8103_0x0006_Formatter))] - public class JT808_0x8103_0x0006 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0006 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0006; /// @@ -19,5 +19,20 @@ namespace JT808.Protocol.MessageBody /// SMS 消息应答超时时间,单位为秒(s) /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0006 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0006 jT808_0x8103_0x0006 = new JT808_0x8103_0x0006(); + jT808_0x8103_0x0006.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0006.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0006.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0006; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0006 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0007.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0007.cs index 4e71207..e04bbb2 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0007.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0007.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -7,8 +8,7 @@ namespace JT808.Protocol.MessageBody /// SMS 消息重传次数 /// 0x8103_0x0007 /// - [JT808Formatter(typeof(JT808_0x8103_0x0007_Formatter))] - public class JT808_0x8103_0x0007 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0007 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0007; /// @@ -19,5 +19,20 @@ namespace JT808.Protocol.MessageBody /// SMS 消息重传次数 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0007 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0007 jT808_0x8103_0x0007 = new JT808_0x8103_0x0007(); + jT808_0x8103_0x0007.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0007.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0007.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0007; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0007 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0010.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0010.cs index 0dd35de..ede685b 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0010.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0010.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 主服务器 APN,无线通信拨号访问点。若网络制式为 CDMA,则该处为PPP 拨号号码 /// - [JT808Formatter(typeof(JT808_0x8103_0x0010_Formatter))] - public class JT808_0x8103_0x0010 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0010 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0010; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 主服务器 APN,无线通信拨号访问点。若网络制式为 CDMA,则该处为PPP 拨号号码 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0010 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0010 jT808_0x8103_0x0010 = new JT808_0x8103_0x0010(); + jT808_0x8103_0x0010.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0010.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0010.ParamValue = reader.ReadString(jT808_0x8103_0x0010.ParamLength); + return jT808_0x8103_0x0010; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0010 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0011.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0011.cs index 396c8b0..7584bc4 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0011.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0011.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 主服务器无线通信拨号用户名 /// - [JT808Formatter(typeof(JT808_0x8103_0x0011_Formatter))] - public class JT808_0x8103_0x0011 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0011 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0011; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 主服务器无线通信拨号用户名 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0011 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0011 jT808_0x8103_0x0011 = new JT808_0x8103_0x0011(); + jT808_0x8103_0x0011.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0011.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0011.ParamValue = reader.ReadString(jT808_0x8103_0x0011.ParamLength); + return jT808_0x8103_0x0011; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0011 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0012.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0012.cs index 0a7ddc9..0e9bf6c 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0012.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0012.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 主服务器无线通信拨号密码 /// - [JT808Formatter(typeof(JT808_0x8103_0x0012_Formatter))] - public class JT808_0x8103_0x0012 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0012 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0012; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 主服务器无线通信拨号密码 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0012 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0012 jT808_0x8103_0x0012 = new JT808_0x8103_0x0012(); + jT808_0x8103_0x0012.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0012.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0012.ParamValue = reader.ReadString(jT808_0x8103_0x0012.ParamLength); + return jT808_0x8103_0x0012; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0012 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0013.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0013.cs index c953c93..b88c841 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0013.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0013.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 主服务器地址,IP 或域名 /// - [JT808Formatter(typeof(JT808_0x8103_0x0013_Formatter))] - public class JT808_0x8103_0x0013 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0013 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0013; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 主服务器地址,IP 或域名 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0013 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0013 jT808_0x8103_0x0013 = new JT808_0x8103_0x0013(); + jT808_0x8103_0x0013.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0013.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0013.ParamValue = reader.ReadString(jT808_0x8103_0x0013.ParamLength); + return jT808_0x8103_0x0013; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0013 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0014.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0014.cs index 7432614..79c6661 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0014.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0014.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 备份服务器 APN,无线通信拨号访问点 /// - [JT808Formatter(typeof(JT808_0x8103_0x0014_Formatter))] - public class JT808_0x8103_0x0014 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0014 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0014; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 备份服务器 APN,无线通信拨号访问点 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0014 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0014 jT808_0x8103_0x0014 = new JT808_0x8103_0x0014(); + jT808_0x8103_0x0014.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0014.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0014.ParamValue = reader.ReadString(jT808_0x8103_0x0014.ParamLength); + return jT808_0x8103_0x0014; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0014 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0015.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0015.cs index 7aa2217..19a6664 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0015.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0015.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 备份服务器无线通信拨号用户名 /// - [JT808Formatter(typeof(JT808_0x8103_0x0015_Formatter))] - public class JT808_0x8103_0x0015 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0015 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0015; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 备份服务器无线通信拨号用户名 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0015 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0015 jT808_0x8103_0x0015 = new JT808_0x8103_0x0015(); + jT808_0x8103_0x0015.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0015.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0015.ParamValue = reader.ReadString(jT808_0x8103_0x0015.ParamLength); + return jT808_0x8103_0x0015; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0015 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0016.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0016.cs index a64e979..e3dd443 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0016.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0016.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 备份服务器无线通信拨号密码 /// - [JT808Formatter(typeof(JT808_0x8103_0x0016_Formatter))] - public class JT808_0x8103_0x0016 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0016 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0016; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 备份服务器无线通信拨号密码 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0016 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0016 jT808_0x8103_0x0016 = new JT808_0x8103_0x0016(); + jT808_0x8103_0x0016.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0016.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0016.ParamValue = reader.ReadString(jT808_0x8103_0x0016.ParamLength); + return jT808_0x8103_0x0016; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0016 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0017.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0017.cs index f0c34f1..1cfc3eb 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0017.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0017.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 备份服务器地址,IP 或域名 /// - [JT808Formatter(typeof(JT808_0x8103_0x0017_Formatter))] - public class JT808_0x8103_0x0017 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0017 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0017; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 备份服务器地址,IP 或域名 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0017 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0017 jT808_0x8103_0x0017 = new JT808_0x8103_0x0017(); + jT808_0x8103_0x0017.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0017.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0017.ParamValue = reader.ReadString(jT808_0x8103_0x0017.ParamLength); + return jT808_0x8103_0x0017; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0017 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs index 89fa14c..2ac12b5 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 服务器 TCP 端口 /// - [JT808Formatter(typeof(JT808_0x8103_0x0018_Formatter))] - public class JT808_0x8103_0x0018 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0018 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0018; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody ///服务器 TCP 端口 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0018 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0018 jT808_0x8103_0x0018 = new JT808_0x8103_0x0018(); + jT808_0x8103_0x0018.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0018.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0018.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0018; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0018 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs index 5676162..e030a7f 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 服务器 UDP 端口 /// - [JT808Formatter(typeof(JT808_0x8103_0x0019_Formatter))] - public class JT808_0x8103_0x0019 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0019 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0019; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody ///服务器 TCP 端口 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0019 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0019 jT808_0x8103_0x0019 = new JT808_0x8103_0x0019(); + jT808_0x8103_0x0019.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0019.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0019.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0019; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0019 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001A.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001A.cs index b518f29..d4e115d 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001A.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001A.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 道路运输证 IC 卡认证主服务器 IP 地址或域名 /// - [JT808Formatter(typeof(JT808_0x8103_0x001A_Formatter))] - public class JT808_0x8103_0x001A : JT808_0x8103_BodyBase + public class JT808_0x8103_0x001A : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x001A; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 道路运输证 IC 卡认证主服务器 IP 地址或域名 /// public string ParamValue { get; set; } + public JT808_0x8103_0x001A Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x001A jT808_0x8103_0x001A = new JT808_0x8103_0x001A(); + jT808_0x8103_0x001A.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x001A.ParamLength = reader.ReadByte(); + jT808_0x8103_0x001A.ParamValue = reader.ReadString(jT808_0x8103_0x001A.ParamLength); + return jT808_0x8103_0x001A; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x001A value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001B.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001B.cs index 65b2a5c..900fd9f 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001B.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001B.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 道路运输证 IC 卡认证主服务器 TCP 端口 /// - [JT808Formatter(typeof(JT808_0x8103_0x001B_Formatter))] - public class JT808_0x8103_0x001B : JT808_0x8103_BodyBase + public class JT808_0x8103_0x001B : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x001B; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody ///道路运输证 IC 卡认证主服务器 TCP 端口 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x001B Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x001B jT808_0x8103_0x001B = new JT808_0x8103_0x001B(); + jT808_0x8103_0x001B.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x001B.ParamLength = reader.ReadByte(); + jT808_0x8103_0x001B.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x001B; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x001B value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001C.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001C.cs index 34b7bed..4693e59 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001C.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001C.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 道路运输证 IC 卡认证主服务器 UDP 端口 /// - [JT808Formatter(typeof(JT808_0x8103_0x001C_Formatter))] - public class JT808_0x8103_0x001C : JT808_0x8103_BodyBase + public class JT808_0x8103_0x001C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x001C; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody ///道路运输证 IC 卡认证主服务器 UDP 端口 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x001C Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x001C jT808_0x8103_0x001C = new JT808_0x8103_0x001C(); + jT808_0x8103_0x001C.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x001C.ParamLength = reader.ReadByte(); + jT808_0x8103_0x001C.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x001C; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x001C value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001D.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001D.cs index 158442b..5ff09c1 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001D.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001D.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 道路运输证 IC 卡认证备份服务器 IP 地址或域名,端口同主服务器 /// - [JT808Formatter(typeof(JT808_0x8103_0x001D_Formatter))] - public class JT808_0x8103_0x001D : JT808_0x8103_BodyBase + public class JT808_0x8103_0x001D : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x001D; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 道路运输证 IC 卡认证备份服务器 IP 地址或域名,端口同主服务器 /// public string ParamValue { get; set; } + public JT808_0x8103_0x001D Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x001D jT808_0x8103_0x001D = new JT808_0x8103_0x001D(); + jT808_0x8103_0x001D.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x001D.ParamLength = reader.ReadByte(); + jT808_0x8103_0x001D.ParamValue = reader.ReadString(jT808_0x8103_0x001D.ParamLength); + return jT808_0x8103_0x001D; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x001D value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0020.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0020.cs index 191479d..6d6919a 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0020.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0020.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 位置汇报策略,0:定时汇报;1:定距汇报;2:定时和定距汇报 /// - [JT808Formatter(typeof(JT808_0x8103_0x0020_Formatter))] - public class JT808_0x8103_0x0020 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0020 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0020; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 位置汇报策略,0:定时汇报;1:定距汇报;2:定时和定距汇报 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0020 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0020 jT808_0x8103_0x0020 = new JT808_0x8103_0x0020(); + jT808_0x8103_0x0020.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0020.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0020.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0020; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0020 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0021.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0021.cs index ccf9e6b..bf3d87d 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0021.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0021.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 位置汇报方案,0:根据 ACC 状态; 1:根据登录状态和 ACC 状态,先判断登录状态,若登录再根据 ACC 状态 /// - [JT808Formatter(typeof(JT808_0x8103_0x0021_Formatter))] - public class JT808_0x8103_0x0021 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0021 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0021; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 位置汇报方案,0:根据 ACC 状态; 1:根据登录状态和 ACC 状态,先判断登录状态,若登录再根据 ACC 状态 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0021 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0021 jT808_0x8103_0x0021 = new JT808_0x8103_0x0021(); + jT808_0x8103_0x0021.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0021.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0021.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0021; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0021 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0022.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0022.cs index 9727f66..ca5ba4e 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0022.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0022.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 驾驶员未登录汇报时间间隔,单位为秒(s),>0 /// - [JT808Formatter(typeof(JT808_0x8103_0x0022_Formatter))] - public class JT808_0x8103_0x0022 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0022 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0022; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 驾驶员未登录汇报时间间隔,单位为秒(s),>0 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0022 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0022 jT808_0x8103_0x0022 = new JT808_0x8103_0x0022(); + jT808_0x8103_0x0022.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0022.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0022.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0022; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0022 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0027.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0027.cs index c7af276..8a4d441 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0027.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0027.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 休眠时汇报时间间隔,单位为秒(s),>0 /// - [JT808Formatter(typeof(JT808_0x8103_0x0027_Formatter))] - public class JT808_0x8103_0x0027 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0027 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0027; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 休眠时汇报时间间隔,单位为秒(s),>0 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0027 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0027 jT808_0x8103_0x0027 = new JT808_0x8103_0x0027(); + jT808_0x8103_0x0027.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0027.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0027.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0027; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0027 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0028.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0028.cs index 355ae3e..79cf7cc 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0028.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0028.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 紧急报警时汇报时间间隔,单位为秒(s),>0 /// - [JT808Formatter(typeof(JT808_0x8103_0x0028_Formatter))] - public class JT808_0x8103_0x0028 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0028 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0028; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 紧急报警时汇报时间间隔,单位为秒(s),>0 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0028 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0028 jT808_0x8103_0x0028 = new JT808_0x8103_0x0028(); + jT808_0x8103_0x0028.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0028.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0028.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0028; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0028 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0029.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0029.cs index c8ee297..06e7de2 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0029.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0029.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 缺省时间汇报间隔,单位为秒(s),>0 /// - [JT808Formatter(typeof(JT808_0x8103_0x0029_Formatter))] - public class JT808_0x8103_0x0029 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0029 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0029; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 缺省时间汇报间隔,单位为秒(s),>0 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0029 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0029 jT808_0x8103_0x0029 = new JT808_0x8103_0x0029(); + jT808_0x8103_0x0029.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0029.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0029.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0029; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0029 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002C.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002C.cs index 2a7af06..dfba47c 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002C.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002C.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 缺省距离汇报间隔,单位为米(m),>0 /// - [JT808Formatter(typeof(JT808_0x8103_0x002C_Formatter))] - public class JT808_0x8103_0x002C : JT808_0x8103_BodyBase + public class JT808_0x8103_0x002C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x002C; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 缺省距离汇报间隔,单位为米(m),>0 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x002C Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x002C jT808_0x8103_0x002C = new JT808_0x8103_0x002C(); + jT808_0x8103_0x002C.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x002C.ParamLength = reader.ReadByte(); + jT808_0x8103_0x002C.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x002C; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x002C value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002D.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002D.cs index a9b79c4..58c533d 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002D.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002D.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 驾驶员未登录汇报距离间隔,单位为米(m),>0 /// - [JT808Formatter(typeof(JT808_0x8103_0x002D_Formatter))] - public class JT808_0x8103_0x002D : JT808_0x8103_BodyBase + public class JT808_0x8103_0x002D : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x002D; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 驾驶员未登录汇报距离间隔,单位为米(m),>0 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x002D Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x002D jT808_0x8103_0x002D = new JT808_0x8103_0x002D(); + jT808_0x8103_0x002D.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x002D.ParamLength = reader.ReadByte(); + jT808_0x8103_0x002D.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x002D; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x002D value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002E.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002E.cs index c061742..b6cd597 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002E.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002E.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 休眠时汇报距离间隔,单位为米(m),>0 /// - [JT808Formatter(typeof(JT808_0x8103_0x002E_Formatter))] - public class JT808_0x8103_0x002E : JT808_0x8103_BodyBase + public class JT808_0x8103_0x002E : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x002E; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 休眠时汇报距离间隔,单位为米(m),>0 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x002E Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x002E jT808_0x8103_0x002E = new JT808_0x8103_0x002E(); + jT808_0x8103_0x002E.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x002E.ParamLength = reader.ReadByte(); + jT808_0x8103_0x002E.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x002E; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x002E value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002F.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002F.cs index 6543d10..65e8d92 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002F.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002F.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 紧急报警时汇报距离间隔,单位为米(m),>0 /// - [JT808Formatter(typeof(JT808_0x8103_0x002F_Formatter))] - public class JT808_0x8103_0x002F : JT808_0x8103_BodyBase + public class JT808_0x8103_0x002F : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x002F; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 紧急报警时汇报距离间隔,单位为米(m),>0 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x002F Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x002F jT808_0x8103_0x002F = new JT808_0x8103_0x002F(); + jT808_0x8103_0x002F.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x002F.ParamLength = reader.ReadByte(); + jT808_0x8103_0x002F.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x002F; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x002F value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0030.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0030.cs index b089441..252376b 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0030.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0030.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 拐点补传角度,<180 /// - [JT808Formatter(typeof(JT808_0x8103_0x0030_Formatter))] - public class JT808_0x8103_0x0030 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0030 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0030; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 拐点补传角度,<180 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0030 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0030 jT808_0x8103_0x0030 = new JT808_0x8103_0x0030(); + jT808_0x8103_0x0030.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0030.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0030.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0030; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0030 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0031.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0031.cs index ce64476..94dfeac 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0031.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0031.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 电子围栏半径(非法位移阈值),单位为米 /// - [JT808Formatter(typeof(JT808_0x8103_0x0031_Formatter))] - public class JT808_0x8103_0x0031 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0031 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0031; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 电子围栏半径(非法位移阈值),单位为米 /// public ushort ParamValue { get; set; } + public JT808_0x8103_0x0031 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0031 jT808_0x8103_0x0031 = new JT808_0x8103_0x0031(); + jT808_0x8103_0x0031.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0031.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0031.ParamValue = reader.ReadUInt16(); + return jT808_0x8103_0x0031; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0031 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt16(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0040.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0040.cs index 024d821..2318606 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0040.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0040.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 监控平台电话号码 /// - [JT808Formatter(typeof(JT808_0x8103_0x0040_Formatter))] - public class JT808_0x8103_0x0040 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0040 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0040; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 监控平台电话号码 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0040 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0040 jT808_0x8103_0x0040 = new JT808_0x8103_0x0040(); + jT808_0x8103_0x0040.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0040.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0040.ParamValue = reader.ReadString(jT808_0x8103_0x0040.ParamLength); + return jT808_0x8103_0x0040; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0040 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0041.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0041.cs index 825df95..20bac5f 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0041.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0041.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 复位电话号码,可采用此电话号码拨打终端电话让终端复位 /// - [JT808Formatter(typeof(JT808_0x8103_0x0041_Formatter))] - public class JT808_0x8103_0x0041 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0041 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0041; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 复位电话号码,可采用此电话号码拨打终端电话让终端复位 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0041 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0041 jT808_0x8103_0x0041 = new JT808_0x8103_0x0041(); + jT808_0x8103_0x0041.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0041.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0041.ParamValue = reader.ReadString(jT808_0x8103_0x0041.ParamLength); + return jT808_0x8103_0x0041; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0041 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0042.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0042.cs index c27cca7..7c76702 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0042.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0042.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 恢复出厂设置电话号码,可采用此电话号码拨打终端电话让终端恢复出厂设置 /// - [JT808Formatter(typeof(JT808_0x8103_0x0042_Formatter))] - public class JT808_0x8103_0x0042 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0042 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0042; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 恢复出厂设置电话号码,可采用此电话号码拨打终端电话让终端恢复出厂设置 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0042 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0042 jT808_0x8103_0x0042 = new JT808_0x8103_0x0042(); + jT808_0x8103_0x0042.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0042.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0042.ParamValue = reader.ReadString(jT808_0x8103_0x0042.ParamLength); + return jT808_0x8103_0x0042; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0042 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0043.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0043.cs index 593aeac..9414b6a 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0043.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0043.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 监控平台 SMS 电话号码 /// - [JT808Formatter(typeof(JT808_0x8103_0x0043_Formatter))] - public class JT808_0x8103_0x0043 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0043 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0043; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 监控平台 SMS 电话号码 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0043 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0043 jT808_0x8103_0x0043 = new JT808_0x8103_0x0043(); + jT808_0x8103_0x0043.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0043.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0043.ParamValue = reader.ReadString(jT808_0x8103_0x0043.ParamLength); + return jT808_0x8103_0x0043; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0043 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0044.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0044.cs index 3e87dde..67764f3 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0044.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0044.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 接收终端 SMS 文本报警号码 /// - [JT808Formatter(typeof(JT808_0x8103_0x0044_Formatter))] - public class JT808_0x8103_0x0044 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0044 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0044; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 接收终端 SMS 文本报警号码 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0044 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0044 jT808_0x8103_0x0044 = new JT808_0x8103_0x0044(); + jT808_0x8103_0x0044.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0044.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0044.ParamValue = reader.ReadString(jT808_0x8103_0x0044.ParamLength); + return jT808_0x8103_0x0044; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0044 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0045.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0045.cs index 42dd696..6694162 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0045.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0045.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 终端电话接听策略,0:自动接听;1:ACC ON 时自动接听,OFF 时手动接听 /// - [JT808Formatter(typeof(JT808_0x8103_0x0045_Formatter))] - public class JT808_0x8103_0x0045 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0045 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0045; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 终端电话接听策略,0:自动接听;1:ACC ON 时自动接听,OFF 时手动接听 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0045 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0045 jT808_0x8103_0x0045 = new JT808_0x8103_0x0045(); + jT808_0x8103_0x0045.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0045.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0045.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0045; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0045 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0046.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0046.cs index fed5456..8241e92 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0046.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0046.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 每次最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 /// - [JT808Formatter(typeof(JT808_0x8103_0x0046_Formatter))] - public class JT808_0x8103_0x0046 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0046 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0046; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 每次最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0046 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0046 jT808_0x8103_0x0046 = new JT808_0x8103_0x0046(); + jT808_0x8103_0x0046.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0046.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0046.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0046; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0046 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0047.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0047.cs index e7b1d9d..e71756b 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0047.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0047.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 当月最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 /// - [JT808Formatter(typeof(JT808_0x8103_0x0047_Formatter))] - public class JT808_0x8103_0x0047 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0047 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0047; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 当月最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0047 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0047 jT808_0x8103_0x0047 = new JT808_0x8103_0x0047(); + jT808_0x8103_0x0047.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0047.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0047.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0047; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0047 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0048.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0048.cs index 0c87e80..8b71ec0 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0048.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0048.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 监听电话号码 /// - [JT808Formatter(typeof(JT808_0x8103_0x0048_Formatter))] - public class JT808_0x8103_0x0048 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0048 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0048; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 监听电话号码 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0048 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0048 jT808_0x8103_0x0048 = new JT808_0x8103_0x0048(); + jT808_0x8103_0x0048.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0048.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0048.ParamValue = reader.ReadString(jT808_0x8103_0x0048.ParamLength); + return jT808_0x8103_0x0048; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0048 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0049.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0049.cs index d084851..239f426 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0049.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0049.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 监管平台特权短信号码 /// - [JT808Formatter(typeof(JT808_0x8103_0x0049_Formatter))] - public class JT808_0x8103_0x0049 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0049 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0049; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 监管平台特权短信号码 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0049 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0049 jT808_0x8103_0x0049 = new JT808_0x8103_0x0049(); + jT808_0x8103_0x0049.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0049.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0049.ParamValue = reader.ReadString(jT808_0x8103_0x0049.ParamLength); + return jT808_0x8103_0x0049; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0049 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0050.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0050.cs index 0ca5b95..b302357 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0050.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0050.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 报警屏蔽字,与位置信息汇报消息中的报警标志相对应,相应位为 1则相应报警被屏蔽 /// - [JT808Formatter(typeof(JT808_0x8103_0x0050_Formatter))] - public class JT808_0x8103_0x0050 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0050 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0050; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 报警屏蔽字,与位置信息汇报消息中的报警标志相对应,相应位为 1则相应报警被屏蔽 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0050 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0050 jT808_0x8103_0x0050 = new JT808_0x8103_0x0050(); + jT808_0x8103_0x0050.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0050.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0050.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0050; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0050 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0051.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0051.cs index 8c7feb1..aad8038 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0051.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0051.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 报警发送文本 SMS 开关,与位置信息汇报消息中的报警标志相对应,相应位为 1 则相应报警时发送文本 SMS /// - [JT808Formatter(typeof(JT808_0x8103_0x0051_Formatter))] - public class JT808_0x8103_0x0051 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0051 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0051; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 报警发送文本 SMS 开关,与位置信息汇报消息中的报警标志相对应,相应位为 1 则相应报警时发送文本 SMS /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0051 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0051 jT808_0x8103_0x0051 = new JT808_0x8103_0x0051(); + jT808_0x8103_0x0051.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0051.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0051.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0051; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0051 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0052.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0052.cs index fda4251..cb75ea2 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0052.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0052.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 报警拍摄开关,与位置信息汇报消息中的报警标志相对应,相应位为1 则相应报警时摄像头拍摄 /// - [JT808Formatter(typeof(JT808_0x8103_0x0052_Formatter))] - public class JT808_0x8103_0x0052 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0052 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0052; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 报警拍摄开关,与位置信息汇报消息中的报警标志相对应,相应位为1 则相应报警时摄像头拍摄 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0052 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0052 jT808_0x8103_0x0052 = new JT808_0x8103_0x0052(); + jT808_0x8103_0x0052.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0052.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0052.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0052; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0052 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0053.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0053.cs index d87d6f7..bc8642a 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0053.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0053.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 报警拍摄存储标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警时拍的照片进行存储,否则实时上传 /// - [JT808Formatter(typeof(JT808_0x8103_0x0053_Formatter))] - public class JT808_0x8103_0x0053 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0053 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0053; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 报警拍摄存储标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警时拍的照片进行存储,否则实时上传 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0053 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0053 jT808_0x8103_0x0053 = new JT808_0x8103_0x0053(); + jT808_0x8103_0x0053.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0053.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0053.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0053; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0053 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0054.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0054.cs index 2dd0135..dce64ea 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0054.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0054.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 关键标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警为关键报警 /// - [JT808Formatter(typeof(JT808_0x8103_0x0054_Formatter))] - public class JT808_0x8103_0x0054 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0054 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0054; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 关键标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警为关键报警 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0054 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0054 jT808_0x8103_0x0054 = new JT808_0x8103_0x0054(); + jT808_0x8103_0x0054.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0054.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0054.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0054; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0054 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0055.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0055.cs index 717e739..ee937d7 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0055.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0055.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 最高速度,单位为公里每小时(km/h) /// - [JT808Formatter(typeof(JT808_0x8103_0x0055_Formatter))] - public class JT808_0x8103_0x0055 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0055 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0055; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 最高速度,单位为公里每小时(km/h) /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0055 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0055 jT808_0x8103_0x0055 = new JT808_0x8103_0x0055(); + jT808_0x8103_0x0055.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0055.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0055.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0055; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0055 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0056.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0056.cs index 4090ef3..3d4efcc 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0056.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0056.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 超速持续时间,单位为秒(s) /// - [JT808Formatter(typeof(JT808_0x8103_0x0056_Formatter))] - public class JT808_0x8103_0x0056 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0056 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0056; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 超速持续时间,单位为秒(s) /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0056 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0056 jT808_0x8103_0x0056 = new JT808_0x8103_0x0056(); + jT808_0x8103_0x0056.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0056.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0056.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0056; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0056 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0057.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0057.cs index 1854bfe..a5ae369 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0057.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0057.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 连续驾驶时间门限,单位为秒(s) /// - [JT808Formatter(typeof(JT808_0x8103_0x0057_Formatter))] - public class JT808_0x8103_0x0057 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0057 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0057; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 连续驾驶时间门限,单位为秒(s) /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0057 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0057 jT808_0x8103_0x0057 = new JT808_0x8103_0x0057(); + jT808_0x8103_0x0057.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0057.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0057.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0057; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0057 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0058.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0058.cs index 3139f77..812bcb4 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0058.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0058.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 当天累计驾驶时间门限,单位为秒(s) /// - [JT808Formatter(typeof(JT808_0x8103_0x0058_Formatter))] - public class JT808_0x8103_0x0058 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0058 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0058; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 当天累计驾驶时间门限,单位为秒(s) /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0058 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0058 jT808_0x8103_0x0058 = new JT808_0x8103_0x0058(); + jT808_0x8103_0x0058.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0058.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0058.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0058; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0058 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0059.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0059.cs index b90b684..83ce52b 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0059.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0059.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 最小休息时间,单位为秒(s) /// - [JT808Formatter(typeof(JT808_0x8103_0x0059_Formatter))] - public class JT808_0x8103_0x0059 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0059 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0059; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 最小休息时间,单位为秒(s) /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0059 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0059 jT808_0x8103_0x0059 = new JT808_0x8103_0x0059(); + jT808_0x8103_0x0059.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0059.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0059.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0059; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0059 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005A.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005A.cs index baa46b6..54c581a 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005A.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005A.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 最长停车时间,单位为秒(s) /// - [JT808Formatter(typeof(JT808_0x8103_0x005A_Formatter))] - public class JT808_0x8103_0x005A : JT808_0x8103_BodyBase + public class JT808_0x8103_0x005A : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x005A; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 最长停车时间,单位为秒(s) /// public uint ParamValue { get; set; } + public JT808_0x8103_0x005A Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x005A jT808_0x8103_0x005A = new JT808_0x8103_0x005A(); + jT808_0x8103_0x005A.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x005A.ParamLength = reader.ReadByte(); + jT808_0x8103_0x005A.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x005A; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x005A value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005B.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005B.cs index 18d7d7d..412e235 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005B.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005B.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 超速报警预警差值,单位为 1/10Km/h /// - [JT808Formatter(typeof(JT808_0x8103_0x005B_Formatter))] - public class JT808_0x8103_0x005B : JT808_0x8103_BodyBase + public class JT808_0x8103_0x005B : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x005B; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 超速报警预警差值,单位为 1/10Km/h /// public ushort ParamValue { get; set; } + public JT808_0x8103_0x005B Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x005B jT808_0x8103_0x005B = new JT808_0x8103_0x005B(); + jT808_0x8103_0x005B.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x005B.ParamLength = reader.ReadByte(); + jT808_0x8103_0x005B.ParamValue = reader.ReadUInt16(); + return jT808_0x8103_0x005B; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x005B value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt16(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005C.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005C.cs index 350a58f..3238fd5 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005C.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005C.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 疲劳驾驶预警差值,单位为秒(s),>0 /// - [JT808Formatter(typeof(JT808_0x8103_0x005C_Formatter))] - public class JT808_0x8103_0x005C : JT808_0x8103_BodyBase + public class JT808_0x8103_0x005C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x005C; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 疲劳驾驶预警差值,单位为秒(s),>0 /// public ushort ParamValue { get; set; } + public JT808_0x8103_0x005C Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x005C jT808_0x8103_0x005C = new JT808_0x8103_0x005C(); + jT808_0x8103_0x005C.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x005C.ParamLength = reader.ReadByte(); + jT808_0x8103_0x005C.ParamValue = reader.ReadUInt16(); + return jT808_0x8103_0x005C; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x005C value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt16(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005D.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005D.cs index 13f562d..83695e2 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005D.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005D.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -8,8 +9,7 @@ namespace JT808.Protocol.MessageBody /// b7-b0: 碰撞时间,单位 4ms; /// b15-b8:碰撞加速度,单位 0.1g,设置范围在:0-79 之间,默认为10。 /// - [JT808Formatter(typeof(JT808_0x8103_0x005D_Formatter))] - public class JT808_0x8103_0x005D : JT808_0x8103_BodyBase + public class JT808_0x8103_0x005D : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x005D; /// @@ -22,5 +22,20 @@ namespace JT808.Protocol.MessageBody /// b15-b8:碰撞加速度,单位 0.1g,设置范围在:0-79 之间,默认为10。 /// public ushort ParamValue { get; set; } + public JT808_0x8103_0x005D Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x005D jT808_0x8103_0x005D = new JT808_0x8103_0x005D(); + jT808_0x8103_0x005D.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x005D.ParamLength = reader.ReadByte(); + jT808_0x8103_0x005D.ParamValue = reader.ReadUInt16(); + return jT808_0x8103_0x005D; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x005D value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt16(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005E.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005E.cs index 6fdd507..268230b 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005E.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x005E.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -7,8 +8,7 @@ namespace JT808.Protocol.MessageBody /// 侧翻报警参数设置: /// 侧翻角度,单位 1 度,默认为 30 度 /// - [JT808Formatter(typeof(JT808_0x8103_0x005E_Formatter))] - public class JT808_0x8103_0x005E : JT808_0x8103_BodyBase + public class JT808_0x8103_0x005E : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x005E; /// @@ -20,5 +20,20 @@ namespace JT808.Protocol.MessageBody /// 侧翻角度,单位 1 度,默认为 30 度 /// public ushort ParamValue { get; set; } + public JT808_0x8103_0x005E Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x005E jT808_0x8103_0x005E = new JT808_0x8103_0x005E(); + jT808_0x8103_0x005E.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x005E.ParamLength = reader.ReadByte(); + jT808_0x8103_0x005E.ParamValue = reader.ReadUInt16(); + return jT808_0x8103_0x005E; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x005E value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt16(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0064.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0064.cs index 5ba7a87..78e829e 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0064.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0064.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 定时拍照控制,见 表 13 /// - [JT808Formatter(typeof(JT808_0x8103_0x0064_Formatter))] - public class JT808_0x8103_0x0064 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0064 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0064; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 定时拍照控制,见 表 13 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0064 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0064 jT808_0x8103_0x0064 = new JT808_0x8103_0x0064(); + jT808_0x8103_0x0064.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0064.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0064.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0064; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0064 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0065.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0065.cs index d8c2742..e20d683 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0065.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0065.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 定距拍照控制,见 表 14 /// - [JT808Formatter(typeof(JT808_0x8103_0x0065_Formatter))] - public class JT808_0x8103_0x0065 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0065 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0065; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 定距拍照控制,见 表 14 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0065 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0065 jT808_0x8103_0x0065 = new JT808_0x8103_0x0065(); + jT808_0x8103_0x0065.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0065.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0065.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0065; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0065 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0070.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0070.cs index 82034b8..32a1806 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0070.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0070.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 图像/视频质量,1-10,1 最好 /// - [JT808Formatter(typeof(JT808_0x8103_0x0070_Formatter))] - public class JT808_0x8103_0x0070 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0070 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0070; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 图像/视频质量,1-10,1 最好 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0070 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0070 jT808_0x8103_0x0070 = new JT808_0x8103_0x0070(); + jT808_0x8103_0x0070.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0070.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0070.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0070; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0070 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0071.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0071.cs index b47746c..22daffc 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0071.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0071.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 亮度,0-255 /// - [JT808Formatter(typeof(JT808_0x8103_0x0071_Formatter))] - public class JT808_0x8103_0x0071 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0071 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0071; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 亮度,0-255 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0071 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0071 jT808_0x8103_0x0071 = new JT808_0x8103_0x0071(); + jT808_0x8103_0x0071.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0071.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0071.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0071; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0071 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0072.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0072.cs index fa9ac9d..6d89b54 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0072.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0072.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 对比度,0-127 /// - [JT808Formatter(typeof(JT808_0x8103_0x0072_Formatter))] - public class JT808_0x8103_0x0072 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0072 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0072; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 对比度,0-127 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0072 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0072 jT808_0x8103_0x0072 = new JT808_0x8103_0x0072(); + jT808_0x8103_0x0072.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0072.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0072.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0072; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0072 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0073.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0073.cs index b6b9601..f8e9208 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0073.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0073.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 饱和度,0-127 /// - [JT808Formatter(typeof(JT808_0x8103_0x0073_Formatter))] - public class JT808_0x8103_0x0073 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0073 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0073; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 饱和度,0-127 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0073 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0073 jT808_0x8103_0x0073 = new JT808_0x8103_0x0073(); + jT808_0x8103_0x0073.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0073.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0073.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0073; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0073 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0074.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0074.cs index 3a7abe0..279f78b 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0074.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0074.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 色度,0-255 /// - [JT808Formatter(typeof(JT808_0x8103_0x0074_Formatter))] - public class JT808_0x8103_0x0074 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0074 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0074; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 饱和度,0-127 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0074 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0074 jT808_0x8103_0x0074 = new JT808_0x8103_0x0074(); + jT808_0x8103_0x0074.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0074.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0074.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0074; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0074 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0080.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0080.cs index 1fd7f65..fc10ba4 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0080.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0080.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 车辆里程表读数,1/10km /// - [JT808Formatter(typeof(JT808_0x8103_0x0080_Formatter))] - public class JT808_0x8103_0x0080 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0080 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0080; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 车辆里程表读数,1/10km /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0080 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0080 jT808_0x8103_0x0080 = new JT808_0x8103_0x0080(); + jT808_0x8103_0x0080.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0080.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0080.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0080; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0080 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0081.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0081.cs index 36e2b24..dd1ebb3 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0081.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0081.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 车辆所在的省域 ID /// - [JT808Formatter(typeof(JT808_0x8103_0x0081_Formatter))] - public class JT808_0x8103_0x0081 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0081 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0081; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 车辆所在的省域 ID /// public ushort ParamValue { get; set; } + public JT808_0x8103_0x0081 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0081 jT808_0x8103_0x0081 = new JT808_0x8103_0x0081(); + jT808_0x8103_0x0081.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0081.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0081.ParamValue = reader.ReadUInt16(); + return jT808_0x8103_0x0081; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0081 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt16(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0082.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0082.cs index e6dd69f..5a12098 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0082.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0082.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 车辆所在的市域 ID /// - [JT808Formatter(typeof(JT808_0x8103_0x0082_Formatter))] - public class JT808_0x8103_0x0082 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0082 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0082; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 车辆所在的市域 ID /// public ushort ParamValue { get; set; } + public JT808_0x8103_0x0082 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0082 jT808_0x8103_0x0082 = new JT808_0x8103_0x0082(); + jT808_0x8103_0x0082.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0082.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0082.ParamValue = reader.ReadUInt16(); + return jT808_0x8103_0x0082; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0082 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt16(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0083.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0083.cs index 87914c1..3bda09d 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0083.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0083.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 公安交通管理部门颁发的机动车号牌 /// - [JT808Formatter(typeof(JT808_0x8103_0x0083_Formatter))] - public class JT808_0x8103_0x0083 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0083 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0083; /// @@ -18,5 +18,22 @@ namespace JT808.Protocol.MessageBody /// 公安交通管理部门颁发的机动车号牌 /// public string ParamValue { get; set; } + public JT808_0x8103_0x0083 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0083 jT808_0x8103_0x0083 = new JT808_0x8103_0x0083(); + jT808_0x8103_0x0083.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0083.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0083.ParamValue = reader.ReadString(jT808_0x8103_0x0083.ParamLength); + return jT808_0x8103_0x0083; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0083 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.Skip(1, out int skipPosition); + writer.WriteString(value.ParamValue); + int length = writer.GetCurrentPosition() - skipPosition - 1; + writer.WriteByteReturn((byte)length, skipPosition); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0084.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0084.cs index 0048e3f..95ab737 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0084.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0084.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// 车牌颜色,按照 JT/T415-2006 的 5.4.12 /// - [JT808Formatter(typeof(JT808_0x8103_0x0084_Formatter))] - public class JT808_0x8103_0x0084 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0084 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0084; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// 车牌颜色,按照 JT/T415-2006 的 5.4.12 /// public byte ParamValue { get; set; } + public JT808_0x8103_0x0084 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0084 jT808_0x8103_0x0084 = new JT808_0x8103_0x0084(); + jT808_0x8103_0x0084.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0084.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0084.ParamValue = reader.ReadByte(); + return jT808_0x8103_0x0084; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0084 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteByte(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0090.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0090.cs index e9420e9..09d1789 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0090.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0090.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -10,8 +11,7 @@ namespace JT808.Protocol.MessageBody /// bit2,0:禁用 GLONASS 定位, 1:启用 GLONASS 定位; /// bit3,0:禁用 Galileo 定位, 1:启用 Galileo 定位。 /// - [JT808Formatter(typeof(JT808_0x8103_0x0090_Formatter))] - public class JT808_0x8103_0x0090 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0090 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0090; /// @@ -26,5 +26,20 @@ namespace JT808.Protocol.MessageBody /// bit3,0:禁用 Galileo 定位, 1:启用 Galileo 定位。 /// public byte ParamValue { get; set; } + public JT808_0x8103_0x0090 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0090 jT808_0x8103_0x0090 = new JT808_0x8103_0x0090(); + jT808_0x8103_0x0090.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0090.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0090.ParamValue = reader.ReadByte(); + return jT808_0x8103_0x0090; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0090 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteByte(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0091.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0091.cs index 26df052..cbe094f 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0091.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0091.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -9,8 +10,7 @@ namespace JT808.Protocol.MessageBody /// 0x02:19200;0x03:38400; /// 0x04:57600;0x05:115200。 /// - [JT808Formatter(typeof(JT808_0x8103_0x0091_Formatter))] - public class JT808_0x8103_0x0091 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0091 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0091; /// @@ -24,5 +24,20 @@ namespace JT808.Protocol.MessageBody /// 0x04:57600;0x05:115200。 /// public byte ParamValue { get; set; } + public JT808_0x8103_0x0091 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0091 jT808_0x8103_0x0091 = new JT808_0x8103_0x0091(); + jT808_0x8103_0x0091.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0091.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0091.ParamValue = reader.ReadByte(); + return jT808_0x8103_0x0091; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0091 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteByte(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0092.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0092.cs index bef54ee..e747a8c 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0092.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0092.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -9,8 +10,7 @@ namespace JT808.Protocol.MessageBody /// 0x02:2000ms;0x03:3000ms; /// 0x04:4000ms。 /// - [JT808Formatter(typeof(JT808_0x8103_0x0092_Formatter))] - public class JT808_0x8103_0x0092 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0092 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0092; /// @@ -24,5 +24,20 @@ namespace JT808.Protocol.MessageBody /// 0x04:4000ms。 /// public byte ParamValue { get; set; } + public JT808_0x8103_0x0092 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0092 jT808_0x8103_0x0092 = new JT808_0x8103_0x0092(); + jT808_0x8103_0x0092.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0092.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0092.ParamValue = reader.ReadByte(); + return jT808_0x8103_0x0092; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0092 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteByte(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0093.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0093.cs index 1b77ad7..223f8a9 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0093.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0093.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// GNSS 模块详细定位数据采集频率,单位为秒,默认为 1。 /// - [JT808Formatter(typeof(JT808_0x8103_0x0093_Formatter))] - public class JT808_0x8103_0x0093 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0093 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0093; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// GNSS 模块详细定位数据采集频率,单位为秒,默认为 1。 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0093 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0093 jT808_0x8103_0x0093 = new JT808_0x8103_0x0093(); + jT808_0x8103_0x0093.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0093.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0093.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0093; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0093 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0094.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0094.cs index 6f6f446..015db18 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0094.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0094.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -12,8 +13,7 @@ namespace JT808.Protocol.MessageBody /// 0x0C,按累计距离上传,达到距离后自动停止上传; /// 0x0D,按累计条数上传,达到上传条数后自动停止上传。 /// - [JT808Formatter(typeof(JT808_0x8103_0x0094_Formatter))] - public class JT808_0x8103_0x0094 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0094 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0094; /// @@ -30,5 +30,20 @@ namespace JT808.Protocol.MessageBody /// 0x0D,按累计条数上传,达到上传条数后自动停止上传。 /// public byte ParamValue { get; set; } + public JT808_0x8103_0x0094 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0094 jT808_0x8103_0x0094 = new JT808_0x8103_0x0094(); + jT808_0x8103_0x0094.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0094.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0094.ParamValue = reader.ReadByte(); + return jT808_0x8103_0x0094; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0094 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteByte(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0095.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0095.cs index b9fd2aa..4afca31 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0095.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0095.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -11,8 +12,7 @@ namespace JT808.Protocol.MessageBody /// 上传方式为 0x0C 时,单位为米; /// 上传方式为 0x0D 时,单位为条。 /// - [JT808Formatter(typeof(JT808_0x8103_0x0095_Formatter))] - public class JT808_0x8103_0x0095 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0095 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0095; /// @@ -28,5 +28,20 @@ namespace JT808.Protocol.MessageBody /// 上传方式为 0x0D 时,单位为条。 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0095 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0095 jT808_0x8103_0x0095 = new JT808_0x8103_0x0095(); + jT808_0x8103_0x0095.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0095.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0095.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0095; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0095 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0100.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0100.cs index a77c4e7..b55d432 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0100.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0100.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// CAN 总线通道 1 采集时间间隔(ms),0 表示不采集 /// - [JT808Formatter(typeof(JT808_0x8103_0x0100_Formatter))] - public class JT808_0x8103_0x0100 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0100 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0100; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// CAN 总线通道 1 采集时间间隔(ms),0 表示不采集 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0100 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0100 jT808_0x8103_0x0100 = new JT808_0x8103_0x0100(); + jT808_0x8103_0x0100.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0100.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0100.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0100; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0100 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0101.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0101.cs index ed84494..0ba8322 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0101.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0101.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// CAN 总线通道 1 上传时间间隔(s),0 表示不上传 /// - [JT808Formatter(typeof(JT808_0x8103_0x0101_Formatter))] - public class JT808_0x8103_0x0101 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0101 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0101; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// CAN 总线通道 1 上传时间间隔(s),0 表示不上传 /// public ushort ParamValue { get; set; } + public JT808_0x8103_0x0101 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0101 jT808_0x8103_0x0101 = new JT808_0x8103_0x0101(); + jT808_0x8103_0x0101.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0101.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0101.ParamValue = reader.ReadUInt16(); + return jT808_0x8103_0x0101; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0101 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt16(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0102.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0102.cs index 9136275..7037e35 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0102.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0102.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// CAN 总线通道 2 采集时间间隔(ms),0 表示不采集 /// - [JT808Formatter(typeof(JT808_0x8103_0x0102_Formatter))] - public class JT808_0x8103_0x0102 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0102 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0102; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// CAN 总线通道 2 采集时间间隔(ms),0 表示不采集 /// public uint ParamValue { get; set; } + public JT808_0x8103_0x0102 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0102 jT808_0x8103_0x0102 = new JT808_0x8103_0x0102(); + jT808_0x8103_0x0102.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0102.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0102.ParamValue = reader.ReadUInt32(); + return jT808_0x8103_0x0102; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0102 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt32(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0103.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0103.cs index a23c489..4a2388e 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0103.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0103.cs @@ -1,13 +1,13 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { /// /// CAN 总线通道 2 上传时间间隔(s),0 表示不上传 /// - [JT808Formatter(typeof(JT808_0x8103_0x0103_Formatter))] - public class JT808_0x8103_0x0103 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0103 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0103; /// @@ -18,5 +18,20 @@ namespace JT808.Protocol.MessageBody /// CAN 总线通道 2 上传时间间隔(s),0 表示不上传 /// public ushort ParamValue { get; set; } + public JT808_0x8103_0x0103 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0103 jT808_0x8103_0x0103 = new JT808_0x8103_0x0103(); + jT808_0x8103_0x0103.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0103.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0103.ParamValue = reader.ReadUInt16(); + return jT808_0x8103_0x0103; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0103 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte(value.ParamLength); + writer.WriteUInt16(value.ParamValue); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0110.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0110.cs index fde4b13..dbd46f0 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0110.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0110.cs @@ -1,5 +1,6 @@ using JT808.Protocol.Attributes; -using JT808.Protocol.Formatters.MessageBodyFormatters; +using JT808.Protocol.Formatters; +using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody { @@ -11,8 +12,7 @@ namespace JT808.Protocol.MessageBody /// bit29 表示数据采集方式,0:原始数据,1:采集区间的计算值; /// bit28-bit0 表示 CAN 总线 ID。 /// - [JT808Formatter(typeof(JT808_0x8103_0x0110_Formatter))] - public class JT808_0x8103_0x0110 : JT808_0x8103_BodyBase + public class JT808_0x8103_0x0110 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter { public override uint ParamId { get; set; } = 0x0110; /// @@ -28,5 +28,20 @@ namespace JT808.Protocol.MessageBody /// bit28-bit0 表示 CAN 总线 ID。 /// public byte[] ParamValue { get; set; } + public JT808_0x8103_0x0110 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) + { + JT808_0x8103_0x0110 jT808_0x8103_0x0110 = new JT808_0x8103_0x0110(); + jT808_0x8103_0x0110.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0110.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0110.ParamValue = reader.ReadArray(jT808_0x8103_0x0110.ParamLength).ToArray(); + return jT808_0x8103_0x0110; + } + + public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0110 value, IJT808Config config) + { + writer.WriteUInt32(value.ParamId); + writer.WriteByte((byte)value.ParamValue.Length); + writer.WriteArray(value.ParamValue); + } } }