mxpopstar
2022-05-03 e75ef5f04f61aa5fbd89fd5c413dcee1819b7a91
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
package com.dev.ntm.cmd;
 
import java.nio.ByteBuffer;
 
import com.dev.bts.data.FBS9100_ComBase;
 
public class NTM_TestData {
    private final int BYTE_LEN = 16;
    
    public int battgroup_cnt = 0;
    public int mon_cnt = 0;
    public double online_vol = 0;
    public double group_vol = 0;
    public byte[] test_starttime = new byte[6];
    public byte[] test_timelong = new byte[3];
    public byte button_stat = 0;
    public int monvol_lower_cnt = 0;
    public double batt_curr = 0;
    public double batt_cap = 0;
    
    public int mon_volmax_num = 0;
    public double mon_volmax = 0;
    public int mon_volmin_num = 0;
    public double mon_volmin = 0;
    
    public boolean putByteBuffer(final ByteBuffer bf) {
        if(bf.limit() < BYTE_LEN) {
            return false;
        }
        
        bf.position(0);
        online_vol = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        group_vol = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        for(int n=0; n<test_starttime.length; n++) {
            test_starttime[n] = bf.get();
        }
        for(int n=0; n<test_timelong.length; n++) {
            test_timelong[n] = bf.get();
        }
        button_stat = bf.get();
        monvol_lower_cnt = FBS9100_ComBase.changeShortToInt(bf.getShort());
        batt_curr = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        batt_cap = FBS9100_ComBase.changeShortToDouble(bf.getShort());
        mon_volmax_num = FBS9100_ComBase.changeShortToInt(bf.getShort());
        mon_volmax = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 1000;
        mon_volmin_num = FBS9100_ComBase.changeShortToInt(bf.getShort());
        mon_volmin = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 1000;
        
        return true;
    }
}