Skip to content

Commit

Permalink
Merge 741461d into f823265
Browse files Browse the repository at this point in the history
  • Loading branch information
RachelErin committed Oct 19, 2020
2 parents f823265 + 741461d commit c04efff
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions BAC0/core/io/Write.py
Expand Up @@ -295,9 +295,9 @@ def build_wpm_request(self, args, vendor_id=0, addr=None):
)
)

was = []
for each in args:
property_values = []
was = []
if isinstance(each, str):
obj_type, obj_inst, prop_id, value, priority, indx = self._parse_wp_args(
each
Expand All @@ -312,21 +312,31 @@ def build_wpm_request(self, args, vendor_id=0, addr=None):
obj_type, prop_id, indx, vendor_id, value
)

property_values.append(
PropertyValue(
propertyIdentifier=prop_id,
propertyArrayIndex=indx,
value=value,
priority=priority,
existingObject = next((obj for obj in was if obj.objectIdentifier == (obj_type, obj_inst)), None)

if existingObject == None:
property_values.append(
PropertyValue(
propertyIdentifier=prop_id,
propertyArrayIndex=indx,
value=value,
priority=priority,
)
)
)

was.append(
WriteAccessSpecification(
objectIdentifier=(obj_type, obj_inst),
listOfProperties=property_values,
was.append(
WriteAccessSpecification(
objectIdentifier=(obj_type, obj_inst),
listOfProperties=property_values,
)
)
)
else:
existingObject.listOfProperties.append(PropertyValue(
propertyIdentifier=prop_id,
propertyArrayIndex=indx,
value=value,
priority=priority,
))

datatype = get_datatype(obj_type, prop_id, vendor_id=vendor_id)

Expand Down

0 comments on commit c04efff

Please sign in to comment.