Bug 952025: Rename EF_TYPE_TRANSPARENT|LINEAR_FIXED|CYCLIC type of file to structure of file. r=echen

This commit is contained in:
John Dai 2014-12-25 18:24:00 +08:00
parent 91b1e32f3c
commit 43ce03568f
4 changed files with 28 additions and 25 deletions

View File

@ -567,16 +567,16 @@ this.RESPONSE_DATA_LENGTH = 12;
this.RESPONSE_DATA_STRUCTURE = 13;
this.RESPONSE_DATA_RECORD_LENGTH = 14;
// Types of files TS 11.11 9.3
this.EF_TYPE_TRANSPARENT = 0;
this.EF_TYPE_LINEAR_FIXED = 1;
this.EF_TYPE_CYCLIC = 3;
// Structure of files TS 11.11 9.3
this.EF_STRUCTURE_TRANSPARENT = 0;
this.EF_STRUCTURE_LINEAR_FIXED = 1;
this.EF_STRUCTURE_CYCLIC = 3;
// TS 102.221 11.1.1.4.3 Table 11.5: File descriptor byte.
this.UICC_EF_STRUCTURE = {};
this.UICC_EF_STRUCTURE[this.EF_TYPE_TRANSPARENT]= 1;
this.UICC_EF_STRUCTURE[this.EF_TYPE_LINEAR_FIXED]= 2;
this.UICC_EF_STRUCTURE[this.EF_TYPE_CYCLIC]= 6;
this.UICC_EF_STRUCTURE[this.EF_STRUCTURE_TRANSPARENT]= 1;
this.UICC_EF_STRUCTURE[this.EF_STRUCTURE_LINEAR_FIXED]= 2;
this.UICC_EF_STRUCTURE[this.EF_STRUCTURE_CYCLIC]= 6;
// Status code of EFsms
// see 3GPP TS 51.011 clause 10.5.3

View File

