mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 833270 - Part 1 - Adding RUIM support. r=allstars.chh
This commit is contained in:
parent
d35a2bb73d
commit
cb79d83951
@ -441,6 +441,10 @@ this.ICC_EF_MWIS = 0x6fca;
|
||||
this.ICC_EF_CFIS = 0x6fcb;
|
||||
this.ICC_EF_SPDI = 0x6fcd;
|
||||
|
||||
// CSIM files
|
||||
this.ICC_EF_CSIM_CDMAHOME = 0x6f28;
|
||||
this.ICC_EF_CSIM_CST = 0x6f32; // CDMA Service table
|
||||
|
||||
this.ICC_PHASE_1 = 0x00;
|
||||
this.ICC_PHASE_2 = 0x02;
|
||||
this.ICC_PHASE_2_PROFILE_DOWNLOAD_REQUIRED = 0x03;
|
||||
@ -498,6 +502,7 @@ this.EF_PATH_MF_SIM = "3f00";
|
||||
this.EF_PATH_DF_PHONEBOOK = "5f3a";
|
||||
this.EF_PATH_DF_TELECOM = "7f10";
|
||||
this.EF_PATH_DF_GSM = "7f20";
|
||||
this.EF_PATH_DF_CDMA = "7f25";
|
||||
this.EF_PATH_ADF_USIM = "7fff";
|
||||
|
||||
// Status code of sw1 for ICC I/O,
|
||||
@ -1066,6 +1071,9 @@ this.GECKO_ICC_SERVICES = {
|
||||
PNN: 45,
|
||||
OPL: 46,
|
||||
SPDI: 51
|
||||
},
|
||||
ruim: {
|
||||
SPN: 17
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -797,6 +797,11 @@ let RIL = {
|
||||
*/
|
||||
this.iccInfo = {};
|
||||
|
||||
/**
|
||||
* CDMA specific information. ex. CDMA Network ID, CDMA System ID... etc.
|
||||
*/
|
||||
this.cdmaHome = null;
|
||||
|
||||
/**
|
||||
* Application identification for apps in ICC.
|
||||
*/
|
||||
@ -2714,8 +2719,8 @@ let RIL = {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Bug 726098, change to use cdmaSubscriptionAppIndex when in CDMA.
|
||||
let index = iccStatus.gsmUmtsSubscriptionAppIndex;
|
||||
let index = this._isCdma ? iccStatus.cdmaSubscriptionAppIndex :
|
||||
iccStatus.gsmUmtsSubscriptionAppIndex;
|
||||
let app = iccStatus.apps[index];
|
||||
if (!app) {
|
||||
if (DEBUG) {
|
||||
@ -2768,10 +2773,14 @@ let RIL = {
|
||||
// Other types of ICC we can send Terminal_Profile immediately.
|
||||
if (this.appType == CARD_APPTYPE_SIM) {
|
||||
ICCRecordHelper.getICCPhase();
|
||||
} else {
|
||||
ICCRecordHelper.fetchICCRecords();
|
||||
} else if (this.appType == CARD_APPTYPE_USIM) {
|
||||
this.sendStkTerminalProfile(STK_SUPPORTED_TERMINAL_PROFILE);
|
||||
ICCRecordHelper.fetchICCRecords();
|
||||
} else if (this.appType == CARD_APPTYPE_RUIM) {
|
||||
this.sendStkTerminalProfile(STK_SUPPORTED_TERMINAL_PROFILE);
|
||||
RuimRecordHelper.fetchRuimRecords();
|
||||
}
|
||||
ICCRecordHelper.fetchICCRecords();
|
||||
this.reportStkServiceIsRunning();
|
||||
}
|
||||
|
||||
@ -2930,10 +2939,7 @@ let RIL = {
|
||||
RIL.getSMSCAddress();
|
||||
}
|
||||
|
||||
// TODO: This zombie code branch that will be raised from the dead once
|
||||
// we add explicit CDMA support everywhere (bug 726098).
|
||||
let cdma = false;
|
||||
if (cdma) {
|
||||
if (this._isCdma) {
|
||||
let baseStationId = RIL.parseInt(state[4]);
|
||||
let baseStationLatitude = RIL.parseInt(state[5]);
|
||||
let baseStationLongitude = RIL.parseInt(state[6]);
|
||||
@ -8441,6 +8447,19 @@ let ICCFileHelper = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This function handles EFs for RUIM
|
||||
*/
|
||||
getRuimEFPath: function getRuimEFPath(fileId) {
|
||||
switch(fileId) {
|
||||
case ICC_EF_CSIM_CDMAHOME:
|
||||
case ICC_EF_CSIM_CST:
|
||||
return EF_PATH_MF_SIM + EF_PATH_DF_CDMA;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper function for getting the pathId for the specific ICC record
|
||||
* depeding on which type of ICC card we are using.
|
||||
@ -8450,13 +8469,7 @@ let ICCFileHelper = {
|
||||
* @return The pathId or null in case of an error or invalid input.
|
||||
*/
|
||||
getEFPath: function getEFPath(fileId) {
|
||||
// TODO: Bug 726098, change to use cdmaSubscriptionAppIndex when in CDMA.
|
||||
let index = RIL.iccStatus.gsmUmtsSubscriptionAppIndex;
|
||||
if (index == -1) {
|
||||
return null;
|
||||
}
|
||||
let app = RIL.iccStatus.apps[index];
|
||||
if (!app) {
|
||||
if (RIL.appType == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -8465,15 +8478,17 @@ let ICCFileHelper = {
|
||||
return path;
|
||||
}
|
||||
|
||||
switch (app.app_type) {
|
||||
switch (RIL.appType) {
|
||||
case CARD_APPTYPE_SIM:
|
||||
return this.getSimEFPath(fileId);
|
||||
case CARD_APPTYPE_USIM:
|
||||
return this.getUSimEFPath(fileId);
|
||||
case CARD_APPTYPE_RUIM:
|
||||
return this.getRuimEFPath(fileId);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -9793,9 +9808,10 @@ let ICCUtilsHelper = {
|
||||
* @return true if the service is enabled, false otherwise.
|
||||
*/
|
||||
isICCServiceAvailable: function isICCServiceAvailable(geckoService) {
|
||||
let serviceTable = RIL.iccInfoPrivate.sst;
|
||||
let serviceTable = RIL._isCdma ? RIL.iccInfoPrivate.cst:
|
||||
RIL.iccInfoPrivate.sst;
|
||||
let index, bitmask;
|
||||
if (RIL.appType == CARD_APPTYPE_SIM) {
|
||||
if (RIL.appType == CARD_APPTYPE_SIM || RIL.appType == CARD_APPTYPE_RUIM) {
|
||||
/**
|
||||
* Service id is valid in 1..N, and 2 bits are used to code each service.
|
||||
*
|
||||
@ -9810,14 +9826,19 @@ let ICCUtilsHelper = {
|
||||
*
|
||||
* @see 3GPP TS 51.011 10.3.7.
|
||||
*/
|
||||
let simService = GECKO_ICC_SERVICES.sim[geckoService];
|
||||
let simService;
|
||||
if (RIL.appType == CARD_APPTYPE_SIM) {
|
||||
simService = GECKO_ICC_SERVICES.sim[geckoService];
|
||||
} else {
|
||||
simService = GECKO_ICC_SERVICES.ruim[geckoService];
|
||||
}
|
||||
if (!simService) {
|
||||
return false;
|
||||
}
|
||||
simService -= 1;
|
||||
index = Math.floor(simService / 4);
|
||||
bitmask = 2 << ((simService % 4) << 1);
|
||||
} else {
|
||||
} else if (RIL.appType == CARD_APPTYPE_USIM) {
|
||||
/**
|
||||
* Service id is valid in 1..N, and 1 bit is used to code each service.
|
||||
*
|
||||
@ -10157,6 +10178,73 @@ let ICCContactHelper = {
|
||||
},
|
||||
};
|
||||
|
||||
let RuimRecordHelper = {
|
||||
fetchRuimRecords: function fetchRuimRecords() {
|
||||
ICCRecordHelper.getICCID();
|
||||
RIL.getIMSI();
|
||||
this.readCST();
|
||||
this.readCDMAHome();
|
||||
},
|
||||
|
||||
/**
|
||||
* Read CDMAHOME for CSIM.
|
||||
* See 3GPP2 C.S0023 Sec. 3.4.8.
|
||||
*/
|
||||
readCDMAHome: function readCDMAHome() {
|
||||
function callback(options) {
|
||||
let strLen = Buf.readUint32();
|
||||
let tempOctet = GsmPDUHelper.readHexOctet();
|
||||
cdmaHomeSystemId.push(((GsmPDUHelper.readHexOctet() & 0x7f) << 8) | tempOctet);
|
||||
tempOctet = GsmPDUHelper.readHexOctet();
|
||||
cdmaHomeNetworkId.push(((GsmPDUHelper.readHexOctet() & 0xff) << 8) | tempOctet);
|
||||
|
||||
// Consuming the last octet: band class.
|
||||
Buf.seekIncoming(PDU_HEX_OCTET_SIZE);
|
||||
|
||||
Buf.readStringDelimiter(strLen);
|
||||
if (options.p1 < options.totalRecords) {
|
||||
ICCIOHelper.loadNextRecord(options);
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
debug("CDMAHome system id: " + JSON.stringify(cdmaHomeSystemId));
|
||||
debug("CDMAHome network id: " + JSON.stringify(cdmaHomeNetworkId));
|
||||
}
|
||||
RIL.cdmaHome = {
|
||||
systemId: cdmaHomeSystemId,
|
||||
networkId: cdmaHomeNetworkId
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
let cdmaHomeSystemId = [], cdmaHomeNetworkId = [];
|
||||
ICCIOHelper.loadLinearFixedEF({fileId: ICC_EF_CSIM_CDMAHOME,
|
||||
callback: callback.bind(this)});
|
||||
},
|
||||
|
||||
/**
|
||||
* Read CDMA Service Table.
|
||||
* See 3GPP2 C.S0023 Sec. 3.4.18
|
||||
*/
|
||||
readCST: function readCST() {
|
||||
function callback() {
|
||||
let strLen = Buf.readUint32();
|
||||
// Each octet is encoded into two chars.
|
||||
RIL.iccInfoPrivate.cst = GsmPDUHelper.readHexOctetArray(strLen / 2);
|
||||
Buf.readStringDelimiter(strLen);
|
||||
|
||||
if (DEBUG) {
|
||||
let str = "";
|
||||
for (let i = 0; i < RIL.iccInfoPrivate.cst.length; i++) {
|
||||
str += RIL.iccInfoPrivate.cst[i] + ", ";
|
||||
}
|
||||
debug("CST: " + str);
|
||||
}
|
||||
}
|
||||
ICCIOHelper.loadTransparentEF({fileId: ICC_EF_CSIM_CST,
|
||||
callback: callback.bind(this)});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Global stuff.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user