using MQTTnet.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Edge.Core.MqttClient
{
    public interface IMqttClientService
    {
        /// <summary>
        /// 开启 Mqtt
        /// </summary>
        /// <param name="topics">要订阅的主题</param>
        void Start();

        /// <summary>
        /// 发布主题
        /// </summary>
        /// <param name="topic">发布的主题</param>
        /// <param name="paramsJson">参数 json 串</param>
        void Public(string topic, string paramsJson);

        /// <summary>
        /// MQTT 已连接事件
        /// </summary>
        event EventHandler<MqttClientConnectedEventArgs> OnConnect;

        /// <summary>
        /// MQTT 已断开事件
        /// </summary>
        event EventHandler<MqttClientDisconnectedEventArgs> OnDisconnect;

        /// <summary>
        /// MQTT 获取到信息事件
        /// </summary>
        event EventHandler<MqttApplicationMessageReceivedEventArgs> OnApplicationMessageReceived;


    }
}
