(self, nodeid, attr)
| 642 | self._nodes = LazyLoadingDict(shelve.open(path, "r")) |
| 643 | |
| 644 | def get_attribute_value(self, nodeid, attr): |
| 645 | with self._lock: |
| 646 | self.logger.debug("get attr val: %s %s", nodeid, attr) |
| 647 | if nodeid not in self._nodes: |
| 648 | dv = ua.DataValue() |
| 649 | dv.StatusCode = ua.StatusCode(ua.StatusCodes.BadNodeIdUnknown) |
| 650 | return dv |
| 651 | node = self._nodes[nodeid] |
| 652 | if attr not in node.attributes: |
| 653 | self.logger.warning("Tried to read attribute '%s' in %s, but the attribute is missing", attr, nodeid) |
| 654 | dv = ua.DataValue() |
| 655 | dv.StatusCode = ua.StatusCode(ua.StatusCodes.BadAttributeIdInvalid) |
| 656 | return dv |
| 657 | attval = node.attributes[attr] |
| 658 | if attval.value_callback: |
| 659 | return attval.value_callback() |
| 660 | return attval.value |
| 661 | |
| 662 | def set_attribute_value(self, nodeid, attr, value): |
| 663 | with self._lock: |
no outgoing calls
no test coverage detected