Bug 766866 - Save data call information in data call object. r=philikon
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -1751,17 +1751,17 @@ let RIL = {
* DATACALL_AUTH_NONE => PAP and CHAP is never performed.
* DATACALL_AUTH_PAP => PAP may be performed.
* DATACALL_AUTH_CHAP => CHAP may be performed.
* DATACALL_AUTH_PAP_OR_CHAP => PAP / CHAP may be performed.
* @param pdptype
* String containing PDP type to request. ("IP", "IPV6", ...)
*/
setupDataCall: function setupDataCall(options) {
- let token = Buf.newParcel(REQUEST_SETUP_DATA_CALL);
+ let token = Buf.newParcel(REQUEST_SETUP_DATA_CALL, options);
Buf.writeUint32(7);
Buf.writeString(options.radioTech.toString());
Buf.writeString(DATACALL_PROFILE_DEFAULT.toString());
Buf.writeString(options.apn);
Buf.writeString(options.user);
Buf.writeString(options.passwd);
Buf.writeString(options.chappap.toString());
Buf.writeString(options.pdptype);
@@ -3292,51 +3292,53 @@ RIL[REQUEST_BASEBAND_VERSION] = function
};
RIL[REQUEST_SEPARATE_CONNECTION] = null;
RIL[REQUEST_SET_MUTE] = null;
RIL[REQUEST_GET_MUTE] = null;
RIL[REQUEST_QUERY_CLIP] = null;
RIL[REQUEST_LAST_DATA_CALL_FAIL_CAUSE] = null;
RIL.readDataCall_v5 = function readDataCall_v5() {
- return {
- cid: Buf.readUint32().toString(),
- active: Buf.readUint32(), // DATACALL_ACTIVE_*
- type: Buf.readString(),
- apn: Buf.readString(),
- address: Buf.readString()
- };
-};
-
-RIL.readDataCall_v6 = function readDataCall_v6(obj) {
- if (!obj) {
- obj = {};
+ if (!options) {
+ options = {};
}
- obj.status = Buf.readUint32(); // DATACALL_FAIL_*
- if (!RILQUIRKS_DATACALLSTATE_NO_SUGGESTEDRETRYTIME) {
- obj.suggestedRetryTime = Buf.readUint32();
+ cid = Buf.readUint32().toString();
+ active = Buf.readUint32(); // DATACALL_ACTIVE_*
+ type = Buf.readString();
+ apn = Buf.readString();
+ address = Buf.readString();
+ return options;
+};
+
+RIL.readDataCall_v6 = function readDataCall_v6(options) {
+ if (!options) {
+ options = {};
}
- obj.cid = Buf.readUint32().toString();
- obj.active = Buf.readUint32(); // DATACALL_ACTIVE_*
- obj.type = Buf.readString();
- obj.ifname = Buf.readString();
- obj.ipaddr = Buf.readString();
- obj.dns = Buf.readString();
- obj.gw = Buf.readString();
- if (obj.dns) {
- obj.dns = obj.dns.split(" ");
+ options.status = Buf.readUint32(); // DATACALL_FAIL_*
+ if (!RILQUIRKS_DATACALLSTATE_NO_SUGGESTEDRETRYTIME) {
+ options.suggestedRetryTime = Buf.readUint32();
+ }
+ options.cid = Buf.readUint32().toString();
+ options.active = Buf.readUint32(); // DATACALL_ACTIVE_*
+ options.type = Buf.readString();
+ options.ifname = Buf.readString();
+ options.ipaddr = Buf.readString();
+ options.dns = Buf.readString();
+ options.gw = Buf.readString();
+ if (options.dns) {
+ options.dns = options.dns.split(" ");
}
//TODO for now we only support one address and gateway
- if (obj.ipaddr) {
- obj.ipaddr = obj.ipaddr.split(" ")[0];
+ if (options.ipaddr) {
+ options.ipaddr = options.ipaddr.split(" ")[0];
}
- if (obj.gw) {
- obj.gw = obj.gw.split(" ")[0];
+ if (options.gw) {
+ options.gw = options.gw.split(" ")[0];
}
- return obj;
+ return options;
};
RIL[REQUEST_DATA_CALL_LIST] = function REQUEST_DATA_CALL_LIST(length, options) {
if (options.rilRequestError) {
return;
}
this.initRILQuirks();
@@ -3349,19 +3351,19 @@ RIL[REQUEST_DATA_CALL_LIST] = function R
if (!RILQUIRKS_V5_LEGACY) {
version = Buf.readUint32();
}
let num = num = Buf.readUint32();
let datacalls = {};
for (let i = 0; i < num; i++) {
let datacall;
if (version < 6) {
- datacall = this.readDataCall_v5();
+ datacall = this.readDataCall_v5(options);
} else {
- datacall = this.readDataCall_v6();
+ datacall = this.readDataCall_v6(options);
}
datacalls[datacall.cid] = datacall;
}
this._processDataCallList(datacalls);
};
RIL[REQUEST_RESET_RADIO] = null;
RIL[REQUEST_OEM_HOOK_RAW] = null;