int ret = ppp_env_init();
if (ret == 0) {
ppp_print_info("PPP ENV INIT: PPP environment initialized successfully (AT mode)\n");
+ ppp_env_init_monitor_task();
return ERRCODE_SUCC;
} else {
ppp_print_err("PPP ENV INIT: Failed to initialize PPP environment, error: %d\n", ret);
return -1;
}
- /* 4. 创建网络监控任务 */
- PRINT("Creating network monitor task...\r\n");
- g_monitor_task = osal_kthread_create(network_monitor_task, NULL, "net_monitor", (2048+1024)); // 恢复原始栈大小,AT函数已优化
- if (g_monitor_task == NULL) {
- PRINT("Failed to create monitor task\r\n");
- zhihui_ppp_deinit();
- return -1;
- }
-
g_ppp_env_initialized = true;
PRINT("PPP environment initialized successfully (AT mode)\r\n");
if (ppp_is_4g_power_initialized()) {
}
+int ppp_env_init_monitor_task(void)
+{
+ /* 4. 创建网络监控任务 */
+ if (g_monitor_task != NULL) {
+ PRINT("Monitor task already exists\r\n");
+ return 0;
+ }
+ PRINT("Creating network monitor task...\r\n");
+ g_monitor_task = osal_kthread_create(network_monitor_task, NULL, "net_monitor", (2048+1024)); // 恢复原始栈大小,AT函数已优化
+ if (g_monitor_task == NULL) {
+ PRINT("Failed to create monitor task\r\n");
+ return -1;
+ }
+ return 0;
+}
+
/**
* @brief 开始PPP拨号(异步版本,不阻塞AT命令线程)
* @return 0成功启动拨号,-1失败
*/
int ppp_env_deinit(void);
+
/**
- * @brief PPP拨号示例主函数
- *
- * 使用新的模块化函数实现的示例主函数,展示完整的PPP使用流程。
+ * @brief 初始化网络监控任务
*
* @return 0成功,-1失败
*/
-int ppp_example_main(void);
+int ppp_env_init_monitor_task(void);
+
#ifdef __cplusplus
}
system_init_uart();//配置uartat
#endif
-#ifdef BOARD_LEINIAO
- // zhihui_ppp_init();
-#else
- if ( cm_poweron_cat1_on_bootup_flag() )
- {
- PRINT("PowerOn Cat1 !\r\n");
- uapi_set4GCapability(true);
- }else{
- PRINT("PowerOff Cat1 !\r\n");
- uapi_set4GCapability(false);
- }
-#endif
uapi_gei_btmac_and_chipinfo();
uint8_t buildversion[128]={0};
{
CustomEventPublish(TOPIC_EVENT_NEXTDAY_UPDATE, NULL , 0);
}
+
+
+
+#ifdef BOARD_LEINIAO
+ extern int ppp_env_init(void);
+ ppp_env_init();
+#else
+if ( cm_poweron_cat1_on_bootup_flag() )
+{
+ PRINT("PowerOn Cat1 !\r\n");
+ uapi_set4GCapability(true);
+}else{
+ PRINT("PowerOff Cat1 !\r\n");
+ uapi_set4GCapability(false);
+}
+#endif
+
#ifdef A5133_DEMO_SERVER
uapi_button_register_event_cb(a5133_demo_msg_unbind_callback, BUTTON_PWR_CLICKUP_2);
a5133_demo_msg_change_callback();