diff --git a/lib/python/labcomm/LabComm.py b/lib/python/labcomm/LabComm.py index c4b353c63d7c73994249ab4ab6221276f3a4d121..b3b6dd6d8acef3124588fc0811bb97bab380e1eb 100644 --- a/lib/python/labcomm/LabComm.py +++ b/lib/python/labcomm/LabComm.py @@ -157,6 +157,8 @@ DEFAULT_VERSION = "LabComm2014" i_VERSION = 0x01 i_SAMPLE_DEF = 0x02 i_SAMPLE_REF = 0x03 +i_TYPE_DEF = 0x04 +i_TYPE_BINDING= 0x05 i_PRAGMA = 0x3f i_USER = 0x40 # ..0xffffffff @@ -829,6 +831,13 @@ class Decoder(Codec): for _ in xrange(length): self.decode_byte() + # kludge, should really check if the index exists in self.version + def skip_or_raise(self, length, index): + if usePacketLength(self.version): + self.skip(length) + else: + raise Exception("Invalid type index %d" % index) + def decode(self): while True: index = self.decode_type_number() @@ -847,6 +856,18 @@ class Decoder(Codec): elif index == i_SAMPLE_REF: decl = self.index_to_decl[index].decode_decl(self) value = None + elif index == i_TYPE_DEF: + self.skip_or_raise(length, index) + decl = None + value = None + elif index == i_TYPE_BINDING: + self.skip_or_raise(length, index) + decl = None + value = None + elif index == i_PRAGMA: + self.skip_or_raise(length, index) + decl = None + value = None elif index < i_USER: raise Exception("Invalid type index %d" % index) else: