Bug 797277 - Part 3/5: RIL implementation, r=philikon

This commit is contained in:
Vicamo Yang 2012-10-31 17:10:48 +08:00
Родитель dccc0bf199
Коммит c855746479
4 изменённых файлов: 33 добавлений и 12 удалений

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

@ -25,6 +25,8 @@ const DELIVERY_STATUS_SUCCESS = "success";
const DELIVERY_STATUS_PENDING = "pending";
const DELIVERY_STATUS_ERROR = "error";
const MESSAGE_CLASS_NORMAL = "normal";
const FILTER_TIMESTAMP = "timestamp";
const FILTER_NUMBERS = "numbers";
const FILTER_DELIVERY = "delivery";
@ -326,6 +328,7 @@ SmsDatabaseService.prototype = {
message.sender,
message.receiver,
message.body,
message.messageClass,
message.timestamp,
message.read);
gSmsRequestManager.notifyCreateMessageList(requestId,
@ -354,7 +357,7 @@ SmsDatabaseService.prototype = {
* nsISmsDatabaseService API
*/
saveReceivedMessage: function saveReceivedMessage(sender, body, date) {
saveReceivedMessage: function saveReceivedMessage(sender, body, messageClass, date) {
let receiver = this.mRIL.rilContext.icc ? this.mRIL.rilContext.icc.msisdn : null;
let message = {delivery: DELIVERY_RECEIVED,
@ -362,6 +365,7 @@ SmsDatabaseService.prototype = {
sender: sender,
receiver: receiver,
body: body,
messageClass: messageClass,
timestamp: date,
read: FILTER_READ_UNREAD};
return this.saveMessage(message);
@ -375,6 +379,7 @@ SmsDatabaseService.prototype = {
sender: sender,
receiver: receiver,
body: body,
messageClass: MESSAGE_CLASS_NORMAL,
timestamp: date,
read: FILTER_READ_READ};
return this.saveMessage(message);
@ -469,6 +474,7 @@ SmsDatabaseService.prototype = {
data.sender,
data.receiver,
data.body,
data.messageClass,
data.timestamp,
data.read);
gSmsRequestManager.notifyGotSms(requestId, message);
@ -694,6 +700,7 @@ SmsDatabaseService.prototype = {
message.sender,
message.receiver,
message.body,
message.messageClass,
message.timestamp,
message.read);
gSmsRequestManager.notifyGotNextMessage(requestId, sms);

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

@ -1230,9 +1230,10 @@ RadioInterfaceLayer.prototype = {
}
let id = -1;
if (message.messageClass != RIL.PDU_DCS_MSG_CLASS_0) {
if (message.messageClass != RIL.GECKO_SMS_MESSAGE_CLASSES[RIL.PDU_DCS_MSG_CLASS_0]) {
id = gSmsDatabaseService.saveReceivedMessage(message.sender || null,
message.fullBody || null,
message.messageClass,
message.timestamp);
}
let sms = gSmsService.createSmsMessage(id,
@ -1241,6 +1242,7 @@ RadioInterfaceLayer.prototype = {
message.sender || null,
message.receiver || null,
message.fullBody || null,
message.messageClass,
message.timestamp,
false);
@ -1251,6 +1253,7 @@ RadioInterfaceLayer.prototype = {
sender: message.sender || null,
receiver: message.receiver || null,
body: message.fullBody || null,
messageClass: message.messageClass,
timestamp: message.timestamp,
read: false});
Services.obs.notifyObservers(sms, kSmsReceivedObserverTopic, null);
@ -1280,6 +1283,7 @@ RadioInterfaceLayer.prototype = {
}
let timestamp = Date.now();
let messageClass = RIL.GECKO_SMS_MESSAGE_CLASSES[RIL.PDU_DCS_MSG_CLASS_NORMAL];
let id = gSmsDatabaseService.saveSentMessage(options.number,
options.fullBody,
timestamp);
@ -1289,6 +1293,7 @@ RadioInterfaceLayer.prototype = {
null,
options.number,
options.fullBody,
messageClass,
timestamp,
true);
@ -1314,6 +1319,7 @@ RadioInterfaceLayer.prototype = {
}
delete this._sentSmsEnvelopes[message.envelopeId];
let messageClass = RIL.GECKO_SMS_MESSAGE_CLASSES[RIL.PDU_DCS_MSG_CLASS_NORMAL];
gSmsDatabaseService.setMessageDeliveryStatus(options.id,
message.deliveryStatus);
let sms = gSmsService.createSmsMessage(options.id,
@ -1322,6 +1328,7 @@ RadioInterfaceLayer.prototype = {
null,
options.number,
options.fullBody,
messageClass,
options.timestamp,
true);

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

@ -964,11 +964,11 @@ const PDU_PID_USIM_DATA_DOWNLOAD = 0x7F;
const PDU_DCS_MSG_CODING_7BITS_ALPHABET = 0x00;
const PDU_DCS_MSG_CODING_8BITS_ALPHABET = 0x04;
const PDU_DCS_MSG_CODING_16BITS_ALPHABET = 0x08;
const PDU_DCS_MSG_CLASS_UNKNOWN = 0xFF;
const PDU_DCS_MSG_CLASS_NORMAL = 0xFF;
const PDU_DCS_MSG_CLASS_0 = 0x00;
const PDU_DCS_MSG_CLASS_ME_SPECIFIC = 0x01;
const PDU_DCS_MSG_CLASS_SIM_SPECIFIC = 0x02;
const PDU_DCS_MSG_CLASS_TE_SPECIFIC = 0x03;
const PDU_DCS_MSG_CLASS_1 = 0x01;
const PDU_DCS_MSG_CLASS_2 = 0x02;
const PDU_DCS_MSG_CLASS_3 = 0x03;
const PDU_DCS_CODING_GROUP_BITS = 0xF0;
const PDU_DCS_MSG_CLASS_BITS = 0x03;
const PDU_DCS_MWI_ACTIVE_BITS = 0x08;
@ -979,6 +979,13 @@ const PDU_DCS_MWI_TYPE_FAX = 0x01;
const PDU_DCS_MWI_TYPE_EMAIL = 0x02;
const PDU_DCS_MWI_TYPE_OTHER = 0x03;
const GECKO_SMS_MESSAGE_CLASSES = {};
GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL] = "normal";
GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_0] = "class-0";
GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_1] = "class-1";
GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_2] = "class-2";
GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_3] = "class-3";
// Because service center timestamp omit the century. Yay.
const PDU_TIMESTAMP_YEAR_OFFSET = 2000;

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

@ -3751,7 +3751,7 @@ let RIL = {
return PDU_FCS_OK;
}
if (message.messageClass == PDU_DCS_MSG_CLASS_SIM_SPECIFIC) {
if (message.messageClass == GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_2]) {
switch (message.epid) {
case PDU_PID_ANSI_136_R_DATA:
case PDU_PID_USIM_DATA_DOWNLOAD:
@ -3777,13 +3777,13 @@ let RIL = {
}
// TODO: Bug 739143: B2G SMS: Support SMS Storage Full event
if ((message.messageClass != PDU_DCS_MSG_CLASS_0) && !true) {
if ((message.messageClass != GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_0]) && !true) {
// `When a mobile terminated message is class 0..., the MS shall display
// the message immediately and send a ACK to the SC ..., irrespective of
// whether there is memory available in the (U)SIM or ME.` ~ 3GPP 23.038
// clause 4.
if (message.messageClass == PDU_DCS_MSG_CLASS_SIM_SPECIFIC) {
if (message.messageClass == GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_2]) {
// `If all the short message storage at the MS is already in use, the
// MS shall return "memory capacity exceeded".` ~ 3GPP 23.038 clause 4.
return PDU_FCS_MEMORY_CAPACITY_EXCEEDED;
@ -3809,7 +3809,7 @@ let RIL = {
this.sendDOMMessage(message);
}
if (message.messageClass == PDU_DCS_MSG_CLASS_SIM_SPECIFIC) {
if (message.messageClass == GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_2]) {
// `MS shall ensure that the message has been to the SMS data field in
// the (U)SIM before sending an ACK to the SC.` ~ 3GPP 23.038 clause 4
return PDU_FCS_RESERVED;
@ -5925,7 +5925,7 @@ let GsmPDUHelper = {
if (DEBUG) debug("PDU: read dcs: " + dcs);
// No message class by default.
let messageClass = PDU_DCS_MSG_CLASS_UNKNOWN;
let messageClass = PDU_DCS_MSG_CLASS_NORMAL;
// 7 bit is the default fallback encoding.
let encoding = PDU_DCS_MSG_CODING_7BITS_ALPHABET;
switch (dcs & PDU_DCS_CODING_GROUP_BITS) {
@ -6002,7 +6002,7 @@ let GsmPDUHelper = {
msg.dcs = dcs;
msg.encoding = encoding;
msg.messageClass = messageClass;
msg.messageClass = GECKO_SMS_MESSAGE_CLASSES[messageClass];
if (DEBUG) debug("PDU: message encoding is " + encoding + " bit.");
},