package com.dev.fgcd.data;
|
|
import java.nio.ByteBuffer;
|
import java.util.Arrays;
|
|
/**
|
* ÔÚÏßÄ£¿éÐÅÏ¢
|
* @author LiJun
|
*
|
*/
|
public class FGCD_OnlineInfo {
|
private final int BYTE_LEN = 24;
|
|
public double batt1_vol; //µç³Ø×é1µçѹ
|
public double batt2_vol; //µç³Ø×é2µçѹ
|
public int currBattNum; //µ±Ç°Ñ¡ÔñµÄµç³Ø×é;0:δѡÔñµç³Ø×é
|
public int endoscopeState; //ÄÚ¿ú¾µ×´Ì¬->0Í£Ö¹ÏÔʾ;1:¿ªÊ¼ÏÔʾ
|
public int backup[] = new int[14];
|
|
public boolean putByteBuffer(ByteBuffer bf) {
|
if(bf.limit()<BYTE_LEN) {
|
return false;
|
}
|
ByteBuffer tmpbuf = bf;
|
tmpbuf.position(0);
|
|
batt1_vol = bf.getFloat(); //µç³Ø×é1µçѹ
|
batt2_vol = bf.getFloat(); //µç³Ø×é2µçѹ
|
currBattNum = FGCD_ComBase.changeByteToInt(bf.get());
|
endoscopeState = FGCD_ComBase.changeByteToInt(bf.get());
|
for(int i = 0 ; i < backup.length ; i++) {
|
backup[i] = FGCD_ComBase.changeByteToInt(bf.get());
|
}
|
return true;
|
}
|
|
/**
|
* »ñÈ¡µ±Ç°Ñ¡ÖÐµç³Ø×éµÄ×é¶Ëµçѹ
|
* @return
|
*/
|
public double getGroupVol() {
|
double tmp_groupvol = 0;
|
if(this.currBattNum > 0) {
|
switch(this.currBattNum) {
|
case 0:tmp_groupvol = 0;break;
|
case 1:tmp_groupvol = batt1_vol;break;
|
case 2:tmp_groupvol = batt2_vol;break;
|
}
|
}
|
return tmp_groupvol;
|
}
|
|
|
@Override
|
public String toString() {
|
return "FGCD_OnlineInfo [BYTE_LEN=" + BYTE_LEN + ", batt1_vol=" + batt1_vol + ", batt2_vol=" + batt2_vol
|
+ ", currBattNum=" + currBattNum + ", endoscopeState=" + endoscopeState + ", backup="
|
+ Arrays.toString(backup) + "]";
|
}
|
|
}
|