using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;

namespace FLY.Modbus.WithThread
{
    public interface IModbusServer
    {
        /// <summary>
        /// 通信超时, client 长时间连接上，但不通讯，会被断开
        /// </summary>
        TimeSpan Timeout { get; set; }

        /// <summary>
        /// 本地地址
        /// </summary>
        IPEndPoint LocalEP { get; set; }

        /// <summary>
        /// 当前连接数
        /// </summary>
        int ConnectedCnt { get; }

        /// <summary>
        /// 工作中
        /// </summary>
        bool IsRunning { get; set; }

        /// <summary>
        /// socket 错误信息
        /// </summary>
        string ErrMsg { get; set; }

        GetValueHander GetValue { get; }
        SetValueHander SetValue { get; }

        void Start();

        void Stop();


    }

    public delegate void GetValueHander(int addr, object values);
    public delegate void SetValueHander(int addr, object values);
}
