Преглед изворни кода

update: iperf,更新API文档,补充回调消息的说明

https://gitee.com/openLuat/LuatOS/issues/ICS76U
Wendal Chen пре 5 месеци
родитељ
комит
303b1df162
1 измењених фајлова са 7 додато и 2 уклоњено
  1. 7 2
      components/network/iperf/binding/luat_lib_iperf.c

+ 7 - 2
components/network/iperf/binding/luat_lib_iperf.c

@@ -6,8 +6,7 @@
 @date    2025.02.14
 @tag LUAT_USE_IPERF
 @usage
--- 本库仅部分模组固件已添加
--- 当前仅支持server模式, client模式未添加
+-- 支持server模式, 也支持client模式
 */
 
 #include "luat_base.h"
@@ -108,10 +107,15 @@ static int start_gogogo(int adpater_id, int is_server, const ip_addr_t* remote_i
 @return boolean 成功返回true, 失败返回false
 @usage
 -- 启动server模式, 监听5001端口
+-- 注意, 该网卡必须已经联网成功, 并且有ip地址
 if iperf then
     log.info("启动iperf服务器端")
     iperf.server(socket.LWIP_ETH)
 end
+-- 测试结果回调
+sys.subscribe("IPERF_REPORT", function(bytes, ms_duration, bandwidth)
+    log.info("iperf", bytes, ms_duration, bandwidth)
+end)
 */
 static int l_iperf_server(lua_State *L) {
     if (iperf_session != NULL) {
@@ -134,6 +138,7 @@ static int l_iperf_server(lua_State *L) {
 @return boolean 成功返回true, 失败返回false
 @usage
 -- 启动client模式, 连接服务器的5001端口
+-- 注意, 该网卡必须已经联网成功, 并且有ip地址
 if iperf then
     log.info("启动iperf客户端端")
     -- 47.94.236.172 是演示服务器, 不一定有开启