feat(dcl): replace hand-rolled LmxProxy gRPC client with real LmxProxyClient library

Switches from v1 string-based proto stubs to the production LmxProxyClient
(v2 native TypedValue protocol) via project reference. Deletes 6k+ lines of
generated proto code. Preserves ILmxProxyClient adapter interface for testability.
This commit is contained in:
Joseph Doherty
2026-03-22 07:55:50 -04:00
parent abb7579227
commit 5ec7f35150
10 changed files with 134 additions and 6756 deletions

View File

@@ -1,15 +1,7 @@
using ZB.MOM.WW.LmxProxy.Client.Domain;
namespace ScadaLink.DataConnectionLayer.Adapters;
/// <summary>
/// Quality enumeration mirroring the LmxProxy SDK's Quality type.
/// </summary>
public enum LmxQuality { Good, Uncertain, Bad }
/// <summary>
/// Value-Timestamp-Quality record mirroring the LmxProxy SDK's Vtq type.
/// </summary>
public readonly record struct LmxVtq(object? Value, DateTime TimestampUtc, LmxQuality Quality);
/// <summary>
/// Subscription handle returned by <see cref="ILmxProxyClient.SubscribeAsync"/>.
/// Disposing the subscription stops receiving updates.
@@ -18,10 +10,8 @@ public interface ILmxSubscription : IAsyncDisposable { }
/// <summary>
/// Abstraction over the LmxProxy SDK client for testability.
/// Mirrors the real ScadaBridge LmxProxyClient API:
/// - Session-based connection with automatic 30s keep-alive
/// - gRPC streaming for subscriptions
/// - Throws on write/read failures
/// The production implementation delegates to the real
/// <see cref="ZB.MOM.WW.LmxProxy.Client.LmxProxyClient"/> library.
/// </summary>
public interface ILmxProxyClient : IAsyncDisposable
{
@@ -30,16 +20,16 @@ public interface ILmxProxyClient : IAsyncDisposable
Task ConnectAsync(CancellationToken cancellationToken = default);
Task DisconnectAsync();
Task<LmxVtq> ReadAsync(string address, CancellationToken cancellationToken = default);
Task<IDictionary<string, LmxVtq>> ReadBatchAsync(IEnumerable<string> addresses, CancellationToken cancellationToken = default);
Task<Vtq> ReadAsync(string address, CancellationToken cancellationToken = default);
Task<IDictionary<string, Vtq>> ReadBatchAsync(IEnumerable<string> addresses, CancellationToken cancellationToken = default);
Task WriteAsync(string address, object value, CancellationToken cancellationToken = default);
Task WriteBatchAsync(IDictionary<string, object> values, CancellationToken cancellationToken = default);
Task WriteAsync(string address, TypedValue value, CancellationToken cancellationToken = default);
Task WriteBatchAsync(IDictionary<string, TypedValue> values, CancellationToken cancellationToken = default);
Task<ILmxSubscription> SubscribeAsync(
IEnumerable<string> addresses,
Action<string, LmxVtq> onUpdate,
Action? onStreamError = null,
Action<string, Vtq> onUpdate,
Action<Exception>? onStreamError = null,
CancellationToken cancellationToken = default);
}
@@ -49,62 +39,5 @@ public interface ILmxProxyClient : IAsyncDisposable
/// </summary>
public interface ILmxProxyClientFactory
{
ILmxProxyClient Create(string host, int port, string? apiKey, int samplingIntervalMs = 0, bool useTls = false);
}
/// <summary>
/// Default factory that creates stub LmxProxy clients for development/testing.
/// </summary>
public class DefaultLmxProxyClientFactory : ILmxProxyClientFactory
{
public ILmxProxyClient Create(string host, int port, string? apiKey, int samplingIntervalMs = 0, bool useTls = false) => new StubLmxProxyClient();
}
/// <summary>
/// Stub LmxProxy client for development and unit testing.
/// </summary>
internal class StubLmxProxyClient : ILmxProxyClient
{
public bool IsConnected { get; private set; }
public Task ConnectAsync(CancellationToken cancellationToken = default)
{
IsConnected = true;
return Task.CompletedTask;
}
public Task DisconnectAsync()
{
IsConnected = false;
return Task.CompletedTask;
}
public Task<LmxVtq> ReadAsync(string address, CancellationToken cancellationToken = default)
=> Task.FromResult(new LmxVtq(null, DateTime.UtcNow, LmxQuality.Good));
public Task<IDictionary<string, LmxVtq>> ReadBatchAsync(IEnumerable<string> addresses, CancellationToken cancellationToken = default)
{
var results = addresses.ToDictionary(a => a, _ => new LmxVtq(null, DateTime.UtcNow, LmxQuality.Good));
return Task.FromResult<IDictionary<string, LmxVtq>>(results);
}
public Task WriteAsync(string address, object value, CancellationToken cancellationToken = default)
=> Task.CompletedTask;
public Task WriteBatchAsync(IDictionary<string, object> values, CancellationToken cancellationToken = default)
=> Task.CompletedTask;
public Task<ILmxSubscription> SubscribeAsync(IEnumerable<string> addresses, Action<string, LmxVtq> onUpdate, Action? onStreamError = null, CancellationToken cancellationToken = default)
=> Task.FromResult<ILmxSubscription>(new StubLmxSubscription());
public ValueTask DisposeAsync()
{
IsConnected = false;
return ValueTask.CompletedTask;
}
}
internal class StubLmxSubscription : ILmxSubscription
{
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
ILmxProxyClient Create(string host, int port, string? apiKey, bool useTls = false);
}

