Revision 371001 of MozMobileConnection

  • Revision slug: DOM/MozMobileConnection
  • Revision title: MozMobileConnection
  • Revision id: 371001
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment

Revision Content

{{ non-standard_header() }}

{{ B2GOnlyHeader2('certified') }}

Summary

This API is used to get information about the current mobile voice and data connection states of the device. It is accessible through {{domxref("window.navigator.mozMobileConnection","navigator.mozMobileConnection")}}.

This object also includes ICC-related (SIM/RUIM card) functionalities, such as :

  • entering PIN, PIN2, PUK, PUK2 to unlock various states of the SIM card.
  • changing the PIN (also serves as enabling/disabling the PIN lock.)

Interface overview

callback EventHandler = any ({{domxref("Event")}} event);

interface MozMobileConnection : {{domxref("EventTarget")}}
{
  const long ICC_SERVICE_CLASS_VOICE = (1 << 0);
  const long ICC_SERVICE_CLASS_DATA = (1 << 1);
  const long ICC_SERVICE_CLASS_FAX = (1 << 2);
  const long ICC_SERVICE_CLASS_SMS = (1 << 3);
  const long ICC_SERVICE_CLASS_DATA_SYNC = (1 << 4);
  const long ICC_SERVICE_CLASS_DATA_ASYNC = (1 << 5);
  const long ICC_SERVICE_CLASS_PACKET = (1 << 6);
  const long ICC_SERVICE_CLASS_PAD = (1 << 7);
  const long ICC_SERVICE_CLASS_MAX = (1 << 7);

  readonly attribute DOMString cardState;
  readonly attribute {{domxref("MozMobileICCInfo")}} iccInfo;
  readonly attribute {{domxref("MozMobileConnectionInfo")}} voice;
  readonly attribute {{domxref("MozMobileConnectionInfo")}} data;
  readonly attribute DOMString networkSelectionMode;
  readonly attribute {{domxref("MozIccManager")}} icc;

  DOMRequest getNetworks();
  DOMRequest selectNetwork({{domxref("MozMobileNetworkInfo")}} network);
  DOMRequest selectNetworkAutomatically();
  DOMRequest getCardLock(DOMString lockType);
  DOMRequest unlockCardLock(object info);
  DOMRequest setCardLock(object info);
  DOMRequest sendMMI(DOMString mmi);
  DOMRequest cancelMMI();
  DOMRequest setCallForwardingOption({{domxref("MozMobileCFInfo")}} CFInfo);
  DOMRequest getCallForwardingOption(unsigned short reason);

  attribute EventHandler oncardstatechange;
  attribute EventHandler oniccinfochange;
  attribute EventHandler onvoicechange;
  attribute EventHandler ondatachange;
  attribute EventHandler onussdreceived;
  attribute EventHandler ondataerror;
  attribute EventHandler onicccardlockerror;
  attribute EventHandler oncfstatechange;
};

Properties

{{domxref("MozMobileConnection.cardState")}} {{readonlyinline}}
A string that indicates the state of the device's ICC card.
{{domxref("MozMobileConnection.data")}} {{readonlyinline}}
A {{domxref("MozMobileConnectionInfo")}} object that gives access to information about the data connection.
{{domxref("MozMobileConnection.icc")}} {{readonlyinline}}
A {{domxref("MozIccManager")}} object that gives access to ICC related funcionality.
{{domxref("MozMobileConnection.iccInfo")}} {{readonlyinline}}
A {{domxref("MozMobileICCInfo")}} object that gives access to information stored in the device's ICC card.
{{domxref("MozMobileConnection.networkSelectionMode")}} {{readonlyinline}}
A string that indicate the selection mode of the voice and data networks.
{{domxref("MozMobileConnection.oncardstatechange")}}
A handler for the cardstatechange event. This event is fired when the {{domxref("MozMobileConnection.cardState","cardState")}} property changes value.
{{domxref("MozMobileConnection.oncfstatechange")}}
A handler for the cfstatechange event. This event is fired when the call forwarding state changes.
{{domxref("MozMobileConnection.ondatachange")}}
A handler for the datachange event. This event is fired whenever the {{domxref("MozMobileConnection.data","data")}} connection object changes values.
{{domxref("MozMobileConnection.ondataerror")}}
A handler for the dataerror event. This event is fired whenever the {{domxref("MozMobileConnection.data","data")}} connection object receive an error from the RIL.
{{domxref("MozMobileConnection.onicccardlockerror")}}
A handler for the icccardlockerror event. This event is fired whenever the {{domxref("MozMobileConnection.unlockCardLock()","unlockCardLock")}} or {{domxref("MozMobileConnection.setCardLock()","setCardLock")}} methods fails.
{{domxref("MozMobileConnection.oniccinfochange")}}
A handler for the iccinfochange event. This event is fired whenever the {{domxref("MozMobileConnection.iccInfo","iccInfo")}} object changes.
{{domxref("MozMobileConnection.onussdreceived")}}
A handler for the ussdreceived event. This event is fired whenever a new USSD message is received.
{{domxref("MozMobileConnection.onvoicechange")}}
A handler for the voicechange event. This event is fired whenever the {{domxref("MozMobileConnection.voice","voice")}} connection object changes.
{{domxref("MozMobileConnection.voice")}} {{readonlyinline}}
A {{domxref("MozMobileConnectionInfo")}} object that gives access to information about the voice connection.

