Add aaa-12 添加4G注释

RCA:
SOL:
修改人:tongyebin
检视人:
This commit is contained in:
tongyebin 2019-10-24 15:08:53 +08:00
parent 81e1ff45cf
commit f5bc20b62d
1 changed files with 93 additions and 67 deletions

View File

@ -8,18 +8,23 @@ int g_action = 0;
int g_status = STOPPED;
pthread_t lte;
/*
{
"operate":"set",
"action":"start"
}
{
"operate":"getall"
}
*/
/*******************************************
*jsonset
*actiongetall就直接返回
*
* {
* "operate":"set",
* "action":"start"
* }
*
* {
* "operate":"getall"
* }
*
*
*conf_typeaction
*RET_OK,
*********************************************/
ret_code LTE_json_parse(pointer input, uint *conf_type, int action)
{
ret_code ret = RET_OK;
@ -94,6 +99,12 @@ ret_code LTE_json_parse(pointer input, uint *conf_type, int action)
return ret;
}
/************************************
*
*
*
*10
*************************************/
int killpid()
{
char pid[10] = {0};
@ -119,6 +130,13 @@ int killpid()
return 1;
}
/************************************
*4G是否开启成功
*
*
*10
*************************************/
int start_success()
{
char result[RESULT_LENGTH] = {0};
@ -144,6 +162,12 @@ int start_success()
}
}
/************************************
*ppp0口相关的静态路由
*
*
*
*************************************/
int recover_static_route()
{
FILE *f;
@ -217,6 +241,13 @@ next_while:
return conf_file_write(STATIC_ROUTING_PATH,buff_total);
}
/*******************************************************
*线4G状态
*60s
*
*g_status
*
********************************************************/
void _start_lte(void)
{
char result[RESULT_LENGTH] = {0};
@ -307,6 +338,12 @@ void _start_lte(void)
return;
}
/****************************************
*4G的脚本是否执行成功
*
*
*RET_OK
******************************************/
ret_code start_lte()
{
if(g_status == STARTING)
@ -367,6 +404,13 @@ ret_code start_lte()
}
}
/****************************************
*4G的脚本是否执行成功
*
*
*RET_OK
******************************************/
ret_code stop_lte()
{
if(g_status == STARTING)
@ -413,60 +457,14 @@ ret_code stop_lte()
}
/*void restart_lte()
{
char result[RESULT_LENGTH] = {0};
int wait_time = 0;
FILE *f = NULL;
f = popen("/etc/ppp/ppp-4g restart","r");
if (NULL == f)
{
rpc_log_info("execuate cmd fail\n");
g_status = START_FAIL;
return;
}
fseek(f,0,SEEK_SET);
fgets(result,sizeof(result),f);
memset(result,0,sizeof(result));
fseek(f,0,SEEK_CUR);
fgets(result,sizeof(result),f);
rpc_log_info("%s\n",result);
if(strstr(result,"start pppd ppp0") != NULL)
{
while(wait_time < 60)
{
if(start_success() == 1)
{
g_status = CONNECTED;
pclose(f);
return;
}
else
{
sleep(1);
wait_time ++;
}
}
pclose(f);
g_status = START_FAIL;
return;
}
else
{
g_status = START_FAIL;
pclose(f);
return;
}
}*/
/****************************************
*json
*status
*outputoutput_len
*RET_OK
******************************************/
ret_code lte_to_json(char *status, pointer output, int *output_len)
{
if(NULL == status || NULL == output || NULL == output_len)
@ -496,6 +494,14 @@ ret_code lte_to_json(char *status, pointer output, int *output_len)
return ret;
}
/*********************************************
*4G状态的脚本是否执行成功
*
*
*RET_OK
**********************************************/
ret_code status_lte(pointer output, int *output_len)
{
if((NULL == output) || (NULL == output_len))
@ -543,12 +549,19 @@ ret_code status_lte(pointer output, int *output_len)
pclose(f);
return RET_ERR;
}
//·â×°json
//封装json
ret = lte_to_json(status,output,output_len);
pclose(f);
return ret;
}
/****************************************
*4G模块输入校验
*
*
*
******************************************/
ret_code LTE_config_chk(uint source, uint *config_type,
pointer input, int *input_len,
pointer output, int *output_len)
@ -570,13 +583,20 @@ ret_code LTE_config_chk(uint source, uint *config_type,
}
ret_code ret = RET_OK;
//int action = 0;
ret = LTE_json_parse(input,config_type,g_action);
return ret;
}
/*****************************************************
*4G模块配置入口config_type调用不同函数
*
*
*RET_OK
******************************************************/
ret_code LTE_config_proc(uint source, uint config_type,
pointer input, int input_len,
pointer output, int *output_len)
@ -612,7 +632,13 @@ ret_code LTE_config_proc(uint source, uint config_type,
return ret;
}
/****************************************
*4G模块get_all入口
*
*
*RET_OK
******************************************/
ret_code LTE_config_get_all(uint source,
pointer output, int *output_len)
{