From b9a3c8bee135c0cd9d3670798521766d3ecf8f75 Mon Sep 17 00:00:00 2001 From: Patrick Ritchie Date: Sun, 23 Apr 2023 23:28:23 -0400 Subject: [PATCH] Update to allow a Device file to override the Device read by a Http Client Adapter --- .../MTConnectHttpAgentGatewayApplication.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MTConnect.NET-Applications-Agents/MTConnectHttpAgentGatewayApplication.cs b/src/MTConnect.NET-Applications-Agents/MTConnectHttpAgentGatewayApplication.cs index 1b73196e..c2b0f50e 100644 --- a/src/MTConnect.NET-Applications-Agents/MTConnectHttpAgentGatewayApplication.cs +++ b/src/MTConnect.NET-Applications-Agents/MTConnectHttpAgentGatewayApplication.cs @@ -102,11 +102,15 @@ protected override void OnStartAgentBeforeLoad(IEnumerable agentClient.OnClientStopped += (s, e) => AgentClientStopped(agentClient); agentClient.OnStreamStarted += (s, query) => AgentClientStreamStarted(agentClient, query); agentClient.OnStreamStopped += (s, e) => AgentClientStreamStopped(agentClient); - agentClient.OnProbeReceived += (s, doc) => DevicesDocumentReceived(agentClient, doc); agentClient.OnCurrentReceived += (s, doc) => StreamsDocumentReceived(agentClient, doc); agentClient.OnSampleReceived += (s, doc) => StreamsDocumentReceived(agentClient, doc); agentClient.OnAssetsReceived += (s, doc) => AssetsDocumentReceived(agentClient, doc); + if (Agent.GetDevice(agentClient.Device) == null) + { + agentClient.OnProbeReceived += (s, doc) => DevicesDocumentReceived(agentClient, doc); + } + _clients.Add(agentClient); } }