View File

@@ -1,17 +1,22 @@
using Microsoft.Extensions.Logging;
using ScadaLink.Commons.Interfaces.Protocol;
using ScadaLink.Commons.Types.Enums;
using ZB.MOM.WW.LmxProxy.Client.Domain;
using QualityCode = ScadaLink.Commons.Interfaces.Protocol.QualityCode;
using WriteResult = ScadaLink.Commons.Interfaces.Protocol.WriteResult;
namespace ScadaLink.DataConnectionLayer.Adapters;
/// <summary>
/// LmxProxy adapter implementing IDataConnection.
/// Maps IDataConnection operations to the LmxProxy SDK client.
/// Maps IDataConnection operations to the real LmxProxy SDK client
/// via the <see cref="ILmxProxyClient"/> abstraction.
///
/// LmxProxy-specific behavior:
/// - Session-based connection with automatic 30s keep-alive (managed by SDK)
/// - gRPC streaming for subscriptions via ILmxSubscription handles
/// - API key authentication via x-api-key gRPC metadata header
/// - Native TypedValue writes (v2 protocol)
/// </summary>
public class LmxProxyDataConnection : IDataConnection
{
@@ -41,11 +46,10 @@ public class LmxProxyDataConnection : IDataConnection
_port = port;
connectionDetails.TryGetValue("ApiKey", out var apiKey);
var samplingIntervalMs = connectionDetails.TryGetValue("SamplingIntervalMs", out var sampStr) && int.TryParse(sampStr, out var samp) ? samp : 0;
var useTls = connectionDetails.TryGetValue("UseTls", out var tlsStr) && bool.TryParse(tlsStr, out var tls) && tls;
_status = ConnectionHealth.Connecting;
_client = _clientFactory.Create(_host, _port, apiKey, samplingIntervalMs, useTls);
_client = _clientFactory.Create(_host, _port, apiKey, useTls);
await _client.ConnectAsync(cancellationToken);
_status = ConnectionHealth.Connected;
@@ -72,9 +76,9 @@ public class LmxProxyDataConnection : IDataConnection
{
var vtq = await _client!.ReadAsync(tagPath, cancellationToken);
var quality = MapQuality(vtq.Quality);
var tagValue = new TagValue(vtq.Value, quality, new DateTimeOffset(vtq.TimestampUtc, TimeSpan.Zero));
var tagValue = new TagValue(vtq.Value, quality, new DateTimeOffset(vtq.Timestamp, TimeSpan.Zero));
return vtq.Quality == LmxQuality.Bad
return vtq.Quality.IsBad()
? new ReadResult(false, tagValue, "LmxProxy read returned bad quality")
: new ReadResult(true, tagValue, null);
}
@@ -96,8 +100,8 @@ public class LmxProxyDataConnection : IDataConnection
foreach (var (tag, vtq) in vtqs)
{
var quality = MapQuality(vtq.Quality);
var tagValue = new TagValue(vtq.Value, quality, new DateTimeOffset(vtq.TimestampUtc, TimeSpan.Zero));
results[tag] = vtq.Quality == LmxQuality.Bad
var tagValue = new TagValue(vtq.Value, quality, new DateTimeOffset(vtq.Timestamp, TimeSpan.Zero));
results[tag] = vtq.Quality.IsBad()
? new ReadResult(false, tagValue, "LmxProxy read returned bad quality")
: new ReadResult(true, tagValue, null);
}
@@ -111,7 +115,7 @@ public class LmxProxyDataConnection : IDataConnection
try
{
await _client!.WriteAsync(tagPath, value!, cancellationToken);
await _client!.WriteAsync(tagPath, ToTypedValue(value), cancellationToken);
return new WriteResult(true, null);
}
catch (Exception ex)
@@ -126,9 +130,8 @@ public class LmxProxyDataConnection : IDataConnection
try
{
var nonNullValues = values.Where(kv => kv.Value != null)
.ToDictionary(kv => kv.Key, kv => kv.Value!);
await _client!.WriteBatchAsync(nonNullValues, cancellationToken);
var typedValues = values.ToDictionary(kv => kv.Key, kv => ToTypedValue(kv.Value));
await _client!.WriteBatchAsync(typedValues, cancellationToken);
return values.Keys.ToDictionary(k => k, _ => new WriteResult(true, null))
as IReadOnlyDictionary<string, WriteResult>;
@@ -174,11 +177,11 @@ public class LmxProxyDataConnection : IDataConnection
(path, vtq) =>
{
var quality = MapQuality(vtq.Quality);
callback(path, new TagValue(vtq.Value, quality, new DateTimeOffset(vtq.TimestampUtc, TimeSpan.Zero)));
callback(path, new TagValue(vtq.Value, quality, new DateTimeOffset(vtq.Timestamp, TimeSpan.Zero)));
},
onStreamError: () =>
onStreamError: ex =>
{
_logger.LogWarning("LmxProxy subscription stream ended unexpectedly for {TagPath}", tagPath);
_logger.LogWarning(ex, "LmxProxy subscription stream ended unexpectedly for {TagPath}", tagPath);
RaiseDisconnected();
},
cancellationToken);
@@ -219,10 +222,6 @@ public class LmxProxyDataConnection : IDataConnection
throw new InvalidOperationException("LmxProxy client is not connected.");
}
/// <summary>
/// Marks the connection as disconnected and fires the Disconnected event once.
/// Thread-safe: only the first caller triggers the event.
/// </summary>
private void RaiseDisconnected()
{
if (_disconnectFired) return;
@@ -232,11 +231,23 @@ public class LmxProxyDataConnection : IDataConnection
Disconnected?.Invoke();
}
private static QualityCode MapQuality(LmxQuality quality) => quality switch
private static QualityCode MapQuality(Quality quality)
{
LmxQuality.Good => QualityCode.Good,
LmxQuality.Uncertain => QualityCode.Uncertain,
LmxQuality.Bad => QualityCode.Bad,
_ => QualityCode.Bad
if (quality.IsGood()) return QualityCode.Good;
if (quality.IsUncertain()) return QualityCode.Uncertain;
return QualityCode.Bad;
}
private static TypedValue ToTypedValue(object? value) => value switch
{
bool b => new TypedValue { BoolValue = b },
int i => new TypedValue { Int32Value = i },
long l => new TypedValue { Int64Value = l },
float f => new TypedValue { FloatValue = f },
double d => new TypedValue { DoubleValue = d },
string s => new TypedValue { StringValue = s },
DateTime dt => new TypedValue { DatetimeValue = dt.ToUniversalTime().Ticks },
null => new TypedValue { StringValue = string.Empty },
_ => new TypedValue { StringValue = value.ToString() ?? string.Empty }
};
}

