From 1878778de688ccd67179d60c4f7e27dd67c48f25 Mon Sep 17 00:00:00 2001 From: SmallChi <564952747@qq.com> Date: Fri, 22 Jun 2018 17:50:49 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E4=BF=A1=E6=81=AF=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=A0=87=E5=BF=97=202.=E5=A2=9E=E5=8A=A0=E5=AE=9E?= =?UTF-8?q?=E6=97=B6=E4=BF=A1=E6=81=AF=E4=B8=8A=E6=8A=A5=EF=BC=88=E6=8A=A5?= =?UTF-8?q?=E8=AD=A6=E6=95=B0=E6=8D=AE=E3=80=81=E5=8F=AF=E5=85=85=E7=94=B5?= =?UTF-8?q?=E5=82=A8=E8=83=BD=E8=A3=85=E7=BD=AE=E7=94=B5=E5=8E=8B=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E3=80=81=E5=8F=AF=E5=85=85=E7=94=B5=E5=82=A8=E8=83=BD?= =?UTF-8?q?=E8=A3=85=E7=BD=AE=E6=B8=A9=E5=BA=A6=E6=95=B0=E6=8D=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/GBNewEnergy.Protocol/Enums/NEInfoType.cs | 5 +- src/GBNewEnergy.Protocol/NEBodiesFactory.cs | 83 ++++++++++--------- .../NEUploadAlarmProperty.cs | 60 ++++++++++++++ .../NEUploadEnergyStorageProperty.cs | 60 ++++++++++++++ ...EUploadEnergyStorageTemperatureProperty.cs | 43 ++++++++++ .../NEUploadProperties/NEUploadProperty.cs | 11 ++- .../UpStream/NERealUploadUpStream.cs | 35 ++++++++ 7 files changed, 253 insertions(+), 44 deletions(-) create mode 100644 src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadAlarmProperty.cs create mode 100644 src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageProperty.cs create mode 100644 src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageTemperatureProperty.cs create mode 100644 src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs diff --git a/src/GBNewEnergy.Protocol/Enums/NEInfoType.cs b/src/GBNewEnergy.Protocol/Enums/NEInfoType.cs index f8cf870..1b614e7 100644 --- a/src/GBNewEnergy.Protocol/Enums/NEInfoType.cs +++ b/src/GBNewEnergy.Protocol/Enums/NEInfoType.cs @@ -16,8 +16,9 @@ namespace GBNewEnergy.Protocol.Enums 车辆位置数据=0x05, 极值数据=0x06, 报警数据=0x07, - 终端数据预留=0x08, - 平台交换协议自定义数据=0x0A, + 可充电储能装置电压数据=0x08, + 可充电储能装置温度数据 = 0x09, + 平台交换协议自定义数据 =0x0A, 预留=0x30, 用户自定义=0x80 } diff --git a/src/GBNewEnergy.Protocol/NEBodiesFactory.cs b/src/GBNewEnergy.Protocol/NEBodiesFactory.cs index e9d0787..56853bf 100644 --- a/src/GBNewEnergy.Protocol/NEBodiesFactory.cs +++ b/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 - { - /// - /// 通过命令id获取数据体 - /// - /// - /// - /// - 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 + { + /// + /// 通过命令id获取数据体 + /// + /// + /// + /// + 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; + } + } + } +} diff --git a/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadAlarmProperty.cs b/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadAlarmProperty.cs new file mode 100644 index 0000000..706d3f8 --- /dev/null +++ b/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 +{ + /// + /// 报警数据 + /// + public class NEUploadAlarmProperty : NEUploadPropertyBase + { + public override NEInfoType NEInfoType => NEInfoType.报警数据; + + /// + /// 报警等级 + /// + public byte AlarmLevel { get; set; } + /// + /// 通用报警标志 + /// + public int AlarmBatteryFlag { get; set; } + /// + /// 报警没变化 0,有报警 1 + /// + public byte AlarmBatteryChanged { get; set; } + /// + /// 可充电储能装置故障总数 + /// + public byte AlarmBatteryOtherCount { get; set; } + /// + /// 可充电储能装置故障代码列表 + /// + public List AlarmBatteryOtherList { get; set; } = new List(); + /// + /// 驱动电机故障总数 + /// + public byte AlarmElCount { get; set; } + /// + /// 驱动电机故障代码列表 + /// + public List AlarmElList { get; set; } = new List(); + /// + /// 发动机故障总数 + /// + public byte AlarmEngineCount { get; set; } + /// + /// 发动机故障列表 + /// + public ListAlarmEngineList { get; set; } = new List(); + /// + /// 其他故障总数 + /// + public byte AlarmOtherCount { get; set; } + /// + /// 其他故障代码列表 + /// + public List AlarmOtherList { get; set; } = new List(); + } +} diff --git a/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageProperty.cs b/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageProperty.cs new file mode 100644 index 0000000..0541c0f --- /dev/null +++ b/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 +{ + /// + /// 可充电储能装置电压数据 + /// + public class NEUploadEnergyStorageProperty : NEUploadPropertyBase + { + public override NEInfoType NEInfoType => NEInfoType.可充电储能装置电压数据; + + /// + /// 可充电储能子系统个数 + /// + public byte BatteryAssemblyCount { get; set; } + + /// + /// 可充电储能子系统电压信息列表 + /// + public List BatteryAssemblyList { get; set; } = new List(); + + /// + /// 每个电池总成数据 + /// + public class BatteryAssembly + { + /// + /// 可充电储能子系统号 + /// + public byte BatteryAssemblyNo { get; set; } + /// + /// 可充电储能装置电压 + /// + public double BatteryAssemblyVoltage { get; set; } + /// + /// 可充电储能装置电流 + /// + public double BatteryAssemblyCurrent { get; set; } + /// + /// 单体电池总数 + /// + public int SingleBatteryCount { get; set; } + /// + /// 本帧起始电池序号 + /// + public int ThisSingleBatteryBeginNo { get; set; } + /// + /// /本帧单体电池总数 + /// + public int ThisSingleBatteryBeginCount { get; set; } + /// + /// 单体电池电压 + /// + public List SingleBatteryVoltageList { get; set; } = new List(); + } + } +} diff --git a/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageTemperatureProperty.cs b/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadEnergyStorageTemperatureProperty.cs new file mode 100644 index 0000000..9302658 --- /dev/null +++ b/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 +{ + /// + /// 可充电储能装置温度数据 + /// + public class NEUploadEnergyStorageTemperatureProperty : NEUploadPropertyBase + { + public override NEInfoType NEInfoType => NEInfoType.可充电储能装置温度数据; + + /// + /// 动力蓄电池总成个数 + /// + public byte BatteryAssemblyCount { get; set; } + /// + /// 每个可充电储能子系统温度信息长度 + /// + public List BatteryAssemblyList { get; set; } = new List(); + + /// + /// 每个动力蓄电池上温度数据 + /// + public class BatteryTemperature + { + /// + /// 可充电储能子系统号 + /// + public byte BatteryAssemblyNo { get; set; } + /// + /// 可充电储能温度探针个数 + /// + public int TemperatureProbeCount { get; set; } + /// + /// 可充电储能子系统各温度探针检测到的温度值 + /// + public List TemperatureList { get; set; } = new List(); + } + } +} diff --git a/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadProperty.cs b/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadProperty.cs index 17fdfc9..6cff296 100644 --- a/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadProperty.cs +++ b/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 NEUploadPropertys { get; set; } } } diff --git a/src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs b/src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs new file mode 100644 index 0000000..e7dabde --- /dev/null +++ b/src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace GBNewEnergy.Protocol.UpStream +{ + /// + /// 实时信息上报 + /// + 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(); + } + } +}