|
Android example source code file (CatCmdMessage.java)
The CatCmdMessage.java Android example source code/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony.cat; import android.os.Parcel; import android.os.Parcelable; /** * Class used to pass CAT messages from telephony to application. Application * should call getXXX() to get commands's specific values. * */ public class CatCmdMessage implements Parcelable { // members CommandDetails mCmdDet; private TextMessage mTextMsg; private Menu mMenu; private Input mInput; private BrowserSettings mBrowserSettings = null; private ToneSettings mToneSettings = null; private CallSettings mCallSettings = null; /* * Container for Launch Browser command settings. */ public class BrowserSettings { public String url; public LaunchBrowserMode mode; } /* * Container for Call Setup command settings. */ public class CallSettings { public TextMessage confirmMsg; public TextMessage callMsg; } CatCmdMessage(CommandParams cmdParams) { mCmdDet = cmdParams.cmdDet; switch(getCmdType()) { case SET_UP_MENU: case SELECT_ITEM: mMenu = ((SelectItemParams) cmdParams).menu; break; case DISPLAY_TEXT: case SET_UP_IDLE_MODE_TEXT: case SEND_DTMF: case SEND_SMS: case SEND_SS: case SEND_USSD: mTextMsg = ((DisplayTextParams) cmdParams).textMsg; break; case GET_INPUT: case GET_INKEY: mInput = ((GetInputParams) cmdParams).input; break; case LAUNCH_BROWSER: mTextMsg = ((LaunchBrowserParams) cmdParams).confirmMsg; mBrowserSettings = new BrowserSettings(); mBrowserSettings.url = ((LaunchBrowserParams) cmdParams).url; mBrowserSettings.mode = ((LaunchBrowserParams) cmdParams).mode; break; case PLAY_TONE: PlayToneParams params = (PlayToneParams) cmdParams; mToneSettings = params.settings; mTextMsg = params.textMsg; break; case SET_UP_CALL: mCallSettings = new CallSettings(); mCallSettings.confirmMsg = ((CallSetupParams) cmdParams).confirmMsg; mCallSettings.callMsg = ((CallSetupParams) cmdParams).callMsg; break; } } public CatCmdMessage(Parcel in) { mCmdDet = in.readParcelable(null); mTextMsg = in.readParcelable(null); mMenu = in.readParcelable(null); mInput = in.readParcelable(null); switch (getCmdType()) { case LAUNCH_BROWSER: mBrowserSettings = new BrowserSettings(); mBrowserSettings.url = in.readString(); mBrowserSettings.mode = LaunchBrowserMode.values()[in.readInt()]; break; case PLAY_TONE: mToneSettings = in.readParcelable(null); break; case SET_UP_CALL: mCallSettings = new CallSettings(); mCallSettings.confirmMsg = in.readParcelable(null); mCallSettings.callMsg = in.readParcelable(null); break; } } public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(mCmdDet, 0); dest.writeParcelable(mTextMsg, 0); dest.writeParcelable(mMenu, 0); dest.writeParcelable(mInput, 0); switch(getCmdType()) { case LAUNCH_BROWSER: dest.writeString(mBrowserSettings.url); dest.writeInt(mBrowserSettings.mode.ordinal()); break; case PLAY_TONE: dest.writeParcelable(mToneSettings, 0); break; case SET_UP_CALL: dest.writeParcelable(mCallSettings.confirmMsg, 0); dest.writeParcelable(mCallSettings.callMsg, 0); break; } } public static final Parcelable.Creator<CatCmdMessage> CREATOR = new Parcelable.Creator Other Android examples (source code examples)Here is a short list of links related to this Android CatCmdMessage.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.