PLC.cs 861 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace WCS.Core
  7. {
  8. public class PLC : EntityEx<PLCInfo>
  9. {
  10. public PLC(PLCInfo ent) : base(ent)
  11. {
  12. if (Configs.PLCAccessorCreater != null)
  13. {
  14. Accessor = Configs.PLCAccessorCreater.Create(ent);
  15. }
  16. else
  17. throw new Exception("Configs.PLCAccessorCreater未赋值");
  18. }
  19. public IPLCAccessor Accessor { get; private set; }
  20. }
  21. public interface IPLCAccessorCreater
  22. {
  23. IPLCAccessor Create(PLCInfo data);
  24. }
  25. public interface IPLCAccessor
  26. {
  27. void WriteBytes(ushort db, ushort address, byte[] data);
  28. byte[] ReadBytes(ushort db, ushort address, ushort length);
  29. }
  30. }