private boolean processBIPClient(CommandDetails cmdDet, List<ComprehensionTlv> ctlvs) throws ResultException { AppInterface.CommandType commandType = AppInterface.CommandType.fromInt(cmdDet.typeOfCommand); if (commandType != null) { CatLog.d(this, "process " + commandType.name()); } TextMessage textMsg = new TextMessage(); IconId iconId = null; ComprehensionTlv ctlv = null; boolean has_alpha_id = false; // parse alpha identifier ctlv = searchForTag(ComprehensionTlvTag.ALPHA_ID, ctlvs); if (ctlv != null) { textMsg.text = ValueParser.retrieveAlphaId(ctlv); CatLog.d(this, "alpha TLV text=" + textMsg.text); has_alpha_id = true; } // parse icon identifier ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs); if (ctlv != null) { iconId = ValueParser.retrieveIconId(ctlv); textMsg.iconSelfExplanatory = iconId.selfExplanatory; } textMsg.responseNeeded = false; mCmdParams = new BIPClientParams(cmdDet, textMsg, has_alpha_id); if (iconId != null) { mIconLoadState = LOAD_SINGLE_ICON; mIconLoader.loadIcon(iconId.recordNumber, this.obtainMessage(MSG_ID_LOAD_ICON_DONE)); return true; } return false; }
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); } }