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

namespace FLY.OBJComponents.IService
{
    /// <summary>
    /// PLC代理系统
    /// </summary>
    public interface IPLCProxySystemService:INotifyPropertyChanged
    {
        /// <summary>
        /// 与PLC连接成功
        /// </summary>
        bool IsConnectedWithPLC { get; }
        /// <summary>
        /// 对象名称
        /// </summary>
        Dictionary<string, INotifyPropertyChanged> ObjNames { get; }

        /// <summary>
        /// 设置更新计划
        /// </summary>
        /// <param name="objname">对象名</param>
        /// <param name="propertynames">属性名</param>
        /// <param name="planID">计划的编号，应该全局唯一,建议使用时间ticks</param>
        void SetPlan(string objname, IEnumerable<string> propertynames, long planID);

        /// <summary>
        /// 设置更新计划
        /// </summary>
        /// <param name="objname">对象名</param>
        /// <param name="propertynames">属性名</param>
        /// <param name="planID">计划的编号，应该全局唯一,建议使用时间ticks</param>
        void SetPlan(string objname, IEnumerable<string> propertynames, SetPlanReponseHandler setPlanReponse, object context);

        /// <summary>
        /// 更新计划持续，如果不喂狗，120s后停止更新数据
        /// </summary>
        /// <param name="planID">计划的编号</param>
        void FeedPlan(long planID);

        /// <summary>
        /// 主动删除某个计划
        /// </summary>
        /// <param name="planID"></param>
        void RemovePlan(long planID);
    }

    public delegate void SetPlanReponseHandler(long planid, object context);
}
