You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BatCharging.Model;
namespace BatCharging.Service
{
/// <summary>
/// 3.4.2 充放电机应答站功率调节指令
/// </summary>
public class PowerRegulateDecoder
{
/// <summary>
/// 解包1 应答结果 BIN 1字节 0: 成功 1失败
///2 失败原因 BIN 1字节 0正常 1参数非法 2双向充电设备放电中 0xFF:其他原因
/// </summary>
/// <param name="msgRecv">接收到字节数组</param>
/// <returns>/returns>
public PowerRegulateResult GetPowerRegulateResult(byte[] msgRecv)
{
PowerRegulateResult msgResult = null;
if (msgRecv != null)
{
int num = msgRecv.Length;
if (num >= 27)
{
msgResult = new PowerRegulateResult
{
ResponseResults = msgRecv[25],
FailurReason = msgRecv[26],
};
}
}
return msgResult;
}
}
}