using FLY.IBC.Common; using FLY.IBC.IService; using FLY.IBC.OBJ_INTERFACE; using FLY.IBC.Server.Model; using FLY.OBJComponents.Client; using FLY.OBJComponents.IService; using FObjBase; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FLY.IBC.Client { public class IbcSystemServiceClient : FObjServiceClient, IIbcSystemService { //public BufferServiceClient<Db_Width> CtrlList; #region IIBCSystemService /// <summary> /// 数据 /// </summary> public IBCData Item { get; } = new IBCData(); SyncPropServiceClient syncPropServiceClient; /// <summary> /// PLC代理系统 /// </summary> public IPLCProxySystemService PLCos { get; private set; } #endregion /// <summary> /// 当前 INotifyPropertyChanged 对象 引发了 PropertyChanged, 是由于 接收到数据导致的 /// </summary> public bool IsInPushValue { get { return syncPropServiceClient.IsInPushValue; } } public IbcSystemServiceClient(UInt32 serviceId) : base(serviceId) { Init(); } public IbcSystemServiceClient(UInt32 serviceId, string connName) : base(serviceId) { Init(); ConnName = connName; FObjServiceClientManager.Instance.Connect_to_Another_OBJSys(connName, this); } void Init() { syncPropServiceClient = new SyncPropServiceClient( mServerID + 1, new Dictionary<string, INotifyPropertyChanged> { {"Item", Item } }); PLCos = new PLCProxySystemServiceClient( mServerID + 2, new Dictionary<string, INotifyPropertyChanged> { { "Item", Item } }); //CtrlList = new BufferServiceClient<Db_Width>(OBJ_INTERFACE.OBJ_INTERFACE.IBC_OBJ_CTRLLIST_ID); } /// <summary> /// /// </summary> /// <returns></returns> public override UInt32[] GetIDs() { List<UInt32> IDs = new List<uint>(); IDs.Add(ID); IDs.Add(syncPropServiceClient.ID); IDs.AddRange(((PLCProxySystemServiceClient)PLCos).GetIDs()); //IDs.Add(CtrlList.ID); return IDs.ToArray(); } public override void ConnectNotify(IFConn from) { base.ConnectNotify(from); if (from.IsConnected) { CurrObjSys.SenseConfigEx(mConn, mServerID, ID, 0xffffffff, SENSE_CONFIG.ADD); } } } }