WcfCifxServiceClient.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Aitex.Core.WCF;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace MECF.Framework.Common.EtherCAT.Hongke
  8. {
  9. public class WcfCifxServiceClient : ServiceClientWrapper<IWcfCifxService>, IWcfCifxService
  10. {
  11. public WcfCifxServiceClient(string configName)
  12. : base(configName, "WcfCifxService")
  13. {
  14. }
  15. public WcfCifxServiceClient()
  16. : base("Client_IWcfCifxService", "WcfCifxService")
  17. {
  18. }
  19. public UInt32 ChannelIOWrite(UInt32 hChannel, UInt32 ulAreaNumber, UInt32 ulOffset, UInt32 ulDataLen, byte[] pvData, UInt32 ulTimeout)
  20. {
  21. UInt32 result = 0;
  22. Invoke(svc =>
  23. {
  24. result = svc.ChannelIOWrite(hChannel, ulAreaNumber, ulOffset, ulDataLen, pvData, ulTimeout);
  25. });
  26. return result;
  27. }
  28. public UInt32 ChannelIORead(UInt32 hChannel, UInt32 ulAreaNumber, UInt32 ulOffset, UInt32 ulDataLen, ref byte[] pvData, UInt32 ulTimeout)
  29. {
  30. UInt32 result = 0;
  31. byte[] temp = new byte[1024];
  32. Invoke(svc =>
  33. {
  34. result = svc.ChannelIORead(hChannel, ulAreaNumber, ulOffset, ulDataLen, ref temp, ulTimeout);
  35. });
  36. pvData = temp;
  37. return result;
  38. }
  39. public UInt32 DriverGetErrorDescription(UInt32 lError, byte[] szBuffer, UInt32 ulBufferLen)
  40. {
  41. UInt32 result = 0;
  42. Invoke(svc =>
  43. {
  44. result = svc.DriverGetErrorDescription(lError, szBuffer, ulBufferLen);
  45. });
  46. return result;
  47. }
  48. }
  49. }