Skip to content

Commit

Permalink
add:用户可设置长时间无网后自动重启协议栈恢复
Browse files Browse the repository at this point in the history
  • Loading branch information
allewalker committed May 23, 2023
1 parent e9f5fcf commit ee24d1d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions components/mobile/luat_lib_mobile.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,18 @@ static int l_mobile_set_rrc_auto_release_time(lua_State* L) {
@int 周期性获取小区信息的时间间隔,单位毫秒。获取小区信息会增加部分功耗。写0或者不写则是关闭功能
@int 每次搜索小区时最大搜索时间,单位秒。不要超过8秒
@boolean 网络遇到严重故障时尝试自动恢复,和飞行模式/SIM卡切换冲突,true开启,false关闭,开始状态是false,留空则不做改变
@int 设置定时检测网络是否正常并且在检测到长时间无网时通过重启协议栈来恢复,无网恢复时长,单位ms,建议60000以上,为网络搜索网络保留足够的时间,留空则不做更改
@return nil 无返回值
*/
static int l_mobile_set_auto_work(lua_State* L) {
luat_mobile_set_period_work(luaL_optinteger(L, 2, 0), luaL_optinteger(L, 1, 0), luaL_optinteger(L, 3, 0));
if (LUA_TBOOLEAN == lua_type(L, 4)) {
luat_mobile_fatal_error_auto_reset_stack(lua_toboolean(L, 4));
}
if (lua_isinteger(L, 5)) {
luat_mobile_set_check_network_period(luaL_optinteger(L, 5, 0));
}

return 0;
}

Expand Down
8 changes: 7 additions & 1 deletion components/mobile/luat_mobile.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,13 @@ void luat_mobile_fatal_error_auto_reset_stack(uint8_t onoff);
* @return int
*/
int luat_mobile_set_period_work(uint32_t get_cell_period, uint32_t check_sim_period, uint8_t search_cell_time);

/**
* @brief 设置定时检测网络是否正常并且在检测到长时间无网时通过重启协议栈来恢复,但是不能保证一定成功,这个功能和luat_mobile_reset_stack是有可能冲突的。所有功能默认都是关闭的
*
* @param period 无网时长,单位ms,不可以太短,建议60000以上,为网络搜索网络保留足够的时间
* @return void
*/
void luat_mobile_set_check_network_period(uint32_t period);
/**
* @brief 获取累计的IP流量数据
* @param uplink 上行流量
Expand Down

0 comments on commit ee24d1d

Please sign in to comment.