跳到主要内容

04 插件范围与命令

范围策略

纳入插件

  • transport(轻量版)
  • test_plugin(轻量版)
  • port_forwarder(完整版)

排除插件

  • web
  • sql
  • dependency_manager
  • env_guard
  • 其他非目标服务插件

命令矩阵

命令描述
plugin-list列出当前注册的插件
plugin-load <name> [config]加载插件
plugin-cmd <name> <cmd> [args...]向指定插件发出命令
transport-status快速查看传输状态
test-plugin ...执行 test_plugin 命令
port-forwarder ...执行 port_forwarder 命令

插件级命令

transport

  • status
  • dispatch <proto|auto> <hex_payload>

test_plugin

  • status
  • run [suite]

port_forwarder

  • status
  • stats
  • list
  • add-rule <name> <from_proto> <from_port|*> <to_proto> <to_port>
  • remove-rule <name>
  • enable-rule <name> <0|1>
  • forward <from_proto> <from_port> <hex_payload>
  • save [path]
  • load [path]

插件应用映射(具体用途)

插件典型用途示例
transport设备侧发包与链路 fallbackplugin-cmd transport dispatch auto A1B2C3
test_plugin现场健康检查、OTA 后快速验证plugin-cmd test_plugin run component
port_forwarder网关协议/端口转发桥接port-forwarder add-rule r1 udp 8080 tcp 9000

说明:

  • transport 更偏"发包执行面"。
  • test_plugin 更偏"运行时自检面"。
  • port_forwarder 更偏"网关转发策略面"。

快速示例

# 1) 查看当前纳入的插件
.\build\osfx_cli_cl.exe plugin-list

# 2) 加载作用域插件
.\build\osfx_cli_cl.exe plugin-load transport
.\build\osfx_cli_cl.exe plugin-load test_plugin
.\build\osfx_cli_cl.exe plugin-load port_forwarder

# 3) 通过 plugin-cmd 访问 transport
.\build\osfx_cli_cl.exe plugin-cmd transport status