using MQTTnet.Client.Connecting;
using MQTTnet.Client.Disconnecting;
using MQTTnet.Client.ExtendedAuthenticationExchange;
using MQTTnet.Client.Options;
using MQTTnet.Client.Subscribing;
using MQTTnet.Client.Unsubscribing;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace MQTTnet.Client
{
public interface IMqttClient : IApplicationMessageReceiver, IApplicationMessagePublisher, IDisposable
{
bool IsConnected { get; }
IMqttClientOptions Options { get; }
///
/// Gets or sets the connected handler that is fired after the client has connected to the server successfully.
/// Hint: Initialize handlers before you connect the client to avoid issues.
///
IMqttClientConnectedHandler ConnectedHandler { get; set; }
///
/// Gets or sets the disconnected handler that is fired after the client has disconnected from the server.
/// Hint: Initialize handlers before you connect the client to avoid issues.
///
IMqttClientDisconnectedHandler DisconnectedHandler { get; set; }
Task ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken);
Task DisconnectAsync(MqttClientDisconnectOptions options, CancellationToken cancellationToken);
Task PingAsync(CancellationToken cancellationToken);
///
/// Sends extended authentication data.
/// Hint: MQTT 5 feature only.
///
/// The extended data.
/// A cancellation token to stop the task.
/// A representing any asynchronous operation.
Task SendExtendedAuthenticationExchangeDataAsync(MqttExtendedAuthenticationExchangeData data, CancellationToken cancellationToken);
Task SubscribeAsync(MqttClientSubscribeOptions options, CancellationToken cancellationToken);
Task UnsubscribeAsync(MqttClientUnsubscribeOptions options, CancellationToken cancellationToken);
}
}