1.去除编译警告

This commit is contained in:
payton 2023-09-06 21:09:40 +08:00
parent 8ce2b8abbe
commit b1ec28e979
2 changed files with 161 additions and 161 deletions

View File

@ -9,13 +9,13 @@
#define INPUT_SUBFOLDER "mnt/sd/config" #define INPUT_SUBFOLDER "mnt/sd/config"
#define OUTPUT_SUBFOLDER "mnt/sd/logs" #define OUTPUT_SUBFOLDER "mnt/sd/logs"
#ifndef true #ifndef true
#define true 1 #define true 1
#endif #endif
#ifndef false #ifndef false
#define false 0 #define false 0
#endif #endif
#define PROFILE_STATE_DISABLED 0 #define PROFILE_STATE_DISABLED 0
@ -48,8 +48,8 @@ LPA_API_ERROR sf_enable_profile(UINT8 indexProfiles);
UINT32 sf_profile_name_paired(UINT8 *profileName, UINT8 *operatorName); UINT32 sf_profile_name_paired(UINT8 *profileName, UINT8 *operatorName);
void sf_lpa_profile_active_change(void); void sf_lpa_profile_active_change(void);
UINT8 sf_is_esim_card(); UINT8 sf_is_esim_card(void);
UINT8 sf_is_esim_init_finish(); UINT8 sf_is_esim_init_finish(void);
UINT32 sf_get_profile_total(void); UINT32 sf_get_profile_total(void);
UINT32 sf_is_profile_index_enable(UINT8 index); UINT32 sf_is_profile_index_enable(UINT8 index);
@ -70,7 +70,7 @@ SINT32 sf_lpa_set_download_profile_iccid(SINT8* iccid);
void sf_set_wifi_socket(int fd); void sf_set_wifi_socket(int fd);
int sf_get_wifi_socket(void); int sf_get_wifi_socket(void);
void sf_set_wifi_cmd(UINT8 cmd); void sf_set_wifi_cmd(UINT8 cmd);
UINT8 sf_get_wifi_cmd(); UINT8 sf_get_wifi_cmd(void);
void sf_network_select(UINT8* profileId); void sf_network_select(UINT8* profileId);
void sf_4g_operator_scan(UINT8 mode); void sf_4g_operator_scan(UINT8 mode);

View File

