diff --git a/src/GBNewEnergy.Protocol/DownStream/NEControlDownStream.cs b/src/GBNewEnergy.Protocol/DownStream/NEControlDownStream.cs index 2702f58..56e1e3a 100644 --- a/src/GBNewEnergy.Protocol/DownStream/NEControlDownStream.cs +++ b/src/GBNewEnergy.Protocol/DownStream/NEControlDownStream.cs @@ -1,35 +1,35 @@ using GBNewEnergy.Protocol.Enums; -using GBNewEnergy.Protocol.Extensions; -using GBNewEnergy.Protocol.NEProperties; -using System; -using System.Collections.Generic; -using System.Text; - -namespace GBNewEnergy.Protocol.DownStream -{ - /// - /// 车载终端控制命令 - /// - public class NEControlDownStream : NEBodies - { - public NEControlDownStream(byte[] buffer, NEGlobalConfigs nEConfigs) : base(buffer, nEConfigs) - { - } - - public NEControlDownStream(INEProperties nEProperties, NEGlobalConfigs nEConfigs) : base(nEProperties, nEConfigs) - { +using GBNewEnergy.Protocol.Extensions; +using GBNewEnergy.Protocol.NEProperties; +using System; +using System.Collections.Generic; +using System.Text; + +namespace GBNewEnergy.Protocol.DownStream +{ + /// + /// 车载终端控制命令 + /// + public class NEControlDownStream : NEBodies + { + public NEControlDownStream(byte[] buffer, NEGlobalConfigs nEConfigs) : base(buffer, nEConfigs) + { + } + + public NEControlDownStream(INEProperties nEProperties, NEGlobalConfigs nEConfigs) : base(nEProperties, nEConfigs) + { } - /// - /// 命令ID 只能发送一个 + /// + /// 命令ID 只能发送一个 /// public NEControlCmd CmdID { get; set; } /// /// 命令参数 没有内容则内容为空 /// - public string CmdParameter { get; set; } - protected override void InitializeProperties(INEProperties nEProperties) + public string CmdParameter { get; set; } + protected override void InitializeProperties(INEProperties nEProperties) { - NEControlProperty nEControlProperty = (NEControlProperty)nEProperties; + NEControlProperty nEControlProperty = (NEControlProperty)nEProperties; CmdID = nEControlProperty.CmdID; if (CmdID == NEControlCmd.remoteupdate) { @@ -38,13 +38,13 @@ namespace GBNewEnergy.Protocol.DownStream else if(CmdID == NEControlCmd.warning) { CmdParameter = nEControlProperty.AlarmParameter.nEAlarmLevel.ToString(); - } - } - - protected override void InitializePropertiesFromBuffer() - { - CurrentDateTime = Buffer.ReadDateTimeLittle(0, 6); - CmdID = (NEControlCmd)Buffer[6]; + } + } + + protected override void InitializePropertiesFromBuffer() + { + CurrentDateTime = Buffer.ReadDateTimeLittle(0, 6); + CmdID = (NEControlCmd)Buffer[6]; switch (CmdID) { case NEControlCmd.remoteupdate: @@ -61,12 +61,12 @@ namespace GBNewEnergy.Protocol.DownStream case NEControlCmd.OpenMonitoring: default: break; - } - } - - - protected override void ToBuffer() - { + } + } + + + protected override void ToBuffer() + { if (CmdID == NEControlCmd.remoteupdate) { var contentLength = NEConfigs.NEEncoding.GetBytes(CmdParameter).Length; @@ -86,7 +86,7 @@ namespace GBNewEnergy.Protocol.DownStream Buffer = new byte[6 + 1]; Buffer.WriteLittle(CurrentDateTime, 0, 6); Buffer.WriteLittle(CmdID.ToByteValue(), 6); - } - } - } -} + } + } + } +} diff --git a/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadDrivenElectricalProperty.cs b/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadDrivenElectricalProperty.cs index 1d84b91..37a685a 100644 --- a/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadDrivenElectricalProperty.cs +++ b/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadDrivenElectricalProperty.cs @@ -20,44 +20,44 @@ namespace GBNewEnergy.Protocol.NEProperties.NEUploadProperties /// 电机信息集合 /// public IEnumerable ElectricalList { get; set; } - } - /// - /// 电机信息 - /// - public class ElectricalInfo - { - /// - /// 电机序号 - /// - public byte ElNo { get; set; } - /// - /// 电机状态 - /// - public byte ElStatus { get; set; } - /// - /// 电机控制器温度 - /// - public int ElControlTemp { get; set; } /// - /// 电机转速 - /// - public int ElSpeed { get; set; } - /// - /// 电机转矩 - /// - public double ElTorque { get; set; } - /// - /// 电机温度 - /// - public int ElTemp { get; set; } - /// - /// 电机电压 - /// - public double ElVoltage { get; set; } - /// - /// 电机母线电流 - /// - public double ElCurrent { get; set; } + /// 电机信息 + /// + public class ElectricalInfo + { + /// + /// 电机序号 + /// + public byte ElNo { get; set; } + /// + /// 电机状态 + /// + public byte ElStatus { get; set; } + /// + /// 电机控制器温度 + /// + public int ElControlTemp { get; set; } + /// + /// 电机转速 + /// + public int ElSpeed { get; set; } + /// + /// 电机转矩 + /// + public double ElTorque { get; set; } + /// + /// 电机温度 + /// + public int ElTemp { get; set; } + /// + /// 电机电压 + /// + public double ElVoltage { get; set; } + /// + /// 电机母线电流 + /// + public double ElCurrent { get; set; } + } } } diff --git a/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadProperty.cs b/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadProperty.cs index 6cff296..f31683d 100644 --- a/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadProperty.cs +++ b/src/GBNewEnergy.Protocol/NEProperties/NEUploadProperties/NEUploadProperty.cs @@ -13,11 +13,11 @@ namespace GBNewEnergy.Protocol.NEProperties.NEUploadProperties { public string VIN { get ; set; } - public NEUploadProperty(params NEUploadPropertyBase[] nEUploadPropertyBases) + public NEUploadProperty(params NEUploadPropertyBase[] NEUploadPropertyBase) { - if (nEUploadPropertyBases != null) + if (NEUploadPropertyBase != null) { - NEUploadPropertys = nEUploadPropertyBases.ToList(); + NEUploadPropertys = NEUploadPropertyBase.ToList(); } } diff --git a/src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs b/src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs index e7dabde..db8217a 100644 --- a/src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs +++ b/src/GBNewEnergy.Protocol/UpStream/NERealUploadUpStream.cs @@ -1,4 +1,5 @@ -using System; +using GBNewEnergy.Protocol.NEProperties.NEUploadProperties; +using System; using System.Collections.Generic; using System.Text; @@ -17,9 +18,11 @@ namespace GBNewEnergy.Protocol.UpStream { } + public NEUploadProperty NEUploadProperty { get;private set; } + protected override void InitializeProperties(INEProperties nEProperties) { - throw new NotImplementedException(); + NEUploadProperty = (NEUploadProperty)nEProperties; } protected override void InitializePropertiesFromBuffer()