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.
57 lines
1.4 KiB
57 lines
1.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace BatCharging.Model
|
|
{
|
|
public class SetPeakValleyTime : ASDU
|
|
{
|
|
/// <summary>
|
|
/// 时段个数
|
|
/// </summary>
|
|
public byte Count { get; set; }
|
|
/// <summary>
|
|
/// 时段 开始时间
|
|
/// </summary>
|
|
public List<PeakVallyTime> PeakVallyTimes { get; set; }
|
|
|
|
public SetPeakValleyTime(byte count, List<PeakVallyTime> peakVallyTimes)
|
|
{
|
|
this.Count = count;
|
|
this.PeakVallyTimes = peakVallyTimes;
|
|
//TODO BCD处理
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public class PeakVallyTime
|
|
{
|
|
public byte StartHour { get; set; }
|
|
public byte StartMinute { get; set; }
|
|
public byte Type { get; set; }
|
|
|
|
public PeakVallyTime(byte startHour, byte startMinute, byte type)
|
|
{
|
|
this.StartHour = startHour;
|
|
this.StartMinute = startMinute;
|
|
this.Type = type;
|
|
}
|
|
|
|
public byte[] GetBcd()
|
|
{
|
|
byte[] bytes = new byte[2];
|
|
int startHourTen = StartHour / 10;
|
|
int startHour = StartHour % 10;
|
|
|
|
bytes[0] = Convert.ToByte(startHourTen << 4 + startHour);
|
|
|
|
int startMinuteTen = StartMinute / 10;
|
|
int startMinute = StartMinute % 10;
|
|
|
|
bytes[1] = Convert.ToByte(startMinuteTen << 4 + startMinute);
|
|
|
|
return bytes;
|
|
}
|
|
}
|
|
}
|