ILanYinWsClientService.cs 1.22 KB
using Rcs.Cyaninetech.Models;
using Rcs.Domain.Settings;

namespace Rcs.Cyaninetech.Services
{
    /// <summary>
    /// 蓝音 WebSocket 客户端服务接口
    /// @author zzy
    /// </summary>
    public interface ILanYinWsClientService
    {
        /// <summary>
        /// 连接 WebSocket 服务器
        /// </summary>
        Task ConnectAsync(CancellationToken cancellationToken = default);

        /// <summary>
        /// 断开连接
        /// </summary>
        Task DisconnectAsync();

        /// <summary>
        /// 发送订阅请求
        /// </summary>
        Task SubscribeAsync(List<string> topics);

        /// <summary>
        /// 是否已连接
        /// </summary>
        bool IsConnected { get; }

        /// <summary>
        /// 机器人状态接收事件
        /// </summary>
        event EventHandler<List<LanYinRobotStatus>>? OnRobotStatusReceived;

        /// <summary>
        /// 机器人信息接收事件
        /// </summary>
        event EventHandler<List<LanYinRobotInfo>>? OnRobotInfoReceived;

        /// <summary>
        /// 机器人实时路径接收事件
        /// </summary>
        event EventHandler<LanYinRobotRealtimePath>? OnRobotRealtimePathReceived;
    }
}