@ -12281,8 +12281,8 @@ BerTlvHelperObject.prototype = {
};
// byte 5 ~ 7 are mandatory for linear fixed and cyclic files, otherwise
// they are not applicable.
if (fileStructure === UICC_EF_STRUCTURE[EF_TYPE_LINEAR_FIXED] ||
fileStructure === UICC_EF_STRUCTURE[EF_TYPE_CYCLIC]) {
if (fileStructure === UICC_EF_STRUCTURE[EF_STRUCTURE_LINEAR_FIXED] ||
fileStructure === UICC_EF_STRUCTURE[EF_STRUCTURE_CYCLIC]) {
fileDescriptor.recordLength = (GsmPDUHelper.readHexOctet() << 8) +
GsmPDUHelper.readHexOctet();
fileDescriptor.numOfRecords = GsmPDUHelper.readHexOctet();
@ -12502,7 +12502,7 @@ ICCIOHelperObject.prototype = {
this.context.RIL.iccIO(options);
}).bind(this);
options.type = EF_TYPE_LINEAR_FIXED;
options.structure = EF_STRUCTURE_LINEAR_FIXED;
options.pathId = this.context.ICCFileHelper.getEFPath(options.fileId);
if (options.recordSize) {
readRecord(options);
@ -12544,7 +12544,7 @@ ICCIOHelperObject.prototype = {
" or recordNumber " + options.recordNumber);
}
options.type = EF_TYPE_LINEAR_FIXED;
options.structure = EF_STRUCTURE_LINEAR_FIXED;
options.pathId = this.context.ICCFileHelper.getEFPath(options.fileId);
let cb = options.callback;
options.callback = function callback(options) {
@ -12569,7 +12569,7 @@ ICCIOHelperObject.prototype = {
* The callback function shall be called when failure.
*/
loadTransparentEF: function(options) {
options.type = EF_TYPE_TRANSPARENT;
options.structure = EF_STRUCTURE_TRANSPARENT;
let cb = options.callback;
options.callback = function callback(options) {
options.callback = cb;
@ -12654,13 +12654,15 @@ ICCIOHelperObject.prototype = {
let iter = Iterator(berTlv.value);
let tlv = BerTlvHelper.searchForNextTag(BER_FCP_FILE_DESCRIPTOR_TAG,
iter);
if (!tlv || (tlv.value.fileStructure !== UICC_EF_STRUCTURE[options.type])) {
throw new Error("Expected EF type " + UICC_EF_STRUCTURE[options.type] +
if (!tlv ||
(tlv.value.fileStructure !== UICC_EF_STRUCTURE[options.structure])) {
throw new Error("Expected EF structure " +
UICC_EF_STRUCTURE[options.structure] +
" but read " + tlv.value.fileStructure);
}
if (tlv.value.fileStructure === UICC_EF_STRUCTURE[EF_TYPE_LINEAR_FIXED] ||
tlv.value.fileStructure === UICC_EF_STRUCTURE[EF_TYPE_CYCLIC]) {
if (tlv.value.fileStructure === UICC_EF_STRUCTURE[EF_STRUCTURE_LINEAR_FIXED] ||
tlv.value.fileStructure === UICC_EF_STRUCTURE[EF_STRUCTURE_CYCLIC]) {
options.recordSize = tlv.value.recordLength;
options.totalRecords = tlv.value.numOfRecords;
}
@ -12716,15 +12718,16 @@ ICCIOHelperObject.prototype = {
Buf.PDU_HEX_OCTET_SIZE));
// Read Structure of EF, data[13]
let efType = GsmPDUHelper.readHexOctet();
if (efType != options.type) {
throw new Error("Expected EF type " + options.type + " but read " + efType);
let efStructure = GsmPDUHelper.readHexOctet();
if (efStructure != options.structure) {
throw new Error("Expected EF structure " + options.structure +
" but read " + efStructure);
}
// TODO: Bug 952025.
// Length of a record, data[14].
// Only available for LINEAR_FIXED and CYCLIC.
if (efType == EF_TYPE_LINEAR_FIXED || efType == EF_TYPE_CYCLIC) {
if (efStructure == EF_STRUCTURE_LINEAR_FIXED ||
efStructure == EF_STRUCTURE_CYCLIC) {
options.recordSize = GsmPDUHelper.readHexOctet();
options.totalRecords = options.fileSize / options.recordSize;
} else {

View File

@ -35,7 +35,7 @@ add_test(function test_fcp_template_for_transparent_structure() {
let berTlv = berHelper.decode(tag_test.length);
let iter = Iterator(berTlv.value);
let tlv = berHelper.searchForNextTag(BER_FCP_FILE_DESCRIPTOR_TAG, iter);
do_check_eq(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_TYPE_TRANSPARENT]);
do_check_eq(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_TRANSPARENT]);
tlv = berHelper.searchForNextTag(BER_FCP_FILE_IDENTIFIER_TAG, iter);
do_check_eq(tlv.value.fileId, 0x2FE2);
@ -73,7 +73,7 @@ add_test(function test_fcp_template_for_linear_fixed_structure() {
let berTlv = berHelper.decode(tag_test.length);
let iter = Iterator(berTlv.value);
let tlv = berHelper.searchForNextTag(BER_FCP_FILE_DESCRIPTOR_TAG, iter);
do_check_eq(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_TYPE_LINEAR_FIXED]);
do_check_eq(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_LINEAR_FIXED]);
do_check_eq(tlv.value.recordLength, 0x1A);
do_check_eq(tlv.value.numOfRecords, 0x01);

View File

@ -123,7 +123,7 @@ add_test(function test_icc_io_get_response_for_transparent_structure() {
buf.writeStringDelimiter(strLen);
let options = {fileId: ICC_EF_ICCID,
type: EF_TYPE_TRANSPARENT};
structure: EF_STRUCTURE_TRANSPARENT};
iccioHelper.processICCIOGetResponse(options);
do_check_eq(options.fileSize, 0x0A);
@ -161,7 +161,7 @@ add_test(function test_icc_io_get_response_for_linear_fixed_structure() {
buf.writeStringDelimiter(strLen);
let options = {fileId: ICC_EF_MSISDN,
type: EF_TYPE_LINEAR_FIXED};
structure: EF_STRUCTURE_LINEAR_FIXED};
iccioHelper.processICCIOGetResponse(options);
do_check_eq(options.fileSize, 0x1A);