def decode_control(self, encoded): sc = StringCodec(encoded) code = sc.read_uint16() cls = CONTROLS[code] ctl = cls() sc.read_fields(ctl) return ctl
def decode_command(self, encoded): sc = StringCodec(encoded) code = sc.read_uint16() cls = COMMANDS[code] hdr = sc.read_compound(Header) cmd = cls() sc.read_fields(cmd) cmd.sync = hdr.sync return cmd