Bug 882985 - 0001. Receive CDMA information record and send system message. r=vicamo

This commit is contained in:
Chuck Lee 2013-09-11 00:48:19 +08:00
parent 30f8625230
commit 140abdfa7e
4 changed files with 168 additions and 1 deletions

View File

@ -99,6 +99,9 @@ this.SystemMessagePermissionsTable = {
"wappush-received": {
"wappush": []
},
"cdma-info-rec-received": {
"mobileconnection": []
},
};
this.SystemMessagePermissionsChecker = {

View File

@ -1002,6 +1002,10 @@ RadioInterface.prototype = {
case "exitEmergencyCbMode":
this.handleExitEmergencyCbMode(message);
break;
case "cdma-info-rec-received":
if (DEBUG) this.debug("cdma-info-rec-received: " + JSON.stringify(message));
gSystemMessenger.broadcastMessage("cdma-info-rec-received", message);
break;
default:
throw new Error("Don't know about this message type: " +
message.rilMessageType);

View File

@ -2775,6 +2775,50 @@ this.CDMA_ROAMING_PREFERENCE_TO_GECKO = [
GECKO_CDMA_ROAMING_PREFERENCE_ANY // CDMA_ROAMING_PREFERENCE_ANY
];
// Information Record Type, reference from ril.h
this.PDU_CDMA_INFO_REC_TYPE_DISPLAY = 0;
this.PDU_CDMA_INFO_REC_TYPE_CALLED_PARTY_NUMBER = 1;
this.PDU_CDMA_INFO_REC_TYPE_CALLING_PARTY_NUMBER = 2;
this.PDU_CDMA_INFO_REC_TYPE_CONNECTED_NUMBER =3;
this.PDU_CDMA_INFO_REC_TYPE_SIGNAL = 4;
this.PDU_CDMA_INFO_REC_TYPE_REDIRECTING_NUMBER = 5;
this.PDU_CDMA_INFO_REC_TYPE_LINE_CONTROL = 6;
this.PDU_CDMA_INFO_REC_TYPE_EXTENDED_DISPLAY = 7;
this.PDU_CDMA_INFO_REC_TYPE_T53_CLIR = 8;
this.PDU_CDMA_INFO_REC_TYPE_T53_RELEASE = 9;
this.PDU_CDMA_INFO_REC_TYPE_T53_AUDIO_CONTROL = 10;
// Display type of extended display of information record,
// as defined in C.S0005-F v1.0, Table 3.7.5.16-2
this.INFO_REC_EXTENDED_DISPLAY_BLANK = 0x80;
this.INFO_REC_EXTENDED_DISPLAY_SKIP = 0x81;
this.INFO_REC_EXTENDED_DISPLAY_CONTINATION = 0x82;
this.INFO_REC_EXTENDED_DISPLAY_CALLED_ADDRESS = 0x83;
this.INFO_REC_EXTENDED_DISPLAY_CAUSE = 0x84;
this.INFO_REC_EXTENDED_DISPLAY_PROGRESS_INDICATOR = 0x85;
this.INFO_REC_EXTENDED_DISPLAY_NOTIFICATION_INDICATOR = 0x86;
this.INFO_REC_EXTENDED_DISPLAY_PROMPT = 0x87;
this.INFO_REC_EXTENDED_DISPLAY_ACCUMULATED_DIGITS = 0x88;
this.INFO_REC_EXTENDED_DISPLAY_STATUS = 0x89;
this.INFO_REC_EXTENDED_DISPLAY_INBAND = 0x8A;
this.INFO_REC_EXTENDED_DISPLAY_CALLING_ADDRESS = 0x8B;
this.INFO_REC_EXTENDED_DISPLAY_REASON = 0x8C;
this.INFO_REC_EXTENDED_DISPLAY_CALLING_PARTY_NAME = 0x8D;
this.INFO_REC_EXTENDED_DISPLAY_CALLED_PARTY_NAME = 0x8E;
this.INFO_REC_EXTENDED_DISPLAY_ORIGINAL_CALLED_NAME = 0x8F;
this.INFO_REC_EXTENDED_DISPLAY_REDIRECT_NAME = 0x90;
this.INFO_REC_EXTENDED_DISPLAY_CONNECTED_NAME = 0x91;
this.INFO_REC_EXTENDED_DISPLAY_ORIGINATING_RESTRICTIONS = 0x92;
this.INFO_REC_EXTENDED_DISPLAY_DATE_TIME_OF_DAY = 0x93;
this.INFO_REC_EXTENDED_DISPLAY_CALL_APPEARANCE_ID = 0x94;
this.INFO_REC_EXTENDED_DISPLAY_FEATURE_ADDRESS = 0x95;
this.INFO_REC_EXTENDED_DISPLAY_REDIRECTION_NAME = 0x96;
this.INFO_REC_EXTENDED_DISPLAY_REDIRECTION_NUMBER = 0x97;
this.INFO_REC_EXTENDED_DISPLAY_REDIRECTING_NUMBER = 0x98;
this.INFO_REC_EXTENDED_DISPLAY_ORIGINAL_CALLED_NUMBER = 0x99;
this.INFO_REC_EXTENDED_DISPLAY_CONNECTED_NUMBER = 0x9A;
this.INFO_REC_EXTENDED_DISPLAY_TEXT = 0x9B;
/**
* The table for MCC which the length of MNC is 3
*

View File

@ -6149,7 +6149,11 @@ RIL[UNSOLICITED_CDMA_OTA_PROVISION_STATUS] = function UNSOLICITED_CDMA_OTA_PROVI
this.sendChromeMessage({rilMessageType: "otastatuschange",
status: status});
};
RIL[UNSOLICITED_CDMA_INFO_REC] = null;
RIL[UNSOLICITED_CDMA_INFO_REC] = function UNSOLICITED_CDMA_INFO_REC(length) {
let record = CdmaPDUHelper.decodeInformationRecord();
record.rilMessageType = "cdma-info-rec-received";
this.sendChromeMessage(record);
};
RIL[UNSOLICITED_OEM_HOOK_RAW] = null;
RIL[UNSOLICITED_RINGBACK_TONE] = null;
RIL[UNSOLICITED_RESEND_INCALL_MUTE] = null;
@ -9254,6 +9258,118 @@ let CdmaPDUHelper = {
}
return result;
},
/**
* Decode information record parcel.
*/
decodeInformationRecord: function cdma_decodeInformationRecord() {
let record = {};
let numOfRecords = Buf.readUint32();
let type;
for (let i = 0; i < numOfRecords; i++) {
type = Buf.readUint32();
switch (type) {
/*
* Every type is encaped by ril, except extended display
*/
case PDU_CDMA_INFO_REC_TYPE_DISPLAY:
record.display = Buf.readString();
break;
case PDU_CDMA_INFO_REC_TYPE_CALLED_PARTY_NUMBER:
record.calledNumber = {};
record.calledNumber.number = Buf.readString();
record.calledNumber.type = Buf.readUint32();
record.calledNumber.plan = Buf.readUint32();
record.calledNumber.pi = Buf.readUint32();
record.calledNumber.si = Buf.readUint32();
break;
case PDU_CDMA_INFO_REC_TYPE_CALLING_PARTY_NUMBER:
record.callingNumber = {};
record.callingNumber.number = Buf.readString();
record.callingNumber.type = Buf.readUint32();
record.callingNumber.plan = Buf.readUint32();
record.callingNumber.pi = Buf.readUint32();
record.callingNumber.si = Buf.readUint32();
break;
case PDU_CDMA_INFO_REC_TYPE_CONNECTED_NUMBER:
record.connectedNumber = {};
record.connectedNumber.number = Buf.readString();
record.connectedNumber.type = Buf.readUint32();
record.connectedNumber.plan = Buf.readUint32();
record.connectedNumber.pi = Buf.readUint32();
record.connectedNumber.si = Buf.readUint32();
break;
case PDU_CDMA_INFO_REC_TYPE_SIGNAL:
record.signal = {};
record.signal.present = Buf.readUint32();
record.signal.type = Buf.readUint32();
record.signal.alertPitch = Buf.readUint32();
record.signal.signal = Buf.readUint32();
break;
case PDU_CDMA_INFO_REC_TYPE_REDIRECTING_NUMBER:
record.redirect = {};
record.redirect.number = Buf.readString();
record.redirect.type = Buf.readUint32();
record.redirect.plan = Buf.readUint32();
record.redirect.pi = Buf.readUint32();
record.redirect.si = Buf.readUint32();
record.redirect.reason = Buf.readUint32();
break;
case PDU_CDMA_INFO_REC_TYPE_LINE_CONTROL:
record.lineControl = {};
record.lineControl.polarityIncluded = Buf.readUint32();
record.lineControl.toggle = Buf.readUint32();
record.lineControl.recerse = Buf.readUint32();
record.lineControl.powerDenial = Buf.readUint32();
break;
case PDU_CDMA_INFO_REC_TYPE_EXTENDED_DISPLAY:
let length = Buf.readUint32();
/*
* Extended display is still in format defined in
* C.S0005-F v1.0, 3.7.5.16
*/
record.extendedDisplay = {};
let headerByte = Buf.readUint32();
length--;
// Based on spec, headerByte must be 0x80 now
record.extendedDisplay.indicator = (headerByte >> 7);
record.extendedDisplay.type = (headerByte & 0x7F);
record.extendedDisplay.records = [];
while (length > 0) {
let display = {};
display.tag = Buf.readUint32();
length--;
if (display.tag !== INFO_REC_EXTENDED_DISPLAY_BLANK &&
display.tag !== INFO_REC_EXTENDED_DISPLAY_SKIP) {
display.content = Buf.readString();
length -= (display.content.length + 1);
}
record.extendedDisplay.records.push(display);
}
break;
case PDU_CDMA_INFO_REC_TYPE_T53_CLIR:
record.cause = Buf.readUint32();
break;
case PDU_CDMA_INFO_REC_TYPE_T53_AUDIO_CONTROL:
record.audioControl = {};
record.audioControl.upLink = Buf.readUint32();
record.audioControl.downLink = Buf.readUint32();
break;
case PDU_CDMA_INFO_REC_TYPE_T53_RELEASE:
// Fall through
default:
throw new Error("UNSOLICITED_CDMA_INFO_REC(), Unsupported information record type " + record.type + "\n");
}
}
return record;
}
};