private boolean decodeMessageParams(RilMessage rilMsg) { boolean decodingStarted; mCurrentRilMessage = rilMsg; switch (rilMsg.mId) { case CatService.MSG_ID_SESSION_END: case CatService.MSG_ID_CALL_SETUP: mCurrentRilMessage.mResCode = ResultCode.OK; sendCmdForExecution(mCurrentRilMessage); decodingStarted = false; break; case CatService.MSG_ID_PROACTIVE_COMMAND: case CatService.MSG_ID_EVENT_NOTIFY: case CatService.MSG_ID_REFRESH: byte[] rawData = null; try { rawData = IccUtils.hexStringToBytes((String) rilMsg.mData); } catch (Exception e) { // zombie messages are dropped CatLog.d(this, "decodeMessageParams dropping zombie messages"); decodingStarted = false; break; } try { // Start asynch parsing of the command parameters. mCmdParamsFactory.make(BerTlv.decode(rawData)); decodingStarted = true; } catch (ResultException e) { // send to Service for proper RIL communication. CatLog.d(this, "decodeMessageParams: caught ResultException e=" + e); mCurrentRilMessage.mResCode = e.result(); sendCmdForExecution(mCurrentRilMessage); decodingStarted = false; } break; default: decodingStarted = false; break; } return decodingStarted; }
void make(BerTlv berTlv, IconLoader iconLoader) { if (berTlv == null) { return; } CatLog.d(this, "IconLoader received: " + iconLoader); // reset global state parameters. mIconLoader = iconLoader; mCmdParams = null; mIconLoadState = LOAD_NO_ICON; // only proactive command messages are processed. if (berTlv.getTag() != BerTlv.BER_PROACTIVE_COMMAND_TAG) { sendCmdParams(ResultCode.CMD_TYPE_NOT_UNDERSTOOD); return; } boolean cmdPending = false; List<ComprehensionTlv> ctlvs = berTlv.getComprehensionTlvs(); // process command dtails from the tlv list. CommandDetails cmdDet = processCommandDetails(ctlvs); if (cmdDet == null) { sendCmdParams(ResultCode.CMD_TYPE_NOT_UNDERSTOOD); return; } // extract command type enumeration from the raw value stored inside // the Command Details object. AppInterface.CommandType cmdType = AppInterface.CommandType.fromInt(cmdDet.typeOfCommand); if (cmdType == null) { // This PROACTIVE COMMAND is presently not handled. Hence set // result code as BEYOND_TERMINAL_CAPABILITY in TR. mCmdParams = new CommandParams(cmdDet); sendCmdParams(ResultCode.BEYOND_TERMINAL_CAPABILITY); return; } try { switch (cmdType) { case SET_UP_MENU: cmdPending = processSelectItem(cmdDet, ctlvs); break; case SELECT_ITEM: cmdPending = processSelectItem(cmdDet, ctlvs); break; case DISPLAY_TEXT: cmdPending = processDisplayText(cmdDet, ctlvs); break; case SET_UP_IDLE_MODE_TEXT: cmdPending = processSetUpIdleModeText(cmdDet, ctlvs); break; case GET_INKEY: cmdPending = processGetInkey(cmdDet, ctlvs); break; case GET_INPUT: cmdPending = processGetInput(cmdDet, ctlvs); break; case SEND_DTMF: case SEND_SMS: case SEND_SS: case SEND_USSD: cmdPending = processEventNotify(cmdDet, ctlvs); break; case GET_CHANNEL_STATUS: case SET_UP_CALL: cmdPending = processSetupCall(cmdDet, ctlvs); break; case REFRESH: processRefresh(cmdDet, ctlvs); cmdPending = false; break; case LAUNCH_BROWSER: cmdPending = processLaunchBrowser(cmdDet, ctlvs); break; case PLAY_TONE: cmdPending = processPlayTone(cmdDet, ctlvs); break; case SET_UP_EVENT_LIST: cmdPending = processSetUpEventList(cmdDet, ctlvs); break; case PROVIDE_LOCAL_INFORMATION: cmdPending = processProvideLocalInfo(cmdDet, ctlvs); break; case OPEN_CHANNEL: case CLOSE_CHANNEL: case RECEIVE_DATA: case SEND_DATA: cmdPending = processBIPClient(cmdDet, ctlvs); break; default: // unsupported proactive commands mCmdParams = new CommandParams(cmdDet); sendCmdParams(ResultCode.BEYOND_TERMINAL_CAPABILITY); return; } } catch (ResultException e) { CatLog.d(this, "make: caught ResultException e=" + e); mCmdParams = new CommandParams(cmdDet); sendCmdParams(e.result()); return; } if (!cmdPending) { sendCmdParams(ResultCode.OK); } }