Search in sources :

Example 1 with AgentStatusEvent

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());
            });
        }
    }
}
Also used : SimulatorState(org.openremote.model.simulator.SimulatorState) DatapointInterval(org.openremote.model.datapoint.DatapointInterval) AssetMapper(org.openremote.app.client.assets.AssetMapper) Environment(org.openremote.app.client.Environment) ProtocolConfiguration(org.openremote.model.asset.agent.ProtocolConfiguration) AttributeRef(org.openremote.model.attribute.AttributeRef) AssetDatapointResource(org.openremote.model.datapoint.AssetDatapointResource) AttributeViewImpl(org.openremote.app.client.assets.attributes.AttributeViewImpl) ObjectValueMapper(org.openremote.app.client.interop.value.ObjectValueMapper) FormButton(org.openremote.app.client.widget.FormButton) NumberDatapoint(org.openremote.model.datapoint.NumberDatapoint) ArrayList(java.util.ArrayList) AgentLink(org.openremote.model.asset.agent.AgentLink) Inject(javax.inject.Inject) ReadAssetAttributesEvent(org.openremote.model.asset.ReadAssetAttributesEvent) TenantFilter(org.openremote.model.event.shared.TenantFilter) AttributeEvent(org.openremote.model.attribute.AttributeEvent) URL(com.google.gwt.http.client.URL) AbstractAttributeViewExtension(org.openremote.app.client.assets.attributes.AbstractAttributeViewExtension) AttributeView(org.openremote.app.client.assets.attributes.AttributeView) AgentStatusEventMapper(org.openremote.app.client.assets.AgentStatusEventMapper) Consumer(org.openremote.model.interop.Consumer) AgentResource(org.openremote.model.asset.agent.AgentResource) MapResource(org.openremote.model.map.MapResource) AgentStatusEvent(org.openremote.model.asset.agent.AgentStatusEvent) AssetType(org.openremote.model.asset.AssetType) DatapointBrowser(org.openremote.app.client.datapoint.DatapointBrowser) JsonEditor(org.openremote.app.client.app.dialog.JsonEditor) Constants(org.openremote.model.Constants) AssetResource(org.openremote.model.asset.AssetResource) Provider(com.google.inject.Provider) List(java.util.List) AssetBrowser(org.openremote.app.client.assets.browser.AssetBrowser) NumberDatapointArrayMapper(org.openremote.app.client.datapoint.NumberDatapointArrayMapper) Optional(java.util.Optional) Values(org.openremote.model.value.Values) TextUtil.isNullOrEmpty(org.openremote.model.util.TextUtil.isNullOrEmpty) AssetAttribute(org.openremote.model.asset.AssetAttribute) Datapoint(org.openremote.model.datapoint.Datapoint) Collections(java.util.Collections) Simulator(org.openremote.app.client.simulator.Simulator) AttributeExecuteStatus(org.openremote.model.attribute.AttributeExecuteStatus) AttributeView(org.openremote.app.client.assets.attributes.AttributeView) AttributeRef(org.openremote.model.attribute.AttributeRef) AssetAttribute(org.openremote.model.asset.AssetAttribute)

Aggregations

URL (com.google.gwt.http.client.URL)1 Provider (com.google.inject.Provider)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Optional (java.util.Optional)1 Inject (javax.inject.Inject)1 Environment (org.openremote.app.client.Environment)1 JsonEditor (org.openremote.app.client.app.dialog.JsonEditor)1 AgentStatusEventMapper (org.openremote.app.client.assets.AgentStatusEventMapper)1 AssetMapper (org.openremote.app.client.assets.AssetMapper)1 AbstractAttributeViewExtension (org.openremote.app.client.assets.attributes.AbstractAttributeViewExtension)1 AttributeView (org.openremote.app.client.assets.attributes.AttributeView)1 AttributeViewImpl (org.openremote.app.client.assets.attributes.AttributeViewImpl)1 AssetBrowser (org.openremote.app.client.assets.browser.AssetBrowser)1 DatapointBrowser (org.openremote.app.client.datapoint.DatapointBrowser)1 NumberDatapointArrayMapper (org.openremote.app.client.datapoint.NumberDatapointArrayMapper)1 ObjectValueMapper (org.openremote.app.client.interop.value.ObjectValueMapper)1 Simulator (org.openremote.app.client.simulator.Simulator)1 FormButton (org.openremote.app.client.widget.FormButton)1