using FLY.OBJComponents.IService;
using FLY.OBJComponents.OBJ_INTERFACE;
using FObjBase;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace FLY.OBJComponents.Client
{
    public class PLCProxySystemServiceClient :  FObjBase.Reflect.Reflect_SeviceClient, IPLCProxySystemService
    {
        protected override Type InterfaceType => typeof(IPLCProxySystemService);

        /// <summary>
        /// 与PLC连接成功
        /// </summary>
        public bool IsConnectedWithPLC { get; set; } = false;
        public PLCProxySystemServiceClient(UInt32 serviceId) : base(serviceId) { }
        public PLCProxySystemServiceClient(UInt32 serviceId, string connName) : base(serviceId, connName) { }




        #region IPLCProxySystemService
        public void FeedPlan(long planID)
        {
            Call(nameof(FeedPlan), new { planID });
        }
        public void RemovePlan(long planID)
        {
            Call(nameof(RemovePlan), new { planID });
        }

        public void SetPlan(string objname, IEnumerable<string> propertynames, long planID)
        {
            Call(nameof(SetPlan), new { objname, propertynames, planID });
        }

        /// <summary>
        /// 设置更新计划
        /// </summary>
        /// <param name="objname">对象名</param>
        /// <param name="propertynames">属性名</param>
        /// <param name="planID">计划的编号，应该全局唯一,建议使用时间ticks</param>
        public void SetPlan(string objname, IEnumerable<string> propertynames, AsyncCBHandler asyncDelegate, object asyncContext)
        {
            Call(nameof(SetPlan), new { objname, propertynames}, asyncDelegate, asyncContext);
        }
        #endregion
    }
}
