• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.cat;
18 
19 /**
20  * Interface for communication between STK App and CAT Telephony
21  *
22  * {@hide}
23  */
24 public interface AppInterface {
25 
26     /*
27      * Intent's actions which are broadcasted by the Telephony once a new CAT
28      * proactive command, session end, ALPHA during STK CC arrive.
29      */
30     public static final String CAT_CMD_ACTION =
31                                     "android.intent.action.stk.command";
32     public static final String CAT_SESSION_END_ACTION =
33                                     "android.intent.action.stk.session_end";
34     public static final String CAT_ALPHA_NOTIFY_ACTION =
35                                     "android.intent.action.stk.alpha_notify";
36 
37     //This is used to send ALPHA string from card to STK App.
38     public static final String ALPHA_STRING = "alpha_string";
39 
40     // This is used to send refresh-result when MSG_ID_ICC_REFRESH is received.
41     public static final String REFRESH_RESULT = "refresh_result";
42     //This is used to send card status from card to STK App.
43     public static final String CARD_STATUS = "card_status";
44     //Intent's actions are broadcasted by Telephony once IccRefresh occurs.
45     public static final String CAT_ICC_STATUS_CHANGE =
46                                     "android.intent.action.stk.icc_status_change";
47 
48     // Permission required by STK command receiver
49     public static final String STK_PERMISSION = "android.permission.RECEIVE_STK_COMMANDS";
50 
51     /*
52      * Callback function from app to telephony to pass a result code and user's
53      * input back to the ICC.
54      */
onCmdResponse(CatResponseMessage resMsg)55     void onCmdResponse(CatResponseMessage resMsg);
56 
57     /*
58      * Enumeration for representing "Type of Command" of proactive commands.
59      * Those are the only commands which are supported by the Telephony. Any app
60      * implementation should support those.
61      * Refer to ETSI TS 102.223 section 9.4
62      */
63     public static enum CommandType {
64         DISPLAY_TEXT(0x21),
65         GET_INKEY(0x22),
66         GET_INPUT(0x23),
67         LAUNCH_BROWSER(0x15),
68         PLAY_TONE(0x20),
69         REFRESH(0x01),
70         SELECT_ITEM(0x24),
71         SEND_SS(0x11),
72         SEND_USSD(0x12),
73         SEND_SMS(0x13),
74         SEND_DTMF(0x14),
75         SET_UP_EVENT_LIST(0x05),
76         SET_UP_IDLE_MODE_TEXT(0x28),
77         SET_UP_MENU(0x25),
78         SET_UP_CALL(0x10),
79         PROVIDE_LOCAL_INFORMATION(0x26),
80         OPEN_CHANNEL(0x40),
81         CLOSE_CHANNEL(0x41),
82         RECEIVE_DATA(0x42),
83         SEND_DATA(0x43),
84         GET_CHANNEL_STATUS(0x44);
85 
86         private int mValue;
87 
CommandType(int value)88         CommandType(int value) {
89             mValue = value;
90         }
91 
value()92         public int value() {
93             return mValue;
94         }
95 
96         /**
97          * Create a CommandType object.
98          *
99          * @param value Integer value to be converted to a CommandType object.
100          * @return CommandType object whose "Type of Command" value is {@code
101          *         value}. If no CommandType object has that value, null is
102          *         returned.
103          */
fromInt(int value)104         public static CommandType fromInt(int value) {
105             for (CommandType e : CommandType.values()) {
106                 if (e.mValue == value) {
107                     return e;
108                 }
109             }
110             return null;
111         }
112     }
113 }
114