mirror of
https://gitee.com/openLuat/LuatOS
synced 2025-08-17 22:18:03 +08:00
add:mobile允许开机优先使用SIM0
This commit is contained in:
parent
7ded1adee9
commit
4690d5d6eb
|
@ -196,7 +196,8 @@ static int l_mobile_number(lua_State* L) {
|
|||
/**
|
||||
获取当前SIM卡槽,或者切换卡槽
|
||||
@api mobile.simid(id)
|
||||
@int SIM卡的编号, 例如0, 1,如果支持双卡,比如EC618,可以填2来自适应,但是会占用掉4个IO。如果不填就直接读取当前卡槽
|
||||
@int SIM卡的编号, 例如0, 1, 如果支持双卡,比如EC618,可以填2来自适应,但是会占用掉4个IO。如果不填就直接读取当前卡槽
|
||||
@boolean 是否优先用SIM0,只有SIM卡编号写2自适应才有用!!!。true优先用SIM0,false则优先用上一次探测到的,默认是false,必须在开机就配置,否则就无效了
|
||||
@return int 当前sim卡槽编号,若失败返回-1
|
||||
*/
|
||||
static int l_mobile_simid(lua_State* L) {
|
||||
|
@ -207,6 +208,11 @@ static int l_mobile_simid(lua_State* L) {
|
|||
ret = luat_mobile_set_sim_id(lua_tointeger(L, 1));
|
||||
LLOGI("sim set to %d , ret %d", lua_tointeger(L, 1), ret);
|
||||
}
|
||||
if (LUA_TBOOLEAN == lua_type(L, 2)) {
|
||||
if (lua_toboolean(L, 2)) {
|
||||
luat_mobile_set_sim_detect_sim0_fisrt();
|
||||
}
|
||||
}
|
||||
ret = luat_mobile_get_sim_id(&id);
|
||||
if (ret == 0) {
|
||||
lua_pushinteger(L, id);
|
||||
|
|
|
@ -110,6 +110,12 @@ int luat_mobile_get_sim_id(int *id);
|
|||
*/
|
||||
int luat_mobile_set_sim_id(int id);
|
||||
|
||||
/**
|
||||
* @brief 在自动选择模式时,开机后优先用sim0
|
||||
*
|
||||
*/
|
||||
void luat_mobile_set_sim_detect_sim0_fisrt(void);
|
||||
|
||||
/**
|
||||
* @brief 设置默认PDN激活时是否要IPV6网络,现在默认情况下不开
|
||||
* @param onoff 1开 0关
|
||||
|
|
|
@ -7,11 +7,10 @@ log.info("main", PROJECT, VERSION)
|
|||
|
||||
-- sys库是标配
|
||||
_G.sys = require("sys")
|
||||
|
||||
-- 对于双卡的设备, 可以设置为自动选sim卡
|
||||
-- 但是, 这样SIM1所在管脚就强制复用为SIM功能, 不可以再复用为GPIO
|
||||
-- mobile.simid(2)
|
||||
|
||||
mobile.simid(2,true)--优先用SIM0
|
||||
sys.taskInit(function()
|
||||
-- mobile.apn(0,2,"") -- 使用默认APN激活CID2
|
||||
mobile.rtime(2) -- 在无数据交互时,RRC2秒后自动释放
|
||||
|
|
Loading…
Reference in New Issue
Block a user