using MQTTnet.Client.Connecting; using MQTTnet.Client.Disconnecting; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MQTTnet.Client; namespace MQTTnet.Extensions.ManagedClient { public interface IManagedMqttClient : IApplicationMessageReceiver, IApplicationMessagePublisher, IDisposable { /// /// Gets the internally used MQTT client. /// This property should be used with caution because manipulating the internal client might break the managed client. /// IMqttClient InternalClient { get; } /// /// Gets a value indicating whether the client is started or not. /// bool IsStarted { get; } /// /// Gets a value indicating whether the client is connected or not. /// bool IsConnected { get; } /// /// Gets a pending application message count. /// int PendingApplicationMessagesCount { get; } /// /// Gets the MQTT client options. /// IManagedMqttClientOptions Options { get; } /// /// Gets or sets the connected handler. /// IMqttClientConnectedHandler ConnectedHandler { get; set; } /// /// Gets or sets the disconnected handler. /// IMqttClientDisconnectedHandler DisconnectedHandler { get; set; } /// /// Gets or sets the application message process handler. /// IApplicationMessageProcessedHandler ApplicationMessageProcessedHandler { get; set; } /// /// Gets or sets the application message skipped handler. /// IApplicationMessageSkippedHandler ApplicationMessageSkippedHandler { get; set; } /// /// Gets or sets the connecting failed handler. /// IConnectingFailedHandler ConnectingFailedHandler { get; set; } /// /// Gets or sets the synchronizing subscriptions failed handler. /// ISynchronizingSubscriptionsFailedHandler SynchronizingSubscriptionsFailedHandler { get; set; } /// /// Starts the client. /// /// The options. /// A representing any asynchronous operation. Task StartAsync(IManagedMqttClientOptions options); /// /// Stops the client. /// /// A representing any asynchronous operation. Task StopAsync(); /// /// Pings the server. /// /// A token to cancel the task. /// A representing any asynchronous operation. Task PingAsync(CancellationToken cancellationToken); /// /// Subscribes the client. /// /// The topic filters. /// A representing any asynchronous operation. Task SubscribeAsync(IEnumerable topicFilters); /// /// Unsubscribes the client. /// /// The topics. /// A representing any asynchronous operation. Task UnsubscribeAsync(IEnumerable topics); /// /// Publishes a message from the client. /// /// The application messages. /// A representing any asynchronous operation. Task PublishAsync(ManagedMqttApplicationMessage applicationMessages); } }