瀏覽代碼

1.增加数据包

2.修改数据头
tags/v1.3.0
SmallChi 7 年之前
父節點
當前提交
3ce5d887d9
共有 2 個檔案被更改,包括 55 行新增2 行删除
  1. +36
    -2
      src/JT809.Protocol/ProtocolPacket/Header.cs
  2. +19
    -0
      src/JT809.Protocol/ProtocolPacket/Package.cs

+ 36
- 2
src/JT809.Protocol/ProtocolPacket/Header.cs 查看文件

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace JT809.Protocol.ProtocolPacket
{
@@ -9,7 +7,43 @@ namespace JT809.Protocol.ProtocolPacket
/// </summary>
public class Header
{
/// <summary>
/// 固定为22个字节长度
/// </summary>
public const int HeaderFixedByteLength = 22;
/// <summary>
/// 发送计数器
/// 占用四个字节,为发送信息的序列号,用于接收方检测是否有信息的丢失,上级平台和下级平台接自己发送数据包的个数计数,互不影响。
/// 程序开始运行时等于零,发送第一帧数据时开始计数,到最大数后自动归零
/// </summary>
public static uint CounterOnSendGenerater { get; private set; }
/// <summary>
/// 接收计数器
/// 占用四个字节,为发送信息的序列号,用于接收方检测是否有信息的丢失,上级平台和下级平台接自己发送数据包的个数计数,互不影响。
/// 程序开始运行时等于零,发送第一帧数据时开始计数,到最大数后自动归零
/// </summary>
public static uint CounterOnRecieveGenerater { get; private set; }
/// <summary>
/// 数据长度(包括头标识、数据头、数据体和尾标识)
/// </summary>
public uint Length { get; private set; }
/// <summary>
/// 报文序列号
/// </summary>
public uint SN { get; private set; }
/// <summary>
/// 业务数据类型
/// </summary>
public ushort BusinessID { get; private set; }
/// <summary>
/// 下级平台接入码,上级平台给下级平台分配唯一标识码。
/// </summary>
public uint GNSSCENTERID { get; set; }
public Version Version { get; private set; }
public EncryptEnum EncryptEnum { get; private set; }
/// <summary>
/// 数据加密的密匙,长度为 4 个字节。
/// </summary>
public uint EncryptKey { get; private set; } = 0X00;
}
}

+ 19
- 0
src/JT809.Protocol/ProtocolPacket/Package.cs 查看文件

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace JT809.Protocol.ProtocolPacket
{
/// <summary>
/// 数据包
/// </summary>
public class Package
{
public const int NotDataLength = 26;
public const int CrcByteLength = 2;
public const byte BeginFlag = 0X5B;
public const byte EndFlag = 0X5D;
public Header Header { get; private set; }
private ushort CRCCheckCode { get; set; }
}
}

Loading…
取消
儲存