package com.whyc.abe;
|
|
import com.whyc.constant.Com;
|
import com.whyc.constant.ComBase;
|
|
import java.nio.ByteBuffer;
|
import java.util.Date;
|
|
/**
|
* 充电/放电结束结构体
|
* @author LiJun
|
*
|
*/
|
public class ABETestDataHeadStop implements ABEDataHeadStop{
|
public static final int BYTE_LEN = 18;
|
|
|
public ABECtDataTime startDT; //启动放电的日期时间
|
public ABECtDataTime stopDT; //终止放电的日期时间
|
public ABETestTime test_Time; //已测试时间(HMS)
|
public int testState; //测试状态(停止/暂停/放电)
|
public int testType; //测试类型(放电/充电)
|
public int testGroupNum; //被测试电池组编号(1~4)
|
|
public Date testStartTime; //测试开始时间
|
public Date testStopTime; //测试结束时间
|
public long testTimeLong; //测试时长
|
|
public ABETestDataHeadStop() {
|
startDT = new ABECtDataTime();
|
stopDT = new ABECtDataTime();
|
test_Time = new ABETestTime();
|
testStartTime = new Date();
|
testStopTime = new Date();
|
}
|
|
@Override
|
public boolean setDataInf(ByteBuffer bf) {
|
//System.out.println("bf.limit"+bf.remaining());
|
if(bf.limit() < BYTE_LEN) {
|
return false;
|
}
|
startDT.year = ComBase.changeByteToInt(bf.get());
|
startDT.month = ComBase.changeByteToInt(bf.get());
|
startDT.day = ComBase.changeByteToInt(bf.get());
|
startDT.hour = ComBase.changeByteToInt(bf.get());
|
startDT.minute = ComBase.changeByteToInt(bf.get());
|
startDT.second = ComBase.changeByteToInt(bf.get());
|
|
stopDT.year = ComBase.changeByteToInt(bf.get());
|
stopDT.month = ComBase.changeByteToInt(bf.get());
|
stopDT.day = ComBase.changeByteToInt(bf.get());
|
stopDT.hour = ComBase.changeByteToInt(bf.get());
|
stopDT.minute = ComBase.changeByteToInt(bf.get());
|
stopDT.second = ComBase.changeByteToInt(bf.get());
|
|
test_Time.hour = ComBase.changeByteToInt(bf.get());
|
test_Time.minute = ComBase.changeByteToInt(bf.get());
|
test_Time.second = ComBase.changeByteToInt(bf.get());
|
|
testState = ComBase.changeByteToInt(bf.get());
|
testType = ComBase.changeByteToInt(bf.get());
|
testGroupNum = ComBase.changeByteToInt(bf.get());
|
|
testTimeLong = test_Time.calTestTimeLong();
|
testStartTime = startDT.getFBSDateTime();
|
testStopTime = stopDT.getFBSDateTime();
|
|
//System.out.println(test_Time.hour+":"+test_Time.minute+":"+test_Time.second);
|
//System.out.println(this);
|
return true;
|
}
|
|
@Override
|
public String toString() {
|
return "ABETestDataHeadStop [startDT=" + startDT + ", stopDT=" + stopDT + ", test_Time=" + test_Time
|
+ ", testState=" + testState + ", testType=" + testType + ", testGroupNum=" + testGroupNum
|
+ ", testStartTime=" + Com.getDateTimeFormat(testStartTime, Com.DTF_YMDhms) + ", testStopTime=" + Com.getDateTimeFormat(testStopTime, Com.DTF_YMDhms) + ", testTimeLong="
|
+ testTimeLong + "]";
|
}
|
|
|
}
|