Commit 713dd66b authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

merge from master

parents 0ebaa10d 59729683
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define CURRENT_VERSION "LabComm20141009" #define CURRENT_VERSION "LabComm2014"
#include <errno.h> #include <errno.h>
#include "labcomm.h" #include "labcomm.h"
......
...@@ -2,7 +2,7 @@ namespace se.lth.control.labcomm { ...@@ -2,7 +2,7 @@ namespace se.lth.control.labcomm {
public class Constant { public class Constant {
public const string CURRENT_VERSION = "LabComm20141009"; public const string CURRENT_VERSION = "LabComm2014";
/* /*
* Allowed packet tags * Allowed packet tags
......
...@@ -14,13 +14,13 @@ MODULES=Constant \ ...@@ -14,13 +14,13 @@ MODULES=Constant \
Writer \ Writer \
WriterWrapper WriterWrapper
all: labcomm.jar labcomm20141009.jar labcomm2006.jar all: labcomm.jar labcomm2014.jar labcomm2006.jar
labcomm.jar: gen/JAVAC labcomm.jar: gen/JAVAC
echo $@ echo $@
cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class se/lth/control/labcomm2006/*.class cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class se/lth/control/labcomm2006/*.class
labcomm20141009.jar: gen/JAVAC labcomm2014.jar: gen/JAVAC
echo $@ echo $@
cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class
...@@ -39,5 +39,5 @@ gen/JAVAC: $(MODULES:%=se/lth/control/labcomm/%.java) $(MODULES:%=se/lth/control ...@@ -39,5 +39,5 @@ gen/JAVAC: $(MODULES:%=se/lth/control/labcomm/%.java) $(MODULES:%=se/lth/control
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf labcomm.jar labcomm2006.jar labcomm20141009.jar gen rm -rf labcomm.jar labcomm2006.jar labcomm2014.jar gen
...@@ -2,7 +2,7 @@ package se.lth.control.labcomm; ...@@ -2,7 +2,7 @@ package se.lth.control.labcomm;
public class Constant { public class Constant {
public static final String CURRENT_VERSION = "LabComm20141009"; public static final String CURRENT_VERSION = "LabComm2014";
/* /*
* Allowed packet tags * Allowed packet tags
......
...@@ -134,7 +134,7 @@ public class DecoderChannel implements Decoder { ...@@ -134,7 +134,7 @@ public class DecoderChannel implements Decoder {
} }
/** /**
method for API harmonization with labcomm20141009. method for API harmonization with labcomm2014.
Labcomm2006 encodes lengths etc as 32 bit ints. Labcomm2006 encodes lengths etc as 32 bit ints.
*/ */
public int decodePacked32() throws IOException { public int decodePacked32() throws IOException {
......
...@@ -81,7 +81,7 @@ public class EncoderChannel implements Encoder { ...@@ -81,7 +81,7 @@ public class EncoderChannel implements Encoder {
} }
/** /**
method for API harmonization with labcomm20141009. method for API harmonization with labcomm2014.
Labcomm2006 encodes lengths etc as 32 bit ints. Labcomm2006 encodes lengths etc as 32 bit ints.
*/ */
public void encodePacked32(long value) throws IOException { public void encodePacked32(long value) throws IOException {
......
#!/usr/bin/python #!/usr/bin/python
# #
# LabComm20141009 packet has the following layout # LabComm2014 packet has the following layout
# #
# +----+----+----+----+ # +----+----+----+----+
# | id (packed32) # | id (packed32)
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# | ... # | ...
# +----+-- # +----+--
# #
# LabComm220141009 SAMPLE_DEF: # LabComm2014 SAMPLE:
# #
# +----+----+----+----+ # +----+----+----+----+
# | id = 0x02 (packed32) # | id = 0x02 (packed32)
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
# | ... # | ...
# +----+-- # +----+--
# #
# LabComm220141009 TYPE_DEF: (as SAMPLE_DEF, but signatures are hierarchical, # LabComm2014 TYPE_DEF: (as SAMPLE_DEF, but signatures are hierarchical,
# i.e., may contain references to other types # i.e., may contain references to other types
# #
# +----+----+----+----+ # +----+----+----+----+
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
# | ... # | ...
# +----+-- # +----+--
# #
# LabComm220141009 TYPE_BINDING # LabComm2014 TYPE_BINDING
# #
# +----+----+----+----+ # +----+----+----+----+
# | id = 0x04 (packed32) # | id = 0x04 (packed32)
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
# | type number (packed32) # | type number (packed32)
# +----+----+----+----+ # +----+----+----+----+
# #
# LabComm20141009 User data: # LabComm2014 User data:
# #
# +----+----+----+----+ # +----+----+----+----+
# | id >= 0x00000040 (packed32) # | id >= 0x00000040 (packed32)
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
import types import types
import struct as packer import struct as packer
DEFAULT_VERSION = "LabComm20141009" DEFAULT_VERSION = "LabComm2014"
# Allowed packet tags # Allowed packet tags
i_VERSION = 0x01 i_VERSION = 0x01
...@@ -177,7 +177,7 @@ i_STRING = 0x27 ...@@ -177,7 +177,7 @@ i_STRING = 0x27
# Version testing # Version testing
def usePacketLength(version): def usePacketLength(version):
return version in [ None, "LabComm20141009" ] return version in [ None, "LabComm2014" ]
class length_encoder: class length_encoder:
def __init__(self, encoder): def __init__(self, encoder):
...@@ -619,7 +619,7 @@ class Encoder(Codec): ...@@ -619,7 +619,7 @@ class Encoder(Codec):
super(Encoder, self).__init__() super(Encoder, self).__init__()
self.writer = writer self.writer = writer
self.version = version self.version = version
if self.version in [ "LabComm20141009" ]: if self.version in [ "LabComm2014" ]:
self.encode_type(i_VERSION) self.encode_type(i_VERSION)
with length_encoder(self) as e: with length_encoder(self) as e:
e.encode_string(version) e.encode_string(version)
...@@ -654,7 +654,7 @@ class Encoder(Codec): ...@@ -654,7 +654,7 @@ class Encoder(Codec):
decl.encode_decl(self) decl.encode_decl(self)
def encode_packed32(self, v): def encode_packed32(self, v):
if self.version in [ None, "LabComm20141009" ]: if self.version in [ None, "LabComm2014" ]:
v = v & 0xffffffff v = v & 0xffffffff
tmp = [ v & 0x7f ] tmp = [ v & 0x7f ]
v = v >> 7 v = v >> 7
...@@ -771,7 +771,7 @@ class Decoder(Codec): ...@@ -771,7 +771,7 @@ class Decoder(Codec):
return result return result
def decode_packed32(self): def decode_packed32(self):
if self.version in [ "LabComm2013", "LabComm20141009" ] : if self.version in [ "LabComm2013", "LabComm2014" ] :
result = 0 result = 0
while True: while True:
tmp = self.decode_byte() tmp = self.decode_byte()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment