using System; using System.Collections.Generic; using System.Data; using EPInterface.Data; using System.ServiceModel; using Aitex.Core.Util; using Aitex.Core.WCF; using EPInterface.Datas; using MECF.Framework.Common.Utilities; namespace EPInterface { public class EPDClient : Singleton { private IEPDService _service; public IEPDService Service { get { if (_service == null) { _service = new EPDServiceClient(); } return _service; } } } public class EPDServiceClient : ServiceClientWrapper, IEPDService { public EPDServiceClient() : base("Client_IEPDService", "EPDService") { } public void SetModel(int channel,string name, string model) { Invoke(svc => { svc.SetModel(channel, name, model); }); } public int Heartbeat(int counter) { int result = 0; Invoke(svc => { result = svc.Heartbeat(counter); }); return result; } public void Online() { Invoke(svc => { svc.Online(); }); } public void Offline() { Invoke(svc => { svc.Offline(); }); } public bool IsOnline() { bool result = false; Invoke(svc => { result = svc.IsOnline(); }); return result; } public void SetOption(string name, string value) { Invoke(svc => { svc.SetOption(name, value); }); } public string GetOption(string name ) { string result = string.Empty; Invoke(svc => { result = svc.GetOption(name); }); return result; } public void RecipeStart(int channel, string name) { Invoke(svc => { svc.RecipeStart(channel, name); }); } public void RecipeStop(int channel) { Invoke(svc => { svc.RecipeStop(channel); }); } public void Start(int channel,int idx, string name, string model) { Invoke(svc => { svc.Start(channel, idx, name, model); }); } public void StartByConfig(int channel, int idx, string name, EPDConfig config) { Invoke(svc => { svc.StartByConfig(channel, idx, name, config); }); } public void Stop(int channel) { Invoke(svc => { svc.Stop(channel); }); } public void Pause(int channel) { Invoke(svc => { svc.Pause(channel); }); } public void Resume(int channel) { Invoke(svc => { svc.Resume(channel); }); } public int QueryChannels() { int result = 0; Invoke(svc => { result = svc.QueryChannels(); }); return result; } public List QueryChannelNames() { List result = new List(); Invoke(svc => { result = svc.QueryChannelNames(); }); return result; } public string QueryChannelName(int channel) { string result = ""; Invoke(svc => { result = svc.QueryChannelName(channel); }); return result; } public Tuple QueryModel(int channel) { Tuple result = null; Invoke(svc => { result = svc.QueryModel(channel); }); return result; } public double[] QueryWave(int channel) { double[] result = null; Invoke(svc => { result = svc.QueryWave(channel); }); return result; } public CRawDataItem QueryData(int channel) { CRawDataItem result = default(CRawDataItem) ; Invoke(svc => { result = svc.QueryData(channel); }); return result; } public EPDState QueryState(int channel) { EPDState result = EPDState.UnSampling; Invoke(svc => { result = svc.QueryState(channel); }); return result; } public bool QueryRecordState(int channel) { bool result = false; Invoke(svc => { result = svc.QueryRecordState(channel); }); return result; } public long QueryRecipeTime(int channel) { long result = 0; Invoke(svc => { result = svc.QueryRecipeTime(channel); }); return result; } public List QueryStepTime(int channel) { List result = new List(); Invoke(svc => { result = svc.QueryStepTime(channel); }); return result; } public List QueryConfigList() { List result = new List(); Invoke(svc => { result = svc.QueryConfigList(); }); return result; } public string QueryConfig(string name) { string result = string.Empty; Invoke(svc => { result = svc.QueryConfig(name); }); return result; } } }