blob: 32435a03ba2934007621a01aaa8cd3ee0d906f73 [file] [log] [blame] [view]
Skyler Kaufman991ae4d2011-04-07 12:30:41 -07001# Sim Toolkit Application (STK) #
2
3[TOC]
4
5This document offers a high-level overview of the SIM Toolkit Application for Android 1.0 and is primarily of interest for implementors of the Radio Interface Layer (RIL). The STK is R96 compatible (3GPP TS 11.14 v5.9.0) and complies partially with R99 (3GPP TS 101.267 v8.17.0). See the [STK Feature List](#androidSTKFeatureList) for the complete feature list.
6
7The Android STK implementation includes three layers:
8
9- STK RIL: Low-level layer provided by the vendor plus `libril`.
10
11- STK Telephony: Protocol translation layer that converts raw messages provided by the STK RIL to application level messages.
12
13- STK Application: Provides the user interface interactions needed by the STK.
14
15<img src="/images/stk.gif" alt="STK schema" width="566" height="516" />
16
17The Sim Toolkit communication flow is bi-directional and commands can originate from the `STK RIL` packaged in `RIL_UNSOL_STK_PROACTIVE_COMMAND`, `RIL_UNSOL_STK_EVENT_NOTIFY`, `RIL_UNSOL_REFRESH` and `RIL_UNSOL_STK_SESSION_END` messages.
18
19Commands originating from the STK App or STK Telephony layers are packaged in `RIL_REQUEST_STK_SEND_TERMINAL_REPSONSE`, `RIL_REQUEST_SEND_ENVELOPE_COMMAND` or `RIL_REQUEST_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM`.
20
21For commands sent or recieved by the STK RIL, it's not necessary to remove unused sub-commands because the upper layers will gracefully ignore unused information contained in the message. The content of each message is encoded in the BER-TLV format except for two:
22
23- `RIL_UNSOL_STK_SESSION_END`: has no data
24
25- `RIL_REQUEST_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM`: has a single byte of data that indicates accept/reject.
26
27See the [Android Platform Development Kit](http://pdk-docs.prom.corp.google.com/docs/telephony.html) for details.
28
29## Communication from the RIL up ##
30
31Communication to the upper layers is done using the `RIL_UNSOL_xxx` family of commands defined in `/hardware/ril/include/ril.h`. The payload for each command is encoded using BER-TLV. As stated above, it is not necessary to remove extraneous fields. This allows the SIM to pass a complete command to the upper layers and simplifies STK RIL code. Below is the mapping from RIL_UNSOL_xxx commands to the SIM commands.
32
33### RIL_UNSOL_STK_PROACTIVE_COMMAND ###
34
35The Sim Toolkit communication flow is bi-directional and commands can originate from the `STK RIL` packaged in `RIL_UNSOL_STK_PROACTIVE_COMMAND`, `RIL_UNSOL_STK_EVENT_NOTIFY`, `RIL_UNSOL_REFRESH` and `RIL_UNSOL_STK_SESSION_END` messages.
36
37#### DISPLAY TEXT (6.4.1) ####
38
39This command is handled by `StkDialogActivity`. If the immediate response flag is set, the terminal response is sent with an "OK" `(0x00)` result code when the message is first received. Otherwise the terminal response is sent when the dialog is dismissed either from user action or it times out.
40
41The user sees a dialog box with a message and / or icon, an OK button, and a Cancel button.
42
43Terminal responses include:
44- "OK" (0x00)
45- "Session terminated by user" (0x10)
46- "Backward move by user" (0x11)
47- "No response from user" (0x12)
48
49<img src="/images/stk_display_text.gif" border="1">
50
51#### GET IN KEY (6.4.2) ####
52
53This command is processed by `StkInputActivity`. It displays a dialog box with a prompt and or an icon and yes and no buttons.
54
55Terminal responses include:
56
57- "OK" (0x00) with "Yes" or "No" as the response text
58- "Session terminated by user" (0x10) << Currently not supported
59- "Backward move by user" (0x11)
60- "No response from user" (0x12)
61
62#### GET INPUT (6.4.3) ###
63
64This command is handled by `StkInputActivity`.
65
66The user sees a dialog box with a prompt and/or an icon, a text box with optional default text, and an OK button. 'digits only,' 'min,' 'max,' and 'hidden' modes are all supported.
67
68Terminal responses include:
69
70- "OK" (0x00) if the input criteria is met
71- "Session terminated by user" (0x10) << Currently not supported
72- "Backward move by user" (0x11)
73- "No response from user" (0x12)
74
75#### PLAY TONE (6.4.5) ####
76
77This command is processed by `ToneDialog`.
78
79The user sees a dialog box with a prompt for the duration of the tone or until the user presses the back key.
80
81Terminal responses include:
82
83- "OK" (0x00) if the tone is played to completion
84- "Session terminated by user" (0x10) if back button is pressed
85
86#### SET UP MENU (6.4.8) ####
87
88This command is processed by `StkAppService`. It installs the STK ICON on the home page and prepares the Main menu for use when the ICON is selected. Typically this is the first RIL unsolicited command and should not be sent until after the `RIL_RadioFunctions.getVersion` routine is called.
89
90Terminal reponses:
91
92- "OK" (0x00)
93
94At a later time, the STK ICON will be selected and `StkMenuActivity` will launch and display the Main menu to the user. If an item is selected, it will be returned to the RIL in `RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND` with the item id. If no item is selected, the `StkMenuActivity` will receive a timeout message and return to the Main menu and no message will be sent to the RIL.
95
96Depending upon what item is selected, the SIM may perform another action, such as sending another set of menu items via a SELECT ITEM command or performing an action like send an SMS or text display.
97
98#### SELECT ITEM (6.4.9) ####
99
100This command is processed by `StkMenuActivity`. Instead of displaying the Main menu, the list of menu items provided in this command are displayed.
101
102Terminal responses:
103
104- "OK" (0x00)
105
106The command then proceeds as in the SETUP MENU.
107
108#### SET UP IDLE MODE TEXT (6.4.22) ####
109
110`StkAppService` displays the message and or icon as an Android notification.
111
112Terminal responses include:
113
114- "OK" (0x00)
115
116#### LAUNCH BROWSER (6.4.26) ####
117
118This command is initially handled by `StkDialogActivity` and presents the user with a confirmation dialog, a URL, and OK, and cancel buttons. If the user presses OK, the browser is launched using the URL.
119
120Terminal responses include:
121
122- "OK" (0x00) the browser has been launched
123- "Session terminated by user" (0x10)
124- "Backward move by user" (0x11)
125- "No response from user" (0x12)
126
127### RIL_UNSOL_STK_EVENT_NOTIFY ###
128
129The commands in this section are proactive in nature. They are handled by the STK RIL and the upper layers and delivered using `RIL_UNSOL_STK_EVENT_NOTIFY` message. This distinction is an implementation detail of Android and is not defined in the 3GPP sepcifications.
130
131The upper layers handle the UI and the STK RIL handles all other aspects of each command, which means that the STK RIL sends the terminal response (it is never sent by the STK App). Each command must be a properlery-formed proactive command. It is not necessary to remove unused fields. The behavior of any other command <em>within this context </em>sent by `RIL_UNSOL_STK_EVENT_NOTIFY` is undefined. See Event Notify Command Details.
132
133- SEND SMS (6.4.10) – no response
134- SEND SS (6.4.11) – no response
135- SEND USSD (6.4.12) – no response
136- SET UP CALL (6.4.13) – responds with `RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM`
137- SEND DTMF (6.4.24) – no response
138
139<img src="/images/stk_send_SMS.gif">
140
141### RIL_UNSOL_SIM_REFRESH ###
142
143Used to send the `REFRESH` command. No response.
144
145### REFRESH (6.4.7) ###
146
147`RIL_UNSOL_STK_SESSION_END`
148
149Sent by the SIM to signal the end of a session. No content and no response.
150
151<img src="/images/stk_refresh_init.gif">
152
153<img src="/images/stk_refresh_update.gif">
154
155<img src="/images/stk_refresh_reset.gif">
156
157### RIL_UNSOL_STK_SESSION_END ###
158
159Sent by SIM to signal end of session. No content and no response.
160
161## Communication from the application down ##
162
163Communication from the upper layers to the RIL uses the commands below (defined in `ril.h`)
164
165### RIL_REQUEST_STK_SEND_TERMINAL_REPSONSE ###
166
167Used to send a terminal response for commands sent via `RIL_UNSOL_STK_PROACTIVE_COMMAND`.
168
169Contents include TERMINAL RESPONSE (6.8).
170
171### RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND ###
172
173Used to send information from to SIM encoded as BER-TLV tags (see R96 section 13). Two tags are supported:
174
175- BER_MENU_SELECTION_TAG (0xd3); Contents: MENU SELECTION (8)
176- BER_EVENT_DOWNLOAD_TAG (0xd6); Contents: EVENT DOWNLOAD Language selection (11.8)
177
178Content for these tags include:
179
180- MENU SELECTION (8)
181- EVENT DOWNLOAD Language selection (11.8)
182
183### RIL_REQUEST_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM ###
184
185Returns a single-byte parameter:
186
187- 1: accepted
188- 0: not accepted
189
190This should cause the terminal response to be sent to the SIM.
191
192## Telephony ##
193
194STK Telephony is a protocol translation layer used to convert messages from BERL-TLV format to Application messages and back.
195
196On the STK RIL side, STK Telphony receives raw buffer messages from RIL I/F and decodes them into a command parameters container before passing them on to the application. On the Application side, this layer receives application responses for commands and encodes them into raw buffer messages, which then get sent over the RIL I/F back to the SIM card.
197
198## Feature List ##
199
200Feature | Support | Implemented by
201------------|---------|---------------
202PROFILE DOWNLOAD - before radio turn-on | YES | Baseband
203SET UP MENU | YES | ME
204SELECT ITEM | YES | ME
205GET INPUT | YES | ME
206GET INKEY | YES | ME
207DISPLAY TEXT| YES | ME
208SET UP IDLE MODE TEXT | YES | ME
209SEND SHORT MESSAGE | YES | Baseband – ME
210SEND | YES | Baseband – ME
211SEND USSD | YES | Baseband – ME
212SEND DTMF | YES | Baseband – ME
213LAUNCH BROWSER | YES | ME
214SET UP CALL | YES | Baseband – ME
215PLAY TONE | YES | ME
216POLL INTERVAL | YES | Baseband
217POLLING OFF | YES | Baseband
218TIMER MANAGEMENT | YES | Baseband
219MORE TIME | YES | Baseband
220PROVIDE LOCAL INFORMATION (MCC, MNC, LAC, Cell ID & IMEI) | YES | Baseband
221PROVIDE LOCAL INFORMATION (NMR) | YES | Baseband
222PROVIDE LOCAL INFORMATION (Timing Advance) | YES | Baseband
223PROVIDE LOCAL INFORMATION (battery state) | YES | Baseband
224PROVIDE LOCAL INFORMATION (IMEISV) | YES | Baseband
225PROVIDE LOCAL INFORMATION (NMR(UTRAN)) | YES | Baseband
226PROVIDE LOCAL INFORMATION (Search Mode change) | YES | Baseband
227REFRESH | YES | ME
228SET UP EVENT LIST | YES | Baseband – ME
229Event: MT call | YES | Baseband
230Event: Call connected (all modes) | YES | Baseband
231Event: Call disconnected (all modes) | YES | Baseband
232Event: Idle screen available | NO
233Event: Browser termination | NO
234Event: Location status | YES | Baseband
235Event: Data available | NO
236Event: Channel status | NO
237Event: Access Technology changed | YES | Baseband
238Event: Local Connection | NO
239Event: Network Search Mode Change | YES | Baseband
240GET READER STATUS | NO
241POWER ON CARD | NO
242POWER OFF CARD | NO
243PERFORM CARD ADPU | NO
244RUN AT COMMAND | NO
245OPEN CHANNEL | NO
246CLOSE CHANNEL | NO
247RECEIVE DATA | NO
248SEND DATA | NO
249GET CHANNEL STATUS | NO
250CALL CONTROL BY SIM | YES | Baseband
251SMS-PP data download | YES | Baseband
252SMS-CB data download | YES | Baseband
253BIP over GPRS | NO
254BIP over USB | NO
255Text Attributes | NO
256Color icons | YES | ME
257