Constants

  • ICC_SERVICE_CLASS_VOICE
  • ICC_SERVICE_CLASS_DATA
  • ICC_SERVICE_CLASS_FAX
  • ICC_SERVICE_CLASS_SMS
  • ICC_SERVICE_CLASS_DATA_SYNC
  • ICC_SERVICE_CLASS_DATA_ASYNC
  • ICC_SERVICE_CLASS_PACKET
  • ICC_SERVICE_CLASS_PAD
  • ICC_SERVICE_CLASS_MAX

Methods

Note: All the methods of the MozMobileConnection object are fully asynchronous. They all return a {{domxref("DOMRequest")}} which has a onsuccess and onerror event handler to handle the success or failur of the method call.

{{domxref("MozMobileConnection.cancelMMI()")}}
Cancel the current MMI request if one exists.
{{domxref("MozMobileConnection.getCardLock()")}}
Find out about the status of an ICC lock (e.g. the PIN lock).
{{domxref("MozMobileConnection.getCallForwardingOption()")}}
Queries current call forward options.
{{domxref("MozMobileConnection.getNetworks()")}}
Search for available networks.
{{domxref("MozMobileConnection.selectNetwork()")}}
Manually selects a network, overriding the radio's current selection.
{{domxref("MozMobileConnection.selectNetworkAutomatically()")}}
Tell the radio to automatically select a network.
{{domxref("MozMobileConnection.sendMMI()")}}
Send a MMI message.
{{domxref("MozMobileConnection.setCallForwardingOption()")}}
Configures call forward options.
{{domxref("MozMobileConnection.setCardLock()")}}
Modify the state of a card lock.
{{domxref("MozMobileConnection.unlockCardLock()")}}
Unlock a card lock.

Specification

Not part of any specification

See also

  • {{domxref("window.navigator.mozMobileConnection","navigator.mozMobileConnection")}}
  • {{domxref("MozMobileConnectionInfo")}}
  • {{domxref("MozMobileICCInfo")}}
  • {{domxref("MozIccManager")}}
  • {{domxref("MozMobileNetworkInfo")}}
  • {{domxref("MozMobileCFInfo")}}
  • {{domxref("MozMobileCellInfo")}}

Revision Source

<p>{{ non-standard_header() }}</p>
<p>{{ B2GOnlyHeader2('certified') }}</p>
<h2 id="Summary" name="Summary">Summary</h2>
<p>This API is used to get information about the current mobile voice and data connection states of the device. It is accessible through {{domxref("window.navigator.mozMobileConnection","navigator.mozMobileConnection")}}.</p>
<p>This object also includes ICC-related (SIM/RUIM card) functionalities, such as&nbsp;:</p>
<ul>
  <li>entering PIN, PIN2, PUK, PUK2 to unlock various states of the SIM card.</li>
  <li>changing the PIN (also serves as enabling/disabling the PIN lock.)</li>
</ul>
<h2 id="Syntax" name="Syntax">Interface overview</h2>
<pre class="eval">
callback EventHandler = any ({{domxref("Event")}} event);

