电子产品世界 » 论坛首页 » 综合技术 » 通讯及无线技术 » 根据SIM卡适配SinglePdp


共3条 1/1 1 跳转至

根据SIM卡适配SinglePdp

菜鸟
2017-09-21 17:47:48    评分


MTK手机默认为支持MultiPDP,一张sim卡可以同时上网和收发彩信。


但有些海外运营商网络只支持SinglePdp,就会出现上网的时候无法收发彩信


[SOLUTION]


针对特别的运营商网络,将代码逻辑修改为支持SinglePdp,需要做以下改动:


以Meteor这家运营商的sim卡为例(MccMnc为27203)


GsmDataConnectionTracker.java 文件


1. private boolean trySetupData(ApnContext apnContext) 函数


...........


if (DBG) {
log("trySetupData for type:" + apnType +
" due to " + apnContext.getReason());
log("trySetupData with mIsPsRestricted=" + mIsPsRestricted);
}


//MTK single pdp add begin
IccRecords r = mIccRecords.get();
String operator = (r != null) ? r.getOperatorNumeric() : "";
boolean isConn = isConnected();
log("trySetupData , operator = " + operator );
log("trySetupData , isConnected() = "+isConn);
if(operator != null && operator.equals( "27203") && isConnected()){
log("trySetupData" + operator + "doesn't support MPDN");
for (ApnContext apnCxt : mApnContexts.values()) {
if(apnCxt.getApnType().equals(PhoneConstants.APN_TYPE_DEFAULT)){
apnCxt.setReason("SinglePdp");
clearWaitingApn();
cleanUpConnection(true, apnCxt);
mWaitingApnList.add(apnContext.getApnType());
}

}

}
//MTK single pdp add end


if (mPhone.getSimulatedRadioControl() != null) {
...........


2. protected void onDisconnectDone(int connId, AsyncResult ar) 函数


.............


//MTK single pdp add begin
if((apnContext.getReason()).equals("SinglePdp")){
logd("onDisconnectionDone, reason is SinglePdp then enableWaitingApn");
enableApnRet = enableWaitingApn();
if (apnContext.getApnType() == PhoneConstants.APN_TYPE_DEFAULT) {
apnContext.setReason(Phone.REASON_RADIO_TURNED_OFF);
logd("onDisconnectoinDone, singlePdp: set reason to radio turned off to avoid retry.");
}

}
//MTK single pdp add end
if (!mWaitingNonDefaultApn.isEmpty()) {
enableApnType(mWaitingNonDefaultApn.remove(0));
}


3. private GsmDataConnection createDataConnection()函数


...........


//MTK single pdp add begin
IccRecords r = mIccRecords.get();
String operator = (r != null) ? r.getOperatorNumeric() : "";
if(operator != null && operator.equals( "27203")){
loge("createDataConnection, singlePdp,id="+id);
if(id >= 1){
mUniqueIdGenerator.getAndDecrement();
return null;
} }
//MTK single pdp add end


if (id >= PDP_CONNECTION_POOL_SIZE) {
loge("Max PDP count is 3,but request " + (id + 1));
return null;
}




关键词: SinglePdp    

专家
2017-09-22 09:12:17    评分
2楼

谢谢楼主的经验分享。


菜鸟
2017-09-23 15:53:37    评分
3楼

学习了,感谢分享!

AC-DC电源模块



共3条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]