Core method don't return data but modify response object.

This commit is contained in:
Mikaël Ates 2013-10-08 11:45:31 +02:00
parent ae0221349a
commit cdf48d400f
3 changed files with 12 additions and 14 deletions

View File

@ -54,4 +54,4 @@ def inventory(response):
else:
raise MalformedDataError('Data content is malformed.')
tags.append(tag)
return tags
response.processed_data = tags

View File

@ -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

View File

@ -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):