interface MozMobileConnection : {{domxref("EventTarget")}}
{
&nbsp; const long ICC_SERVICE_CLASS_VOICE = (1 &lt;&lt; 0);
&nbsp; const long ICC_SERVICE_CLASS_DATA = (1 &lt;&lt; 1);
&nbsp; const long ICC_SERVICE_CLASS_FAX = (1 &lt;&lt; 2);
&nbsp; const long ICC_SERVICE_CLASS_SMS = (1 &lt;&lt; 3);
&nbsp; const long ICC_SERVICE_CLASS_DATA_SYNC = (1 &lt;&lt; 4);
&nbsp; const long ICC_SERVICE_CLASS_DATA_ASYNC = (1 &lt;&lt; 5);
&nbsp; const long ICC_SERVICE_CLASS_PACKET = (1 &lt;&lt; 6);
&nbsp; const long ICC_SERVICE_CLASS_PAD = (1 &lt;&lt; 7);
&nbsp; const long ICC_SERVICE_CLASS_MAX = (1 &lt;&lt; 7);

&nbsp; readonly attribute DOMString cardState;
&nbsp; readonly attribute {{domxref("MozMobileICCInfo")}} iccInfo;
&nbsp; readonly attribute {{domxref("MozMobileConnectionInfo")}} voice;
&nbsp; readonly attribute {{domxref("MozMobileConnectionInfo")}} data;
&nbsp; readonly attribute DOMString networkSelectionMode;
&nbsp; readonly attribute {{domxref("MozIccManager")}} icc;

&nbsp; DOMRequest getNetworks();
&nbsp; DOMRequest selectNetwork({{domxref("MozMobileNetworkInfo")}} network);
&nbsp; DOMRequest selectNetworkAutomatically();
&nbsp; DOMRequest getCardLock(DOMString lockType);
&nbsp; DOMRequest unlockCardLock(object info);
&nbsp; DOMRequest setCardLock(object info);
&nbsp; DOMRequest sendMMI(DOMString mmi);
&nbsp; DOMRequest cancelMMI();
&nbsp; DOMRequest setCallForwardingOption({{domxref("MozMobileCFInfo")}} CFInfo);
&nbsp; DOMRequest getCallForwardingOption(unsigned short reason);

&nbsp; attribute EventHandler oncardstatechange;
&nbsp; attribute EventHandler oniccinfochange;
&nbsp; attribute EventHandler onvoicechange;
&nbsp; attribute EventHandler ondatachange;
&nbsp; attribute EventHandler onussdreceived;
&nbsp; attribute EventHandler ondataerror;
&nbsp; attribute EventHandler onicccardlockerror;
&nbsp; attribute EventHandler oncfstatechange;
};
</pre>
<h2 id="Properties">Properties</h2>
<dl>
  <dt>
    {{domxref("MozMobileConnection.cardState")}} {{readonlyinline}}</dt>
  <dd>
    A string that indicates the state of the device's ICC card.</dd>
  <dt>
    {{domxref("MozMobileConnection.data")}} {{readonlyinline}}</dt>
  <dd>
    A {{domxref("MozMobileConnectionInfo")}} object that gives access to information about the data connection.</dd>
  <dt>
    {{domxref("MozMobileConnection.icc")}} {{readonlyinline}}</dt>
  <dd>
    A {{domxref("MozIccManager")}} object that gives access to ICC related funcionality.</dd>
  <dt>
    {{domxref("MozMobileConnection.iccInfo")}} {{readonlyinline}}</dt>
  <dd>
    A {{domxref("MozMobileICCInfo")}} object that gives access to information stored in the device's ICC card.</dd>
  <dt>
    {{domxref("MozMobileConnection.networkSelectionMode")}} {{readonlyinline}}</dt>
  <dd>
    A string that indicate the selection mode of the voice and data networks.</dd>
  <dt>
    {{domxref("MozMobileConnection.oncardstatechange")}}</dt>
  <dd>
    A handler for the <code>cardstatechange</code> event. This event is fired when the {{domxref("MozMobileConnection.cardState","cardState")}} property changes value.</dd>
  <dt>
    {{domxref("MozMobileConnection.oncfstatechange")}}</dt>
  <dd>
    A handler for the <code>cfstatechange</code> event. This event is fired when the call forwarding state changes.</dd>
  <dt>
    {{domxref("MozMobileConnection.ondatachange")}}</dt>
  <dd>
    A handler for the <code>datachange</code> event. This event is fired whenever the {{domxref("MozMobileConnection.data","data")}} connection object changes values.</dd>
  <dt>
    {{domxref("MozMobileConnection.ondataerror")}}</dt>
  <dd>
    A handler for the <code>dataerror</code> event. This event is fired whenever the {{domxref("MozMobileConnection.data","data")}} connection object receive an error from the RIL.</dd>
  <dt>
    {{domxref("MozMobileConnection.onicccardlockerror")}}</dt>
  <dd>
    A handler for the <code>icccardlockerror</code> event. This event is fired whenever the {{domxref("MozMobileConnection.unlockCardLock()","unlockCardLock")}} or {{domxref("MozMobileConnection.setCardLock()","setCardLock")}} methods fails.</dd>
  <dt>
    {{domxref("MozMobileConnection.oniccinfochange")}}</dt>
  <dd>
    A handler for the <code>iccinfochange</code> event. This event is fired whenever the {{domxref("MozMobileConnection.iccInfo","iccInfo")}} object changes.</dd>
  <dt>
    {{domxref("MozMobileConnection.onussdreceived")}}</dt>
  <dd>
    A handler for the <code>ussdreceived</code> event. This event is fired whenever a new USSD message is received.</dd>
  <dt>
    {{domxref("MozMobileConnection.onvoicechange")}}</dt>
  <dd>
    A handler for the <code>voicechange</code> event. This event is fired whenever the {{domxref("MozMobileConnection.voice","voice")}} connection object changes.</dd>
  <dt>
    {{domxref("MozMobileConnection.voice")}} {{readonlyinline}}</dt>
  <dd>
    A {{domxref("MozMobileConnectionInfo")}} object that gives access to information about the voice connection.</dd>
