From c65efc9f009bcff85753334b6f499f44e04cb54e Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Tue, 16 Jun 2015 17:29:50 +0800 Subject: [PATCH] Bug 1114937 - Part 1: Define new IDL for IccContacts. r=echen --- dom/icc/interfaces/moz.build | 1 + dom/icc/interfaces/nsIIccContact.idl | 60 ++++++++++++++++++++++++ dom/icc/interfaces/nsIIccService.idl | 69 ++++++++++++++++++++++++++-- 3 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 dom/icc/interfaces/nsIIccContact.idl diff --git a/dom/icc/interfaces/moz.build b/dom/icc/interfaces/moz.build index 5654a2051930..ddc3f86defc4 100644 --- a/dom/icc/interfaces/moz.build +++ b/dom/icc/interfaces/moz.build @@ -5,6 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. XPIDL_SOURCES += [ + 'nsIIccContact.idl', 'nsIIccInfo.idl', 'nsIIccProvider.idl', # TODO: Bug 815526, deprecate RILContentHelper. 'nsIIccService.idl', diff --git a/dom/icc/interfaces/nsIIccContact.idl b/dom/icc/interfaces/nsIIccContact.idl new file mode 100644 index 000000000000..9bc4bee25820 --- /dev/null +++ b/dom/icc/interfaces/nsIIccContact.idl @@ -0,0 +1,60 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(0f3dbcd1-9f7b-40a8-aa3c-b5701978ec53)] +interface nsIIccContact : nsISupports +{ + /** + * The unique identifier of this ICC Contact. + * + * Note: This id is composed of the iccid and its record index of EF_ADN. + */ + readonly attribute DOMString id; + + /** + * Name list. + * + * The container of Alpha-Id in EF_ADN and Second Name in EF_SNE of this contact, + * where EF_SNE provides the possibility to store a name in different language. + * + * @see 10.2.1 Support of two name fields per entry, 3GPP TS 21.111. + * + * @param aCount + * The number of names. + * + * @returns the array of names. + */ + void getNames([optional] out unsigned long aCount, + [array, size_is(aCount), retval] out wstring aNames); + + /** + * Phone number list. + * + * The container of the dialing numbers of this contact in EF_ADN and EF_ANR. + * + * @see 10.2.2 Support of multiple phone numbers per entry, 3GPP TS 21.111. + * + * @param aCount + * The number of phone numbers. + * + * @returns the array of phone numbers. + */ + void getNumbers([optional] out unsigned long aCount, + [array, size_is(aCount), retval] out wstring aNumbers); + + /** + * Email list. + * + * The container of the emails of this contact in EF_EMAIL. + * + * @param aCount + * The number of emails. + * + * @returns the array of emails. + */ + void getEmails([optional] out unsigned long aCount, + [array, size_is(aCount), retval] out wstring aEmails); +}; \ No newline at end of file diff --git a/dom/icc/interfaces/nsIIccService.idl b/dom/icc/interfaces/nsIIccService.idl index dc82af4d38d5..b3ca9cac8150 100644 --- a/dom/icc/interfaces/nsIIccService.idl +++ b/dom/icc/interfaces/nsIIccService.idl @@ -5,6 +5,7 @@ #include "nsISupports.idl" interface nsIIcc; +interface nsIIccContact; interface nsIIccInfo; interface nsIStkDownloadEvent; interface nsIStkProactiveCmd; @@ -22,7 +23,7 @@ interface nsIIccListener : nsISupports /** * A callback interface for handling asynchronous response. */ -[scriptable, uuid(b0e2899a-adc3-11e4-89cf-1b60eaa35b06)] +[scriptable, uuid(b7b0623f-fb2c-4cec-b0dc-00ac2fe7b296)] interface nsIIccCallback : nsISupports { /** @@ -45,9 +46,28 @@ interface nsIIccCallback : nsISupports */ void notifyGetCardLockRetryCount(in long aCount); + /** + * The success callback of |readContacts|. + * + * @param aContacts + * The list of contacts retrieved from ICC. + * @param aCount + * The number of contacts retrieved from ICC. + */ + void notifyRetrievedIccContacts([array, size_is(aCount)] in nsIIccContact aContacts, + in uint32_t aCount); + + /** + * The success callback of |updateContact|. + * + * @param aContact + * The contact with the updated result. + */ + void notifyUpdatedIccContact(in nsIIccContact aContact); + /** * The error callback of |getCardLockEnabled|, |getCardLockRetryCount|, - * |matchMvno|, and |getServiceStateEnabled|. + * |matchMvno|, |getServiceStateEnabled|, |readContacts| and |updateContact|. * * @param aErrorMsg * The error message. @@ -138,7 +158,7 @@ NS_CreateIccService(); /** * XPCOM component that provides the access to the selected ICC. */ -[scriptable, uuid(6ded322c-fadd-11e4-9cb6-3f4fc3f241d3)] +[scriptable, uuid(1791f102-b081-4435-8555-37eb035fa4e2)] interface nsIIcc : nsISupports { /** @@ -235,6 +255,15 @@ interface nsIIcc : nsISupports */ const unsigned long CARD_SERVICE_FDN = 0; + /** + * Icc Contact Type Constants + * + * Note: MUST be matched with enum IccContactType in MozIcc.webidl! + */ + const unsigned long CONTACT_TYPE_ADN = 0; + const unsigned long CONTACT_TYPE_FDN = 1; + const unsigned long CONTACT_TYPE_SDN = 2; + /** * Called to register icc-related changes. * @@ -472,4 +501,38 @@ interface nsIIcc : nsISupports * The event that ICC listening to in STK_CMD_SET_UP_EVENT_LIST. */ void sendStkEventDownload(in nsIStkDownloadEvent aEvent); + + /** + * Read Specified type of Contact from ICC. + * + * @param aContactType + * One of CONTACT_TYPE_*. + * + * @param aCallback + * An instance of nsIIccCallback: + * nsIIccCallback::notifyRetrievedIccContacts() if success. + * nsIIccCallback::notifyError(), otherwise. + */ + void readContacts(in unsigned long aContactType, + in nsIIccCallback aCallback); + + /** + * Update Specified type of Contact in ICC. + * + * @param aContactType + * One of CONTACT_TYPE_*. + * @param aContact + * an nsIIccContact instance with information to be updated. + * @param aPin2 (Optional) + * The PIN2 required to update FDN contact. + * + * @param aCallback + * An instance of nsIIccCallback: + * nsIIccCallback::notifyUpdatedIccContact() if success. + * nsIIccCallback::notifyError(), otherwise. + */ + void updateContact(in unsigned long aContactType, + in nsIIccContact aContact, + in DOMString aPin2, + in nsIIccCallback aCallback); };