value info no longe exists
This commit is contained in:
parent
467f53cb72
commit
f4ab581ea3
@ -41,33 +41,6 @@ class Xml_reader:
|
||||
"""
|
||||
return [device.get("name") for device in self.root.findall('Device')]
|
||||
|
||||
def get_value_info(self,device_name: str) -> dict:
|
||||
"""returns the value information for a given device
|
||||
|
||||
Args:
|
||||
device_name (str): the name of a device
|
||||
|
||||
Returns:
|
||||
dict: {'type','unit','offset','factor'}
|
||||
|
||||
Raises:
|
||||
NameError: device_name will be checked against the config XML
|
||||
"""
|
||||
#check if a device exists in the config XML
|
||||
if self.root.find("Device[@name='%s']" % device_name) is None:
|
||||
raise NameError("unknown device %s" % device_name)
|
||||
value_info = self.root.find(
|
||||
"Device[@name='%s']/ValueInfo" % device_name)
|
||||
#format the output
|
||||
return {
|
||||
'type': value_info.get('type'),
|
||||
'unit': value_info.get('unit'),
|
||||
'offset': None if value_info.find("Offset") is None
|
||||
else value_info.find("Offset").text,
|
||||
'factor': None if value_info.find("Factor") is None
|
||||
else value_info.find("Factor").text,
|
||||
}
|
||||
|
||||
def get_port(self,device_name:str) -> dict:
|
||||
"""returns the information about a port of a given device
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user