Bug 913313 - [wasabi][CDMA] There is no tick icon next to the message sent after enabling "Delivery reports". r=gene

This commit is contained in:
Bevis Tseng 2013-10-30 15:24:17 +08:00
parent 1e0a0ea185
commit b71cc8bbe9
2 changed files with 133 additions and 35 deletions

View File

@ -2772,16 +2772,18 @@ this.PDU_CDMA_MSG_CODING_7BITS_GSM = 0x09; // GSM 7-bit default alphabet(7-bi
this.PDU_CDMA_MSG_CODING_GSM_DCS = 0x0A; // GSM Data-Coding-Scheme, Not supported this.PDU_CDMA_MSG_CODING_GSM_DCS = 0x0A; // GSM Data-Coding-Scheme, Not supported
// SMS Message Type, as defined in 3GPP2 C.S0015-A v2.0, Table 4.5.1-1 // SMS Message Type, as defined in 3GPP2 C.S0015-A v2.0, Table 4.5.1-1
this.PDU_CDMA_MSG_TYPE_DELIVER = 0x01; // Receive this.PDU_CDMA_MSG_TYPE_DELIVER = 0x01; // Deliver
this.PDU_CDMA_MSG_TYPE_SUBMIT = 0x02; // Send this.PDU_CDMA_MSG_TYPE_SUBMIT = 0x02; // Submit
this.PDU_CDMA_MSG_TYPE_DELIVER_ACK = 0x04; // Delivery Acknowledgment
// SMS User Data Subparameters, as defined in 3GPP2 C.S0015-A v2.0, Table 4.5-1 // SMS User Data Subparameters, as defined in 3GPP2 C.S0015-A v2.0, Table 4.5-1
this.PDU_CDMA_MSG_USERDATA_MSG_ID = 0x00; // Message Identifier this.PDU_CDMA_MSG_USERDATA_MSG_ID = 0x00; // Message Identifier
this.PDU_CDMA_MSG_USERDATA_BODY = 0x01; // User Data Body this.PDU_CDMA_MSG_USERDATA_BODY = 0x01; // User Data Body
this.PDU_CDMA_MSG_USERDATA_TIMESTAMP = 0x03; // Message Center Time Stamp this.PDU_CDMA_MSG_USERDATA_TIMESTAMP = 0x03; // Message Center Time Stamp
this.PDU_CDMA_REPLY_OPTION = 0x0A; // Reply Option this.PDU_CDMA_MSG_USERDATA_REPLY_OPTION = 0x0A; // Reply Option
this.PDU_CDMA_LANGUAGE_INDICATOR = 0x0D; // Language Indicator this.PDU_CDMA_LANGUAGE_INDICATOR = 0x0D; // Language Indicator
this.PDU_CDMA_MSG_USERDATA_CALLBACK_NUMBER = 0x0E; // Callback Number this.PDU_CDMA_MSG_USERDATA_CALLBACK_NUMBER = 0x0E; // Callback Number
this.PDU_CDMA_MSG_USER_DATA_MSG_STATUS = 0x14; // Message Status
// CDMA Language Indicator: Language groups // CDMA Language Indicator: Language groups
// see 3GPP2 C.R1001-F table 9.2-1 // see 3GPP2 C.R1001-F table 9.2-1

View File

