Bug 791934 - Part 1: Profile download. r=vicamo

This commit is contained in:
Yoshi Huang 2012-09-18 18:27:42 +08:00
parent 19acca1828
commit 15797ff0c7
2 changed files with 183 additions and 0 deletions

View File

@ -417,6 +417,7 @@ this.ICC_EF_EXT1 = 0x6f4a;
this.ICC_EF_EXT2 = 0x6f4b;
this.ICC_EF_EXT3 = 0x6f4c;
this.ICC_EF_AD = 0x6fad;
this.ICC_EF_PHASE = 0x6fae;
this.ICC_EF_PNN = 0x6fc5;
this.ICC_EF_MBDN = 0x6fc7;
this.ICC_EF_EXT6 = 0x6fc8; // Ext record for EF[MBDN]
@ -425,6 +426,10 @@ this.ICC_EF_MWIS = 0x6fca;
this.ICC_EF_CFIS = 0x6fcb;
this.ICC_EF_SPDI = 0x6fcd;
this.ICC_PHASE_1 = 0x00;
this.ICC_PHASE_2 = 0x02;
this.ICC_PHASE_2_PROFILE_DOWNLOAD_REQUIRED = 0x03;
// Types of files TS 11.11 9.3
this.TYPE_RFU = 0;
this.TYPE_MF = 1;
@ -768,6 +773,130 @@ this.STK_TIME_UNIT_MINUTE = 0x00;
this.STK_TIME_UNIT_SECOND = 0x01;
this.STK_TIME_UNIT_TENTH_SECOND = 0x02;
/**
* Supported Terminal Facilities.
*
* value = 1, supported.
* 0, not supported.
*/
this.STK_TERMINAL_SUPPORT_PROFILE_DOWNLOAD = 1;
this.STK_TERMINAL_SUPPORT_SMS_PP_DOWNLOAD = 1;
this.STK_TERMINAL_SUPPORT_CELL_BROADCAST_DATA_DOWNLOAD = 0;
this.STK_TERMINAL_SUPPORT_MENU_SELECTION = 1;
this.STK_TERMINAL_SUPPORT_SIM_DATA_DOWNLOAD_ERROR = 0;
this.STK_TERMINAL_SUPPORT_TIMER_EXPIRATION = 0;
this.STK_TERMINAL_SUPPORT_USSD_IN_CALL_CONTROL = 0;
this.STK_TERMINAL_SUPPORT_CALL_CONTROL_IN_REDIAL = 0;
this.STK_TERMINAL_SUPPORT_COMMAND_RESULT = 1;
this.STK_TERMINAL_SUPPORT_CALL_CONTROL = 1;
this.STK_TERMINAL_SUPPORT_CALL_ID_INCLUDED = 0;
this.STK_TERMINAL_SUPPORT_MO_SMS_CONTROL = 0;
this.STK_TERMINAL_SUPPORT_ALPHA_ID_INDICATION = 0;
this.STK_TERMINAL_SUPPORT_UCS2_ENTRY = 1;
this.STK_TERMINAL_SUPPORT_UCS2_DISPLAY = 1;
this.STK_TERMINAL_SUPPORT_EXTENSION_TEXT = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_DISPLAY_TEXT = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_GET_INKEY = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_GET_INPUT = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_MORE_TIME = 0;
this.STK_TERMINAL_SUPPORT_PROACTIVE_PLAY_TONE = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_POLL_INTERVAL = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_POLL_OFF = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_REFRESH = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_SELECT_ITEM = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_SEND_SMS = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_SEND_SS = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_SEND_USSD = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_SET_UP_CALL = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_SET_UP_MENU = 1;
this.STK_TERMINAL_SUPPORT_PROACTIVE_LOCAL_INFO = 0;
this.STK_TERMINAL_SUPPORT_PROACTIVE_LOCAL_INFO_NMR = 0;
this.STK_TERMINAL_SUPPORT_PROACTIVE_SET_UP_EVENT_LIST = 1;
this.STK_TERMINAL_SUPPORT_EVENT_MT_CALL = 1;
this.STK_TERMINAL_SUPPORT_EVENT_CALL_CONNECTED = 1;
this.STK_TERMINAL_SUPPORT_EVENT_CALL_DISCONNECTED = 1;
this.STK_TERMINAL_SUPPORT_EVENT_LOCATION_STATUS = 1;
this.STK_TERMINAL_SUPPORT_EVENT_USER_ACTIVITY = 0;
this.STK_TERMINAL_SUPPORT_EVENT_IDLE_SCREEN_AVAILABLE = 0;
this.STK_TERMINAL_SUPPORT_EVENT_CARD_READER_STATUS = 0;
this.STK_TERMINAL_PROFILE_DOWNLOAD =
(STK_TERMINAL_SUPPORT_PROFILE_DOWNLOAD << 0) |
(STK_TERMINAL_SUPPORT_SMS_PP_DOWNLOAD << 1) |
(STK_TERMINAL_SUPPORT_CELL_BROADCAST_DATA_DOWNLOAD << 2) |
(STK_TERMINAL_SUPPORT_MENU_SELECTION << 3) |
(STK_TERMINAL_SUPPORT_SIM_DATA_DOWNLOAD_ERROR << 4) |
(STK_TERMINAL_SUPPORT_TIMER_EXPIRATION << 5) |
(STK_TERMINAL_SUPPORT_USSD_IN_CALL_CONTROL << 6) |
(STK_TERMINAL_SUPPORT_CALL_CONTROL_IN_REDIAL << 7);
this.STK_TERMINAL_PROFILE_OTHER =
(STK_TERMINAL_SUPPORT_COMMAND_RESULT << 0) |
(STK_TERMINAL_SUPPORT_CALL_CONTROL << 1) |
(STK_TERMINAL_SUPPORT_CALL_ID_INCLUDED << 2) |
(STK_TERMINAL_SUPPORT_MO_SMS_CONTROL << 3) |
(STK_TERMINAL_SUPPORT_ALPHA_ID_INDICATION << 4) |
(STK_TERMINAL_SUPPORT_UCS2_ENTRY << 5) |
(STK_TERMINAL_SUPPORT_UCS2_DISPLAY << 6) |
(STK_TERMINAL_SUPPORT_EXTENSION_TEXT << 7);
this.STK_TERMINAL_PROFILE_PROACTIVE_1 =
(STK_TERMINAL_SUPPORT_PROACTIVE_DISPLAY_TEXT << 0) |
(STK_TERMINAL_SUPPORT_PROACTIVE_GET_INKEY << 1) |
(STK_TERMINAL_SUPPORT_PROACTIVE_GET_INPUT << 2) |
(STK_TERMINAL_SUPPORT_PROACTIVE_MORE_TIME << 3) |
(STK_TERMINAL_SUPPORT_PROACTIVE_PLAY_TONE << 4) |
(STK_TERMINAL_SUPPORT_PROACTIVE_POLL_INTERVAL << 5) |
(STK_TERMINAL_SUPPORT_PROACTIVE_POLL_OFF << 6) |
(STK_TERMINAL_SUPPORT_PROACTIVE_REFRESH << 7);
this.STK_TERMINAL_PROFILE_PROACTIVE_2 =
(STK_TERMINAL_SUPPORT_PROACTIVE_SELECT_ITEM << 0) |
(STK_TERMINAL_SUPPORT_PROACTIVE_SEND_SMS << 1) |
(STK_TERMINAL_SUPPORT_PROACTIVE_SEND_SS << 2) |
(STK_TERMINAL_SUPPORT_PROACTIVE_SEND_USSD << 3) |
(STK_TERMINAL_SUPPORT_PROACTIVE_SET_UP_CALL << 4) |
(STK_TERMINAL_SUPPORT_PROACTIVE_SET_UP_MENU << 5) |
(STK_TERMINAL_SUPPORT_PROACTIVE_LOCAL_INFO << 6) |
(STK_TERMINAL_SUPPORT_PROACTIVE_LOCAL_INFO_NMR << 7);
this.STK_TERMINAL_PROFILE_EVENT =
(STK_TERMINAL_SUPPORT_PROACTIVE_SET_UP_EVENT_LIST << 0) |
(STK_TERMINAL_SUPPORT_EVENT_MT_CALL << 1) |
(STK_TERMINAL_SUPPORT_EVENT_CALL_CONNECTED << 2) |
(STK_TERMINAL_SUPPORT_EVENT_CALL_DISCONNECTED << 3) |
(STK_TERMINAL_SUPPORT_EVENT_LOCATION_STATUS << 4) |
(STK_TERMINAL_SUPPORT_EVENT_USER_ACTIVITY << 5) |
(STK_TERMINAL_SUPPORT_EVENT_IDLE_SCREEN_AVAILABLE << 6) |
(STK_TERMINAL_SUPPORT_EVENT_CARD_READER_STATUS << 7);
this.STK_SUPPORTED_TERMINAL_PROFILE = [
STK_TERMINAL_PROFILE_DOWNLOAD,
STK_TERMINAL_PROFILE_OTHER,
STK_TERMINAL_PROFILE_PROACTIVE_1,
STK_TERMINAL_PROFILE_PROACTIVE_2,
STK_TERMINAL_PROFILE_EVENT,
0x00, // Event extension
0x00, // Multiple card proactive commands
0x00, // Proactive Commands
0x00, // Proactive Commands
0x00, // Softkey support
0x00, // Softkey information
0x00, // BIP proactive commands
0x00, // BIP supported bearers
0x00, // Screen height
0x00, // Screen width
0x00, // 16, Screen effects
0x00, // 17, BIP supported transport interface
0x00, // 18, RFU
0x00, // 19, RFU
0x00, // 20, RFU
];
/**
* (U)SIM Services.
*

View File

@ -1184,6 +1184,38 @@ let RIL = {
this.sendDOMMessage(this.iccInfo);
},
/**
* Get EF_phase.
* This EF is only available in SIM.
*/
getICCPhase: function getICCPhase() {
function callback() {
let length = Buf.readUint32();
let phase = GsmPDUHelper.readHexOctet();
// If EF_phase is coded '03' or greater, an ME supporting STK shall
// perform the PROFILE DOWNLOAD procedure.
if (phase >= ICC_PHASE_2_PROFILE_DOWNLOAD_REQUIRED) {
this.sendStkTerminalProfile(STK_SUPPORTED_TERMINAL_PROFILE);
}
Buf.readStringDelimiter(length);
}
this.iccIO({
command: ICC_COMMAND_GET_RESPONSE,
fileId: ICC_EF_PHASE,
pathId: EF_PATH_MF_SIM + EF_PATH_DF_GSM,
p1: 0, // For GET_RESPONSE, p1 = 0
p2: 0, // For GET_RESPONSE, p2 = 0
p3: GET_RESPONSE_EF_SIZE_BYTES,
data: null,
pin2: null,
type: EF_TYPE_TRANSPARENT,
callback: callback,
});
},
/**
* Get IMSI.
*
@ -2583,6 +2615,21 @@ let RIL = {
Buf.sendParcel();
},
/**
* Send STK Profile Download.
*
* @param profile Profile supported by ME.
*/
sendStkTerminalProfile: function sendStkTerminalProfile(profile) {
Buf.newParcel(REQUEST_STK_SET_PROFILE);
Buf.writeUint32(profile.length * 2);
for (let i = 0; i < profile.length; i++) {
GsmPDUHelper.writeHexOctet(profile[i]);
}
Buf.writeUint32(0);
Buf.sendParcel();
},
/**
* Send STK terminal response.
*
@ -2981,6 +3028,13 @@ let RIL = {
this.requestNetworkInfo();
this.getSignalStrength();
if (newCardState == GECKO_CARDSTATE_READY) {
// For type SIM, we need to check EF_phase first.
// Other types of ICC we can send Terminal_Profile immediately.
if (this.appType == CARD_APPTYPE_SIM) {
this.getICCPhase();
} else {
this.sendStkTerminalProfile(STK_SUPPORTED_TERMINAL_PROFILE);
}
this.fetchICCRecords();
this.reportStkServiceIsRunning();
}