|
|
@@ -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 |
|
|
|
{ |
|
|
|
/// <summary> |
|
|
|
/// 车载终端控制命令 |
|
|
|
/// </summary> |
|
|
|
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
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// 车载终端控制命令
|
|
|
|
/// </summary>
|
|
|
|
public class NEControlDownStream : NEBodies
|
|
|
|
{
|
|
|
|
public NEControlDownStream(byte[] buffer, NEGlobalConfigs nEConfigs) : base(buffer, nEConfigs)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public NEControlDownStream(INEProperties nEProperties, NEGlobalConfigs nEConfigs) : base(nEProperties, nEConfigs)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary> |
|
|
|
/// 命令ID 只能发送一个 |
|
|
|
/// <summary>
|
|
|
|
/// 命令ID 只能发送一个
|
|
|
|
/// </summary>
|
|
|
|
public NEControlCmd CmdID { get; set; }
|
|
|
|
/// <summary>
|
|
|
|
/// 命令参数 没有内容则内容为空
|
|
|
|
/// </summary>
|
|
|
|
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);
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|