瀏覽代碼

1.增加信息类型标志

2.增加实时信息上报(报警数据、可充电储能装置电压数据、可充电储能装置温度数据)
tags/1.0.0
SmallChi 7 年之前
父節點
當前提交
1878778de6
共有 7 個文件被更改,包括 253 次插入44 次删除
  1. +3
    -2
      src/GBNewEnergy.Protocol/Enums/NEInfoType.cs
  2. +42
    -41
      src/GBNewEnergy.Protocol/NEBodiesFactory.cs
  3. +60
    -0
      src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadAlarmProperty.cs
  4. +60
    -0
      src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageProperty.cs
  5. +43
    -0
      src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageTemperatureProperty.cs
  6. +10
    -1
      src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadProperty.cs
  7. +35
    -0
      src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs

+ 3
- 2
src/GBNewEnergy.Protocol/Enums/NEInfoType.cs 查看文件

@@ -16,8 +16,9 @@ namespace GBNewEnergy.Protocol.Enums
车辆位置数据=0x05,
极值数据=0x06,
报警数据=0x07,
终端数据预留=0x08,
平台交换协议自定义数据=0x0A,
可充电储能装置电压数据=0x08,
可充电储能装置温度数据 = 0x09,
平台交换协议自定义数据 =0x0A,
预留=0x30,
用户自定义=0x80
}


+ 42
- 41
src/GBNewEnergy.Protocol/NEBodiesFactory.cs 查看文件

@@ -1,42 +1,43 @@
using GBNewEnergy.Protocol.DownStream;
using GBNewEnergy.Protocol.Enums;
using GBNewEnergy.Protocol.UpStream;
using System;
using System.Collections.Generic;
using System.Text;

namespace GBNewEnergy.Protocol
{
public class NEBodiesFactory
{
/// <summary>
/// 通过命令id获取数据体
/// </summary>
/// <param name="msgId"></param>
/// <param name="buf"></param>
/// <returns></returns>
public static NEBodies GetNEBodiesByMsgId(NEMsgId msgId,byte[] buf, NEGlobalConfigs nEConfigs)
{
switch (msgId)
{
case NEMsgId.login:
return new NELoginUpStream(buf, nEConfigs);
case NEMsgId.loginout:
return new NELogoutUpStream(buf, nEConfigs);
case NEMsgId.platformlogin:
return new NEPlatformLoginUpStream(buf, nEConfigs);
case NEMsgId.platformlogout:
return new NEPlatformLogoutUpStream(buf, nEConfigs);
using GBNewEnergy.Protocol.DownStream;
using GBNewEnergy.Protocol.Enums;
using GBNewEnergy.Protocol.UpStream;
using System;
using System.Collections.Generic;
using System.Text;
namespace GBNewEnergy.Protocol
{
public class NEBodiesFactory
{
/// <summary>
/// 通过命令id获取数据体
/// </summary>
/// <param name="msgId"></param>
/// <param name="buf"></param>
/// <returns></returns>
public static NEBodies GetNEBodiesByMsgId(NEMsgId msgId,byte[] buf, NEGlobalConfigs nEConfigs)
{
switch (msgId)
{
case NEMsgId.login:
return new NELoginUpStream(buf, nEConfigs);
case NEMsgId.uploadim:
return new NERealUploadUpStream(buf, nEConfigs);
case NEMsgId.loginout:
return new NELogoutUpStream(buf, nEConfigs);
case NEMsgId.platformlogin:
return new NEPlatformLoginUpStream(buf, nEConfigs);
case NEMsgId.platformlogout:
return new NEPlatformLogoutUpStream(buf, nEConfigs);
case NEMsgId.control:
return new NEControlDownStream(buf, nEConfigs);
case NEMsgId.settings:
case NEMsgId.heartbeat:
case NEMsgId.checktime:
return new CommonUpStream(buf, nEConfigs);

default:
return null;
}
}
}
}
return new NEControlDownStream(buf, nEConfigs);
case NEMsgId.settings:
case NEMsgId.heartbeat:
case NEMsgId.checktime:
return new CommonUpStream(buf, nEConfigs);
default:
return null;
}
}
}
}

+ 60
- 0
src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadAlarmProperty.cs 查看文件

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Text;
using GBNewEnergy.Protocol.Enums;

namespace GBNewEnergy.Protocol.NEProperties.NEUploadProperties
{
/// <summary>
/// 报警数据
/// </summary>
public class NEUploadAlarmProperty : NEUploadPropertyBase
{
public override NEInfoType NEInfoType => NEInfoType.报警数据;

/// <summary>
/// 报警等级
/// </summary>
public byte AlarmLevel { get; set; }
/// <summary>
/// 通用报警标志
/// </summary>
public int AlarmBatteryFlag { get; set; }
/// <summary>
/// 报警没变化 0,有报警 1
/// </summary>
public byte AlarmBatteryChanged { get; set; }
/// <summary>
/// 可充电储能装置故障总数
/// </summary>
public byte AlarmBatteryOtherCount { get; set; }
/// <summary>
/// 可充电储能装置故障代码列表
/// </summary>
public List<int> AlarmBatteryOtherList { get; set; } = new List<int>();
/// <summary>
/// 驱动电机故障总数
/// </summary>
public byte AlarmElCount { get; set; }
/// <summary>
/// 驱动电机故障代码列表
/// </summary>
public List<int> AlarmElList { get; set; } = new List<int>();
/// <summary>
/// 发动机故障总数
/// </summary>
public byte AlarmEngineCount { get; set; }
/// <summary>
/// 发动机故障列表
/// </summary>
public List<int>AlarmEngineList { get; set; } = new List<int>();
/// <summary>
/// 其他故障总数
/// </summary>
public byte AlarmOtherCount { get; set; }
/// <summary>
/// 其他故障代码列表
/// </summary>
public List<int> AlarmOtherList { get; set; } = new List<int>();
}
}

