Skip to content
Snippets Groups Projects
Commit 95f0af5d authored by Taya Snijder's avatar Taya Snijder
Browse files

fixed scalar string issues

parent daae688e
No related branches found
No related tags found
1 merge request!28Resolve #2021 "05 10 branched from master sdp update"
......@@ -51,6 +51,7 @@ class OPCUAConnection(CommClient):
fault_func()
return
# determine namespace used
try:
if type(namespace) is str:
......@@ -64,6 +65,7 @@ class OPCUAConnection(CommClient):
self.name_space_index = 2
self.obj = self.client.get_objects_node()
self.check_nodes()
def _servername(self):
return self.client.server_url.geturl()
......@@ -83,6 +85,21 @@ class OPCUAConnection(CommClient):
self.streams.error_stream("Could not connect to server %s: %s", self._servername(), e)
raise Exception("Could not connect to server %s", self._servername()) from e
def check_nodes(self):
"""
function purely for debugging/development only. Simply lists all top level nodes and the nodes below that
"""
for i in self.obj.get_children():
print(i.get_browse_name())
for j in i.get_children():
try:
print(j.get_browse_name(), j.get_data_type_as_variant_type())
except:
print(j.get_browse_name())
finally:
pass
def disconnect(self):
"""
......@@ -160,7 +177,6 @@ class OPCUAConnection(CommClient):
self.streams.debug_stream("connected OPC ua node {} of type {} to attribute with dimensions: {} x {} ".format(str(node_name)[:len(node_name)-1], str(ua_type)[len("VariantType."):], dim_x, dim_y))
except:
pass
# return the read/write functions
return prot_attr.read_function, prot_attr.write_function
......@@ -182,12 +198,17 @@ class ProtocolAttribute:
"""
value = numpy.array(self.node.get_value())
if self.dim_y != 0:
if self.dim_y + self.dim_x == 1:
return numpy.array([value])
elif self.dim_y != 0:
value = numpy.array(numpy.split(value, indices_or_sections=self.dim_y))
else:
value = numpy.array(value)
return value
def write_function(self, value):
"""
write_RW function
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment