diff --git a/core_standard.py b/core_standard.py index a420be2..2e7e425 100644 --- a/core_standard.py +++ b/core_standard.py @@ -54,4 +54,4 @@ def inventory(response): else: raise MalformedDataError('Data content is malformed.') tags.append(tag) - return tags + response.processed_data = tags diff --git a/models.py b/models.py index f947429..9bfea4d 100644 --- a/models.py +++ b/models.py @@ -306,23 +306,21 @@ class Response(): raise UnknownResponseErrorType('Unknown type %s' % self.status_type.encode('hex')) self.time = None + self.processed_data = None if self.data: self.process_data() def process_data(self): - self.processed_data = None - if self.data and self.command.command_name: + try: core_method_name = self.command.command_name.lower() - try: - module = None - if isinstance(self.command, ReaderCommand): - module = self.command.reader.core - else: - module = core_standard - core_method = getattr(module, core_method_name) - self.processed_data = core_method(self) - except Exception, err: - pass + module = None + if isinstance(self.command, ReaderCommand): + module = self.command.reader.core + else: + module = core_standard + getattr(module, core_method_name)(self) + except Exception, e: + pass def pretty_print(self): display = None diff --git a/stid_readers/core.py b/stid_readers/core.py index e7d991b..12e3320 100644 --- a/stid_readers/core.py +++ b/stid_readers/core.py @@ -47,7 +47,7 @@ def get_rfsettings(response): logic_port['PowerAnt'] = (power_ant_nb >> 4) / 10 #[0E6h ≤ PowerAnt ≤ 136h] soit [23 dBm ≤ PowerAnt ≤ 31 dBm] (URF) logic_ports.append(logic_port) - return logic_ports + response.processed_data = logic_ports def set_rfsettings(command):