Files
ulapp/FieldLogger/Services/Sync/IMqttSyncService.cs

33 lines
1.0 KiB
C#

using FieldLogger.Models;
namespace FieldLogger.Services.Sync;
/// <summary>
/// Durable app MQTT synchronization. Captures are persisted locally before this service queues
/// them, and queue rows are released only by an application-level ACCEPTED/DUPLICATE ack.
/// </summary>
public interface IMqttSyncService
{
bool IsConnected { get; }
string Status { get; }
event EventHandler<string>? StatusChanged;
event EventHandler<PointSyncFailureEventArgs>? PointRejected;
Task StartAsync(CancellationToken cancellationToken = default);
Task StopAsync();
Task ConnectAsync(CancellationToken cancellationToken = default);
Task DisconnectAsync();
Task PublishPointAsync(LoggedPoint point, CancellationToken cancellationToken = default);
}
public sealed class PointSyncFailureEventArgs : EventArgs
{
public LoggedPoint Point { get; }
public string ReasonCode { get; }
public PointSyncFailureEventArgs(LoggedPoint point, string reasonCode)
{
Point = point;
ReasonCode = reasonCode;
}
}