</dl>
<h3 id="Constants">Constants</h3>
<ul>
  <li><code>ICC_SERVICE_CLASS_VOICE</code></li>
  <li><code>ICC_SERVICE_CLASS_DATA</code></li>
  <li><code>ICC_SERVICE_CLASS_FAX</code></li>
  <li><code>ICC_SERVICE_CLASS_SMS</code></li>
  <li><code>ICC_SERVICE_CLASS_DATA_SYNC</code></li>
  <li><code>ICC_SERVICE_CLASS_DATA_ASYNC</code></li>
  <li><code>ICC_SERVICE_CLASS_PACKET</code></li>
  <li><code>ICC_SERVICE_CLASS_PAD</code></li>
  <li><code>ICC_SERVICE_CLASS_MAX</code></li>
</ul>
<h2 id="Methods">Methods</h2>
<div class="note">
  <p><strong>Note:</strong> All the methods of the <code>MozMobileConnection</code> object are fully asynchronous. They all return a {{domxref("DOMRequest")}} which has a <code>onsuccess</code> and <code>onerror</code> event handler to handle the success or failur of the method call.</p>
</div>
<dl>
  <dt>
    {{domxref("MozMobileConnection.cancelMMI()")}}</dt>
  <dd>
    Cancel the current MMI request if one exists.</dd>
  <dt>
    {{domxref("MozMobileConnection.getCardLock()")}}</dt>
  <dd>
    Find out about the status of an ICC lock (e.g. the PIN lock).</dd>
  <dt>
    {{domxref("MozMobileConnection.getCallForwardingOption()")}}</dt>
  <dd>
    Queries current call forward options.</dd>
  <dt>
    {{domxref("MozMobileConnection.getNetworks()")}}</dt>
  <dd>
    Search for available networks.</dd>
  <dt>
    {{domxref("MozMobileConnection.selectNetwork()")}}</dt>
  <dd>
    Manually selects a network, overriding the radio's current selection.</dd>
  <dt>
    {{domxref("MozMobileConnection.selectNetworkAutomatically()")}}</dt>
  <dd>
    Tell the radio to automatically select a network.</dd>
  <dt>
    {{domxref("MozMobileConnection.sendMMI()")}}</dt>
  <dd>
    Send a MMI message.</dd>
  <dt>
    {{domxref("MozMobileConnection.setCallForwardingOption()")}}</dt>
  <dd>
    Configures call forward options.</dd>
  <dt>
    {{domxref("MozMobileConnection.setCardLock()")}}</dt>
  <dd>
    Modify the state of a card lock.</dd>
  <dt>
    {{domxref("MozMobileConnection.unlockCardLock()")}}</dt>
  <dd>
    Unlock a card lock.</dd>
</dl>
<h2 id="Specification" name="Specification">Specification</h2>
<p>Not part of any specification</p>
<h2>See also</h2>
<ul>
  <li>{{domxref("window.navigator.mozMobileConnection","navigator.mozMobileConnection")}}</li>
  <li>{{domxref("MozMobileConnectionInfo")}}</li>
  <li>{{domxref("MozMobileICCInfo")}}</li>
  <li>{{domxref("MozIccManager")}}</li>
  <li>{{domxref("MozMobileNetworkInfo")}}</li>
  <li>{{domxref("MozMobileCFInfo")}}</li>
  <li>{{domxref("MozMobileCellInfo")}}</li>
</ul>
Revert to this revision