@ -4306,6 +4306,46 @@ let RIL = {
return PDU_FCS_OK; return PDU_FCS_OK;
}, },
/**
* Helper for processing CDMA SMS Delivery Acknowledgment Message
*
* @param message
* decoded SMS Delivery ACK message from CdmaPDUHelper.
*
* @return A failure cause defined in 3GPP 23.040 clause 9.2.3.22.
*/
_processCdmaSmsStatusReport: function _processCdmaSmsStatusReport(message) {
let options = this._pendingSentSmsMap[message.msgId];
if (!options) {
if (DEBUG) debug("no pending SMS-SUBMIT message");
return PDU_FCS_OK;
}
if (message.errorClass === 2) {
if (DEBUG) debug("SMS-STATUS-REPORT: delivery still pending, msgStatus: " + message.msgStatus);
return PDU_FCS_OK;
}
delete this._pendingSentSmsMap[message.msgId];
if (message.errorClass === -1 && message.body) {
// Process as normal incoming SMS, if errorClass is invalid
// but message body is available.
return this._processSmsMultipart(message);
}
let deliveryStatus = (message.errorClass === 0)
? GECKO_SMS_DELIVERY_STATUS_SUCCESS
: GECKO_SMS_DELIVERY_STATUS_ERROR;
this.sendChromeMessage({
rilMessageType: options.rilMessageType,
rilMessageToken: options.rilMessageToken,
deliveryStatus: deliveryStatus
});
return PDU_FCS_OK;
},
/** /**
* Helper for processing received multipart SMS. * Helper for processing received multipart SMS.
* *
@ -6206,8 +6246,12 @@ RIL[UNSOLICITED_RESPONSE_CDMA_NEW_SMS] = function UNSOLICITED_RESPONSE_CDMA_NEW_
let [message, result] = CdmaPDUHelper.processReceivedSms(length); let [message, result] = CdmaPDUHelper.processReceivedSms(length);
if (message) { if (message) {
if (message.subMsgType === PDU_CDMA_MSG_TYPE_DELIVER_ACK) {
result = this._processCdmaSmsStatusReport(message);
} else {
result = this._processSmsMultipart(message); result = this._processSmsMultipart(message);
} }
}
if (result == PDU_FCS_RESERVED || result == MOZ_FCS_WAIT_FOR_EXPLICIT_ACK) { if (result == PDU_FCS_RESERVED || result == MOZ_FCS_WAIT_FOR_EXPLICIT_ACK) {
return; return;
@ -8667,6 +8711,9 @@ let CdmaPDUHelper = {
// User Data // User Data
this.encodeUserDataMsg(options); this.encodeUserDataMsg(options);
// Reply Option
this.encodeUserDataReplyOption(options);
return userDataBuffer; return userDataBuffer;
}, },
@ -8791,6 +8838,21 @@ let CdmaPDUHelper = {
BitBufferHelper.overwriteWriteBuffer(lengthPosition - 1, [currentPosition - lengthPosition]); BitBufferHelper.overwriteWriteBuffer(lengthPosition - 1, [currentPosition - lengthPosition]);
}, },
/**
* User data subparameter encoder : Reply Option
*
* @see 3GGP2 C.S0015-B 2.0, 4.5.11 Reply Option
*/
encodeUserDataReplyOption: function cdma_encodeUserDataReplyOption(options) {
if (options.requestStatusReport) {
BitBufferHelper.writeBits(PDU_CDMA_MSG_USERDATA_REPLY_OPTION, 8);
BitBufferHelper.writeBits(1, 8);
BitBufferHelper.writeBits(0, 1); // USER_ACK_REQ
BitBufferHelper.writeBits(1, 1); // DAK_REQ
BitBufferHelper.flushWithPadding();
}
},
/** /**
* Entry point for SMS decoding, the returned object is made compatible * Entry point for SMS decoding, the returned object is made compatible
* with existing readMessage() of GsmPDUHelper * with existing readMessage() of GsmPDUHelper
@ -8838,9 +8900,23 @@ let CdmaPDUHelper = {
message.sender += String.fromCharCode(addrDigit); message.sender += String.fromCharCode(addrDigit);
} }
// User Data // Bearer Data
this.decodeUserData(message); this.decodeUserData(message);
// Bearer Data Sub-Parameter: User Data
let userData = message[PDU_CDMA_MSG_USERDATA_BODY];
[message.header, message.body, message.encoding] =
(userData)? [userData.header, userData.body, userData.encoding]
: [null, null, null];
// Bearer Data Sub-Parameter: Message Status
// Success Delivery (0) if both Message Status and User Data are absent.
// Message Status absent (-1) if only User Data is available.
let msgStatus = message[PDU_CDMA_MSG_USER_DATA_MSG_STATUS];
[message.errorClass, message.msgStatus] =
(msgStatus)? [msgStatus.errorClass, msgStatus.msgStatus]
: ((message.body)? [-1, -1]: [0, 0]);
// Transform message to GSM msg // Transform message to GSM msg
let msg = { let msg = {
SMSC: "", SMSC: "",
@ -8851,26 +8927,29 @@ let CdmaPDUHelper = {
pid: PDU_PID_DEFAULT, pid: PDU_PID_DEFAULT,
epid: PDU_PID_DEFAULT, epid: PDU_PID_DEFAULT,
dcs: 0, dcs: 0,
mwi: null, //message[PDU_CDMA_MSG_USERDATA_BODY].header ? message[PDU_CDMA_MSG_USERDATA_BODY].header.mwi : null, mwi: null,
replace: false, replace: false,
header: message[PDU_CDMA_MSG_USERDATA_BODY].header, header: message.header,
body: message[PDU_CDMA_MSG_USERDATA_BODY].body, body: message.body,
data: null, data: null,
timestamp: message[PDU_CDMA_MSG_USERDATA_TIMESTAMP], timestamp: message[PDU_CDMA_MSG_USERDATA_TIMESTAMP],
language: message[PDU_CDMA_LANGUAGE_INDICATOR], language: message[PDU_CDMA_LANGUAGE_INDICATOR],
status: null, status: null,
scts: null, scts: null,
dt: null, dt: null,
encoding: message[PDU_CDMA_MSG_USERDATA_BODY].encoding, encoding: message.encoding,
messageClass: GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL], messageClass: GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
messageType: message.messageType, messageType: message.messageType,
serviceCategory: message.service serviceCategory: message.service,
subMsgType: message[PDU_CDMA_MSG_USERDATA_MSG_ID].msgType,
msgId: message[PDU_CDMA_MSG_USERDATA_MSG_ID].msgId,
errorClass: message.errorClass,
msgStatus: message.msgStatus
}; };
return msg; return msg;
}, },
/** /**
* Helper for processing received SMS parcel data. * Helper for processing received SMS parcel data.
* *
@ -8963,8 +9042,8 @@ let CdmaPDUHelper = {
case PDU_CDMA_MSG_USERDATA_TIMESTAMP: case PDU_CDMA_MSG_USERDATA_TIMESTAMP:
message[id] = this.decodeUserDataTimestamp(); message[id] = this.decodeUserDataTimestamp();
break; break;
case PDU_CDMA_REPLY_OPTION: case PDU_CDMA_MSG_USERDATA_REPLY_OPTION:
message[id] = this.decodeUserDataReplyAction(); message[id] = this.decodeUserDataReplyOption();
break; break;
case PDU_CDMA_LANGUAGE_INDICATOR: case PDU_CDMA_LANGUAGE_INDICATOR:
message[id] = this.decodeLanguageIndicator(); message[id] = this.decodeLanguageIndicator();
@ -8972,6 +9051,9 @@ let CdmaPDUHelper = {
case PDU_CDMA_MSG_USERDATA_CALLBACK_NUMBER: case PDU_CDMA_MSG_USERDATA_CALLBACK_NUMBER:
message[id] = this.decodeUserDataCallbackNumber(); message[id] = this.decodeUserDataCallbackNumber();
break; break;
case PDU_CDMA_MSG_USER_DATA_MSG_STATUS:
message[id] = this.decodeUserDataMsgStatus();
break;
} }
userDataLength -= (length + 2); userDataLength -= (length + 2);
@ -9338,7 +9420,7 @@ let CdmaPDUHelper = {
* *
* @see 3GGP2 C.S0015-B 2.0, 4.5.11 Reply Option * @see 3GGP2 C.S0015-B 2.0, 4.5.11 Reply Option
*/ */
decodeUserDataReplyAction: function cdma_decodeUserDataReplyAction() { decodeUserDataReplyOption: function cdma_decodeUserDataReplyOption() {
let replyAction = BitBufferHelper.readBits(4), let replyAction = BitBufferHelper.readBits(4),
result = { userAck: (replyAction & 0x8) ? true : false, result = { userAck: (replyAction & 0x8) ? true : false,
deliverAck: (replyAction & 0x4) ? true : false, deliverAck: (replyAction & 0x4) ? true : false,
@ -9386,6 +9468,20 @@ let CdmaPDUHelper = {
return result; return result;
}, },
/**
* User data subparameter decoder : Message Status
*
* @see 3GGP2 C.S0015-B 2.0, 4.5.21 Message Status
*/
decodeUserDataMsgStatus: function cdma_decodeUserDataMsgStatus() {
let result = {
errorClass: BitBufferHelper.readBits(2),
msgStatus: BitBufferHelper.readBits(6)
};
return result;
},
/** /**
* Decode information record parcel. * Decode information record parcel.
*/ */