WebAPI/WebMobileConnection: Difference between revisions

no edit summary
No edit summary
No edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 3: Line 3:
* entering PIN, PIN2, PUK, PUK2 to unlock various states of the SIM card.  
* entering PIN, PIN2, PUK, PUK2 to unlock various states of the SIM card.  
* changing the PIN (also serves as enabling/disabling the PIN lock.)
* changing the PIN (also serves as enabling/disabling the PIN lock.)


== Status ==
== Status ==


Implemented in {{bug|729173}}. <br>
* Implemented in {{bug|729173}}.
ICC lock(PIN/PIN2/PUK/PUK2) is implemented in {{Bug|729173}}.
* ICC lock(PIN/PIN2/PUK/PUK2) is implemented in {{Bug|729173}}.
* getNetworks() and WebMobileOperatorInfo were added in {{Bug|744344}}
* data status is not exposed until {{Bug|753170}} is resolved.
* Move icc/sim related stuff to iccManager in {{Bug|857414}}. And also separate IccManager from MobileConnection.


== Proposed API ==
== Proposed API ==
Line 21: Line 23:
     */
     */
     readonly attribute string cardState;
     readonly attribute string cardState;
   
   
     /**
     /**
     * Indicates whether the device is connected to a mobile network.
     * Information about the voice connection.
     */
     */
     readonly attribute bool connected;
     readonly attribute MobileConnectionInfo voice;
   
   
     /**
     /**
     * Indicates whether emergency calls are possible.
     * Information about the data connection.
    *
    * This flag is only relevant when 'connected' is false.
     */
     */
     readonly attribute bool emergencyCallsPossible;
     readonly attribute MobileConnectionInfo data;
      
      
     /**
     /**
     * Indicates whether the connection is going through a foreign operator
     * The 'cardstatechange' event is notified when the 'cardState' attribute
     * (roaming) or not.
     * changes value.
     */
     */
     readonly attribute bool roaming;
     attribute EventListener oncardstatechange;
      
      
     /**
     /**
     * Operator name.
     * The 'voicechange' event is notified whenever the voice connection object
    * changes.
     */
     */
     readonly attribute string operator?;
     attribute EventListener onvoicechange;
      
      
     /**
     /**
     * Type of connection.
     * The 'datachange' event is notified whenever the data connection object
    *
     * changes values.
     * Possible values: 'gprs', 'edge', 'umts', 'hsdpa', 'evdo0', 'evdoa', 'evdob', etc.
    */
    readonly attribute string type?;
   
    /**
    * Signal strength, represented linearly as a number between 0 (weakest signal) and 1.0
    * (full signal).
    */
    readonly attribute float signalStrength?;
   
    /**
    * Signal strength in dBm, or null if no service is available.
     */
     */
     readonly attribute short signalStrengthDbm?;
     attribute EventListener ondatachange;
      
      
     /**
     /**
     * Search for available networks.
     * Search for available networks.
     *
     *
     * If successful, the request result will be an array of operator names.
     * If successful, the request's onsuccess will be called, and the request's
    * result will be an array of MobileOperatorInfo.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'.
     */
     */
     DOMRequest getNetworks();
     DOMRequest getNetworks();
   
    /**
    * The 'cardstatechange' event is notified when the 'cardState' attribute
    * changes value.
    */
    attribute EventListener oncardstatechange;
   
    /**
    * The 'connectionchange' event is notified whenever one of the 'connected',
    * 'roaming', 'operator', 'type' attributes change, since typically many or
    * all of them change together.
    */
    attribute EventListener onconnectionchange;
   
    /**
    * The 'signalstrengthchange' event is notified whenever the signal strength
    * changes value. The 'bars' attribute is updated accordingly.
    */
    attribute EventListener onsignalstrengthchange;
      
      
     /**
     /**
Line 100: Line 74:
     *        e.g. {lockType: "pin", enabled: true}.
     *        e.g. {lockType: "pin", enabled: true}.
     */
     */
     nsIDOMDOMRequest getCardLock(in DOMString lockType);
     DOMRequest getCardLock(DOMString lockType);
 
   
     /**
     /**
     * Unlock a card lock.
     * Unlock a card lock.
Line 125: Line 99:
     *                  newPin: "..."});
     *                  newPin: "..."});
     *
     *
     * @return a nsIDOMDOMRequest.
     * @return a DOMRequest.
     *        The request's result will be an object containing  
     *        The request's result will be an object containing  
     *        information about the unlock operation.
     *        information about the unlock operation.
Line 146: Line 120:
     *    }
     *    }
     */
     */
     nsIDOMDOMRequest unlockCardLock(in jsval info);
     DOMRequest unlockCardLock(Object info);
 
   
     /**
     /**
     * Modify the state of a card lock.
     * Modify the state of a card lock.
Line 172: Line 146:
     *                newPin: "..."});
     *                newPin: "..."});
     *
     *
     * @return a nsIDOMDOMRequest.
     * @return a DOMRequest.
     *        The request's result will be an object containing  
     *        The request's result will be an object containing  
     *        information about the operation.
     *        information about the operation.
Line 193: Line 167:
     *    }
     *    }
     */
     */
     nsIDOMDOMRequest setCardLock(in jsval info);
     DOMRequest setCardLock(Object info);
   
  };
 
  interface MobileConnectionInfo
  {
    /**
    * Indicates whether the device is connected to a mobile network.
    */
    readonly attribute bool connected;
   
    /**
    * Indicates whether only emergency calls are possible.
    *
    * This flag is only relevant to voice connections and when 'connected' is
    * false.
    */
    readonly attribute bool emergencyCallsOnly;
   
    /**
    * Indicates whether the connection is going through a foreign operator
    * (roaming) or not.
    */
    readonly attribute bool roaming;
   
    /**
    * Network operator
    */
    readonly attribute DOMString operator;
   
    /**
    * Type of connection.
    *
    * Possible values: 'gsm', 'cdma', gprs', 'edge', 'umts', 'hsdpa', 'evdo0',
    * 'evdoa', 'evdob', etc.
    */
    readonly attribute DOMString type;
   
    /**
    * Signal strength in dBm, or null if no service is available.
    */
    readonly attribute int signalStrength;
   
    /**
    * Signal strength, represented linearly as a number between 0 (weakest
    * signal) and 100 (full signal).
    */
    readonly attribute int relSignalStrength;
   
  };


  interface MobileOperatorInfo
  {
    /**
    * Short name of the network operator
    */
    readonly attribute DOMString shortName;
   
    /**
    * Long name of the network operator
    */
    readonly attribute DOMString longName;
   
    /**
    * Mobile Country Code (MCC) of the network operator
    */
    readonly attribute unsigned short mcc;
   
    /**
    * Mobile Network Code (MNC) of the network operator
    */
    readonly attribute unsigned short mnc;
   
    /**
    * State of this network operator.
    *
    * Possible values: 'available', 'connected', 'forbidden', or null (unknown)
    */
    readonly attribute DOMString state;
   };
   };


Line 209: Line 260:


* ICC-related (SIM/RUIM card)
* ICC-related (SIM/RUIM card)
** own phone number and other ICC I/O related features
** own phone number and other ICC I/O related features.(Currently these information are not exposed in WebAPI, see {{Bug|736941}}.)
* device-related
* device-related
** get IMEI, IMEISV
** get IMEI, IMEISV
Line 216: Line 267:


The latter, device-related features seem to be more exotic than the ICC-related ones and hopefully also mostly unnecessary. The question remains where these APIs should live.
The latter, device-related features seem to be more exotic than the ICC-related ones and hopefully also mostly unnecessary. The question remains where these APIs should live.
[[Category:Web APIs]]
Confirmed users
1,340

edits