DELL
2024-12-23 3f30fdfc73a3891579fa414feab2ca0927771aa5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package com.whyc.mcp;
 
import com.whyc.util.ComBase;
 
import java.nio.ByteBuffer;
import java.util.Arrays;
 
public class SYSMonitorState {
    public static final int BYTE_LEN = 46;
 
    public DateTime startDT;                        //启动放电的日期时间
    public DateTime stopDT;                            //终止放电的日期时间
    public TestTime     test_Time;                        //已测试时间(HMS)
    public int testState;                              //监测状态(MONITOR_STATE_)    //0:停止监测 1:放电监测 2:充电监测
    public int testType;                            //测试类型 0xFA:放电  0xFB:充电
    public int testGroupCount;                      //unused
    public int saveDataEN;                          //保存数据标识
    public int backUp;                              //reserved
    public int restTest_Time[] = new int[4];           //剩余容量可放电时间(HMS)
    public double testCap[] = new double[4];        //每组已测试容量 单位AH 显示一位小数
    public double groupCap[] = new double[4];        //每组实际容量 单位AH 显示一位小数
    public double groupRestCap[] = new double[4];    //每组剩余容量 单位AH 显示一位小数
 
    public int CRC;                                    //未使用
 
    public SYSMonitorState() {
        startDT = new DateTime();                        //启动放电的日期时间
        stopDT = new DateTime();                            //终止放电的日期时间
        test_Time = new TestTime();                        //已测试时间(HMS)
    }
 
    public boolean putByteBuffer(ByteBuffer bf) {
        //System.err.println("bf.remaining():"+bf.remaining());
        if(bf.remaining() < BYTE_LEN) {
            return false;
        }
        bf.position(0);
 
        startDT.setDateTime(bf);                            //启动放电的日期时间
        stopDT.setDateTime(bf);                                //终止放电的日期时间
        test_Time.setTestTime(bf);                            //已测试时间(HMS)
        testState = ComBase.changeByteToInt(bf.get());         //监测状态(MONITOR_STATE_)    //0:停止监测 1:放电监测 2:充电监测
        testType = ComBase.changeByteToInt(bf.get());       //测试类型 0xFA:放电  0xFB:充电
        testGroupCount = ComBase.changeByteToInt(bf.get()); //unused
        saveDataEN = ComBase.changeByteToInt(bf.get());        //保存数据标识
        backUp = ComBase.changeByteToInt(bf.get());                              //reserved
        for(int i=0;i<restTest_Time.length;i++) {
            restTest_Time[i] = bf.getInt();                    //剩余容量可放电时间(HMS)
        }
        for(int i=0;i<testCap.length;i++) {
            testCap[i] = bf.getDouble();                    //每组已测试容量 单位AH 显示一位小数
 
        }
 
        for(int i=0;i<groupCap.length;i++) {
            groupCap[i] = bf.getDouble();                    //每组实际容量 单位AH 显示一位小数
        }
 
        for(int i=0;i<groupRestCap.length;i++) {
            groupRestCap[i] = bf.getDouble();                //每组剩余容量 单位AH 显示一位小数
        }
 
        CRC = ComBase.changeShortToInt(bf.getShort());
        //System.out.println(this);
        return true;
    }
 
    @Override
    public String toString() {
        return "SYSMonitorState [startDT=" + startDT + ", stopDT=" + stopDT + ", test_Time=" + test_Time
                + ", testState=" + testState + ", testType=" + testType + ", testGroupCount=" + testGroupCount
                + ", saveDataEN=" + saveDataEN + ", backUp=" + backUp + ", restTest_Time="
                + Arrays.toString(restTest_Time) + ", testCap=" + Arrays.toString(testCap) + ", groupCap="
                + Arrays.toString(groupCap) + ", groupRestCap=" + Arrays.toString(groupRestCap) + ", CRC=" + CRC
                + "]";
    }
}