mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 736706 - Part 1: Save message class information, r=philikon
This commit is contained in:
parent
10e687271c
commit
c31702c551
@ -902,13 +902,13 @@ 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_ME_SPECIFIC = 0xF1;
|
||||
const PDU_DCS_MSG_CLASS_SIM_SPECIFIC = 0xF2;
|
||||
const PDU_DCS_MSG_CLASS_TE_SPECIFIC = 0xF3;
|
||||
const PDU_DCS_MSG_CLASS_UNKNOWN = 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_CODING_GROUP_BITS = 0xF0;
|
||||
const PDU_DCS_CODING_GROUP_7BITS_DISCARD = 0xC0;
|
||||
const PDU_DCS_CODING_GROUP_7BITS_STORE = 0xD0;
|
||||
const PDU_DCS_CODING_GROUP_16BITS_STORE = 0xE0;
|
||||
const PDU_DCS_MSG_CLASS_BITS = 0x03;
|
||||
const PDU_DCS_MWI_ACTIVE_BITS = 0x08;
|
||||
const PDU_DCS_MWI_ACTIVE_VALUE = 0x08;
|
||||
const PDU_DCS_MWI_TYPE_BITS = 0x03;
|
||||
|
@ -5130,14 +5130,23 @@ let GsmPDUHelper = {
|
||||
let dcs = this.readHexOctet();
|
||||
if (DEBUG) debug("PDU: read dcs: " + dcs);
|
||||
|
||||
// Level 2 of message waiting indication
|
||||
this.readMessageWaitingFromDCS(msg, dcs);
|
||||
|
||||
// No message class by default.
|
||||
let messageClass = PDU_DCS_MSG_CLASS_UNKNOWN;
|
||||
// 7 bit is the default fallback encoding.
|
||||
let encoding = PDU_DCS_MSG_CODING_7BITS_ALPHABET;
|
||||
switch (dcs & 0xC0) {
|
||||
case 0x0:
|
||||
// bits 7..4 = 00xx
|
||||
switch (dcs & PDU_DCS_CODING_GROUP_BITS) {
|
||||
case 0x40: // bits 7..4 = 01xx
|
||||
case 0x50:
|
||||
case 0x60:
|
||||
case 0x70:
|
||||
// Bit 5..0 are coded exactly the same as Group 00xx
|
||||
case 0x00: // bits 7..4 = 00xx
|
||||
case 0x10:
|
||||
case 0x20:
|
||||
case 0x30:
|
||||
if (dcs & 0x10) {
|
||||
messageClass = dcs & PDU_DCS_MSG_CLASS_BITS;
|
||||
}
|
||||
switch (dcs & 0x0C) {
|
||||
case 0x4:
|
||||
encoding = PDU_DCS_MSG_CODING_8BITS_ALPHABET;
|
||||
@ -5147,19 +5156,51 @@ let GsmPDUHelper = {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0xC0:
|
||||
// bits 7..4 = 11xx
|
||||
switch (dcs & 0x30) {
|
||||
case 0x20:
|
||||
encoding = PDU_DCS_MSG_CODING_16BITS_ALPHABET;
|
||||
break;
|
||||
case 0x30:
|
||||
if (dcs & 0x04) {
|
||||
encoding = PDU_DCS_MSG_CODING_8BITS_ALPHABET;
|
||||
|
||||
case 0xE0: // bits 7..4 = 1110
|
||||
encoding = PDU_DCS_MSG_CODING_16BITS_ALPHABET;
|
||||
// Bit 3..0 are coded exactly the same as Message Waiting Indication
|
||||
// Group 1101.
|
||||
case 0xC0: // bits 7..4 = 1100
|
||||
case 0xD0: // bits 7..4 = 1101
|
||||
// Indiciates voicemail indicator set or clear
|
||||
let active = (dcs & PDU_DCS_MWI_ACTIVE_BITS) == PDU_DCS_MWI_ACTIVE_VALUE;
|
||||
|
||||
// If TP-UDH is present, these values will be overwritten
|
||||
switch (dcs & PDU_DCS_MWI_TYPE_BITS) {
|
||||
case PDU_DCS_MWI_TYPE_VOICEMAIL:
|
||||
let mwi = msg.mwi;
|
||||
if (!mwi) {
|
||||
mwi = msg.mwi = {};
|
||||
}
|
||||
|
||||
mwi.active = active;
|
||||
mwi.discard = (dcs & PDU_DCS_CODING_GROUP_BITS) == 0xC0;
|
||||
mwi.msgCount = active ? GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN : 0;
|
||||
|
||||
if (DEBUG) {
|
||||
debug("MWI in DCS received for voicemail: " + JSON.stringify(mwi));
|
||||
}
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_FAX:
|
||||
if (DEBUG) debug("MWI in DCS received for fax");
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_EMAIL:
|
||||
if (DEBUG) debug("MWI in DCS received for email");
|
||||
break;
|
||||
default:
|
||||
if (DEBUG) debug("MWI in DCS received for \"other\"");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xF0: // bits 7..4 = 1111
|
||||
if (dcs & 0x04) {
|
||||
encoding = PDU_DCS_MSG_CODING_8BITS_ALPHABET;
|
||||
}
|
||||
messageClass = dcs & PDU_DCS_MSG_CLASS_BITS;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Falling back to default encoding.
|
||||
break;
|
||||
@ -5167,52 +5208,11 @@ let GsmPDUHelper = {
|
||||
|
||||
msg.dcs = dcs;
|
||||
msg.encoding = encoding;
|
||||
msg.messageClass = messageClass;
|
||||
|
||||
if (DEBUG) debug("PDU: message encoding is " + encoding + " bit.");
|
||||
},
|
||||
|
||||
readMessageWaitingFromDCS: function readMessageWaitingFromDCS(msg, dcs) {
|
||||
// 0xC0 == 7 bit, don't store
|
||||
// 0xD0 == 7 bit, store
|
||||
// 0xE0 == UCS-2, store
|
||||
let codingGroup = dcs & PDU_DCS_CODING_GROUP_BITS;
|
||||
|
||||
if (codingGroup == PDU_DCS_CODING_GROUP_7BITS_DISCARD ||
|
||||
codingGroup == PDU_DCS_CODING_GROUP_7BITS_STORE ||
|
||||
codingGroup == PDU_DCS_CODING_GROUP_16BITS_STORE) {
|
||||
|
||||
// Indiciates voicemail indicator set or clear
|
||||
let active = (dcs & PDU_DCS_MWI_ACTIVE_BITS) == PDU_DCS_MWI_ACTIVE_VALUE;
|
||||
|
||||
// If TP-UDH is present, these values will be overwritten
|
||||
switch (dcs & PDU_DCS_MWI_TYPE_BITS) {
|
||||
case PDU_DCS_MWI_TYPE_VOICEMAIL:
|
||||
let mwi = msg.mwi;
|
||||
if (!mwi) {
|
||||
mwi = msg.mwi = {};
|
||||
}
|
||||
|
||||
mwi.active = active;
|
||||
mwi.discard = codingGroup == PDU_DCS_CODING_GROUP_7BITS_DISCARD;
|
||||
mwi.msgCount = active ? GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN : 0;
|
||||
|
||||
if (DEBUG) {
|
||||
debug("MWI in DCS received for voicemail: " + JSON.stringify(mwi));
|
||||
}
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_FAX:
|
||||
if (DEBUG) debug("MWI in DCS received for fax");
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_EMAIL:
|
||||
if (DEBUG) debug("MWI in DCS received for email");
|
||||
break;
|
||||
default:
|
||||
if (DEBUG) debug("MWI in DCS received for \"other\"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Read GSM TP-Service-Centre-Time-Stamp(TP-SCTS).
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user