WebAPI/WebSTK: Difference between revisions

no edit summary
No edit summary
Line 94: Line 94:
** MozStkResponse
** MozStkResponse


In both MozStkCommand and MozStkCommand, we expose the content of 'Command Details' as:
In both MozStkCommand and MozStkResponse, we expose the content of 'Command Details' as:
* commandNumber
* number
* typeOfCommand
* type
* commandQualifier
* qualifier
So when a webapp tries to create a MozStkResponse, the webapp needs to create exactly the same 'Command Details' as it got from MozStkCommand.
So when a webapp tries to create a MozStkResponse, the webapp needs to create exactly the same 'Command Details' as it got from MozStkCommand.


Line 163: Line 163:
{
{
   /**
   /**
   * Command number is the number of command issued by ICC. And it is assigned  
   * The number of command issued by ICC. And it is assigned  
   * by ICC may take any hexadecimal value betweean '01' and 'FE'.
   * by ICC may take any hexadecimal value betweean '01' and 'FE'.
   *
   *
   * @see TS 11.14, clause 6.5.1
   * @see TS 11.14, clause 6.5.1
   */  
   */  
   readonly attribute unsigned short commandNumber;
   readonly attribute unsigned short number;


   /**
   /**
   * One of nsIDOMMozStkProactiveCommand.
   * One of CMD_*
   */   
   */   
   readonly attribute unsigned short typeOfCommand;  
   readonly attribute unsigned short type;  


   /**
   /**
   * Qualifiers specific to the command.
   * Qualifiers specific to the command.
   */  
   */  
   readonly attribute unsigned short commandQualifier;
   readonly attribute unsigned short qualifier;
    
    
   /**
   /**
   * Used when typeOfCommand in nsIDOMMozStkCommand is  
   * Used when type in nsIDOMMozStkCommand is  
   * DISPLAY_TEXT, SET_UP_IDLE_MODE_TEXT, REFRESH and SEND_*.
   * DISPLAY_TEXT, SET_UP_IDLE_MODE_TEXT, REFRESH and SEND_*.
   */
   */
   readonly attribute nsIDOMMozStkTextMessage textMessage;
   readonly attribute nsIDOMMozStkTextMessage textMessage;
   
   
   /**
   /**
   * Used when typeOfCommand in nsIDOMMozStkCommand is  
   * Used when type in nsIDOMMozStkCommand is  
   * SELECT_ITEM or SET_UP_MENU.
   * SELECT_ITEM or SET_UP_MENU.
   */   
   */   
Line 194: Line 193:


   /**
   /**
   * Used when typeOfCommand in nsIDOMMozStkCommand is  
   * Used when type in nsIDOMMozStkCommand is  
   * GET_INKEY or GET_INPUT.
   * GET_INKEY or GET_INPUT.
   */  
   */  
Line 200: Line 199:
   
   
   /**
   /**
   * Used when typeOfCommand in nsIDOMMozStkCommand is  
   * Used when type in nsIDOMMozStkCommand is  
   * LAUNCH_BROWSER.
   * LAUNCH_BROWSER.
   */  
   */  
Line 206: Line 205:
   
   
   /**
   /**
   * Used when typeOfCommand in nsIDOMMozStkCommand is  
   * Used when type in nsIDOMMozStkCommand is  
   * SET_UP_CALL.
   * SET_UP_CALL.
   */  
   */  
   readonly attribute nsIDOMMozStkSetUpCall setup;
   readonly attribute nsIDOMMozStkSetUpCall call;
};
};
</pre>
</pre>
Line 480: Line 479:
{
{
   /**
   /**
   * Command number from MozStkCommand..
   * number from MozStkCommand..
   *
   *
   * @see nsIDOMMozStkCommand.commandNumber
   * @see nsIDOMMozStkCommand.number
   */  
   */  
   readonly attribute unsigned short commandNumber;
   readonly attribute unsigned short number;


   /**
   /**
   * One of nsIDOMMozStkProactiveCommand.
   * One of nsIDOMMozStkCommand.type
   *
   *
   * @see nsIDOMMozStkCommand.typeOfCommand
   * @see nsIDOMMozStkCommand.type
   */   
   */   
   readonly attribute unsigned short typeOfCommand;  
   readonly attribute unsigned short type;  


   /**
   /**
   * Qualifiers specific to the command.
   * Qualifiers specific to the command.
   *
   *
   * @see nsIDOMMozStkCommand.commandQualifier
   * @see nsIDOMMozStkCommand.qualifier
   */  
   */  
   readonly attribute unsigned short commandQualifier;
   readonly attribute unsigned short qualifier;


   /**
   /**
   * One of nsIDOMMozStkResultCode.
   * One of RESULT_*
   */  
   */  
   attribute unsigned short resultCode;
   attribute unsigned short resultCode;
Line 557: Line 556:
  * @see TS 11.14, clause 13.4
  * @see TS 11.14, clause 13.4
  */
  */
interface nsIDOMMozStkProactiveCommand : nsISupports
partial interface nsIDOMMozStkCommand : nsISupports
{
{
   const unsigned short REFRESH               = 0x01;
  /**
   const unsigned short SET_UP_CALL           = 0x10;
  * STK Proactive commands.
   const unsigned short SEND_SS               = 0x11;
  *
   const unsigned short SEND_USSD             = 0x12;
  * @see TS 11.14, clause 13.4
   const unsigned short SEND_SMS             = 0x13;
  */
   const unsigned short SEND_DTMF             = 0x14;
   const unsigned short CMD_REFRESH               = 0x01;
   const unsigned short LAUNCH_BROWSER       = 0x15;
   const unsigned short CMD_SET_UP_CALL           = 0x10;
   const unsigned short DISPLAY_TEXT         = 0x21;
   const unsigned short CMD_SEND_SS               = 0x11;
   const unsigned short GET_INKEY             = 0x22;
   const unsigned short CMD_SEND_USSD             = 0x12;
   const unsigned short GET_INPUT             = 0x23;
   const unsigned short CMD_SEND_SMS             = 0x13;
   const unsigned short SELECT_ITEM           = 0x24;
   const unsigned short CMD_SEND_DTMF             = 0x14;
   const unsigned short SET_UP_MENU           = 0x25;
   const unsigned short CMD_LAUNCH_BROWSER       = 0x15;
   const unsigned short SET_UP_IDLE_MODE_TEXT = 0x28;
   const unsigned short CMD_DISPLAY_TEXT         = 0x21;
};
   const unsigned short CMD_GET_INKEY             = 0x22;
   const unsigned short CMD_GET_INPUT             = 0x23;
   const unsigned short CMD_SELECT_ITEM           = 0x24;
   const unsigned short CMD_SET_UP_MENU           = 0x25;
   const unsigned short CMD_SET_UP_IDLE_MODE_TEXT = 0x28;
}


/**
/**
Line 579: Line 583:
  * @see TS 11.14, clause 12.12
  * @see TS 11.14, clause 12.12
  */
  */
interface nsIDOMMozStkResultCode : nsISupports
partial interface nsIDOMMozStkResponse : nsISupports
{
{
  /**
  * STK Result code.
  *
  * @see TS 11.14, clause 12.12
  */
   /**
   /**
   * Results '0X' and '1X' indicate that the command has been performed.
   * Results '0X' and '1X' indicate that the command has been performed.
   */
   */
   /** Command performed successfully */
   /** Command performed successfully */
   const unsigned short OK                               = 0x00;
   const unsigned short RESULT_OK                               = 0x00;


   /** Command performed with partial comprehension */
   /** Command performed with partial comprehension */
   const unsigned short PRFRMD_WITH_PARTIAL_COMPREHENSION = 0x01;
   const unsigned short RESULT_PRFRMD_WITH_PARTIAL_COMPREHENSION = 0x01;


   /** Command performed, with missing information */
   /** Command performed, with missing information */
   const unsigned short PRFRMD_WITH_MISSING_INFO         = 0x02;
   const unsigned short RESULT_PRFRMD_WITH_MISSING_INFO         = 0x02;


   /** REFRESH performed with additional EFs read */
   /** REFRESH performed with additional EFs read */
   const unsigned short PRFRMD_WITH_ADDITIONAL_EFS_READ   = 0x03;
   const unsigned short RESULT_PRFRMD_WITH_ADDITIONAL_EFS_READ   = 0x03;
 
  /** Command performed, but modified by call control by NAA */
  const unsigned short PRFRMD_MODIFIED_BY_NAA            = 0x05;


   /** Command performed successfully, limited service */
   /** Command performed successfully, limited service */
   const unsigned short PRFRMD_LIMITED_SERVICE           = 0x06;
   const unsigned short RESULT_PRFRMD_LIMITED_SERVICE           = 0x06;
 
  /** Command performed with modification */
  const unsigned short PRFRMD_WITH_MODIFICATION          = 0x07;
 
  /** REFRESH performed but indicated NAA was not active */
  const unsigned short PRFRMD_NAA_NOT_ACTIVE            = 0x08;


   /** Proactive UICC session terminated by the user */
   /** Proactive UICC session terminated by the user */
   const unsigned short UICC_SESSION_TERM_BY_USER         = 0x10;
   const unsigned short RESULT_UICC_SESSION_TERM_BY_USER         = 0x10;


   /** Backward move in the proactive UICC session requested by the user */
   /** Backward move in the proactive UICC session requested by the user */
   const unsigned short BACKWARD_MOVE_BY_USER             = 0x11;
   const unsigned short RESULT_BACKWARD_MOVE_BY_USER             = 0x11;


   /** No response from user */
   /** No response from user */
   const unsigned short NO_RESPONSE_FROM_USER             = 0x12;
   const unsigned short RESULT_NO_RESPONSE_FROM_USER             = 0x12;


   /** Help information required by the user */
   /** Help information required by the user */
   const unsigned short HELP_INFO_REQUIRED               = 0x13;
   const unsigned short RESULT_HELP_INFO_REQUIRED               = 0x13;


   /** USSD or SS transaction terminated by the user */
   /** USSD or SS transaction terminated by the user */
   const unsigned short USSD_SS_SESSION_TERM_BY_USER     = 0x14;
   const unsigned short RESULT_USSD_SS_SESSION_TERM_BY_USER     = 0x14;


   /*
   /**
   * Results '2X' indicate to the UICC that it may be worth re-trying the
   * Results '2X' indicate to the UICC that it may be worth re-trying the
   * command at a later opportunity.
   * command at a later opportunity.
   */
   */
   /** Terminal currently unable to process command */
   /** Terminal currently unable to process command */
   const unsigned short TERMINAL_CRNTLY_UNABLE_TO_PROCESS = 0x20;
   const unsigned short RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS = 0x20;


   /** Network currently unable to process command */
   /** Network currently unable to process command */
   const unsigned short NETWORK_CRNTLY_UNABLE_TO_PROCESS = 0x21;
   const unsigned short RESULT_NETWORK_CRNTLY_UNABLE_TO_PROCESS = 0x21;


   /** User did not accept the proactive command */
   /** User did not accept the proactive command */
   const unsigned short USER_NOT_ACCEPT                   = 0x22;
   const unsigned short RESULT_USER_NOT_ACCEPT                   = 0x22;


   /** User cleared down call before connection or network release */
   /** User cleared down call before connection or network release */
   const unsigned short USER_CLEAR_DOWN_CALL             = 0x23;
   const unsigned short RESULT_USER_CLEAR_DOWN_CALL             = 0x23;
 
  /** Action in contradiction with the current timer state */
  const unsigned short CONTRADICTION_WITH_TIMER          = 0x24;
 
  /** Interaction with call control by NAA, temporary problem */
  const unsigned short NAA_CALL_CONTROL_TEMPORARY        = 0x25;


   /** Launch browser generic error code */
   /** Launch browser generic error code */
   const unsigned short LAUNCH_BROWSER_ERROR             = 0x26;
   const unsigned short RESULT_LAUNCH_BROWSER_ERROR             = 0x26;


   /*
   /**
   * Results '3X' indicate that it is not worth the UICC re-trying with an
   * Results '3X' indicate that it is not worth the UICC re-trying with an
   * identical command, as it will only get the same response. However, the
   * identical command, as it will only get the same response. However, the
Line 654: Line 649:
   */
   */
   /** Command beyond terminal's capabilities */
   /** Command beyond terminal's capabilities */
   const unsigned short BEYOND_TERMINAL_CAPABILITY       = 0x30;
   const unsigned short RESULT_BEYOND_TERMINAL_CAPABILITY       = 0x30;
    
    
   /** Command type not understood by terminal */
   /** Command type not understood by terminal */
   const unsigned short CMD_TYPE_NOT_UNDERSTOOD           = 0x31;
   const unsigned short RESULT_CMD_TYPE_NOT_UNDERSTOOD           = 0x31;


   /** Command data not understood by terminal */
   /** Command data not understood by terminal */
   const unsigned short CMD_DATA_NOT_UNDERSTOOD           = 0x32;
   const unsigned short RESULT_CMD_DATA_NOT_UNDERSTOOD           = 0x32;


   /** Command number not known by terminal */
   /** Command number not known by terminal */
   const unsigned short CMD_NUM_NOT_KNOWN                 = 0x33;
   const unsigned short RESULT_CMD_NUM_NOT_KNOWN                 = 0x33;


   /** SS Return Error */
   /** SS Return Error */
   const unsigned short SS_RETURN_ERROR                   = 0x34;
   const unsigned short RESULT_SS_RETURN_ERROR                   = 0x34;


   /** SMS RP-ERROR */
   /** SMS RP-ERROR */
   const unsigned short SMS_RP_ERROR                     = 0x35;
   const unsigned short RESULT_SMS_RP_ERROR                     = 0x35;


   /** Error, required values are missing */
   /** Error, required values are missing */
   const unsigned short REQUIRED_VALUES_MISSING           = 0x36;
   const unsigned short RESULT_REQUIRED_VALUES_MISSING           = 0x36;


   /** USSD Return Error */
   /** USSD Return Error */
   const unsigned short USSD_RETURN_ERROR                 = 0x37;
   const unsigned short RESULT_USSD_RETURN_ERROR                 = 0x37;


   /** MultipleCard commands error */
   /** MultipleCard commands error */
   const unsigned short MULTI_CARDS_CMD_ERROR             = 0x38;
   const unsigned short RESULT_MULTI_CARDS_CMD_ERROR             = 0x38;


   /**
   /**
Line 684: Line 679:
   * USIM, permanent problem
   * USIM, permanent problem
   */
   */
   const unsigned short USIM_CALL_CONTROL_PERMANENT       = 0x39;
   const unsigned short RESULT_USIM_CALL_CONTROL_PERMANENT       = 0x39;


   /** Bearer Independent Protocol error */
   /** Bearer Independent Protocol error */
   const unsigned short BIP_ERROR                         = 0x3a;
   const unsigned short RESULT_BIP_ERROR                         = 0x3a;
 
  /** Access Technology unable to process command */
  const unsigned short ACCESS_TECH_UNABLE_TO_PROCESS    = 0x3b;
 
  /** Frames error */
  const unsigned short FRAMES_ERROR                      = 0x3c;
};
};
</pre>
</pre>


Line 703: Line 690:
<pre>
<pre>
mozIcc.onstkcommand = function (command) {
mozIcc.onstkcommand = function (command) {
   switch (command.typeOfCommand) {
   switch (command.type) {
     case mozIcc.proac.SET_UP_MENU:
     case MozStkCommand.SET_UP_MENU:
       var menu = command.menu;
       var menu = command.menu;
       // create a Menu-like UI according to 'menu'
       // create a Menu-like UI according to 'menu'
Line 723: Line 710:
// '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 response = new mozIcc.MozStkResponse(command);
var response = new MozStkResponse(command);
response.resultCode = MozStkResultCode.RESULT_OK;
response.resultCode = MozStkResponse.RESULT_OK;
// 'id' is got from the chosen item identifier (menu.item[].identifier)
// 'id' is got from the chosen item identifier (menu.item[].identifier)
response.itemIdentifier = id;
response.itemIdentifier = id;
Line 733: Line 720:
<pre>
<pre>
mozIcc.onstkcommand = function (command) {
mozIcc.onstkcommand = function (command) {
   switch (command.typeOfCommand) {
   switch (command.type) {
     case MozStkProactiveCommand.GET_INPUT:
     case MozStkCommand.GET_INPUT:
       var input = command.input;
       var input = command.input;
       // create a TextInput-like UI according to 'input'
       // create a TextInput-like UI according to 'input'
Line 744: Line 731:
function onTextInput(input) {
function onTextInput(input) {
   var response = new MozStkResponse(command);
   var response = new MozStkResponse(command);
   response.resultCode = MozStkResultCode.RESULT_OK;
   response.resultCode = MozStkResponse.RESULT_OK;
   response.input = input;
   response.input = input;
   mozIcc.sendStkResponse(response);
   mozIcc.sendStkResponse(response);
Line 753: Line 740:
<pre>
<pre>
mozIcc.onstkcommand = function (command) {
mozIcc.onstkcommand = function (command) {
   switch (command.typeOfCommand) {
   switch (command.type) {
     case MozStkProactiveCommand.SET_UP_CALL:
     case MozStkCommand.SET_UP_CALL:
       var setup = command.param.setup;
       var call = command.call;
       // create a Text Message UI to ask user confirmation  
       // create a Text Message UI to ask user confirmation  
       // for make the MO call.
       // for make the MO call.
Line 765: Line 752:
function onUserConfirm(confirm) {
function onUserConfirm(confirm) {
   var response = new MozStkResponse(command);
   var response = new MozStkResponse(command);
   response.resultCode = MozStkResultCode.RESULT_OK;
   response.resultCode = MozStkResponse.RESULT_OK;
   response.confirmation = confirm;
   response.confirmation = confirm;
   mozIcc.sendStkResponse(response);
   mozIcc.sendStkResponse(response);
Confirmed users
266

edits