WebAPI/WebMobileConnection

From MozillaWiki
< WebAPI
Revision as of 19:20, 5 June 2012 by Philikon (talk | contribs)
Jump to navigation Jump to search

This exposes information about the current mobile voice and 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.

Status

Implemented in bug 729173.

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 emergency calls are possible.
    *
    * This flag is only relevant when 'connected' is false.
    */
   readonly attribute bool emergencyCallsPossible;
   
   /**
    * 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, 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?;
   
   /**
    * Search for available networks.
    *
    * If successful, the request result will be an array of operator names.
    */
   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;
   
 };

Other radio-related functionality

The following radio/mobile connection related features will be exposed as settings in SettingsAPI:

  • radio on/off (e.g. for aeroplane mode)
  • caller ID on/off/provider default (called "CLIR" in TS 27.007)
  • call forwarding preferences
  • manual override for operator selection

There are also some more features of the radio that should be exposed to (privileged) content in some shape or form:

  • ICC-related (SIM/RUIM card)
    • own phone number and other ICC I/O related features
    • entering PIN, PIN2, PUK, PUK2 to unlock various states of the SIM card. Entering the PIN isn't *that* exotic, actually. Some carriers deliver their SIM cards with the PIN lock enabled, for instance.
    • changing the PIN (also serves as enabling/disabling the PIN lock.)
  • device-related
    • get IMEI, IMEISV
    • depersonalize (remove network lock)
    • baseband-related information and features

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.