Revert "support name mangling for parameter/command names"
This reverts commit 99bdafdd0c3293d17e3f23508d2b7762804474e7.
This commit is contained in:
parent
f7576cf541
commit
1b4865c608
@ -457,7 +457,8 @@ class SecopClient(ProxyClient):
|
||||
modules = data['modules']
|
||||
self.modules = {}
|
||||
self.properties = {k: v for k, v in data.items() if k != 'modules'}
|
||||
self.identifier = defaultdict(dict) # dict <mod name> of dict <internal name> of <secop ident>
|
||||
self.identifier = {} # map (module, parameter) -> identifier
|
||||
self.internal = {} # map identifier -> (module, parameter)
|
||||
for modname, moddescr in modules.items():
|
||||
# separate accessibles into command and parameters
|
||||
parameters = {}
|
||||
@ -468,7 +469,8 @@ class SecopClient(ProxyClient):
|
||||
datatype = get_datatype(aentry['datainfo'], iname)
|
||||
aentry = dict(aentry, datatype=datatype)
|
||||
ident = '%s:%s' % (modname, aname)
|
||||
self.identifier[modname][iname] = ident
|
||||
self.identifier[modname, iname] = ident
|
||||
self.internal[ident] = modname, iname
|
||||
if datatype.IS_COMMAND:
|
||||
commands[iname] = aentry
|
||||
else:
|
||||
@ -476,11 +478,6 @@ class SecopClient(ProxyClient):
|
||||
properties = {k: v for k, v in moddescr.items() if k != 'accessibles'}
|
||||
self.modules[modname] = dict(accessibles=accessibles, parameters=parameters,
|
||||
commands=commands, properties=properties)
|
||||
self.fix_internal_names()
|
||||
# invert self.identifier
|
||||
self.internal = {ident: (modname, iname)
|
||||
for modname, identdict in self.identifier.items()
|
||||
for iname, ident in identdict.items()}
|
||||
if changed_modules is not None:
|
||||
done = done_main = self.callback(None, 'descriptiveDataChange', None, self)
|
||||
for mname in changed_modules:
|
||||
@ -537,7 +534,7 @@ class SecopClient(ProxyClient):
|
||||
def readParameter(self, module, parameter):
|
||||
"""forced read over connection"""
|
||||
try:
|
||||
self.request(READREQUEST, self.identifier[module][parameter])
|
||||
self.request(READREQUEST, self.identifier[module, parameter])
|
||||
except secop.errors.SECoPError:
|
||||
# error reply message is already stored as readerror in cache
|
||||
pass
|
||||
@ -556,7 +553,7 @@ class SecopClient(ProxyClient):
|
||||
self.connect() # make sure we are connected
|
||||
datatype = self.modules[module]['parameters'][parameter]['datatype']
|
||||
value = datatype.export_value(value)
|
||||
self.request(WRITEREQUEST, self.identifier[module][parameter], value)
|
||||
self.request(WRITEREQUEST, self.identifier[module, parameter], value)
|
||||
return self.cache[module, parameter]
|
||||
|
||||
def execCommand(self, module, command, argument=None):
|
||||
@ -568,7 +565,7 @@ class SecopClient(ProxyClient):
|
||||
if argument is not None:
|
||||
raise secop.errors.BadValueError('command has no argument')
|
||||
# pylint: disable=unsubscriptable-object
|
||||
data, qualifiers = self.request(COMMANDREQUEST, self.identifier[module][command], argument)[2]
|
||||
data, qualifiers = self.request(COMMANDREQUEST, self.identifier[module, command], argument)[2]
|
||||
datatype = self.modules[module]['commands'][command]['datatype'].result
|
||||
if datatype:
|
||||
data = datatype.import_value(data)
|
||||
@ -590,6 +587,3 @@ class SecopClient(ProxyClient):
|
||||
if name.startswith('_') and name[1:] not in self.PREDEFINED_NAMES:
|
||||
return name[1:]
|
||||
return name
|
||||
|
||||
def fix_internal_names(self):
|
||||
"""fix forbidden items"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user