/** * Processes LAUNCH_BROWSER proactive command from the SIM card. * * @param cmdDet Command Details container object. * @param ctlvs List of ComprehensionTlv objects following Command Details object and Device * Identities object within the proactive command * @return true if the command is processing is pending and additional asynchronous processing is * required. * @throws ResultException */ private boolean processLaunchBrowser(CommandDetails cmdDet, List<ComprehensionTlv> ctlvs) throws ResultException { CatLog.d(this, "process LaunchBrowser"); TextMessage confirmMsg = new TextMessage(); IconId iconId = null; String url = null; ComprehensionTlv ctlv = searchForTag(ComprehensionTlvTag.URL, ctlvs); if (ctlv != null) { try { byte[] rawValue = ctlv.getRawValue(); int valueIndex = ctlv.getValueIndex(); int valueLen = ctlv.getLength(); if (valueLen > 0) { url = GsmAlphabet.gsm8BitUnpackedToString(rawValue, valueIndex, valueLen); } else { url = null; } } catch (IndexOutOfBoundsException e) { throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD); } } // parse alpha identifier. ctlv = searchForTag(ComprehensionTlvTag.ALPHA_ID, ctlvs); confirmMsg.text = ValueParser.retrieveAlphaId(ctlv); // parse icon identifier ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs); if (ctlv != null) { iconId = ValueParser.retrieveIconId(ctlv); confirmMsg.iconSelfExplanatory = iconId.selfExplanatory; } // parse command qualifier value. LaunchBrowserMode mode; switch (cmdDet.commandQualifier) { case 0x00: default: mode = LaunchBrowserMode.LAUNCH_IF_NOT_ALREADY_LAUNCHED; break; case 0x02: mode = LaunchBrowserMode.USE_EXISTING_BROWSER; break; case 0x03: mode = LaunchBrowserMode.LAUNCH_NEW_BROWSER; break; } mCmdParams = new LaunchBrowserParams(cmdDet, confirmMsg, url, mode); if (iconId != null) { mIconLoadState = LOAD_SINGLE_ICON; mIconLoader.loadIcon(iconId.recordNumber, this.obtainMessage(MSG_ID_LOAD_ICON_DONE)); return true; } return false; }
/** * Interprets the user data payload as pack GSM 8-bit (a GSM alphabet string that's stored in * 8-bit unpacked format) characters, and decodes them into a String. * * @param byteCount the number of byest in the user data payload * @return a String with the decoded characters */ String getUserDataGSM8bit(int byteCount) { String ret; ret = GsmAlphabet.gsm8BitUnpackedToString(mPdu, mCur, byteCount); mCur += byteCount; return ret; }