Bug 1185406 - B2G RIL: Read 'pcscf' and expose it in nsIRilNetworkInfo. r=hsinyi

This commit is contained in:
Jessica Jong 2015-08-18 09:54:36 +08:00
parent 9294208be3
commit 008a8c5a4f
6 changed files with 56 additions and 11 deletions

View File

@ -71,7 +71,8 @@ DataCall.prototype = {
ifname: null, ifname: null,
addreses: null, addreses: null,
dnses: null, dnses: null,
gateways: null gateways: null,
pcscf: null
}; };
function DataCallInterfaceService() { function DataCallInterfaceService() {

View File

@ -960,7 +960,8 @@ function DataCall(aClientId, aApnSetting, aDataCallHandler) {
ifname: null, ifname: null,
addresses: [], addresses: [],
dnses: [], dnses: [],
gateways: [] gateways: [],
pcscf: []
}; };
this.state = NETWORK_STATE_UNKNOWN; this.state = NETWORK_STATE_UNKNOWN;
this.requestedNetworkIfaces = []; this.requestedNetworkIfaces = [];
@ -1091,6 +1092,7 @@ DataCall.prototype = {
this.linkInfo.addresses = aDataCall.addresses ? aDataCall.addresses.split(" ") : []; this.linkInfo.addresses = aDataCall.addresses ? aDataCall.addresses.split(" ") : [];
this.linkInfo.gateways = aDataCall.gateways ? aDataCall.gateways.split(" ") : []; this.linkInfo.gateways = aDataCall.gateways ? aDataCall.gateways.split(" ") : [];
this.linkInfo.dnses = aDataCall.dnses ? aDataCall.dnses.split(" ") : []; this.linkInfo.dnses = aDataCall.dnses ? aDataCall.dnses.split(" ") : [];
this.linkInfo.pcscf = aDataCall.pcscf ? aDataCall.pcscf.split(" ") : [];
this.state = this._getGeckoDataCallState(aDataCall); this.state = this._getGeckoDataCallState(aDataCall);
// Notify DataCallHandler about data call connected. // Notify DataCallHandler about data call connected.
@ -1143,7 +1145,8 @@ DataCall.prototype = {
ifname: aUpdatedDataCall.ifname, ifname: aUpdatedDataCall.ifname,
addresses: aUpdatedDataCall.addresses ? aUpdatedDataCall.addresses.split(" ") : [], addresses: aUpdatedDataCall.addresses ? aUpdatedDataCall.addresses.split(" ") : [],
dnses: aUpdatedDataCall.dnses ? aUpdatedDataCall.dnses.split(" ") : [], dnses: aUpdatedDataCall.dnses ? aUpdatedDataCall.dnses.split(" ") : [],
gateways: aUpdatedDataCall.gateways ? aUpdatedDataCall.gateways.split(" ") : [] gateways: aUpdatedDataCall.gateways ? aUpdatedDataCall.gateways.split(" ") : [],
pcscf: aUpdatedDataCall.pcscf ? aUpdatedDataCall.pcscf.split(" ") : []
}; };
switch (dataCallState) { switch (dataCallState) {
@ -1169,6 +1172,7 @@ DataCall.prototype = {
this.linkInfo.addresses = newLinkInfo.addresses.slice(); this.linkInfo.addresses = newLinkInfo.addresses.slice();
this.linkInfo.gateways = newLinkInfo.gateways.slice(); this.linkInfo.gateways = newLinkInfo.gateways.slice();
this.linkInfo.dnses = newLinkInfo.dnses.slice(); this.linkInfo.dnses = newLinkInfo.dnses.slice();
this.linkInfo.pcscf = newLinkInfo.pcscf.slice();
} }
break; break;
case NETWORK_STATE_DISCONNECTED: case NETWORK_STATE_DISCONNECTED:
@ -1267,6 +1271,7 @@ DataCall.prototype = {
this.linkInfo.addresses = []; this.linkInfo.addresses = [];
this.linkInfo.dnses = []; this.linkInfo.dnses = [];
this.linkInfo.gateways = []; this.linkInfo.gateways = [];
this.linkInfo.pcscf = [];
}, },
reset: function() { reset: function() {
@ -1604,6 +1609,20 @@ RILNetworkInfo.prototype = {
// See http://www.iana.org/assignments/port-numbers // See http://www.iana.org/assignments/port-numbers
return this.getApnSetting().mmsport || -1; return this.getApnSetting().mmsport || -1;
}, },
getPcscf: function(aCount) {
if (this.type != NETWORK_TYPE_MOBILE_IMS) {
if (DEBUG) this.debug("Error! Only IMS network can get pcscf.");
throw Cr.NS_ERROR_UNEXPECTED;
}
let linkInfo = this.getDataCall().linkInfo;
if (aCount) {
aCount.value = linkInfo.pcscf.length;
}
return linkInfo.pcscf.slice();
},
}; };
function RILNetworkInterface(aDataCallHandler, aType, aApnSetting, aDataCall) { function RILNetworkInterface(aDataCallHandler, aType, aApnSetting, aDataCall) {

View File

@ -392,7 +392,8 @@ DataCall.prototype = {
ifname: null, ifname: null,
addreses: null, addreses: null,
dnses: null, dnses: null,
gateways: null gateways: null,
pcscf: null
}; };
function RadioInterfaceLayer() { function RadioInterfaceLayer() {

View File

@ -4,7 +4,7 @@
#include "nsISupports.idl" #include "nsISupports.idl"
[scriptable, uuid(d27ce247-9c7c-4582-826b-125e8275e9c2)] [scriptable, uuid(88f18811-8f19-4902-a9b8-2a6430c71c94)]
interface nsIDataCall : nsISupports interface nsIDataCall : nsISupports
{ {
/** /**
@ -55,6 +55,12 @@ interface nsIDataCall : nsISupports
* A space-delimited list of default gateway addresses. * A space-delimited list of default gateway addresses.
*/ */
readonly attribute DOMString gateways; readonly attribute DOMString gateways;
/**
* A space-delimited list of Proxy Call State Control Function addresses for
* IMS client.
*/
readonly attribute DOMString pcscf;
}; };
[scriptable, uuid(e119c54b-9354-4ad6-a1ee-18608bde9320)] [scriptable, uuid(e119c54b-9354-4ad6-a1ee-18608bde9320)]

View File

@ -5,7 +5,7 @@
#include "nsISupports.idl" #include "nsISupports.idl"
#include "nsINetworkInterface.idl" #include "nsINetworkInterface.idl"
[scriptable, uuid(501b7041-0754-4ddb-9174-946e2c2ebd83)] [scriptable, uuid(b8bcd6aa-5b06-4362-a68c-317878429e51)]
interface nsIRilNetworkInfo : nsINetworkInfo interface nsIRilNetworkInfo : nsINetworkInfo
{ {
readonly attribute unsigned long serviceId; readonly attribute unsigned long serviceId;
@ -15,6 +15,17 @@ interface nsIRilNetworkInfo : nsINetworkInfo
readonly attribute DOMString mmsc; // Empty string if not set. readonly attribute DOMString mmsc; // Empty string if not set.
readonly attribute DOMString mmsProxy; // Empty string if not set. readonly attribute DOMString mmsProxy; // Empty string if not set.
readonly attribute long mmsPort; // -1 if not set. readonly attribute long mmsPort; // -1 if not set.
/**
* Get the list of pcscf addresses, could be IPv4 or IPv6.
*
* @param count
* The length of the list of pcscf addresses.
*
* @returns the list of pcscf addresses.
*/
void getPcscf([optional] out unsigned long count,
[array, size_is(count), retval] out wstring pcscf);
}; };
[scriptable, function, uuid(cb2f0f5b-67f4-4c14-93e8-01e66b630464)] [scriptable, function, uuid(cb2f0f5b-67f4-4c14-93e8-01e66b630464)]

View File

@ -4236,12 +4236,11 @@ RilObject.prototype[REQUEST_SETUP_DATA_CALL] = function REQUEST_SETUP_DATA_CALL(
} }
let Buf = this.context.Buf; let Buf = this.context.Buf;
// Skip version of data call. let version = Buf.readInt32();
Buf.readInt32();
// Skip number of data calls. // Skip number of data calls.
Buf.readInt32(); Buf.readInt32();
this.readDataCall_v6(options); this.readDataCall(options, version);
this.sendChromeMessage(options); this.sendChromeMessage(options);
}; };
RilObject.prototype[REQUEST_SIM_IO] = function REQUEST_SIM_IO(length, options) { RilObject.prototype[REQUEST_SIM_IO] = function REQUEST_SIM_IO(length, options) {
@ -4512,9 +4511,13 @@ RilObject.prototype[REQUEST_LAST_DATA_CALL_FAIL_CAUSE] = null;
* length. * length.
* # dnses - A space-delimited list of DNS server addresses. * # dnses - A space-delimited list of DNS server addresses.
* # gateways - A space-delimited list of default gateway addresses. * # gateways - A space-delimited list of default gateway addresses.
*
* V10:
* # pcscf - A space-delimited list of Proxy Call State Control Function
* addresses.
*/ */
RilObject.prototype.readDataCall_v6 = function(options) { RilObject.prototype.readDataCall = function(options, version) {
if (!options) { if (!options) {
options = {}; options = {};
} }
@ -4529,6 +4532,10 @@ RilObject.prototype.readDataCall_v6 = function(options) {
options.dnses = Buf.readString(); options.dnses = Buf.readString();
options.gateways = Buf.readString(); options.gateways = Buf.readString();
if (version >= 10) {
options.pcscf = Buf.readString();
}
return options; return options;
}; };
@ -4557,7 +4564,7 @@ RilObject.prototype[REQUEST_DATA_CALL_LIST] = function REQUEST_DATA_CALL_LIST(le
let datacalls = []; let datacalls = [];
for (let i = 0; i < num; i++) { for (let i = 0; i < num; i++) {
let datacall; let datacall;
datacall = this.readDataCall_v6(); datacall = this.readDataCall({}, version);
datacalls.push(datacall); datacalls.push(datacall);
} }