123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- using Aitex.Core.WCF;
- namespace MECF.Framework.Common.PLC
- {
- public class WcfPlcServiceClient : ServiceClientWrapper<IWcfPlcService>, IWcfPlcService
- {
- public WcfPlcServiceClient(string configName)
- : base(configName, "WcfPlcService")
- {
- }
- public WcfPlcServiceClient()
- : base("Client_IWcfPlcService", "WcfPlcService")
- {
- }
- public bool Read(string variable, out object data, string type, int length, out string reason)
- {
- bool result = false;
- object data1 = null;
- string reason1 = string.Empty;
- Invoke(svc =>
- {
- result = svc.Read(variable, out data1, type, length, out reason1);
- });
- data = data1;
- reason = reason1;
- return result;
- }
- public bool WriteArrayElement(string variable, int index, object value, out string reason)
- {
- bool result = false;
- string reason1 = string.Empty;
- Invoke(svc =>
- {
- result = svc.WriteArrayElement(variable, index, value, out reason1);
- });
- reason = reason1;
- return result;
- }
- public int Heartbeat(int counter)
- {
- int result = 0;
- Invoke(svc =>
- {
- result = svc.Heartbeat(counter);
- });
- return result;
- }
- public bool[] ReadDi(int offset, int size, out string reason)
- {
- bool[] result = null;
- string reason1 = string.Empty;
- Invoke(svc => { result = svc.ReadDi(offset, size, out reason1); });
- reason = reason1;
- return result;
- }
- public float[] ReadAiFloat(int offset, int size, out string reason)
- {
- float[] result = null;
- string reason1 = string.Empty;
- Invoke(svc => { result = svc.ReadAiFloat(offset, size, out reason1); });
- reason = reason1;
- return result;
- }
- public int[] ReadAiInt(int offset, int size, out string reason)
- {
- int[] result = null;
- string reason1 = string.Empty;
- Invoke(svc => { result = svc.ReadAiInt(offset, size, out reason1); });
- reason = reason1;
- return result;
- }
- public short[] ReadAiInt16(int offset, int size, out string reason)
- {
- short[] result = null;
- string reason1 = string.Empty;
- Invoke(svc => { result = svc.ReadAiInt16(offset, size, out reason1); });
- reason = reason1;
- return result;
- }
- public bool WriteDo(int offset, bool[] buffer, out string reason)
- {
- bool result = false;
- string reason1 = string.Empty;
- Invoke(svc => { result = svc.WriteDo(offset, buffer, out reason1); });
- reason = reason1;
- return result;
- }
- public bool WriteAoFloat(int offset, float[] buffer, out string reason)
- {
- bool result = false;
- string reason1 = string.Empty;
- Invoke(svc => { result = svc.WriteAoFloat(offset, buffer, out reason1); });
- reason = reason1;
- return result;
- }
- public bool WriteAoInt(int offset, int[] buffer, out string reason)
- {
- bool result = false;
- string reason1 = string.Empty;
- Invoke(svc => { result = svc.WriteAoInt(offset, buffer, out reason1); });
- reason = reason1;
- return result;
- }
- public bool WriteAoInt16(int offset, short[] buffer, out string reason)
- {
- bool result = false;
- string reason1 = string.Empty;
- Invoke(svc => { result = svc.WriteAoInt16(offset, buffer, out reason1); });
- reason = reason1;
- return result;
- }
- }
- }
|