@ -1918,7 +1918,7 @@ void sf_set_esim_card(UINT8 flag)
g_esim_flag = flag; g_esim_flag = flag;
} }
UINT8 sf_is_esim_card() UINT8 sf_is_esim_card(void)
{ {
return g_esim_flag; return g_esim_flag;
} }
@ -1930,7 +1930,7 @@ void sf_set_esim_init_finish(UINT8 flag)
{ {
g_esim_init_finish_flag = flag; g_esim_init_finish_flag = flag;
} }
UINT8 sf_is_esim_init_finish() UINT8 sf_is_esim_init_finish(void)
{ {
return g_esim_init_finish_flag; return g_esim_init_finish_flag;
} }
@ -1971,7 +1971,7 @@ void sf_lpa_profile_info_refresh(void)
void sf_sample_lpa_thread() void sf_sample_lpa_thread(void)
{ {
bool res; bool res;
const LPA_API_VERSION* lpaApiVersion; const LPA_API_VERSION* lpaApiVersion;
@ -2346,7 +2346,7 @@ void sf_sample_lpa_init(void)
if(!SfLpaTskParam.IsRun) if(!SfLpaTskParam.IsRun)
{ {
pthread_create(&SfLpaTskParam.TskId, NULL, sf_sample_lpa_thread, NULL); pthread_create(&SfLpaTskParam.TskId, NULL, (void *)sf_sample_lpa_thread, NULL);
SfLpaTskParam.IsRun = 1; SfLpaTskParam.IsRun = 1;
} }
} }
@ -2369,7 +2369,7 @@ void sf_profile_active_change_thread(ULONG tmp)
void sf_lpa_profile_active_change(void) void sf_lpa_profile_active_change(void)
{ {
pthread_t tLpaProfileActiveTask; pthread_t tLpaProfileActiveTask;
pthread_create(&tLpaProfileActiveTask,NULL,sf_profile_active_change_thread,(void *)NULL); pthread_create(&tLpaProfileActiveTask,NULL,(void *)sf_profile_active_change_thread,(void *)NULL);
} }
@ -2803,42 +2803,42 @@ void sf_operator_scan_thread(UINT32 *tmp)
{ {
printf("scan network.\n"); printf("scan network.\n");
UINT8 totalOperator = 0; UINT8 totalOperator = 0;
UINT8 totalProfile = 0; UINT8 totalProfile = 0;
UINT8 i = 0; UINT8 i = 0;
UINT8 errCode = CMD_SUCCESS; UINT8 errCode = CMD_SUCCESS;
UINT8 mode = (UINT8)*tmp; UINT8 mode = (UINT8)*tmp;
UINT8 *sendBuff = NULL; UINT8 *sendBuff = NULL;
UINT16 sendBuffLen = 0; UINT16 sendBuffLen = 0;
APP_SVR_PACKET_T *pMsgParse = NULL; APP_SVR_PACKET_T *pMsgParse = NULL;
SF_OPERATORS_LIST_T operatorInfo; SF_OPERATORS_LIST_T operatorInfo;
Operator_Info_T *pOperatorInfo = NULL; Operator_Info_T *pOperatorInfo = NULL;
Profile_Info_T *pProfileInfo = NULL; Profile_Info_T *pProfileInfo = NULL;
LPA_PROFILE_INFO profileItem; LPA_PROFILE_INFO profileItem;
UINT16 profileListBase = 0; UINT16 profileListBase = 0;
UINT8 OperatorNameL[20] = {0}; UINT8 OperatorNameL[20] = {0};
SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get();
memset((void *)&profileItem, 0, sizeof(LPA_PROFILE_INFO)); memset((void *)&profileItem, 0, sizeof(LPA_PROFILE_INFO));
memset((void *)&operatorInfo, 0, sizeof(SF_OPERATORS_LIST_T)); memset((void *)&operatorInfo, 0, sizeof(SF_OPERATORS_LIST_T));
printf("mode=%d\n", mode); printf("mode=%d\n", mode);
errCode = sf_check_network_status(); errCode = sf_check_network_status();
if(errCode == CMD_SUCCESS) if(errCode == CMD_SUCCESS)
{ {
totalOperator = sf_get_operator_total(); totalOperator = sf_get_operator_total();
if(mode == 0) //scan if(mode == 0) //scan
{ {
errCode = NETWORK_CMD_NOT_SUPPORT; errCode = NETWORK_CMD_NOT_SUPPORT;
#if 0 #if 0
sf_operator_delete_to_list(); sf_operator_delete_to_list();
sf_operator_scan(); sf_operator_scan();
totalOperator = sf_get_operator_total(); totalOperator = sf_get_operator_total();
#endif #endif
} }
else if(mode == 1) //not scan and return esim info else if(mode == 1) //not scan and return esim info
{ {
@ -2851,71 +2851,71 @@ void sf_operator_scan_thread(UINT32 *tmp)
{ {
errCode = NETWORK_CMD_NOT_SUPPORT; errCode = NETWORK_CMD_NOT_SUPPORT;
} }
totalProfile = sf_get_profile_total(); totalProfile = sf_get_profile_total();
} }
//int fd = sf_get_wifi_socket(); //int fd = sf_get_wifi_socket();
UINT8 currentCmd = sf_get_wifi_cmd(); UINT8 currentCmd = sf_get_wifi_cmd();
{ {
sendBuffLen = 10/*Magic+MsgLen+CMD+ACK+EndFlag*/ + 5/*Operator/Profile Total,ID*/ + totalOperator * sizeof(Operator_Info_T) + totalProfile * sizeof(Profile_Info_T); sendBuffLen = 10/*Magic+MsgLen+CMD+ACK+EndFlag*/ + 5/*Operator/Profile Total,ID*/ + totalOperator * sizeof(Operator_Info_T) + totalProfile * sizeof(Profile_Info_T);
printf("sendBuffLen=%d totalOperator=%d totalProfile=%d\n", sendBuffLen, totalOperator, totalProfile); printf("sendBuffLen=%d totalOperator=%d totalProfile=%d\n", sendBuffLen, totalOperator, totalProfile);
sendBuff = malloc(sendBuffLen); sendBuff = malloc(sendBuffLen);
memset((void *)sendBuff, 0, sendBuffLen); memset((void *)sendBuff, 0, sendBuffLen);
pMsgParse = (APP_SVR_PACKET_T *)sendBuff; pMsgParse = (APP_SVR_PACKET_T *)sendBuff;
pMsgParse->magicNum = htons(MSG_PRE_FIX); pMsgParse->magicNum = htons(MSG_PRE_FIX);
pMsgParse->cmd = htons(currentCmd); pMsgParse->cmd = htons(currentCmd);
pMsgParse->rsp = htons(MSG_WIFI_2_APP); pMsgParse->rsp = htons(MSG_WIFI_2_APP);
pMsgParse->msglen = htons(sendBuffLen - 2*sizeof(UINT16)); pMsgParse->msglen = htons(sendBuffLen - 2*sizeof(UINT16));
pMsgParse->msgBuf.rctrlNetworkScan.cmdRet = errCode; pMsgParse->msgBuf.rctrlNetworkScan.cmdRet = errCode;
pMsgParse->msgBuf.rctrlNetworkScan.buff[0] = totalOperator; pMsgParse->msgBuf.rctrlNetworkScan.buff[0] = totalOperator;
pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = 0xff; pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = 0xff;
pOperatorInfo = (Operator_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[2]); pOperatorInfo = (Operator_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[2]);
sf_get_operatorname(OperatorNameL); sf_get_operatorname(OperatorNameL);
for(i = 0; i < totalOperator; i++) for(i = 0; i < totalOperator; i++)
{ {
if(sf_get_operator_item(i, &operatorInfo) == SUCCESS) if(sf_get_operator_item(i, &operatorInfo) == SUCCESS)
{ {
pOperatorInfo[i].operatorId = operatorInfo.Index; pOperatorInfo[i].operatorId = operatorInfo.Index;
SF_STRNCPY(&(pOperatorInfo[i].operatorName), &(operatorInfo.OperatorNameLong), 16); SF_STRNCPY(&(pOperatorInfo[i].operatorName), &(operatorInfo.OperatorNameLong), 16);
pOperatorInfo[i].signalVal = operatorInfo.SignalVal; pOperatorInfo[i].signalVal = operatorInfo.SignalVal;
if(SF_STRNCMP(operatorInfo.OperatorNameLong, OperatorNameL, sizeof(operatorInfo.OperatorNameLong)) == 0) if(SF_STRNCMP(operatorInfo.OperatorNameLong, OperatorNameL, sizeof(operatorInfo.OperatorNameLong)) == 0)
{ {
pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = operatorInfo.Index; pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = operatorInfo.Index;
} }
} }
} }
profileListBase = 2 + totalOperator * sizeof(Operator_Info_T); profileListBase = 2 + totalOperator * sizeof(Operator_Info_T);
printf("profileListBase=%d\n", profileListBase); printf("profileListBase=%d\n", profileListBase);
pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase] = totalProfile; //htons(totalProfile); pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase] = totalProfile; //htons(totalProfile);
pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 1] = 0xff; pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 1] = 0xff;
pProfileInfo = (Profile_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 2]); pProfileInfo = (Profile_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 2]);
for(i = 0; i < totalProfile; i++) for(i = 0; i < totalProfile; i++)
{ {
if(sf_get_profile_item(i, &profileItem) == SUCCESS) if(sf_get_profile_item(i, &profileItem) == SUCCESS)
{ {
pProfileInfo[i].profileId = i; pProfileInfo[i].profileId = i;
SF_STRNCPY(&pProfileInfo[i].profileName, profileItem.profileName, 16); SF_STRNCPY(&pProfileInfo[i].profileName, profileItem.profileName, 16);
if(profileItem.profileState[0] == PROFILE_STATE_ENABLED) if(profileItem.profileState[0] == PROFILE_STATE_ENABLED)
{ {
pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 1] = i; pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 1] = i;
} }
} }
} }
sendBuff[sendBuffLen - 2] = 0xff; sendBuff[sendBuffLen - 2] = 0xff;
sendBuff[sendBuffLen - 1] = 0xee; sendBuff[sendBuffLen - 1] = 0xee;
//memdump(sendBuff, sendBuffLen); //memdump(sendBuff, sendBuffLen);
//send(fd,(void *)sendBuff, sendBuffLen, 0); //send(fd,(void *)sendBuff, sendBuffLen, 0);
wifiCfg->Lenth = sendBuffLen; wifiCfg->Lenth = sendBuffLen;
@ -2948,7 +2948,7 @@ void sf_operator_scan_thread(UINT32 *tmp)
sf_share_mem_wifi_down(1); sf_share_mem_wifi_down(1);
} }
} }
@ -3065,16 +3065,16 @@ void sf_network_select_thread(UINT8 * tmp)
UINT32 ret = SF_LPA_SUCCESS; UINT32 ret = SF_LPA_SUCCESS;
UINT32 sts = 0; UINT32 sts = 0;
UINT32 retryTime=0; UINT32 retryTime=0;
UINT8 errCode = CMD_SUCCESS; UINT8 errCode = CMD_SUCCESS;
UINT8 profileId = *tmp; UINT8 profileId = *tmp;
UINT8 curActiveProfileId = 0; UINT8 curActiveProfileId = 0;
UINT32 totalProfile = 0; UINT32 totalProfile = 0;
LPA_API_ERROR lpaErrCode = LPA_NO_ERROR; LPA_API_ERROR lpaErrCode = LPA_NO_ERROR;
errCode = sf_check_network_status(); errCode = sf_check_network_status();
if(errCode == CMD_SUCCESS) if(errCode == CMD_SUCCESS)
{ {
sf_get_profile_active_index(&curActiveProfileId); sf_get_profile_active_index(&curActiveProfileId);
@ -3108,11 +3108,11 @@ void sf_network_select_thread(UINT8 * tmp)
//LOG_DM_RS("Swich Result:0x%02x\n", lpaErrCode); //LOG_DM_RS("Swich Result:0x%02x\n", lpaErrCode);
if(lpaErrCode == LPA_NO_ERROR) if(lpaErrCode == LPA_NO_ERROR)
{ {
sf_lpa_profile_info_refresh(); sf_lpa_profile_info_refresh();
errCode = CMD_SUCCESS; errCode = CMD_SUCCESS;
sts = 1; sts = 1;
} }
else if (lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY) else if (lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY)
{ {
retryTime++; retryTime++;
@ -3147,24 +3147,24 @@ void sf_network_select_thread(UINT8 * tmp)
continue; continue;
} }
else else
{ {
if(lpaErrCode == SF_LPA_ERROR_PROFILE_NOT_FOUND) if(lpaErrCode == SF_LPA_ERROR_PROFILE_NOT_FOUND)
{ {
printf("status:PROFILE_NOT_FOUND\n"); printf("status:PROFILE_NOT_FOUND\n");
errCode = NETWORK_PROFILE_NOT_FOUND; errCode = NETWORK_PROFILE_NOT_FOUND;
} }
else if(lpaErrCode == SF_LPA_ERROR_PROFILE_IS_ENABLE) else if(lpaErrCode == SF_LPA_ERROR_PROFILE_IS_ENABLE)
{ {
printf("status:PROFILE_IS_ENABLE\n"); printf("status:PROFILE_IS_ENABLE\n");
errCode = NETWORK_NOT_NEED_SET; errCode = NETWORK_NOT_NEED_SET;
} }
else else
{ {
printf("status:SELECT_FAILED\n"); printf("status:SELECT_FAILED\n");
errCode = NETWORK_PROFILE_SELECT_FAILED; errCode = NETWORK_PROFILE_SELECT_FAILED;
} }
sts = 1; sts = 1;
} }
} }
if(lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY) if(lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY)
@ -3267,9 +3267,9 @@ void sf_network_select_thread(UINT8 * tmp)
} }
} }
sf_wifi_server_network_select_finish(errCode); sf_wifi_server_network_select_finish(errCode);
#if ((!SF_IQ_DEBUG)&&(!SF_4G_TEST)) #if ((!SF_IQ_DEBUG)&&(!SF_4G_TEST))
if(errCode == CMD_SUCCESS) if(errCode == CMD_SUCCESS)
@ -3281,14 +3281,14 @@ void sf_network_select_thread(UINT8 * tmp)
#endif #endif
#if 0 #if 0
if((errCode == CMD_SUCCESS) || (errCode == NETWORK_PROFILE_SELECT_FAILED)) if((errCode == CMD_SUCCESS) || (errCode == NETWORK_PROFILE_SELECT_FAILED))
{ {
sleep(3); sleep(3);
sf_send_poweroff_msg(); sf_send_poweroff_msg();
printf("[power off] %s(%d)\n",__FUNCTION__,__LINE__); printf("[power off] %s(%d)\n",__FUNCTION__,__LINE__);
} }
#endif #endif
} }
@ -3307,15 +3307,15 @@ void sf_network_switch_thread()
UINT32 ret = SF_LPA_SUCCESS; UINT32 ret = SF_LPA_SUCCESS;
UINT32 sts = 0; UINT32 sts = 0;
UINT32 retryTime=0; UINT32 retryTime=0;
UINT8 errCode = CMD_SUCCESS; UINT8 errCode = CMD_SUCCESS;
UINT8 profileId = 0; UINT8 profileId = 0;
UINT8 curActiveProfileId = 0; UINT8 curActiveProfileId = 0;
LPA_API_ERROR lpaErrCode = LPA_NO_ERROR; LPA_API_ERROR lpaErrCode = LPA_NO_ERROR;
errCode = sf_check_network_status(); errCode = sf_check_network_status();
SLOGE("errCode:%x\n", errCode); SLOGE("errCode:%x\n", errCode);
if(errCode == CMD_SUCCESS) if(errCode == CMD_SUCCESS)
{ {
if(sf_get_active_profile_next_index(&profileId) == FALSE) if(sf_get_active_profile_next_index(&profileId) == FALSE)
{ {
@ -3338,11 +3338,11 @@ void sf_network_switch_thread()
//LOG_DM_RS("Swich Result:0x%02x\n", lpaErrCode); //LOG_DM_RS("Swich Result:0x%02x\n", lpaErrCode);
if(lpaErrCode == LPA_NO_ERROR) if(lpaErrCode == LPA_NO_ERROR)
{ {
sf_lpa_profile_info_refresh(); sf_lpa_profile_info_refresh();
errCode = CMD_SUCCESS; errCode = CMD_SUCCESS;
sts = 1; sts = 1;
} }
else if (lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY) else if (lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY)
{ {
retryTime++; retryTime++;
@ -3377,24 +3377,24 @@ void sf_network_switch_thread()
continue; continue;
} }
else else
{ {
if(lpaErrCode == SF_LPA_ERROR_PROFILE_NOT_FOUND) if(lpaErrCode == SF_LPA_ERROR_PROFILE_NOT_FOUND)
{ {
printf("status:PROFILE_NOT_FOUND\n"); printf("status:PROFILE_NOT_FOUND\n");
errCode = NETWORK_PROFILE_NOT_FOUND; errCode = NETWORK_PROFILE_NOT_FOUND;
} }
else if(lpaErrCode == SF_LPA_ERROR_PROFILE_IS_ENABLE) else if(lpaErrCode == SF_LPA_ERROR_PROFILE_IS_ENABLE)
{ {
printf("status:PROFILE_IS_ENABLE\n"); printf("status:PROFILE_IS_ENABLE\n");
errCode = NETWORK_NOT_NEED_SET; errCode = NETWORK_NOT_NEED_SET;
} }
else else
{ {
printf("status:SELECT_FAILED\n"); printf("status:SELECT_FAILED\n");
errCode = NETWORK_PROFILE_SELECT_FAILED; errCode = NETWORK_PROFILE_SELECT_FAILED;
} }
sts = 1; sts = 1;
} }
} }
if(lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY) if(lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY)