WebAPI/WebMobileConnection: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 27: Line 27:
     * Operator name.
     * Operator name.
     */
     */
     readonly attribute string operator;
     readonly attribute string operator?;
      
      
     /**
     /**
Line 34: Line 34:
     * Possible values: 'gprs', 'edge', 'umts', 'hsdpa', 'evdo0', 'evdoa', 'evdob', etc.
     * Possible values: 'gprs', 'edge', 'umts', 'hsdpa', 'evdo0', 'evdoa', 'evdob', etc.
     */
     */
     readonly attribute string type;
     readonly attribute string type?;
      
      
     /**
     /**
Line 46: Line 46:
     *  null    if no signal strength (or signal) is available.
     *  null    if no signal strength (or signal) is available.
     */
     */
     readonly attribute short signalstrength;
     readonly attribute short signalStrength?;
      
      
     /**
     /**
     * Signal strength expressed as number of "bars".
     * Signal strength expressed as number of "bars".
     *
     *
     * Possible values: 0 (no signal) to 5 (full signal).
     * Possible values: 0 (weakest signal) to 5 (full signal).
     */
     */
     readonly attribute short bars;
     readonly attribute short bars?;
      
      
     /**
     /**

Revision as of 10:08, 22 February 2012

This exposes information about the current mobile data connection to (certain) HTML content. The primary use case for this is the status bar of the main phone UI. It typically shows the operator name, signal strength, data connection type, etc.

Proposed API

 interface MobileConnection : EventTarget
 {
   /**
    * Indicates the state of the device's ICC card.
    *
    * Possible values: 'unavailable', 'absent', 'pin_required', 'puk_required',
    * 'network_locked', 'not_ready', 'ready'.
    */
   readonly attribute string cardState;
   
   /**
    * Indicates whether the device is connected to a mobile network.
    */
   readonly attribute bool connected;
   
   /**
    * Indicates whether the connection is going through a foreign operator
    * (roaming) or not.
    */
   readonly attribute bool roaming;
   
   /**
    * Operator name.
    */
   readonly attribute string operator?;
   
   /**
    * Type of connection.
    *
    * Possible values: 'gprs', 'edge', 'umts', 'hsdpa', 'evdo0', 'evdoa', 'evdob', etc.
    */
   readonly attribute string type?;
   
   /**
    * Signal strength as defined by 3GPP TS 27.007 specification, section 8.5.
    *
    * Possible values:
    *   0       -113 dBm or less
    *   1       -111 dBm
    *   2...30  -109 ... -53 dBm
    *   31      -51 dBm or greater
    *   null    if no signal strength (or signal) is available.
    */
   readonly attribute short signalStrength?;
   
   /**
    * Signal strength expressed as number of "bars".
    *
    * Possible values: 0 (weakest signal) to 5 (full signal).
    */
   readonly attribute short bars?;
   
   /**
    * 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;
 };