|
@@ -34,7 +34,7 @@ public class SecondaryClient {
|
|
|
return vm;
|
|
|
}
|
|
|
|
|
|
- public void readReply(CountDataInputStream di) throws IOException {
|
|
|
+ public int readReply(CountDataInputStream di, boolean isSub) throws IOException {
|
|
|
int beforeCount=di.getCount();
|
|
|
int size = di.readInt(); //4
|
|
|
int pType = di.readByte() & 0xff; //+1=5
|
|
@@ -91,8 +91,6 @@ public class SecondaryClient {
|
|
|
var tci=readToolCommInfo(di, size);
|
|
|
log.info(tci.toString());
|
|
|
break;
|
|
|
-
|
|
|
-
|
|
|
default:
|
|
|
log.warn("unknown ptype: "+pType+", size: "+size);
|
|
|
byte[] pack=new byte[size-5];
|
|
@@ -103,6 +101,7 @@ public class SecondaryClient {
|
|
|
if(diff!=0) {
|
|
|
log.warn("size mismatch: " +diff + "package type: "+pType);
|
|
|
}
|
|
|
+ return size;
|
|
|
}
|
|
|
|
|
|
private MasterBoardData readMasterBoardData(CountDataInputStream di, int size) throws IOException {
|
|
@@ -164,15 +163,9 @@ public class SecondaryClient {
|
|
|
}
|
|
|
|
|
|
void readRobotState(CountDataInputStream di, int size) throws IOException {
|
|
|
- long ts = di.readLong();
|
|
|
- char source = (char) (di.readByte() & 0xFF);
|
|
|
- char robotMessageType = (char) (di.readByte() & 0xFF);
|
|
|
- switch (robotMessageType) {
|
|
|
- default:
|
|
|
- log.info("unknown msg: " + (int)robotMessageType);
|
|
|
- byte[] buf = new byte[size - 10];
|
|
|
- di.readFully(buf);
|
|
|
- }
|
|
|
+ int remaining=size-5;
|
|
|
+ while(remaining>0)
|
|
|
+ remaining-=readReply(di, true);
|
|
|
}
|
|
|
|
|
|
CartesianInfo readCartesianInfo(CountDataInputStream di, int size) throws IOException {
|
|
@@ -229,6 +222,6 @@ public class SecondaryClient {
|
|
|
}
|
|
|
|
|
|
public void readPackage() throws IOException {
|
|
|
- readReply(in);
|
|
|
+ readReply(in, false);
|
|
|
}
|
|
|
}
|