Procházet zdrojové kódy

add: mobile库添加IP_LOSE消息 https://gitee.com/openLuat/LuatOS/issues/I6CL3O

Wendal Chen před 3 roky
rodič
revize
3cf3b994ab
1 změnil soubory, kde provedl 18 přidání a 1 odebrání
  1. 18 1
      components/mobile/luat_lib_mobile.c

+ 18 - 1
components/mobile/luat_lib_mobile.c

@@ -622,6 +622,11 @@ sim卡状态变化
 SIM_IND
 @usage
 sys.subscribe("SIM_IND", function(status)
+    -- status的取值有:
+    -- RDY SIM卡就绪
+    -- NORDY 无SIM卡
+    -- SIM_PIN 需要输入PIN
+    -- GET_NUMBER 获取到电话号码(不一定有值)
     log.info("sim status", status)
 end)
 */
@@ -696,7 +701,19 @@ end)
             lua_call(L, 1, 0);
 			break;
         case LUAT_MOBILE_NETIF_LINK_OFF:
-            LLOGD("NETIF_LINK_OFF");
+            LLOGD("NETIF_LINK_OFF -> IP_LOSE");
+/*
+@sys_pub mobile
+已断网
+IP_LOSE
+@usage
+-- 断网后会发一次这个消息
+sys.subscribe("IP_LOSE", function()
+    log.info("mobile", "IP_LOSE")
+end)
+*/
+            lua_pushstring(L, "IP_LOSE");
+            lua_call(L, 1, 0);
             break;
 		default:
 			break;