关于ServiceStateTracker.java中setPowerStateToDesired函数的疑问

   该函数在关闭radio或者说打开飞行模式的时候,会调用到。。原来源代码,如下。

   @Override
    protected void setPowerStateToDesired() {
        // If we want it on and it's off, turn it on
        if (mDesiredPowerState
            && cm.getRadioState() == CommandsInterface.RadioState.RADIO_OFF) {
            cm.setRadioPower(true, null);
        } else if (!mDesiredPowerState && cm.getRadioState().isOn()) {
            DataConnectionTracker dcTracker = phone.mDataConnection;
            if (! dcTracker.isDataConnectionAsDesired()) {

                EventLog.List val = new EventLog.List(
                        dcTracker.getStateInString(),
                        (dcTracker.getAnyDataEnabled() ? 1 : 0) );
                EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_DATA_STATE_RADIO_OFF, val);
            }
            Message msg = dcTracker.obtainMessage(DataConnectionTracker.EVENT_CLEAN_UP_CONNECTION);
            msg.arg1 = 1; // tearDown is true
            msg.obj = CDMAPhone.REASON_RADIO_TURNED_OFF;
            dcTracker.sendMessage(msg);

            // Poll data state up to 15 times, with a 100ms delay
            // totaling 1.5 sec. Normal data disable action will finish in 100ms.
            for (int i = 0; i < MAX_NUM_DATA_STATE_READS; i++) {
                DataConnectionTracker.State currentState = dcTracker.getState();
                if (currentState != DataConnectionTracker.State.CONNECTED
                        && currentState != DataConnectionTracker.State.DISCONNECTING) {
                    if (DBG) log("Data shutdown complete.");
                    break;
                }
                SystemClock.sleep(DATA_STATE_POLL_SLEEP_MS);
            }
            // If it's on and available and we want it off..
            cm.setRadioPower(false, null);

        } // Otherwise, we're in the desired state
    }

 

   在项目实际过程中,发现红色部分是有问题的。GSM模块没有发现问题,在CDMA中出现了问题。

   在高通6085模块中,每当PPP拨号时,我们去打开飞行模式,发送AT+CFUN=0时,返回+CME ERROR:36。

   其实,该函数的原意是很明确的,即当数据通道Connection的时候,我们需要先断开数据连接,然后才radio power off。

            /*Send message to clean up connection*/

            Message msg = dcTracker.obtainMessage(DataConnectionTracker.EVENT_CLEAN_UP_CONNECTION);
            msg.arg1 = 1; // tearDown is true
            msg.obj = CDMAPhone.REASON_RADIO_TURNED_OFF;
            dcTracker.sendMessage(msg);

但是按照源代码,这个clean up connection操作根本就不可能有时间执行。

后面这段代码的废的。。也就是根本就没有 clean up connection,就直接 cm.setRadioPower(false, null)了。

导致 发送AT+CFUN=0时,返回+CME ERROR:36。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值