package com.whyc.mcp;
|
|
import com.whyc.util.ComBase;
|
|
import java.nio.ByteBuffer;
|
import java.util.Arrays;
|
|
public class MVolData {
|
public static final int BYTE_LEN = 1000;
|
|
public static final int MONOMER_COUNT_MAX = 500;
|
public float vol[];//单体电压 偏移20000 分辨率0.001V
|
public MVolData(int count) {
|
vol = new float[count];
|
}
|
public boolean puByteBuffer(ByteBuffer bf) {
|
bf.position(0);
|
if (bf.remaining() < vol.length * 2) {
|
return false;
|
}
|
for (int i = 0; i < vol.length; i++) {
|
//System.out.println(ComBase.changeShortToFloat(bf.getShort()));
|
vol[i] = ComBase.changeShortToFloat(bf.getShort()) * 0.001f;//单体电压 偏移20000 分辨率0.001V
|
}
|
bf.compact();
|
//System.out.println(this);
|
return true;
|
}
|
public String toString() {
|
return "MVolData [vol=" + Arrays.toString(vol) + "]";
|
}
|
}
|