IntegratedSystemServiceClient.cs 2.94 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4
using FLY.Integrated.Common;
using FLY.Integrated.IService;
using FLY.Integrated.OBJ_INTERFACE;
using FLY.Integrated.Server.Model;
5 6 7 8 9 10 11 12 13 14 15
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;

潘栩锋's avatar
潘栩锋 committed
16
namespace FLY.Integrated.Client
17
{
潘栩锋's avatar
潘栩锋 committed
18
    public class IntegratedSystemServiceClient : FObjServiceClient, IIntegratedSystemService
19
    {
潘栩锋's avatar
潘栩锋 committed
20
        //public BufferServiceClient<Db_Width> CtrlList;
潘栩锋's avatar
潘栩锋 committed
21
        #region IIntegratedSystemService
22 23 24
        /// <summary>
        /// 数据
        /// </summary>
25
        public IbcData Ibc { get; } = new IbcData();
潘栩锋's avatar
潘栩锋 committed
26

27
        /// <summary>
潘栩锋's avatar
潘栩锋 committed
28
        ///  收卷
29
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
30
        public WinderAccessory Accessory { get; } = new WinderAccessory();
31 32 33 34 35 36 37 38 39

        SyncPropServiceClient syncPropServiceClient;
        /// <summary>
        /// PLC代理系统
        /// </summary>
        public IPLCProxySystemService PLCos { get; private set; }

        #endregion

潘栩锋's avatar
潘栩锋 committed
40 41 42 43 44 45 46 47 48 49 50
        /// <summary>
        /// 当前 INotifyPropertyChanged 对象 引发了 PropertyChanged,  是由于 接收到数据导致的
        /// </summary>
        public bool IsInPushValue
        {
            get
            {
                return syncPropServiceClient.IsInPushValue;
            }
        }

潘栩锋's avatar
潘栩锋 committed
51
        public IntegratedSystemServiceClient(UInt32 serviceId) : base(serviceId)
52 53 54 55
        {
            syncPropServiceClient = new SyncPropServiceClient(
                mServerID + 1,
                new Dictionary<string, INotifyPropertyChanged> {
56
                    {"Ibc", Ibc },
潘栩锋's avatar
潘栩锋 committed
57
                    {"Accessory", Accessory },
58 59 60
                });

            PLCos = new PLCProxySystemServiceClient(
潘栩锋's avatar
潘栩锋 committed
61
                mServerID + 2,
62
                new Dictionary<string, INotifyPropertyChanged> {
63
                    {"Ibc", Ibc },
潘栩锋's avatar
潘栩锋 committed
64
                    {"Accessory", Accessory }
65 66 67
                });


潘栩锋's avatar
潘栩锋 committed
68 69 70 71 72 73
            //CtrlList = new BufferServiceClient<Db_Width>(OBJ_INTERFACE.OBJ_INTERFACE.IBC_OBJ_CTRLLIST_ID);
        }
        public IntegratedSystemServiceClient(UInt32 serviceId, string connName) : this(serviceId)
        {
            ConnName = connName;
            FObjServiceClientManager.Instance.Connect_to_Another_OBJSys(connName, this);
74
        }
潘栩锋's avatar
潘栩锋 committed
75 76 77


        public override UInt32[] GetIDs()
78 79 80 81 82
        {
            List<UInt32> IDs = new List<uint>();
            IDs.Add(ID);
            IDs.Add(syncPropServiceClient.ID);
            IDs.AddRange(((PLCProxySystemServiceClient)PLCos).GetIDs());
潘栩锋's avatar
潘栩锋 committed
83
            //IDs.Add(CtrlList.ID);
84 85 86 87
            return IDs.ToArray();
        }
        public override void ConnectNotify(IFConn from)
        {
潘栩锋's avatar
潘栩锋 committed
88
            base.ConnectNotify(from);
89 90 91 92 93 94 95 96 97 98 99
            if (from.IsConnected)
            {   
                CurrObjSys.SenseConfigEx(mConn, mServerID, ID,
                    0xffffffff, SENSE_CONFIG.ADD);
            }
        }

        

    }
}