Core method don't return data but modify response object.
This commit is contained in:
parent
ae0221349a
commit
cdf48d400f
|
@ -54,4 +54,4 @@ def inventory(response):
|
|||
else:
|
||||
raise MalformedDataError('Data content is malformed.')
|
||||
tags.append(tag)
|
||||
return tags
|
||||
response.processed_data = tags
|
||||
|
|
22
models.py
22
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
|
||||
|
|
|
@ -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):
|
||||
|
|
Reference in New Issue