using FLY.OBJComponents.IService; using FLY.OBJComponents.OBJ_INTERFACE; using FObjBase; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace FLY.OBJComponents.Server.OBJProxy { public class PLCProxySystem_OBJProxy : FObj { IPLCProxySystemService plcos; SyncProp_OBJProxy syncProp_OBJProxy; /// <summary> /// 内部会使用 serverID,serverID+1 /// </summary> /// <param name="objsys_idx"></param> /// <param name="serverID"></param> /// <param name="plcos"></param> public PLCProxySystem_OBJProxy(int objsys_idx, UInt32 serverID, IPLCProxySystemService plcos) : base(objsys_idx) { ID = serverID; this.plcos = plcos; syncProp_OBJProxy = new SyncProp_OBJProxy( objsys_idx, serverID + 1, new Dictionary<string, System.ComponentModel.INotifyPropertyChanged> { { ".", plcos } }); } public override void CallFunction(IFConn from, uint srcid, uint magic, ushort funcid, byte[] infodata) { switch (funcid) { case PLCOS_OBJ_INTERFACE.CALL_SET_PLAN: { string json = Misc.Converter.BytesToString(infodata); PLCOS_OBJ_INTERFACE.Pack_SetPlanRequest pack = JsonConvert.DeserializeObject<PLCOS_OBJ_INTERFACE.Pack_SetPlanRequest>(json); plcos.SetPlan(pack.objname, pack.propertyNames, pack.planid); } break; case PLCOS_OBJ_INTERFACE.CALL_FEED_PLAN: { string json = Misc.Converter.BytesToString(infodata); PLCOS_OBJ_INTERFACE.Pack_FeedPlanRequest pack = JsonConvert.DeserializeObject<PLCOS_OBJ_INTERFACE.Pack_FeedPlanRequest>(json); plcos.FeedPlan(pack.planid); } break; } } } }