Bug 809725 - Part 1: Add readEmail and readIAP in ICCRecordHelper. r=allstars.chh

This commit is contained in:
Edgar Chen 2013-01-31 15:34:55 +08:00
Родитель 27cd3a543c
Коммит 3818cf8d15
1 изменённых файлов: 76 добавлений и 0 удалений

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

@ -9149,6 +9149,82 @@ let ICCRecordHelper = {
onerror: onerror});
},
/**
* Read ICC EF_IAP. (Index Administration Phonebook)
*
* @see TS 131.102, clause 4.4.2.2
*
* @param fileId EF id of the IAP.
* @param recordNumber The number of the record shall be loaded.
* @param onsuccess Callback to be called when success.
* @param onerror Callback to be called when error.
*/
readIAP: function readIAP(fileId, recordNumber, onsuccess, onerror) {
function callback(options) {
let strLen = Buf.readUint32();
let octetLen = strLen / 2;
let iap = GsmPDUHelper.readHexOctetArray(octetLen);
Buf.readStringDelimiter(strLen);
if (onsuccess) {
onsuccess(iap);
}
}
ICCIOHelper.loadLinearFixedEF({fileId: fileId,
recordNumber: recordNumber,
callback: callback.bind(this),
onerror: onerror});
},
/**
* Read USIM Phonebook EF_EMAIL.
*
* @see TS 131.102, clause 4.4.2.13
*
* @param fileId EF id of the EMAIL.
* @param fileType The type of the EMAIL, one of the ICC_USIM_TYPE* constants.
* @param recordNumber The number of the record shall be loaded.
* @param onsuccess Callback to be called when success.
* @param onerror Callback to be called when error.
*/
readEmail: function readEmail(fileId, fileType, recordNumber, onsuccess, onerror) {
function callback(optoins) {
let strLen = Buf.readUint32();
let octetLen = strLen / 2;
let email = null;
// Read contact's email
//
// | Byte | Description | Length | M/O
// | 1 ~ X | E-mail Address | X | M
// | X+1 | ADN file SFI | 1 | C
// | X+2 | ADN file Record Identifier | 1 | C
// Note: The fields marked as C above are mandatort if the file
// is not type 1 (as specified in EF_PBR)
if (fileType == ICC_USIM_TYPE1_TAG) {
email = GsmPDUHelper.read8BitUnpackedToString(octetLen);
} else {
email = GsmPDUHelper.read8BitUnpackedToString(octetLen - 2);
// Consumes the remaining buffer
Buf.seekIncoming(2 * PDU_HEX_OCTET_SIZE); // For ADN SFI and Record Identifier
}
Buf.readStringDelimiter(strLen);
if (onsuccess) {
onsuccess(email);
}
}
ICCIOHelper.loadLinearFixedEF({fileId: fileId,
recordNumber: recordNumber,
callback: callback.bind(this),
onerror: onerror});
},
/**
* Read the PLMNsel (Public Land Mobile Network) from the ICC.
*