use of org.openremote.model.asset.agent.AgentStatusEvent in project openremote by openremote.
the class AssetViewActivity method onAgentStatusEvent.
protected void onAgentStatusEvent(AgentStatusEvent event) {
for (AttributeView attributeView : attributeViews) {
AssetAttribute assetAttribute = attributeView.getAttribute();
Optional<AttributeRef> assetAttributeRef = assetAttribute.getReference();
if (asset.getWellKnownType() == AssetType.AGENT) {
if (assetAttributeRef.map(ref -> ref.equals(event.getProtocolConfiguration())).orElse(false)) {
attributeView.setStatus(event.getConnectionStatus());
}
} else {
AgentLink.getAgentLink(assetAttribute).filter(agentLink -> agentLink.equals(event.getProtocolConfiguration())).ifPresent(agentLink -> {
attributeView.setStatus(event.getConnectionStatus());
});
}
}
}
Aggregations