canmove, Confirmed users
725
edits
| Line 264: | Line 264: | ||
** <code>nsIRILContentHelper</code>: XPCOM service that let's DOM implementations such as Telephony, SMS, etc. talk to <code>nsIRadioInterfaceLayer</code> in the chrome process. | ** <code>nsIRILContentHelper</code>: XPCOM service that let's DOM implementations such as Telephony, SMS, etc. talk to <code>nsIRadioInterfaceLayer</code> in the chrome process. | ||
=== Example === | === Example: from rild to the DOM === | ||
Let's start with an example that demonstrates the lower-level parts of the system. When the modem receives an incoming call, it notifies the <code>rild</code> using a proprietary mechanism. The rild then prepares a message for its client according to the "open" protocol [https://github.com/mozilla-b2g/android-hardware-ril/blob/master/include/telephony/ril.h here]. In this case, an incoming call generates the [https://github.com/mozilla-b2g/android-hardware-ril/blob/master/include/telephony/ril.h#L3290 <code>RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED</code>] message. This message is sent by rild to its client and received by rilproxy [https://github.com/mozilla-b2g/rilproxy/blob/master/src/rilproxy.c#L214 here] | Let's start with an example that demonstrates the lower-level parts of the system. When the modem receives an incoming call, it notifies the <code>rild</code> using a proprietary mechanism. The rild then prepares a message for its client according to the "open" protocol [https://github.com/mozilla-b2g/android-hardware-ril/blob/master/include/telephony/ril.h here]. In this case, an incoming call generates the [https://github.com/mozilla-b2g/android-hardware-ril/blob/master/include/telephony/ril.h#L3290 <code>RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED</code>] message. This message is sent by rild to its client and received by rilproxy [https://github.com/mozilla-b2g/rilproxy/blob/master/src/rilproxy.c#L214 here] | ||
| Line 335: | Line 335: | ||
break; | break; | ||
</pre> | </pre> | ||
bit really all that <code>RadioInterfaceLayer</code> does is [https://mxr.mozilla.org/mozilla-central/source/dom/system/gonk/RadioInterfaceLayer.js#536 dispatch the message to the content process] using the <em>parent process message manager</em> (<code>ppmm</code>): | |||
<pre> | |||
handleCallStateChange: function handleCallStateChange(call) { | |||
debug("handleCallStateChange: " + JSON.stringify(call)); | |||
[some internal state updating] | |||
ppmm.sendAsyncMessage("RIL:CallStateChanged", call); | |||
}, | |||
</pre> | |||
In the content process, [https://mxr.mozilla.org/mozilla-central/source/dom/system/gonk/RILContentHelper.js#277 this message is received by the <code>nsIRILContentHelper</code> service] from the <em>child process message manager</em> (<code>cpmm</code>): | |||
<pre> | |||
receiveMessage: function receiveMessage(msg) { | |||
let request; | |||
debug("Received message '" + msg.name + "': " + JSON.stringify(msg.json)); | |||
switch (msg.name) { | |||
case "RIL:CallStateChanged": | |||
this._deliverTelephonyCallback("callStateChanged", | |||
[msg.json.callIndex, msg.json.state, | |||
msg.json.number, msg.json.isActive]); | |||
break; | |||
</pre> | |||
This ends up calling [https://mxr.mozilla.org/mozilla-central/source/dom/system/gonk/nsIRadioInterfaceLayer.idl#15 the <code>nsIRILTelephonyCallback::callStateChanged</code> method] of all registered telephony callback objects. Every HTML page that accesses the <code>navigator.mozTelephony</code> API has registered one such callback object. | |||