1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.internal.telephony.gsm.stk; 18 19 /** 20 * Interface for communication between STK App and STK Telephony 21 * 22 * {@hide} 23 */ 24 public interface AppInterface { 25 26 /* 27 * Intent's actions which are broadcasted by the Telephony once a new STK 28 * proactive command, session end arrive. 29 */ 30 public static final String STK_CMD_ACTION = 31 "android.intent.action.stk.command"; 32 public static final String STK_SESSION_END_ACTION = 33 "android.intent.action.stk.session_end"; 34 35 /* 36 * Callback function from app to telephony to pass a result code and user's 37 * input back to the SIM. 38 */ 39 void onCmdResponse(StkResponseMessage resMsg); 40 41 /* 42 * Enumeration for representing "Type of Command" of proactive commands. 43 * Those are the only commands which are supported by the Telephony. Any app 44 * implementation should support those. 45 */ 46 public static enum CommandType { 47 DISPLAY_TEXT(0x21), 48 GET_INKEY(0x22), 49 GET_INPUT(0x23), 50 LAUNCH_BROWSER(0x15), 51 PLAY_TONE(0x20), 52 REFRESH(0x01), 53 SELECT_ITEM(0x24), 54 SEND_SS(0x11), 55 SEND_USSD(0x12), 56 SEND_SMS(0x13), 57 SEND_DTMF(0x14), 58 SET_UP_EVENT_LIST(0x05), 59 SET_UP_IDLE_MODE_TEXT(0x28), 60 SET_UP_MENU(0x25), 61 SET_UP_CALL(0x10); 62 63 private int mValue; 64 65 CommandType(int value) { 66 mValue = value; 67 } 68 69 public int value() { 70 return mValue; 71 } 72 73 /** 74 * Create a CommandType object. 75 * 76 * @param value Integer value to be converted to a CommandType object. 77 * @return CommandType object whose "Type of Command" value is {@code 78 * value}. If no CommandType object has that value, null is 79 * returned. 80 */ 81 public static CommandType fromInt(int value) { 82 for (CommandType e : CommandType.values()) { 83 if (e.mValue == value) { 84 return e; 85 } 86 } 87 return null; 88 } 89 } 90 } 91