ac12c150c3
Replace the client's QueryActiveAlarmsAsync with StreamAlarmsAsync — a session-less subscription to the gateway's central alarm feed that yields the active-alarm snapshot followed by live transitions. AcknowledgeAlarm is session-less (AcknowledgeAlarmRequest no longer carries a session id). Updates the transport interface, the gRPC transport, the test fake, and the alarm tests; the .NET client solution builds and its alarm tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
79 lines
2.8 KiB
C#
79 lines
2.8 KiB
C#
using Grpc.Core;
|
|
using MxGateway.Contracts.Proto;
|
|
|
|
namespace MxGateway.Client;
|
|
|
|
internal interface IMxGatewayClientTransport
|
|
{
|
|
/// <summary>
|
|
/// Gets the client configuration options.
|
|
/// </summary>
|
|
MxGatewayClientOptions Options { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the underlying gRPC client, if available.
|
|
/// </summary>
|
|
MxAccessGateway.MxAccessGatewayClient? RawClient { get; }
|
|
|
|
/// <summary>
|
|
/// Opens a new gateway session.
|
|
/// </summary>
|
|
/// <param name="request">Session open request.</param>
|
|
/// <param name="callOptions">gRPC call options.</param>
|
|
/// <returns>The session open reply.</returns>
|
|
Task<OpenSessionReply> OpenSessionAsync(
|
|
OpenSessionRequest request,
|
|
CallOptions callOptions);
|
|
|
|
/// <summary>
|
|
/// Closes an open gateway session.
|
|
/// </summary>
|
|
/// <param name="request">Session close request.</param>
|
|
/// <param name="callOptions">gRPC call options.</param>
|
|
/// <returns>The session close reply.</returns>
|
|
Task<CloseSessionReply> CloseSessionAsync(
|
|
CloseSessionRequest request,
|
|
CallOptions callOptions);
|
|
|
|
/// <summary>
|
|
/// Invokes an MXAccess command on the session.
|
|
/// </summary>
|
|
/// <param name="request">The command request.</param>
|
|
/// <param name="callOptions">gRPC call options.</param>
|
|
/// <returns>The command reply.</returns>
|
|
Task<MxCommandReply> InvokeAsync(
|
|
MxCommandRequest request,
|
|
CallOptions callOptions);
|
|
|
|
/// <summary>
|
|
/// Streams events from the session.
|
|
/// </summary>
|
|
/// <param name="request">The stream events request.</param>
|
|
/// <param name="callOptions">gRPC call options.</param>
|
|
/// <returns>An async enumerable of events.</returns>
|
|
IAsyncEnumerable<MxEvent> StreamEventsAsync(
|
|
StreamEventsRequest request,
|
|
CallOptions callOptions);
|
|
|
|
/// <summary>
|
|
/// Acknowledges an active MXAccess alarm condition.
|
|
/// </summary>
|
|
/// <param name="request">The acknowledge request.</param>
|
|
/// <param name="callOptions">gRPC call options.</param>
|
|
/// <returns>The acknowledge reply with native MxStatus.</returns>
|
|
Task<AcknowledgeAlarmReply> AcknowledgeAlarmAsync(
|
|
AcknowledgeAlarmRequest request,
|
|
CallOptions callOptions);
|
|
|
|
/// <summary>
|
|
/// Attaches to the gateway's central alarm feed — the current active-alarm
|
|
/// snapshot followed by live transitions.
|
|
/// </summary>
|
|
/// <param name="request">The stream request, optionally scoped by alarm-reference prefix.</param>
|
|
/// <param name="callOptions">gRPC call options.</param>
|
|
/// <returns>An async enumerable of alarm feed messages.</returns>
|
|
IAsyncEnumerable<AlarmFeedMessage> StreamAlarmsAsync(
|
|
StreamAlarmsRequest request,
|
|
CallOptions callOptions);
|
|
}
|