View File

@@ -1,531 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Adapters/Protos/scada.proto
// </auto-generated>
#pragma warning disable 0414, 1591, 8981, 0612
#region Designer generated code
using grpc = global::Grpc.Core;
namespace ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc {
/// <summary>
/// The SCADA service definition
/// </summary>
public static partial class ScadaService
{
static readonly string __ServiceName = "scada.ScadaService";
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectRequest> __Marshaller_scada_ConnectRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectResponse> __Marshaller_scada_ConnectResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectRequest> __Marshaller_scada_DisconnectRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectResponse> __Marshaller_scada_DisconnectResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateRequest> __Marshaller_scada_GetConnectionStateRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateResponse> __Marshaller_scada_GetConnectionStateResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadRequest> __Marshaller_scada_ReadRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadResponse> __Marshaller_scada_ReadResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchRequest> __Marshaller_scada_ReadBatchRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchResponse> __Marshaller_scada_ReadBatchResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteRequest> __Marshaller_scada_WriteRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteResponse> __Marshaller_scada_WriteResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchRequest> __Marshaller_scada_WriteBatchRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchResponse> __Marshaller_scada_WriteBatchResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitRequest> __Marshaller_scada_WriteBatchAndWaitRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitResponse> __Marshaller_scada_WriteBatchAndWaitResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.SubscribeRequest> __Marshaller_scada_SubscribeRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.SubscribeRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.VtqMessage> __Marshaller_scada_VtqMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.VtqMessage.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyRequest> __Marshaller_scada_CheckApiKeyRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyResponse> __Marshaller_scada_CheckApiKeyResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectResponse> __Method_Connect = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Connect",
__Marshaller_scada_ConnectRequest,
__Marshaller_scada_ConnectResponse);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectResponse> __Method_Disconnect = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Disconnect",
__Marshaller_scada_DisconnectRequest,
__Marshaller_scada_DisconnectResponse);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateResponse> __Method_GetConnectionState = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateResponse>(
grpc::MethodType.Unary,
__ServiceName,
"GetConnectionState",
__Marshaller_scada_GetConnectionStateRequest,
__Marshaller_scada_GetConnectionStateResponse);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadResponse> __Method_Read = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Read",
__Marshaller_scada_ReadRequest,
__Marshaller_scada_ReadResponse);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchResponse> __Method_ReadBatch = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ReadBatch",
__Marshaller_scada_ReadBatchRequest,
__Marshaller_scada_ReadBatchResponse);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteResponse> __Method_Write = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Write",
__Marshaller_scada_WriteRequest,
__Marshaller_scada_WriteResponse);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchResponse> __Method_WriteBatch = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchResponse>(
grpc::MethodType.Unary,
__ServiceName,
"WriteBatch",
__Marshaller_scada_WriteBatchRequest,
__Marshaller_scada_WriteBatchResponse);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitResponse> __Method_WriteBatchAndWait = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitResponse>(
grpc::MethodType.Unary,
__ServiceName,
"WriteBatchAndWait",
__Marshaller_scada_WriteBatchAndWaitRequest,
__Marshaller_scada_WriteBatchAndWaitResponse);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.SubscribeRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.VtqMessage> __Method_Subscribe = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.SubscribeRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.VtqMessage>(
grpc::MethodType.ServerStreaming,
__ServiceName,
"Subscribe",
__Marshaller_scada_SubscribeRequest,
__Marshaller_scada_VtqMessage);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyResponse> __Method_CheckApiKey = new grpc::Method<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyRequest, global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyResponse>(
grpc::MethodType.Unary,
__ServiceName,
"CheckApiKey",
__Marshaller_scada_CheckApiKeyRequest,
__Marshaller_scada_CheckApiKeyResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ScadaReflection.Descriptor.Services[0]; }
}
/// <summary>Client for ScadaService</summary>
public partial class ScadaServiceClient : grpc::ClientBase<ScadaServiceClient>
{
/// <summary>Creates a new client for ScadaService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public ScadaServiceClient(grpc::ChannelBase channel) : base(channel)
{
}
/// <summary>Creates a new client for ScadaService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public ScadaServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected ScadaServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected ScadaServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
/// <summary>
/// Connection management
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectResponse Connect(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Connect(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Connection management
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectResponse Connect(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Connect, null, options, request);
}
/// <summary>
/// Connection management
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectResponse> ConnectAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ConnectAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Connection management
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectResponse> ConnectAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ConnectRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Connect, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectResponse Disconnect(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Disconnect(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectResponse Disconnect(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Disconnect, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectResponse> DisconnectAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return DisconnectAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectResponse> DisconnectAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.DisconnectRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Disconnect, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateResponse GetConnectionState(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetConnectionState(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateResponse GetConnectionState(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetConnectionState, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateResponse> GetConnectionStateAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetConnectionStateAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateResponse> GetConnectionStateAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.GetConnectionStateRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetConnectionState, null, options, request);
}
/// <summary>
/// Read operations
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadResponse Read(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Read(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Read operations
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadResponse Read(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Read, null, options, request);
}
/// <summary>
/// Read operations
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadResponse> ReadAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ReadAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Read operations
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadResponse> ReadAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Read, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchResponse ReadBatch(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ReadBatch(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchResponse ReadBatch(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ReadBatch, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchResponse> ReadBatchAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ReadBatchAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchResponse> ReadBatchAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.ReadBatchRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ReadBatch, null, options, request);
}
/// <summary>
/// Write operations
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteResponse Write(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Write(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Write operations
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteResponse Write(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Write, null, options, request);
}
/// <summary>
/// Write operations
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteResponse> WriteAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return WriteAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Write operations
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteResponse> WriteAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Write, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchResponse WriteBatch(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return WriteBatch(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchResponse WriteBatch(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_WriteBatch, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchResponse> WriteBatchAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return WriteBatchAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchResponse> WriteBatchAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_WriteBatch, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitResponse WriteBatchAndWait(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return WriteBatchAndWait(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitResponse WriteBatchAndWait(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_WriteBatchAndWait, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitResponse> WriteBatchAndWaitAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return WriteBatchAndWaitAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitResponse> WriteBatchAndWaitAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.WriteBatchAndWaitRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_WriteBatchAndWait, null, options, request);
}
/// <summary>
/// Subscription operations (server streaming) - now streams VtqMessage directly
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncServerStreamingCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.VtqMessage> Subscribe(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.SubscribeRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Subscribe(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Subscription operations (server streaming) - now streams VtqMessage directly
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncServerStreamingCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.VtqMessage> Subscribe(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.SubscribeRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncServerStreamingCall(__Method_Subscribe, null, options, request);
}
/// <summary>
/// Authentication
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyResponse CheckApiKey(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return CheckApiKey(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Authentication
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyResponse CheckApiKey(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_CheckApiKey, null, options, request);
}
/// <summary>
/// Authentication
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyResponse> CheckApiKeyAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return CheckApiKeyAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Authentication
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyResponse> CheckApiKeyAsync(global::ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc.CheckApiKeyRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_CheckApiKey, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected override ScadaServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new ScadaServiceClient(configuration);
}
}
}
}
#endregion

View File

@@ -1,166 +0,0 @@
syntax = "proto3";
option csharp_namespace = "ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc";
package scada;
// The SCADA service definition
service ScadaService {
// Connection management
rpc Connect(ConnectRequest) returns (ConnectResponse);
rpc Disconnect(DisconnectRequest) returns (DisconnectResponse);
rpc GetConnectionState(GetConnectionStateRequest) returns (GetConnectionStateResponse);
// Read operations
rpc Read(ReadRequest) returns (ReadResponse);
rpc ReadBatch(ReadBatchRequest) returns (ReadBatchResponse);
// Write operations
rpc Write(WriteRequest) returns (WriteResponse);
rpc WriteBatch(WriteBatchRequest) returns (WriteBatchResponse);
rpc WriteBatchAndWait(WriteBatchAndWaitRequest) returns (WriteBatchAndWaitResponse);
// Subscription operations (server streaming) - now streams VtqMessage directly
rpc Subscribe(SubscribeRequest) returns (stream VtqMessage);
// Authentication
rpc CheckApiKey(CheckApiKeyRequest) returns (CheckApiKeyResponse);
}
// === CONNECTION MESSAGES ===
message ConnectRequest {
string client_id = 1;
string api_key = 2;
}
message ConnectResponse {
bool success = 1;
string message = 2;
string session_id = 3;
}
message DisconnectRequest {
string session_id = 1;
}
message DisconnectResponse {
bool success = 1;
string message = 2;
}
message GetConnectionStateRequest {
string session_id = 1;
}
message GetConnectionStateResponse {
bool is_connected = 1;
string client_id = 2;
int64 connected_since_utc_ticks = 3;
}
// === VTQ MESSAGE ===
message VtqMessage {
string tag = 1;
string value = 2;
int64 timestamp_utc_ticks = 3;
string quality = 4; // "Good", "Uncertain", "Bad"
}
// === READ MESSAGES ===
message ReadRequest {
string session_id = 1;
string tag = 2;
}
message ReadResponse {
bool success = 1;
string message = 2;
VtqMessage vtq = 3;
}
message ReadBatchRequest {
string session_id = 1;
repeated string tags = 2;
}
message ReadBatchResponse {
bool success = 1;
string message = 2;
repeated VtqMessage vtqs = 3;
}
// === WRITE MESSAGES ===
message WriteRequest {
string session_id = 1;
string tag = 2;
string value = 3;
}
message WriteResponse {
bool success = 1;
string message = 2;
}
message WriteItem {
string tag = 1;
string value = 2;
}
message WriteResult {
string tag = 1;
bool success = 2;
string message = 3;
}
message WriteBatchRequest {
string session_id = 1;
repeated WriteItem items = 2;
}
message WriteBatchResponse {
bool success = 1;
string message = 2;
repeated WriteResult results = 3;
}
message WriteBatchAndWaitRequest {
string session_id = 1;
repeated WriteItem items = 2;
string flag_tag = 3;
string flag_value = 4;
int32 timeout_ms = 5;
int32 poll_interval_ms = 6;
}
message WriteBatchAndWaitResponse {
bool success = 1;
string message = 2;
repeated WriteResult write_results = 3;
bool flag_reached = 4;
int32 elapsed_ms = 5;
}
// === SUBSCRIPTION MESSAGES ===
message SubscribeRequest {
string session_id = 1;
repeated string tags = 2;
int32 sampling_ms = 3;
}
// Note: Subscribe RPC now streams VtqMessage directly (defined above)
// === AUTHENTICATION MESSAGES ===
message CheckApiKeyRequest {
string api_key = 1;
}
message CheckApiKeyResponse {
bool is_valid = 1;
string message = 2;
}

View File

@@ -1,211 +1,92 @@
using System.Net.Http;
using Grpc.Core;
using Grpc.Net.Client;
using ScadaLink.DataConnectionLayer.Adapters.LmxProxy.Grpc;
using Microsoft.Extensions.Logging;
using ZB.MOM.WW.LmxProxy.Client;
using ZB.MOM.WW.LmxProxy.Client.Domain;
namespace ScadaLink.DataConnectionLayer.Adapters;
/// <summary>
/// Production ILmxProxyClient that talks to the LmxProxy gRPC service
/// using proto-generated client stubs with x-api-key header injection.
/// Production ILmxProxyClient that delegates to the real
/// <see cref="ZB.MOM.WW.LmxProxy.Client.LmxProxyClient"/> library.
/// </summary>
internal class RealLmxProxyClient : ILmxProxyClient
{
private readonly string _host;
private readonly int _port;
private readonly string? _apiKey;
private readonly int _samplingIntervalMs;
private readonly bool _useTls;
private GrpcChannel? _channel;
private ScadaService.ScadaServiceClient? _client;
private string? _sessionId;
private Metadata? _headers;
private readonly ZB.MOM.WW.LmxProxy.Client.LmxProxyClient _inner;
public RealLmxProxyClient(string host, int port, string? apiKey, int samplingIntervalMs = 0, bool useTls = false)
public RealLmxProxyClient(ZB.MOM.WW.LmxProxy.Client.LmxProxyClient inner)
{
_host = host;
_port = port;
_apiKey = apiKey;
_samplingIntervalMs = samplingIntervalMs;
_useTls = useTls;
_inner = inner;
}
public bool IsConnected => _client != null && !string.IsNullOrEmpty(_sessionId);
public bool IsConnected => _inner.IsConnected;
public async Task ConnectAsync(CancellationToken cancellationToken = default)
public Task ConnectAsync(CancellationToken cancellationToken = default)
=> _inner.ConnectAsync(cancellationToken);
public Task DisconnectAsync()
=> _inner.DisconnectAsync();
public Task<Vtq> ReadAsync(string address, CancellationToken cancellationToken = default)
=> _inner.ReadAsync(address, cancellationToken);
public Task<IDictionary<string, Vtq>> ReadBatchAsync(IEnumerable<string> addresses, CancellationToken cancellationToken = default)
=> _inner.ReadBatchAsync(addresses, cancellationToken);
public Task WriteAsync(string address, TypedValue value, CancellationToken cancellationToken = default)
=> _inner.WriteAsync(address, value, cancellationToken);
public Task WriteBatchAsync(IDictionary<string, TypedValue> values, CancellationToken cancellationToken = default)
=> _inner.WriteBatchAsync(values, cancellationToken);
public async Task<ILmxSubscription> SubscribeAsync(
IEnumerable<string> addresses,
Action<string, Vtq> onUpdate,
Action<Exception>? onStreamError = null,
CancellationToken cancellationToken = default)
{
if (!_useTls)
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
var scheme = _useTls ? "https" : "http";
_channel = GrpcChannel.ForAddress($"{scheme}://{_host}:{_port}");
_client = new ScadaService.ScadaServiceClient(_channel);
_headers = new Metadata();
if (!string.IsNullOrEmpty(_apiKey))
_headers.Add("x-api-key", _apiKey);
var response = await _client.ConnectAsync(new ConnectRequest
{
ClientId = $"ScadaLink-{Guid.NewGuid():N}",
ApiKey = _apiKey ?? string.Empty
}, _headers, cancellationToken: cancellationToken);
if (!response.Success)
throw new InvalidOperationException($"LmxProxy connect failed: {response.Message}");
_sessionId = response.SessionId;
}
public async Task DisconnectAsync()
{
if (_client != null && !string.IsNullOrEmpty(_sessionId))
{
try { await _client.DisconnectAsync(new DisconnectRequest { SessionId = _sessionId }, _headers); }
catch { /* best-effort */ }
}
_client = null;
_sessionId = null;
}
public async Task<LmxVtq> ReadAsync(string address, CancellationToken cancellationToken = default)
{
EnsureConnected();
var response = await _client!.ReadAsync(
new ReadRequest { SessionId = _sessionId!, Tag = address },
_headers, cancellationToken: cancellationToken);
if (!response.Success)
throw new InvalidOperationException($"Read failed for '{address}': {response.Message}");
return ConvertVtq(response.Vtq);
}
public async Task<IDictionary<string, LmxVtq>> ReadBatchAsync(IEnumerable<string> addresses, CancellationToken cancellationToken = default)
{
EnsureConnected();
var request = new ReadBatchRequest { SessionId = _sessionId! };
request.Tags.AddRange(addresses);
var response = await _client!.ReadBatchAsync(request, _headers, cancellationToken: cancellationToken);
if (!response.Success)
throw new InvalidOperationException($"ReadBatch failed: {response.Message}");
return response.Vtqs.ToDictionary(v => v.Tag, v => ConvertVtq(v));
}
public async Task WriteAsync(string address, object value, CancellationToken cancellationToken = default)
{
EnsureConnected();
var response = await _client!.WriteAsync(new WriteRequest
{
SessionId = _sessionId!,
Tag = address,
Value = value?.ToString() ?? string.Empty
}, _headers, cancellationToken: cancellationToken);
if (!response.Success)
throw new InvalidOperationException($"Write failed for '{address}': {response.Message}");
}
public async Task WriteBatchAsync(IDictionary<string, object> values, CancellationToken cancellationToken = default)
{
EnsureConnected();
var request = new WriteBatchRequest { SessionId = _sessionId! };
request.Items.AddRange(values.Select(kv => new WriteItem
{
Tag = kv.Key,
Value = kv.Value?.ToString() ?? string.Empty
}));
var response = await _client!.WriteBatchAsync(request, _headers, cancellationToken: cancellationToken);
if (!response.Success)
throw new InvalidOperationException($"WriteBatch failed: {response.Message}");
}
public Task<ILmxSubscription> SubscribeAsync(IEnumerable<string> addresses, Action<string, LmxVtq> onUpdate, Action? onStreamError = null, CancellationToken cancellationToken = default)
{
EnsureConnected();
var tags = addresses.ToList();
var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
var request = new SubscribeRequest { SessionId = _sessionId!, SamplingMs = _samplingIntervalMs };
request.Tags.AddRange(tags);
var call = _client!.Subscribe(request, _headers, cancellationToken: cts.Token);
_ = Task.Run(async () =>
{
try
{
while (await call.ResponseStream.MoveNext(cts.Token))
{
var msg = call.ResponseStream.Current;
onUpdate(msg.Tag, ConvertVtq(msg));
}
// Stream ended normally (server closed) — treat as disconnect
_sessionId = null;
onStreamError?.Invoke();
}
catch (OperationCanceledException) { }
catch (RpcException ex) when (ex.StatusCode == StatusCode.Cancelled) { }
catch (RpcException)
{
// gRPC error (server offline, network failure) — signal disconnect
_sessionId = null;
onStreamError?.Invoke();
}
}, cts.Token);
return Task.FromResult<ILmxSubscription>(new CtsSubscription(cts));
var innerSub = await _inner.SubscribeAsync(addresses, onUpdate, onStreamError, cancellationToken);
return new SubscriptionWrapper(innerSub);
}
public async ValueTask DisposeAsync()
{
await DisconnectAsync();
_channel?.Dispose();
_channel = null;
await _inner.DisposeAsync();
}
private void EnsureConnected()
private sealed class SubscriptionWrapper(ZB.MOM.WW.LmxProxy.Client.LmxProxyClient.ISubscription inner) : ILmxSubscription
{
if (_client == null || string.IsNullOrEmpty(_sessionId))
throw new InvalidOperationException("LmxProxy client is not connected.");
}
private static LmxVtq ConvertVtq(VtqMessage? msg)
{
if (msg == null)
return new LmxVtq(null, DateTime.UtcNow, LmxQuality.Bad);
object? value = msg.Value;
if (!string.IsNullOrEmpty(msg.Value))
public async ValueTask DisposeAsync()
{
if (double.TryParse(msg.Value, out var d)) value = d;
else if (bool.TryParse(msg.Value, out var b)) value = b;
else value = msg.Value;
}
var timestamp = new DateTime(msg.TimestampUtcTicks, DateTimeKind.Utc);
var quality = msg.Quality?.ToUpperInvariant() switch
{
"GOOD" => LmxQuality.Good,
"UNCERTAIN" => LmxQuality.Uncertain,
_ => LmxQuality.Bad
};
return new LmxVtq(value, timestamp, quality);
}
private sealed class CtsSubscription(CancellationTokenSource cts) : ILmxSubscription
{
public ValueTask DisposeAsync()
{
cts.Cancel();
cts.Dispose();
return ValueTask.CompletedTask;
await inner.DisposeAsync();
}
}
}
/// <summary>
/// Production factory that creates real LmxProxy gRPC clients.
/// Production factory that creates LmxProxy clients using the real library's builder.
/// </summary>
public class RealLmxProxyClientFactory : ILmxProxyClientFactory
{
public ILmxProxyClient Create(string host, int port, string? apiKey, int samplingIntervalMs = 0, bool useTls = false)
=> new RealLmxProxyClient(host, port, apiKey, samplingIntervalMs, useTls);
private readonly ILoggerFactory _loggerFactory;
public RealLmxProxyClientFactory(ILoggerFactory loggerFactory)
{
_loggerFactory = loggerFactory;
}
public ILmxProxyClient Create(string host, int port, string? apiKey, bool useTls = false)
{
var builder = new LmxProxyClientBuilder()
.WithHost(host)
.WithPort(port)
.WithLogger(_loggerFactory.CreateLogger<ZB.MOM.WW.LmxProxy.Client.LmxProxyClient>());
if (!string.IsNullOrEmpty(apiKey))
builder.WithApiKey(apiKey);
if (useTls)
builder.WithSslCredentials(null);
var client = builder.Build();
return new RealLmxProxyClient(client);
}
}

View File

@@ -21,7 +21,7 @@ public class DataConnectionFactory : IDataConnectionFactory
RegisterAdapter("OpcUa", details => new OpcUaDataConnection(
new RealOpcUaClientFactory(), _loggerFactory.CreateLogger<OpcUaDataConnection>()));
RegisterAdapter("LmxProxy", _ => new LmxProxyDataConnection(
new RealLmxProxyClientFactory(), _loggerFactory.CreateLogger<LmxProxyDataConnection>()));
new RealLmxProxyClientFactory(_loggerFactory), _loggerFactory.CreateLogger<LmxProxyDataConnection>()));
}
/// <summary>

View File

@@ -15,14 +15,13 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.5" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.5" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.5" />
<PackageReference Include="Google.Protobuf" Version="3.33.2" />
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client" Version="1.5.378.106" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../ScadaLink.Commons/ScadaLink.Commons.csproj" />
<ProjectReference Include="../ScadaLink.HealthMonitoring/ScadaLink.HealthMonitoring.csproj" />
<ProjectReference Include="../../lmxproxy/src/ZB.MOM.WW.LmxProxy.Client/ZB.MOM.WW.LmxProxy.Client.csproj" />
</ItemGroup>
</Project>