+ 60
- 0
src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageProperty.cs 查看文件

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Text;
using GBNewEnergy.Protocol.Enums;

namespace GBNewEnergy.Protocol.NEProperties.NEUploadProperties
{
/// <summary>
/// 可充电储能装置电压数据
/// </summary>
public class NEUploadEnergyStorageProperty : NEUploadPropertyBase
{
public override NEInfoType NEInfoType => NEInfoType.可充电储能装置电压数据;

/// <summary>
/// 可充电储能子系统个数
/// </summary>
public byte BatteryAssemblyCount { get; set; }

/// <summary>
/// 可充电储能子系统电压信息列表
/// </summary>
public List<BatteryAssembly> BatteryAssemblyList { get; set; } = new List<BatteryAssembly>();

/// <summary>
/// 每个电池总成数据
/// </summary>
public class BatteryAssembly
{
/// <summary>
/// 可充电储能子系统号
/// </summary>
public byte BatteryAssemblyNo { get; set; }
/// <summary>
/// 可充电储能装置电压
/// </summary>
public double BatteryAssemblyVoltage { get; set; }
/// <summary>
/// 可充电储能装置电流
/// </summary>
public double BatteryAssemblyCurrent { get; set; }
/// <summary>
/// 单体电池总数
/// </summary>
public int SingleBatteryCount { get; set; }
/// <summary>
/// 本帧起始电池序号
/// </summary>
public int ThisSingleBatteryBeginNo { get; set; }
/// <summary>
/// /本帧单体电池总数
/// </summary>
public int ThisSingleBatteryBeginCount { get; set; }
/// <summary>
/// 单体电池电压
/// </summary>
public List<double> SingleBatteryVoltageList { get; set; } = new List<double>();
}
}
}

+ 43
- 0
src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageTemperatureProperty.cs 查看文件

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Text;
using GBNewEnergy.Protocol.Enums;

namespace GBNewEnergy.Protocol.NEProperties.NEUploadProperties
{
/// <summary>
/// 可充电储能装置温度数据
/// </summary>
public class NEUploadEnergyStorageTemperatureProperty : NEUploadPropertyBase
{
public override NEInfoType NEInfoType => NEInfoType.可充电储能装置温度数据;

/// <summary>
/// 动力蓄电池总成个数
/// </summary>
public byte BatteryAssemblyCount { get; set; }
/// <summary>
/// 每个可充电储能子系统温度信息长度
/// </summary>
public List<BatteryTemperature> BatteryAssemblyList { get; set; } = new List<BatteryTemperature>();

/// <summary>
/// 每个动力蓄电池上温度数据
/// </summary>
public class BatteryTemperature
{
/// <summary>
/// 可充电储能子系统号
/// </summary>
public byte BatteryAssemblyNo { get; set; }
/// <summary>
/// 可充电储能温度探针个数
/// </summary>
public int TemperatureProbeCount { get; set; }
/// <summary>
/// 可充电储能子系统各温度探针检测到的温度值
/// </summary>
public List<int> TemperatureList { get; set; } = new List<int>();
}
}
}

+ 10
- 1
src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadProperty.cs 查看文件

@@ -1,6 +1,7 @@
using GBNewEnergy.Protocol.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GBNewEnergy.Protocol.NEProperties.NEUploadProperties
@@ -12,6 +13,14 @@ namespace GBNewEnergy.Protocol.NEProperties.NEUploadProperties
{
public string VIN { get ; set; }

public NEUploadProperty(params NEUploadPropertyBase[] nEUploadPropertyBases)
{
if (nEUploadPropertyBases != null)
{
NEUploadPropertys = nEUploadPropertyBases.ToList();
}
}

public List<NEUploadPropertyBase> NEUploadPropertys { get; set; }
}
}

+ 35
- 0
src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs 查看文件

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace GBNewEnergy.Protocol.UpStream
{
/// <summary>
/// 实时信息上报
/// </summary>
public class NERealUploadUpStream : NEBodies
{
public NERealUploadUpStream(byte[] buffer, NEGlobalConfigs nEConfigs) : base(buffer, nEConfigs)
{
}

public NERealUploadUpStream(INEProperties nEProperties, NEGlobalConfigs nEConfigs) : base(nEProperties, nEConfigs)
{
}

protected override void InitializeProperties(INEProperties nEProperties)
{
throw new NotImplementedException();
}

protected override void InitializePropertiesFromBuffer()
{
throw new NotImplementedException();
}

protected override void ToBuffer()
{
throw new NotImplementedException();
}
}
}

Loading…
取消
儲存