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