568 lines
20 KiB
C
568 lines
20 KiB
C
/*============================================================================
|
|
Copyright (c) 2022 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
|
|
Quectel Wireless Solution Proprietary and Confidential.
|
|
=============================================================================*/
|
|
/*===========================================================================
|
|
|
|
EDIT HISTORY FOR MODULE
|
|
|
|
此文件是用于实现移远的ci处理防止影响原厂的ci返回
|
|
|
|
|
|
WHEN WHO WHAT, WHERE, WHY
|
|
---------- ------------ ----------------------------------------------------
|
|
01/04/2024 pony.ma create
|
|
=============================================================================*/
|
|
#include "ci_dev.h"
|
|
#include "quec_network.h"
|
|
#include "teldef.h"
|
|
#include "quec_atcmd_general.h"
|
|
#include "quec_debug.h"
|
|
#include "dev_api.h"
|
|
extern UINT64 qcfg_cmd_type_bitmask;
|
|
extern UINT64 quec_get_gsm_band(void);
|
|
extern UINT64 quec_get_wcdma_band(void);
|
|
extern UINT64 quec_get_lte_band(void);
|
|
extern UINT64 quec_get_lte_band_ext(void);
|
|
|
|
extern UINT64 qcfg_band[3];
|
|
|
|
extern void checkDevRet( CiRequestHandle reqHandle, CiDevRc result );
|
|
#ifdef QUECTEL_AT_QCFG_SUPPORT
|
|
typedef struct
|
|
{
|
|
UINT64 quec_band;
|
|
UINT32 asr_band;
|
|
}quectel_band_type;
|
|
|
|
quectel_band_type quectel_band_tbl_gsm[] =
|
|
{
|
|
{QUEC_BAND_GSM_900, ASR_BAND_EGSM_900},
|
|
{QUEC_BAND_GSM_1800, ASR_BAND_GSM_1800},
|
|
{QUEC_BAND_GSM_850, ASR_BAND_GSM_850},
|
|
{QUEC_BAND_GSM_1900, ASR_BAND_GSM_1900}
|
|
|
|
};
|
|
|
|
quectel_band_type quectel_band_tbl_umts[] =
|
|
{
|
|
{QUEC_BAND_WCDMA_2100, ASR_BAND_UMTS_BAND1},
|
|
{QUEC_BAND_WCDMA_1900, ASR_BAND_UMTS_BAND2},
|
|
{QUEC_BAND_WCDMA_850, ASR_BAND_UMTS_BAND5},
|
|
{QUEC_BAND_WCDMA_900, ASR_BAND_UMTS_BAND8},
|
|
{QUEC_BAND_WCDMA_800, ASR_BAND_UMTS_BAND6},
|
|
{QUEC_BAND_WCDMA_1700, ASR_BAND_UMTS_BAND4}
|
|
|
|
};
|
|
|
|
quectel_band_type quectel_band_tbl_lteh[] =
|
|
{
|
|
{QUEC_BAND_LTE_BAND33, ASR_BAND_LTE_BAND33},
|
|
{QUEC_BAND_LTE_BAND34, ASR_BAND_LTE_BAND34},
|
|
{QUEC_BAND_LTE_BAND38, ASR_BAND_LTE_BAND38},
|
|
{QUEC_BAND_LTE_BAND39, ASR_BAND_LTE_BAND39},
|
|
{QUEC_BAND_LTE_BAND40, ASR_BAND_LTE_BAND40},
|
|
{QUEC_BAND_LTE_BAND41, ASR_BAND_LTE_BAND41}
|
|
|
|
};
|
|
|
|
quectel_band_type quectel_band_tbl_lte_ext[] =
|
|
{
|
|
{QUEC_BAND_LTE_BAND65, ASR_BAND_LTE_BAND65},
|
|
{QUEC_BAND_LTE_BAND66, ASR_BAND_LTE_BAND66},
|
|
{QUEC_BAND_LTE_BAND72, ASR_BAND_LTE_BAND72}
|
|
|
|
};
|
|
typedef struct
|
|
{
|
|
UINT8 net_mode; //which is used to record the support mode
|
|
UINT8 pref_mode; //which is used to record the prefer mode
|
|
UINT8 update_flag; //which is used to record if it the mode had been update
|
|
UINT8 gprsattach;
|
|
UINT32 gsm_band;
|
|
UINT32 umts_band;
|
|
UINT32 lte_band_h;
|
|
UINT32 lte_band_l;
|
|
UINT32 lte_band_ext;
|
|
UINT8 service_domain;
|
|
UINT8 roamservice;
|
|
UINT8 operation;
|
|
UINT8 atp_index;
|
|
}QuecNetModeCfgType;
|
|
|
|
typedef enum
|
|
{
|
|
QUE_MODE_BIT_GSM = 0x0004,
|
|
QUE_MODE_BIT_UMTS = 0x0008,
|
|
QUE_MODE_BIT_LTE = 0x0010,
|
|
#if QUEC_LTE_SUPPORT
|
|
QUE_MODE_BIT_ALL = (QUE_MODE_BIT_GSM | QUE_MODE_BIT_UMTS | QUE_MODE_BIT_LTE),
|
|
#else
|
|
QUE_MODE_BIT_ALL = (QUE_MODE_BIT_GSM | QUE_MODE_BIT_UMTS),
|
|
#endif
|
|
}QUEC_MODE_BIT_MASK;
|
|
|
|
typedef struct
|
|
{
|
|
UINT8 asr_mode;
|
|
QUEC_MODE_BIT_MASK quec_mode_bitmask;
|
|
}quectel_mode_match;
|
|
|
|
#if QUEC_LTE_SUPPORT
|
|
QuecNetModeCfgType QuecNetModeCfg = {CI_DEV_NW_GSM_UMTS_LTE,CI_DEV_NW_GSM_UMTS_LTE,0,1,0xFF,0xFF,0xFF,0xFF,0xFF,2,1,0xFF,0xFF};
|
|
#else
|
|
QuecNetModeCfgType QuecNetModeCfg = {CI_DEV_NW_GSM_UMTS,CI_DEV_NW_GSM_UMTS,0,1,0xFF,0xFF,0xFF,0xFF,0xFF,2,1,0xFF,0xFF};
|
|
#endif
|
|
|
|
UINT8 quec_match_mode_srdomain(UINT8 *net_mode, UINT8 *pref_mode, UINT8 *srdomain)
|
|
{
|
|
UINT8 ret=1;
|
|
Network_Info_Log("net_mode=%d,pref_mode=%d,srdomain=%d",*net_mode,*pref_mode,*srdomain);
|
|
if( *srdomain == 0)//set cs only we need to blind LTE
|
|
{
|
|
switch (*net_mode)
|
|
{
|
|
case CI_DEV_NW_GSM_LTE:
|
|
*net_mode = CI_DEV_NW_GSM;
|
|
break;
|
|
case CI_DEV_NW_UMTS_LTE:
|
|
*net_mode = CI_DEV_NW_UMTS;
|
|
break;
|
|
case CI_DEV_NW_GSM_UMTS_LTE:
|
|
*net_mode = CI_DEV_NW_GSM_UMTS;
|
|
break;
|
|
case CI_DEV_NW_LTE:
|
|
Network_Info_Log("ERROR CS ONLY IN LTE ONLY MODE!!!!!!!!");
|
|
ret=0;
|
|
break;
|
|
default:
|
|
//do nothing
|
|
break;
|
|
}
|
|
//set cs only we need to blind pref mode LTE to net mode
|
|
if(*pref_mode == CI_DEV_NW_LTE)
|
|
{
|
|
*pref_mode = *net_mode;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// *net_mode=QuecNetModePref.net_mode;
|
|
// *pref_mode=QuecNetModePref.pref_mode;
|
|
}
|
|
Network_Info_Log("net_mode=%d,pref_mode=%d,srdomain=%d",*net_mode,*pref_mode,*srdomain);
|
|
return ret;
|
|
}
|
|
quectel_mode_match quectel_match_nwmode_with_band_table[] =
|
|
{
|
|
{CI_DEV_NW_GSM, QUE_MODE_BIT_GSM},
|
|
{CI_DEV_NW_UMTS, QUE_MODE_BIT_UMTS},
|
|
{CI_DEV_NW_LTE, QUE_MODE_BIT_LTE},
|
|
{CI_DEV_NW_GSM_UMTS, (QUEC_MODE_BIT_MASK)(QUE_MODE_BIT_GSM | QUE_MODE_BIT_UMTS)},
|
|
{CI_DEV_NW_GSM_LTE, (QUEC_MODE_BIT_MASK)(QUE_MODE_BIT_GSM | QUE_MODE_BIT_LTE)},
|
|
{CI_DEV_NW_UMTS_LTE, (QUEC_MODE_BIT_MASK)(QUE_MODE_BIT_UMTS | QUE_MODE_BIT_LTE)},
|
|
{CI_DEV_NW_GSM_UMTS_LTE, (QUEC_MODE_BIT_MASK)(QUE_MODE_BIT_GSM | QUE_MODE_BIT_UMTS | QUE_MODE_BIT_LTE)}
|
|
};
|
|
#ifndef QUEC_ARR_SIZE
|
|
#define QUEC_ARR_SIZE(a) ( sizeof(a) / sizeof(a[0]) )
|
|
#endif
|
|
UINT8 quec_match_nwmode_with_band(UINT8 nwmode)
|
|
{
|
|
UINT8 matched_nwmode=0xff;
|
|
UINT16 quec_mode_bitmask=0;
|
|
UINT16 quec_mode_bitmask_temp=0;
|
|
UINT8 index=0;
|
|
if(quec_get_lte_band() != 0)
|
|
{
|
|
quec_mode_bitmask |= QUE_MODE_BIT_LTE;
|
|
}
|
|
|
|
if(quec_get_lte_band_ext() != 0)
|
|
{
|
|
quec_mode_bitmask |= QUE_MODE_BIT_LTE;
|
|
}
|
|
|
|
if(quec_get_gsm_band() != 0)
|
|
{
|
|
quec_mode_bitmask |= QUE_MODE_BIT_GSM;
|
|
}
|
|
|
|
if(quec_get_wcdma_band() != 0)
|
|
{
|
|
quec_mode_bitmask |= QUE_MODE_BIT_UMTS;
|
|
}
|
|
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_match_nwmode_with_band_table); index++)
|
|
{
|
|
if(nwmode == quectel_match_nwmode_with_band_table[index].asr_mode)
|
|
{
|
|
quec_mode_bitmask_temp = quectel_match_nwmode_with_band_table[index].quec_mode_bitmask;
|
|
quec_mode_bitmask_temp &= quec_mode_bitmask;
|
|
break;
|
|
}
|
|
}
|
|
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_match_nwmode_with_band_table); index++)
|
|
{
|
|
if(quec_mode_bitmask_temp == quectel_match_nwmode_with_band_table[index].quec_mode_bitmask)
|
|
{
|
|
matched_nwmode = quectel_match_nwmode_with_band_table[index].asr_mode;
|
|
break;
|
|
}
|
|
}
|
|
|
|
Network_Info_Log("nwmode=%d,matched_nwmode=%d,quec_mode_bitmask_temp=%x,quec_mode_bitmask=%x",nwmode,matched_nwmode,quec_mode_bitmask_temp,quec_mode_bitmask);
|
|
return matched_nwmode;
|
|
}
|
|
|
|
int quec_update_mode_pref(QuecNetModeCfgType *p_quec_net_cfg)
|
|
{
|
|
//UINT8 ret=1;
|
|
Network_Info_Log("net_mode[%d,%d]->[%d,%d], update_flag=%d",QuecNetModeCfg.net_mode,QuecNetModeCfg.pref_mode,
|
|
p_quec_net_cfg->net_mode, p_quec_net_cfg->pref_mode,QuecNetModeCfg.update_flag);
|
|
|
|
//the value is same we do not need to update
|
|
if(memcmp(p_quec_net_cfg, &QuecNetModeCfg, sizeof(QuecNetModeCfgType)) == 0)
|
|
{
|
|
Network_Info_Log("net mode cfg same, nothing to update ");
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
p_quec_net_cfg->update_flag = 1;
|
|
// if(QUEC_FAT_SUCCESS != quectel_nv_fat_write(QUEC_AT_MODE_BACKUP, p_quec_net_cfg, sizeof(QuecNetModeCfgType)))
|
|
// {
|
|
// atcmd_nw_log("net mode cfg save error !!! ");
|
|
// QuecNetModeCfg.update_flag = 0;
|
|
// return -1;
|
|
//
|
|
// }
|
|
|
|
// if ((p_quec_net_cfg->net_mode != QuecNetModeCfg.pref_mode) || (p_quec_net_cfg->pref_mode != QuecNetModeCfg.pref_mode))
|
|
// {
|
|
// if ((p_quec_net_cfg->net_mode >= CI_DEV_NW_LTE) && (p_quec_net_cfg->net_mode <= CI_DEV_NW_GSM_UMTS_LTE))
|
|
// {
|
|
// atcmd_nw_log("update_lte set to 0");
|
|
// update_lte = 0;
|
|
// }
|
|
// #ifndef LTEONLY_THIN_SINGLE_SIM //锟斤拷锟斤拷锟斤拷2M Flash锟斤拷目锟斤拷支锟斤拷
|
|
// if ((p_quec_net_cfg->net_mode != CI_DEV_NW_LTE) && (p_quec_net_cfg->net_mode < CI_DEV_NUM_NW_MODES))
|
|
// {
|
|
// atcmd_nw_log("update_2g_3g set to 0");
|
|
// update_2g_3g = 0;
|
|
// }
|
|
// #endif
|
|
// }
|
|
memcpy(&QuecNetModeCfg, p_quec_net_cfg, sizeof(QuecNetModeCfgType));
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
INT8 quec_mode_check(QuecNetModeCfgType *p_quec_net_cfg)
|
|
{
|
|
UINT8 mode_chk = p_quec_net_cfg->net_mode;
|
|
UINT8 prefer_mode_chk = p_quec_net_cfg->pref_mode;
|
|
UINT8 srv_domain_chk = p_quec_net_cfg->service_domain;
|
|
if (quec_match_mode_srdomain(&mode_chk, &prefer_mode_chk, &srv_domain_chk) == 0)
|
|
{
|
|
Network_Info_Log("ERROR invalid mode or servicedomain!!!!!!!!");
|
|
return -1;
|
|
}
|
|
|
|
// connor 2019/01/25 return error when ipnut invalid a mode which the band is not support
|
|
mode_chk = quec_match_nwmode_with_band(mode_chk);
|
|
prefer_mode_chk = quec_match_nwmode_with_band(prefer_mode_chk);
|
|
|
|
if (mode_chk == 0xff || prefer_mode_chk == 0xff)
|
|
{
|
|
Network_Info_Log(" mode set not match band config %d %d", mode_chk, prefer_mode_chk);
|
|
return -1;
|
|
}
|
|
|
|
//we need to check nw mode and prefer mode, to ensure the prefer mode is the subset of nw mode
|
|
//and prefer mode should be single mode
|
|
switch (mode_chk)
|
|
{
|
|
case CI_DEV_NW_GSM:
|
|
case CI_DEV_NW_UMTS:
|
|
case CI_DEV_NW_LTE:
|
|
if (mode_chk != prefer_mode_chk)
|
|
{
|
|
Network_Info_Log("nw/prefer mode not match %d %d, update prefer as nw mode", mode_chk, prefer_mode_chk);
|
|
prefer_mode_chk = mode_chk;
|
|
}
|
|
break;
|
|
case CI_DEV_NW_GSM_UMTS:
|
|
if ((mode_chk != prefer_mode_chk) && (CI_DEV_NW_GSM != prefer_mode_chk) && (CI_DEV_NW_UMTS != prefer_mode_chk))
|
|
{
|
|
Network_Info_Log("nw/prefer mode not match %d %d, update prefer as nw mode", mode_chk, prefer_mode_chk);
|
|
prefer_mode_chk = mode_chk;
|
|
}
|
|
break;
|
|
case CI_DEV_NW_GSM_LTE:
|
|
if ((mode_chk != prefer_mode_chk) && (CI_DEV_NW_GSM != prefer_mode_chk) && (CI_DEV_NW_LTE != prefer_mode_chk))
|
|
{
|
|
Network_Info_Log("nw/prefer mode not match %d %d, update prefer as nw mode", mode_chk, prefer_mode_chk);
|
|
prefer_mode_chk = mode_chk;
|
|
}
|
|
break;
|
|
case CI_DEV_NW_UMTS_LTE:
|
|
if ((mode_chk != prefer_mode_chk) && (CI_DEV_NW_UMTS != prefer_mode_chk) && (CI_DEV_NW_LTE != prefer_mode_chk))
|
|
{
|
|
Network_Info_Log("nw/prefer mode not match %d %d, update prefer as nw mode", mode_chk, prefer_mode_chk);
|
|
prefer_mode_chk = mode_chk;
|
|
}
|
|
break;
|
|
case CI_DEV_NW_GSM_UMTS_LTE:
|
|
if ((mode_chk != prefer_mode_chk) && (CI_DEV_NW_GSM != prefer_mode_chk) && (CI_DEV_NW_UMTS != prefer_mode_chk) && (CI_DEV_NW_LTE != prefer_mode_chk))
|
|
{
|
|
Network_Info_Log("nw/prefer mode not match %d %d, update prefer as nw mode", mode_chk, prefer_mode_chk);
|
|
prefer_mode_chk = mode_chk;
|
|
}
|
|
break;
|
|
default:
|
|
Network_Info_Log("nw/prefer mode not match %d %d: nw mode is wrong!", mode_chk, prefer_mode_chk);
|
|
return -1;
|
|
}
|
|
|
|
p_quec_net_cfg->net_mode = mode_chk;
|
|
p_quec_net_cfg->pref_mode = prefer_mode_chk;
|
|
//if the mode is valid, then to save it
|
|
return quec_update_mode_pref(p_quec_net_cfg);
|
|
}
|
|
|
|
void quec_map_Quecband2Asrband(UINT64 quec_gw_band,UINT64 quec_lte_band,UINT64 quec_lte_band_ext,UINT32 *asr_gsm_band,
|
|
UINT32 *asr_umts_band,UINT32 *asr_lte_band_h,UINT32 *asr_lte_band_l,UINT32 *asr_lte_band_ext)
|
|
{
|
|
|
|
Network_Info_Log("quec_map_Quecband2Asrband:quec_gw_band=0x%llx,quec_lte_band=0x%llx,0x%llx",quec_gw_band,
|
|
quec_lte_band, quec_lte_band_ext);
|
|
UINT8 index=0;
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_band_tbl_gsm); index++)
|
|
{
|
|
if((quec_gw_band & quectel_band_tbl_gsm[index].quec_band) != 0)
|
|
{
|
|
*asr_gsm_band |= quectel_band_tbl_gsm[index].asr_band;
|
|
}
|
|
}
|
|
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_band_tbl_umts); index++)
|
|
{
|
|
if((quec_gw_band & quectel_band_tbl_umts[index].quec_band) != 0)
|
|
{
|
|
*asr_umts_band |= quectel_band_tbl_umts[index].asr_band;
|
|
}
|
|
}
|
|
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_band_tbl_lteh); index++)
|
|
{
|
|
if((quec_lte_band & quectel_band_tbl_lteh[index].quec_band) != 0)
|
|
{
|
|
*asr_lte_band_h |= quectel_band_tbl_lteh[index].asr_band;
|
|
}
|
|
}
|
|
|
|
*asr_lte_band_l |= quec_lte_band&0xFFFFFFFF;//band1-28
|
|
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_band_tbl_lte_ext); index++)
|
|
{
|
|
if((quec_lte_band_ext & quectel_band_tbl_lte_ext[index].quec_band) != 0)
|
|
{
|
|
*asr_lte_band_ext |= quectel_band_tbl_lte_ext[index].asr_band;
|
|
}
|
|
}
|
|
|
|
|
|
Network_Info_Log("quec_map_Quecband2Asrband:gsm_band=0x%x,umts_band=0x%x,lte_band_h=0x%x,lte_band_l=0x%x,lte_band_ext=0x%x",*asr_gsm_band,*asr_umts_band,*asr_lte_band_h,*asr_lte_band_l, asr_lte_band_ext);
|
|
return;
|
|
}
|
|
|
|
void quec_map_AsrbandQuecband(UINT64 *quec_gw_band,UINT64 *quec_lte_band,UINT64 *quec_lte_band_ext,UINT32 asr_gsm_band
|
|
,UINT32 asr_umts_band,UINT32 asr_lte_band_h,UINT32 asr_lte_band_l,UINT32 asr_lte_band_ext)
|
|
{
|
|
|
|
UINT8 index=0;
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_band_tbl_gsm); index++)
|
|
{
|
|
if((asr_gsm_band & quectel_band_tbl_gsm[index].asr_band) != 0)
|
|
{
|
|
*quec_gw_band |= quectel_band_tbl_gsm[index].quec_band;
|
|
}
|
|
}
|
|
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_band_tbl_umts); index++)
|
|
{
|
|
if((asr_umts_band& quectel_band_tbl_umts[index].asr_band) != 0)
|
|
{
|
|
*quec_gw_band |= quectel_band_tbl_umts[index].quec_band;
|
|
}
|
|
}
|
|
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_band_tbl_lteh); index++)
|
|
{
|
|
if((asr_lte_band_h& quectel_band_tbl_lteh[index].asr_band) != 0)
|
|
{
|
|
*quec_lte_band |= quectel_band_tbl_lteh[index].quec_band;
|
|
}
|
|
}
|
|
|
|
*quec_lte_band |=asr_lte_band_l;
|
|
|
|
for(index = 0; index < QUEC_ARR_SIZE(quectel_band_tbl_lte_ext); index++)
|
|
{
|
|
if((asr_lte_band_ext& quectel_band_tbl_lte_ext[index].asr_band) != 0)
|
|
{
|
|
*quec_lte_band_ext |= quectel_band_tbl_lte_ext[index].quec_band;
|
|
}
|
|
}
|
|
|
|
|
|
Network_Info_Log("quec_map_AsrbandQuecband:gw_band=0x%llx,lte_band=0x%llx,0x%llx", *quec_gw_band, *quec_lte_band,
|
|
*quec_lte_band_ext);
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
|
|
void quec_processGetBandModeConf(UINT32 atHandle, const void *paras)
|
|
{
|
|
CiDevPrimGetBandModeCnf* getBandModeCnf = (CiDevPrimGetBandModeCnf *)paras;
|
|
char bandBuf[100];
|
|
INT8 mode_check_ret = -1;
|
|
QuecNetModeCfgType quec_net_cfg_toWrite = {0};
|
|
memcpy(&quec_net_cfg_toWrite, &QuecNetModeCfg, sizeof(QuecNetModeCfgType));
|
|
|
|
Network_Info_Log("network mode:%d, prefer:%d ,srdomain:%d,roaming:%d,result=%d,bandPriority=%d,isLteDualLink=%d,qcfg_cmd_type_bitmask=%x",
|
|
getBandModeCnf->networkMode, getBandModeCnf->preferredMode,getBandModeCnf->srvDomain,
|
|
getBandModeCnf->roamingConfig,getBandModeCnf->result,getBandModeCnf->bandPriorityFlag, getBandModeCnf->isLteDualLink,qcfg_cmd_type_bitmask);
|
|
|
|
Network_Info_Log("GSM:0x%x, UMTS:0x%x ,EUTRANH:0x%x,EUTRANL:0x%x,EUTRANExt=%x",
|
|
getBandModeCnf->GSMBandMode, getBandModeCnf->UMTSBandMode,getBandModeCnf->EUTRANBandModeH,getBandModeCnf->EUTRANBandModeL,getBandModeCnf->EUTRANBandModeExt);
|
|
|
|
if(getBandModeCnf->result == CIRC_DEV_SUCCESS)
|
|
{
|
|
if(getBandModeCnf->isLteDualLink)
|
|
{
|
|
switch(getBandModeCnf->networkMode)
|
|
{
|
|
case CI_DEV_NW_GSM_LTE:
|
|
case CI_DEV_NW_UMTS_LTE:
|
|
case CI_DEV_NW_GSM_UMTS_LTE:
|
|
break;
|
|
default:
|
|
qcfg_cmd_type_bitmask=0;
|
|
Network_Info_Log("isLteDualLink=%d networkMode=%d ERROR!", getBandModeCnf->isLteDualLink, getBandModeCnf->networkMode);
|
|
ATRESP( atHandle, ATCI_RESULT_CODE_CME_ERROR, CME_UNKNOWN, NULL);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (getBandModeCnf->networkMode == CI_DEV_NW_GSM)
|
|
{
|
|
}
|
|
else if (getBandModeCnf->networkMode == CI_DEV_NW_UMTS)
|
|
{
|
|
}
|
|
else if (getBandModeCnf->networkMode == CI_DEV_NW_GSM_UMTS)
|
|
{
|
|
}
|
|
else if(getBandModeCnf->networkMode == CI_DEV_NW_LTE)
|
|
{
|
|
}
|
|
else if(getBandModeCnf->networkMode == CI_DEV_NW_GSM_UMTS_LTE)
|
|
{
|
|
}
|
|
else if(getBandModeCnf->networkMode == CI_DEV_NW_UMTS_LTE)
|
|
{
|
|
}
|
|
else if(getBandModeCnf->networkMode == CI_DEV_NW_GSM_LTE)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
Network_Info_Log("networkMode=%d,bit=0x%X ERROR!", getBandModeCnf->networkMode, qcfg_cmd_type_bitmask);
|
|
qcfg_cmd_type_bitmask=0;
|
|
ATRESP( atHandle, ATCI_RESULT_CODE_CME_ERROR, CME_UNKNOWN, NULL);
|
|
return;
|
|
}
|
|
|
|
|
|
if(CHECK_BIT_SET(qcfg_cmd_type_bitmask ,QCFG_BAND_GET))
|
|
{
|
|
UINT32 gsm_band=0;
|
|
UINT32 umts_band=0;
|
|
UINT64 quec_gw_band=0;
|
|
UINT64 quec_lte_band=0;
|
|
UINT64 quec_lte_band_ext=0;
|
|
|
|
quec_map_AsrbandQuecband(&quec_gw_band,&quec_lte_band,&quec_lte_band_ext,getBandModeCnf->GSMBandMode,getBandModeCnf->UMTSBandMode,getBandModeCnf->EUTRANBandModeH,getBandModeCnf->EUTRANBandModeL,getBandModeCnf->EUTRANBandModeExt);
|
|
//connor.wu 2018/12/13 fix the isuuse when the band is invalid it return ff but we expect it return 0
|
|
gsm_band=quec_get_gsm_band();
|
|
umts_band=quec_get_wcdma_band();
|
|
quec_gw_band=(quec_gw_band & (gsm_band | umts_band));
|
|
quec_lte_band=(quec_lte_band & quec_get_lte_band());
|
|
quec_lte_band_ext=(quec_lte_band_ext & quec_get_lte_band_ext());
|
|
#if !QUEC_LTE_SUPPORT
|
|
sprintf((char *)bandBuf, "+QCFG: \"band\",0x%llx\r\n", quec_gw_band);
|
|
#else
|
|
if (quec_lte_band_ext > 0)
|
|
{
|
|
sprintf((char *)bandBuf, "+QCFG: \"band\",0x%llx,0x%llx%016llx\r\n", quec_gw_band, quec_lte_band_ext, quec_lte_band);
|
|
}
|
|
else
|
|
{
|
|
sprintf((char *)bandBuf, "+QCFG: \"band\",0x%llx,0x%llx\r\n", quec_gw_band, quec_lte_band);
|
|
}
|
|
#endif
|
|
ATRESP(atHandle, ATCI_RESULT_CODE_OK, 0, bandBuf);
|
|
BIT_CLR(qcfg_cmd_type_bitmask,QCFG_BAND_GET);
|
|
}
|
|
else if(CHECK_BIT_SET(qcfg_cmd_type_bitmask ,QCFG_BAND_SET))
|
|
{
|
|
quec_net_cfg_toWrite.gsm_band = 0;
|
|
quec_net_cfg_toWrite.umts_band = 0;
|
|
quec_net_cfg_toWrite.lte_band_h = 0;
|
|
quec_net_cfg_toWrite.lte_band_l = 0;
|
|
quec_net_cfg_toWrite.lte_band_ext = 0;
|
|
extern void quec_map_Quecband2Asrband(UINT64 quec_gw_band,UINT64 quec_lte_band,UINT64 quec_lte_band_ext,UINT32 *asr_gsm_band,
|
|
UINT32 *asr_umts_band,UINT32 *asr_lte_band_h,UINT32 *asr_lte_band_l,UINT32 *asr_lte_band_ext);
|
|
|
|
quec_map_Quecband2Asrband(qcfg_band[0],qcfg_band[1],qcfg_band[2],&(quec_net_cfg_toWrite.gsm_band),&(quec_net_cfg_toWrite.umts_band),
|
|
&(quec_net_cfg_toWrite.lte_band_h),&(quec_net_cfg_toWrite.lte_band_l),&(quec_net_cfg_toWrite.lte_band_ext));
|
|
BIT_CLR(qcfg_cmd_type_bitmask,QCFG_BAND_SET);
|
|
|
|
quec_net_cfg_toWrite.operation = QCFG_BAND_SET;
|
|
quec_net_cfg_toWrite.atp_index = GET_ATP_INDEX(atHandle);
|
|
|
|
mode_check_ret = quec_mode_check(&quec_net_cfg_toWrite);
|
|
if (1 == mode_check_ret)
|
|
{
|
|
DEV_SetBandModeReq(atHandle, quec_net_cfg_toWrite.net_mode, quec_net_cfg_toWrite.pref_mode,
|
|
quec_net_cfg_toWrite.gsm_band, quec_net_cfg_toWrite.umts_band, quec_net_cfg_toWrite.lte_band_h,quec_net_cfg_toWrite.lte_band_l,
|
|
getBandModeCnf->roamingConfig, getBandModeCnf->srvDomain, getBandModeCnf->bandPriorityFlag, 0, quec_net_cfg_toWrite.lte_band_ext);
|
|
}
|
|
else if (0 == mode_check_ret)
|
|
{
|
|
ATRESP( atHandle, ATCI_RESULT_CODE_OK, NULL, NULL);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
ATRESP( atHandle, ATCI_RESULT_CODE_CME_ERROR, CME_INVALID_PARAM, NULL);
|
|
return;
|
|
}
|
|
}
|
|
|
|
Network_Info_Log("processGetBandModeConf: qcfg_cmd_type_bitmask=%x",qcfg_cmd_type_bitmask);
|
|
}
|
|
else
|
|
{
|
|
qcfg_cmd_type_bitmask=0;
|
|
checkDevRet(atHandle, getBandModeCnf->result);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|