Bug 727319 - Part 2: notify SMS send failed. r=philikon

This commit is contained in:
Vicamo Yang 2012-04-05 14:16:56 -07:00
Родитель 747d303ac0
Коммит 308d1f7157
3 изменённых файлов: 58 добавлений и 5 удалений

Просмотреть файл

@ -262,6 +262,9 @@ RadioInterfaceLayer.prototype = {
case "sms-delivered":
this.handleSmsDelivered(message);
return;
case "sms-send-failed":
this.handleSmsSendFailed(message);
return;
case "datacallstatechange":
this.handleDataCallState(message.datacall);
break;
@ -468,7 +471,6 @@ RadioInterfaceLayer.prototype = {
options.sms = sms;
}
//TODO handle errors (bug 727319)
gSmsRequestManager.notifySmsSent(options.requestId, sms);
},
@ -484,6 +486,25 @@ RadioInterfaceLayer.prototype = {
Services.obs.notifyObservers(options.sms, kSmsDeliveredObserverTopic, null);
},
handleSmsSendFailed: function handleSmsSendFailed(message) {
debug("handleSmsSendFailed: " + JSON.stringify(message));
let options = this._sentSmsEnvelopes[message.envelopeId];
if (!options) {
return;
}
delete this._sentSmsEnvelopes[message.envelopeId];
let error = gSmsRequestManager.UNKNOWN_ERROR;
switch (message.error) {
case RIL.ERROR_RADIO_NOT_AVAILABLE:
error = gSmsRequestManager.NO_SIGNAL_ERROR;
break;
}
gSmsRequestManager.notifySmsSendFailed(options.requestId, error);
},
/**
* Handle data call state changes.
*/

Просмотреть файл

@ -241,6 +241,11 @@ const ERROR_SS_MODIFIED_TO_USSD = 24;
const ERROR_SS_MODIFIED_TO_SS = 25;
const ERROR_SUBSCRIPTION_NOT_SUPPORTED = 26;
// 3GPP 23.040 clause 9.2.3.6 TP-Message-Reference(TP-MR):
// The number of times the MS automatically repeats the SMS-SUBMIT shall be in
// the range 1 to 3 but the precise number is an implementation matter.
const SMS_RETRY_MAX = 3;
const RADIO_STATE_OFF = 0;
const RADIO_STATE_UNAVAILABLE = 1;
const RADIO_STATE_ON = 2;

Просмотреть файл

@ -1026,6 +1026,10 @@ let RIL = {
//TODO: verify values on 'options'
if (!options.retryCount) {
options.retryCount = 0;
}
if (options.segmentMaxSeq > 1) {
if (!options.segmentSeq) {
// Fist segment to send
@ -1572,7 +1576,8 @@ let RIL = {
delete this._pendingSentSmsMap[message.messageRef];
if ((status >>> 5) != 0x00) {
// TODO: bug 727319 - Notify SMS send failures
// It seems unlikely to get a result code for a failure to deliver.
// Even if, we don't want to do anything with this.
return PDU_FCS_OK;
}
@ -1954,7 +1959,24 @@ RIL[REQUEST_RADIO_POWER] = null;
RIL[REQUEST_DTMF] = null;
RIL[REQUEST_SEND_SMS] = function REQUEST_SEND_SMS(length, options) {
if (options.rilRequestError) {
//TODO handle errors (bug 727319)
switch (options.rilRequestError) {
case ERROR_SMS_SEND_FAIL_RETRY:
if (options.retryCount < SMS_RETRY_MAX) {
options.retryCount++;
// TODO: bug 736702 TP-MR, retry interval, retry timeout
this.sendSMS(options);
break;
}
// Fallback to default error handling if it meets max retry count.
default:
this.sendDOMMessage({
type: "sms-send-failed",
envelopeId: options.envelopeId,
error: options.rilRequestError,
});
break;
}
return;
}
@ -2211,8 +2233,13 @@ RIL[REQUEST_DEVICE_IDENTITY] = null;
RIL[REQUEST_EXIT_EMERGENCY_CALLBACK_MODE] = null;
RIL[REQUEST_GET_SMSC_ADDRESS] = function REQUEST_GET_SMSC_ADDRESS(length, options) {
if (options.rilRequestError) {
//TODO: notify main thread if we fail retrieving the SMSC, especially
// if there was a pending SMS (bug 727319).
if (options.body) {
this.sendDOMMessage({
type: "sms-send-failed",
envelopeId: options.envelopeId,
error: options.rilRequestError,
});
}
return;
}