android 系统上做GC双模的--modem 的被动消息处理

来源:互联网 发布:图片分类展示网站源码 编辑:程序博客网 时间:2024/06/07 15:28

一、概述

在android 上做双模手机,CDMA EVDO模块主动上报消息在ril 层,应用层必须要做处理;

 

ril层主要是解析 URAT 上报指令,通过socket 传给java层,有java 来提示给用户

 

 

二、unsolicited 消息从modem上报到java的流程。

  c++部份

 

readerLoop()

 

  line = readline();

 

  processLine(line);

 

    handleUnsolicited(line);

 

      if (s_unsolHandler != NULL) {

 

        s_unsolHandler (line1, line2);//实际执行的是void onUnsolicited (const char *s, const char *sms_pdu)

 

          if (strStartsWith(s,"+CRING:")

 

                || strStartsWith(s,"RING")

 

                || strStartsWith(s,"NO CARRIER")

 

                || strStartsWith(s,"+CCWA")

 

          )

 

            RIL_onUnsolicitedResponse (RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED, NULL, 0);

 

              p.writeInt32 (RESPONSE_UNSOLICITED);

 

              p.writeInt32 (unsolResponse);

 

              ret = s_unsolResponses[unsolResponseIndex].responseFunction(p, data, datalen);

 

              ret = sendResponse(p);

 

                sendResponseRaw(p.data(), p.dataSize());

 

                  ret = blockingWrite(fd, (void *)&header, sizeof(header));

 

                  blockingWrite(fd, data, dataSize);

 

 

 

  java部份

 

  ril.java->RILReceiver.run()

 

    for(;;)

 

    {

 

      ...

 

      length = readRilMessage(is, buffer);

 

      p = Parcel.obtain();

 

      p.unmarshall(buffer, 0, length);

 

      p.setDataPosition(0);

 

      processResponse(p);

 

        processUnsolicited (p);

 

          response = p.readInt();

 

          switch(response) {

 

          ...

 

          case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: ret =  responseVoid(p); break;

 

          ...

 

          }

 

          switch(response) {

 

              case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:

 

                if (RILJ_LOGD) unsljLog(response);

 

 

 

                mCallStateRegistrants

 

                    .notifyRegistrants(new AsyncResult(null, null, null));

 

              ...

 

          }

原创粉丝点击