From 8baeb268b3ac9a7078528dc3247a2e63cfad41bd Mon Sep 17 00:00:00 2001 From: Jose Antonio Olivera Ortega Date: Thu, 21 Jun 2012 17:22:47 -0700 Subject: [PATCH] Bug 753170 - B2G 3G: Expose state information through WebMobileConnection. r=philikon --- dom/system/gonk/RadioInterfaceLayer.js | 30 +++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index c9b10704583..140d428eb3e 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -485,8 +485,7 @@ RadioInterfaceLayer.prototype = { voiceInfo.type = null; voiceInfo.signalStrength = null; voiceInfo.relSignalStrength = null; - ppmm.sendAsyncMessage("RIL:VoiceThis.RadioState.VoiceChanged", - voiceInfo); + ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", voiceInfo); return; } @@ -532,6 +531,23 @@ RadioInterfaceLayer.prototype = { }, updateDataConnection: function updateDataConnection(state) { + let data = this.rilContext.data; + if (!state || state.regState == RIL.NETWORK_CREG_STATE_UNKNOWN) { + data.connected = false; + data.emergencyCallsOnly = false; + data.roaming = false; + data.network = null; + data.type = null; + data.signalStrength = null; + data.relSignalStrength = null; + ppmm.sendAsyncMessage("RIL:DataInfoChanged", data); + return; + } + data.roaming = + (state.regState == RIL.NETWORK_CREG_STATE_REGISTERED_ROAMING); + data.type = RIL.GECKO_RADIO_TECH[state.radioTech] || null; + ppmm.sendAsyncMessage("RIL:DataInfoChanged", data); + if (!this._isDataEnabled()) { return false; } @@ -548,9 +564,6 @@ RadioInterfaceLayer.prototype = { // RILNetworkInterface will ignore this if it's already connected. RILNetworkInterface.connect(); } - //TODO need to keep track of some of the state information, and then - // notify the content when state changes (connected, technology - // changes, etc.). This should be done in RILNetworkInterface. return false; }, @@ -876,6 +889,13 @@ RadioInterfaceLayer.prototype = { * Handle data call state changes. */ handleDataCallState: function handleDataCallState(datacall) { + let data = this.rilContext.data; + + if (datacall.ifname) { + data.connected = (datacall.state == RIL.GECKO_NETWORK_STATE_CONNECTED); + ppmm.sendAsyncMessage("RIL:DataInfoChanged", data); + } + this._deliverDataCallCallback("dataCallStateChanged", [datacall.cid, datacall.ifname, datacall.state]); },