def __composition_data_status_handler(self, opcode, message): page = message.data[0] data = message.data[1:] data = mt.CompositionData().unpack(data) node = self.node_get(message.meta["src"]) node.cid = data["cid"] node.pid = data["pid"] node.vid = data["vid"] node.crpl = data["crpl"] node.features = mt.NodeFeatures(**data["features"]) node.elements = data["elements"] self.db_save() self.logger.info("Received composition data (page 0x%02x): %s", page, json.dumps(data, indent=2))
def compositionDataStatusEventHandler(self, event): if event._opcode != evt.Event.MESH_MESSAGE_RECEIVED_UNICAST: if event._opcode != evt.Event.MESH_MESSAGE_RECEIVED_SUBSCRIPTION: return message = access.AccessMessage(event) opcode = message.opcode_raw.hex() if opcode != str(ConfigurationClient._COMPOSITION_DATA_STATUS): return data = message.data[1:] compositionData = mt.CompositionData().unpack(data) src = message.meta["src"] node, element = self.src_address_to_node_element_index(src) uuid = self.db.nodes[node].UUID if hasattr(self, "onCompositionDataStatus"): self.onCompositionDataStatus(uuid, compositionData)