Martin Kunz лет назад: 6
Родитель
Сommit
b45fccf1fe

+ 6 - 1
src/main/java/at/acdp/urweb/CountDataInputStream.java

@@ -44,9 +44,14 @@ public class CountDataInputStream {
         count+=4;
         return di.readFloat();
     }
+    public final int readUnsignedByte() throws IOException {
+        count+=1;
+        return di.readUnsignedByte();
+    }
+
 
 
-    public int getCount() {
+        public int getCount() {
         return count;
     }
 }

+ 9 - 0
src/main/java/at/acdp/urweb/sclient/SecondaryClient.java

@@ -52,6 +52,9 @@ public class SecondaryClient {
             case PackageType.JOINT_DATA:
                 readJointData(di, size);
                 break;
+            case PackageType.TOOL_DATA:
+                readToolData(di, size);
+                break;
             case PackageType.CARTESIAN_INFO:
                 readCartesianInfo(di, size);
                 break;
@@ -90,6 +93,12 @@ public class SecondaryClient {
         }
     }
 
+    private ToolData readToolData(CountDataInputStream di, int size) throws IOException {
+        ToolData td=new ToolData();
+        td.read(di, size);
+        return td;
+    }
+
     private ToolCommInfo readToolCommInfo(CountDataInputStream di, int size) throws IOException {
         ToolCommInfo tci=new ToolCommInfo();
         tci.read(di, size);

+ 7 - 5
src/main/java/at/acdp/urweb/sclient/data/ToolCommInfo.java

@@ -9,14 +9,16 @@ public class ToolCommInfo implements IRead {
     public boolean toolCommunicationEnabled;
     public int baudrate;
     public int parity;
-    public float rxIdleChars;
-    public float txIdleChars;
-
+    public int rxIdleChars; //TODO: geraten
+    public int txIdleChars;
+    public int whatever;
 
     public void read(CountDataInputStream di, int size) throws IOException {
+        toolCommunicationEnabled=di.readBoolean();
         baudrate=di.readInt();
         parity=di.readInt();
-        rxIdleChars=di.readFloat();
-        txIdleChars=di.readFloat();
+        rxIdleChars=di.readInt();
+        txIdleChars=di.readInt();
+        whatever=di.readInt();
     }
 }

+ 31 - 0
src/main/java/at/acdp/urweb/sclient/data/ToolData.java

@@ -0,0 +1,31 @@
+package at.acdp.urweb.sclient.data;
+
+import at.acdp.urweb.CountDataInputStream;
+
+import java.io.IOException;
+
+public class ToolData implements IRead{
+
+    int		analogInputRange0;
+    int		analogInputRange1;
+    double		analogInput0;
+    double		analogInput1;
+    float		toolVoltage48V;
+    int		toolOutputVoltage;
+    float		toolCurrent;
+    float		toolTemperature;
+    int		toolMode;
+
+    @Override
+    public void read(CountDataInputStream di, int size) throws IOException {
+        analogInputRange0=di.readUnsignedByte();
+        analogInputRange1=di.readUnsignedByte();
+        analogInput0=di.readDouble();
+        analogInput1=di.readDouble();
+        toolVoltage48V=di.readFloat();
+        toolOutputVoltage=di.readUnsignedByte();
+        toolCurrent=di.readFloat();
+        toolTemperature=di.readFloat();
+        toolMode=di.readUnsignedByte();
+    }
+}