__init__.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. """PLC 通信层。
  2. 对外只暴露三样东西:
  3. * :func:`build_publisher` —— 按配置创建发布器(Modbus 从站 / S7 推送 / 两者);
  4. * :class:`~portcv.plc.publisher.PlcPublisher` —— 发布器接口;
  5. * :class:`~portcv.plc.modbus_server.ModbusTcpServer` —— 需要自己做探测/自检时直接用。
  6. 寄存器映射与 PLC 侧约定详见 :mod:`portcv.schema`(数据来源)与
  7. :mod:`portcv.plc.modbus_server`(地址规划)。
  8. """
  9. from .modbus_server import ModbusTcpServer
  10. from .publisher import (
  11. ModbusServerPublisher,
  12. MultiPublisher,
  13. NullPublisher,
  14. PlcPublisher,
  15. build_publisher,
  16. )
  17. from .registers import (
  18. CMD_CLEAR_STATS,
  19. CMD_IDLE,
  20. CMD_LABELS,
  21. CMD_REQUEST,
  22. CMD_RESET,
  23. COMMAND_FIELD_NOTES,
  24. SCL_SNIPPET,
  25. SNAPSHOT_FIELD_NOTES,
  26. addresses,
  27. command_rows,
  28. decode_command,
  29. decode_snapshot,
  30. encode_command,
  31. encode_snapshot,
  32. flag_bits,
  33. holding_offsets,
  34. input_offsets,
  35. snapshot_rows,
  36. )
  37. __all__ = [
  38. "CMD_CLEAR_STATS",
  39. "CMD_IDLE",
  40. "CMD_LABELS",
  41. "CMD_REQUEST",
  42. "CMD_RESET",
  43. "COMMAND_FIELD_NOTES",
  44. "ModbusServerPublisher",
  45. "ModbusTcpServer",
  46. "MultiPublisher",
  47. "NullPublisher",
  48. "PlcPublisher",
  49. "SCL_SNIPPET",
  50. "SNAPSHOT_FIELD_NOTES",
  51. "addresses",
  52. "build_publisher",
  53. "command_rows",
  54. "decode_command",
  55. "decode_snapshot",
  56. "encode_command",
  57. "encode_snapshot",
  58. "flag_bits",
  59. "holding_offsets",
  60. "input_offsets",
  61. "snapshot_rows",
  62. ]