Confirmed users
266
edits
Allstars.chh (talk | contribs) |
Allstars.chh (talk | contribs) |
||
| Line 708: | Line 708: | ||
== Menu Selection == | == Menu Selection == | ||
<pre> | <pre> | ||
function | /** | ||
* onMenuSelected is the callback when some item of the menu is selected. | |||
* @param id The index of the item being selected. | |||
* @param helpRequested Request for help. | |||
*/ | |||
function onMenuSelected(id, helpRequested) { | |||
var icc = navigator.mozMobileConnection.icc; | |||
icc.sendStkMenuSelection(id, helpRequested); | |||
} | } | ||
</pre> | </pre> | ||
| Line 717: | Line 723: | ||
// 'command' is got from onstkcommand | // 'command' is got from onstkcommand | ||
// and assume it's a Select Item command. | // and assume it's a Select Item command. | ||
var icc = navigator.mozMobileConnection.icc; | |||
var response = { | var response = { | ||
resultCode : icc.STK_RESULT_OK, | |||
// 'id' is got from the choosed item identifier (menu.item[].identifier) | |||
resultCode : | |||
// 'id' is got from the | |||
itemIdentifier: id | itemIdentifier: id | ||
}; | }; | ||
mozIcc.sendStkResponse(response); | mozIcc.sendStkResponse(command, response); | ||
</pre> | </pre> | ||
== Get Input == | == Get Input == | ||
<pre> | <pre> | ||
var icc = navigator.mozMobileConnection.icc; | |||
icc.onstkcommand = function (command) { | |||
switch (command.typeOfCommand) { | switch (command.typeOfCommand) { | ||
case | case icc.STK_CMD_GET_INPUT: | ||
var input = command.options; | var input = command.options; | ||
// create a TextInput-like UI according to 'input' | // create a TextInput-like UI according to 'input' | ||
| Line 740: | Line 745: | ||
// onTextInput is the callback when user inputs complete. | // onTextInput is the callback when user inputs complete. | ||
var icc = navigator.mozMobileConnection.icc; | |||
function onTextInput(input) { | function onTextInput(input) { | ||
var response = { | var response = { | ||
resultCode : mozICC.STK_RESULT_OK, | resultCode : mozICC.STK_RESULT_OK, | ||
input: input | input: input | ||
}; | }; | ||
mozIcc.sendStkResponse(response); | mozIcc.sendStkResponse(command, response); | ||
} | } | ||
</pre> | </pre> | ||