You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CoreAgent.ProtocolClient.Context;
using CoreAgent.ProtocolClient.Enums;
using CoreAgent.ProtocolClient.Models;
using Newtonsoft.Json.Linq;
namespace CoreAgent.ProtocolClient.ProtocolEngineCore
{
/// <summary>
/// 定义了协议客户端的公共接口
/// </summary>
public interface IProtocolWsClient : IDisposable
{
event EventHandler ConnectionOpened;
event EventHandler ConnectionClosed;
event EventHandler<string> ConnectionError;
event EventHandler<JObject> MessageReceived;
event EventHandler<JObject> StatsReceived;
event EventHandler<ClientState> StateChanged;
bool IsConnected { get; }
ClientState State { get; }
bool IsReadonly { get; }
ProtocolClientContext Context { get; }
ProtocolClientConfig Config { get; }
void Start();
void Stop();
void ResetLogs();
void SetLogsConfig(ProtocolClientLogsConfig logsConfig, bool save = false);
void LogGet(Dictionary<string, object>? parameters = null);
void TriggerStatsUpdate();
void ResetStatistics();
void SetStatisticsConfig(bool enableSamples, bool enableRf);
(bool samples, bool rf) GetStatisticsConfig();
void SetRefreshDelay(int delay);
void SetMessageHandler(string[] names, MessageHandler handler);
void UnsetMessageHandler(string[] names);
long SendMessage(JObject message, Action<JObject>? callback = null, bool errorHandler = false);
}
}