上库LYNQ_SLEEP接口以及添加对应测试demo(LPM接口暂时未完成等驱动配合),优化LYNQ_NW模块支持配置飞行模式,配置OOS
Change-Id: Id6e9d9e05d8392348cf567a22c253c3a4e319af5
diff --git a/mbtk/mbtk_ril/src/mbtk_info_server.c b/mbtk/mbtk_ril/src/mbtk_info_server.c
index f731309..861c64b 100755
--- a/mbtk/mbtk_ril/src/mbtk_info_server.c
+++ b/mbtk/mbtk_ril/src/mbtk_info_server.c
@@ -75,7 +75,7 @@
if (state >= 0 && state < 32)
{
sprintf(cmd, "AT*POWERIND=%d", state);
- LOG("Set the powerind command is = %s.\n", cmd);
+ LOG("Set the powerind command is = [%s]\n", cmd);
}
int err = at_send_command(cmd, &response);
if (err < 0 || response->success == 0){
@@ -89,36 +89,56 @@
}
/*
+AT+OOSPP=1
+or
+AT+OOSPP=0
+or
AT+OOSPP=1,20,30,40 //AtOospp()
param1:mode
param2:oosPhasePeriod[0] //5 times, 5s by default;
- param3:oosPhasePeriod[1] //5 times, 5s by default;
- param4:oosPhasePeriod[2] //unlimited, 5s by default;
+ param3:oosPhasePeriod[1] //5 times, 10s by default;
+ param4:oosPhasePeriod[2] //unlimited, 20s by default;
BTW
1, 如果只输入mode=1,其余参数不设置,相当于这个功能打开,时间间隔是这个功能的默认值。
2, 如果当mode=1加上其余设置参数后,功能打开,时间间隔是本次设置的值;
-3,如果再设置mode=0,相当于这个功能关闭,是走默认的搜网间隔。
-
+3,如果再设置mode=0,相当于这个功能关闭,是走平台自己另一套的搜网设置。
+平台本身是有一套间隔搜网,也有历史频点优先处理的逻辑(不需要我们进行处理),
+提供给我们的AT+OOSPP指令是让我们可以自定义搜网间隔
*/
-static int req_oos_set(char* state, int *cme_err)
+static int req_oos_set(mbtk_oos_info* state, int *cme_err)
{
ATResponse *response = NULL;
char cmd[100] = {0};
- int mode;
- mode = atoi(state);
- if (mode == 1 || mode == 0)//只有一个值0/1
+ if ((state->mode == 1 && state->oosPhase[0] == 0 && state->oosPhase[1] == 0 && state->oosPhase[2] == 0) \
+ || state->mode == 0)
{
- sprintf(cmd, "AT+OOSPP=%d", mode);
+ sprintf(cmd, "AT+OOSPP=%d", state->mode);//只有一个值0/1
}
else
{
- sprintf(cmd, "AT+OOSPP=%s", state);
+ if ((state->oosPhase[0] != 0) && (state->oosPhase[1] != 0) && (state->oosPhase[2] != 0))
+ {
+ sprintf(cmd, "AT+OOSPP=%d,%d,%d,%d", state->mode, state->oosPhase[0], state->oosPhase[1], state->oosPhase[2]);
+ }
+ else if ((state->oosPhase[0] != 0) && (state->oosPhase[1] != 0) && (state->oosPhase[2] == 0))
+ {
+ sprintf(cmd, "AT+OOSPP=%d,%d,%d", state->mode, state->oosPhase[0], state->oosPhase[1]);
+ }
+ else if ((state->oosPhase[0] != 0) && (state->oosPhase[1] == 0) && (state->oosPhase[2] == 0))
+ {
+ sprintf(cmd, "AT+OOSPP=%d,%d", state->mode, state->oosPhase[0]);
+ }
+ else
+ {
+ LOG("AT+OOSPP SET ERR");
+ goto exit;
+ }
}
- LOG("Set the oos command is = %s.\n", cmd);
+ LOG("Set the oos command is = [%s]\n", cmd);
int err = at_send_command(cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
@@ -133,8 +153,8 @@
/*
AT+OOSPP?
-开:
-+OOSPP:5,5,5
+开(默认值):
++OOSPP:5,10,20
关:
+OOSPP:0
*/
@@ -142,7 +162,7 @@
{
ATResponse *response = NULL;
- int err = at_send_command_singleline("AT+CSCA?", "+OOSPP:", &response);
+ int err = at_send_command_singleline("AT+OOSPP?", "+OOSPP:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
@@ -152,42 +172,48 @@
char *line = response->p_intermediates->line;
char *tmp_str = NULL;
+ err = at_tok_start(&line);//+OOSPP:10,15,20,过滤+OOSPP:
+ if (err < 0)
+ {
+ goto exit;
+ }
+
+ //LOG("req_oos_get =[%s]",line);
+
err = at_tok_nextstr(&line, &tmp_str);
if (err < 0)
{
goto exit;
}
- LOG("[xiaorui] >>> req_oos_get =[%s]",tmp_str);
-
int mode = atoi(tmp_str);
if (mode == 0)//关闭状态
{
- req->mode = (uint8)mode;
+ req->mode = mode;
}
else//开状态
{
req->mode = 1;
-
- req->oosPhase[0] = (uint8)tmp_str;
+ //LOG("tmp_str =[%s]",tmp_str);
+ req->oosPhase[0] = atoi(tmp_str);
err = at_tok_nextstr(&line, &tmp_str);
if (err < 0)
{
goto exit;
}
- req->oosPhase[1] = (uint8)tmp_str;
+ //LOG("tmp_str =[%s]",tmp_str);
+ req->oosPhase[1] = atoi(tmp_str);
err = at_tok_nextstr(&line, &tmp_str);
if (err < 0)
{
goto exit;
}
- req->oosPhase[2] = (uint8)tmp_str;
+ //LOG("tmp_str =[%s]",tmp_str);
+ req->oosPhase[2] = atoi(tmp_str);
}
- memcpy(req, tmp_str, strlen(tmp_str));
-
exit:
at_response_free(response);
return err;
@@ -5248,17 +5274,22 @@
err = MBTK_INFO_ERR_UNKNOWN;
}
LOG("Get SMS OOS fail.");
- printf("Get OOS fail\n");
}
else
{
- printf("Get OOS suscess\n");
pack_rsp_send(cli_info->fd, MBTK_INFO_ID_OOS_STA_RSP, &oos_t, sizeof(mbtk_oos_info));
}
}
else // Set OOS
{
- char* state = pack->data;
+ mbtk_oos_info *state = (mbtk_oos_info *)pack->data;
+ if(pack->data_len != sizeof(mbtk_oos_info))
+ {
+ err = MBTK_INFO_ERR_REQ_PARAMETER;
+ LOG("Set oos error.");
+ break;
+ }
+
if(req_oos_set(state, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
{
if(cme_err != MBTK_INFO_ERR_CME_NON) {