IPortArg.cs 953 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using SHJX.Service.Control.Common.Assets;
  2. namespace SHJX.Service.Control.PortArgs.Interface
  3. {
  4. public abstract class IPortArg
  5. {
  6. protected object _writeData;
  7. private Dictionary<string, byte> _nodeIDs;
  8. protected Dictionary<string, byte> NodeIDs
  9. {
  10. get
  11. {
  12. if (_nodeIDs is null)
  13. {
  14. _nodeIDs = ConfigInstance.GetPortNodeIDs();
  15. }
  16. return _nodeIDs;
  17. }
  18. }
  19. protected byte GetPortId(string nodeName)
  20. {
  21. byte nodeId = 0;
  22. if (NodeIDs.TryGetValue(nodeName, out var value))
  23. {
  24. nodeId = value;
  25. }
  26. return nodeId;
  27. }
  28. public IPortArg SetValue(object value)
  29. {
  30. _writeData = value;
  31. return this;
  32. }
  33. public abstract PortEventArgs Init(string name);
  34. }
  35. }