The Iccrecords of UICC

Source: Internet
Author: User
similar to Iccfilehandler, Uicccardapplication also creates different Iccrecords objects based on the current SIM type, the difference between this object and the Iccfilehandler is that Iccfilehandler is a SIM file system for manipulating objects, while Iccrecords is the SIM store content as the object of operation (Iccfilehandler emphasis on the underlying implementation, iccrecords emphasis on the upper level application)
The following are the different subclass objects of Iccrecords: [Java] View plain copy @UiccCardApplication .java   private iccrecords createiccrecords (apptype  TYPE, CONTEXT C, COMMANDSINTERFACE CI)  {       if  ( type == apptype.apptype_usim | |  type == apptype.apptype_sim)  {            return new simrecords (THIS, C, CI);       } else  if  (type == apptype.apptype_ruim | |  type == apptype.apptype_csim) {            Return new ruimrecords (THIS, C, CI);       } else  if  (Type == apptype.apptype_isim)  {            return new isimuiccrecords (THIS, C, CI);       }  else {           return null;       }   }  

We still pick the typical simrecords to analyze.


first, the main role of Simrecords


Let's look at the main public methods it provides:[Java] View plain Copy Public string getimsi ()  {}   public string getmsisdnnumber ()  {}   public string getgid1 ()  {}   public usimservicetable  Getusimservicetable ()  {}   Public void setmsisdnnumber (string alphatag,  String number, message oncomplete)  {}   Public string getmsisdnalphatag ()  {}   public string getvoicemailnumber ()  {}   public void  Setvoicemailnumber (string alphatag, string voicenumber, message oncomplete)  {}    Public string getvoicemailalphatag () {}   public void  Setvoicemessagewaiting (int line, int countwaiting)  {}   public boolean  Getvoicecallforwardingflag ()  {}   public string getoperatornumeric ()  {}    PUBLIC INT GEtdisplayrule (STRING PLMN)  {}   public boolean iscspplmnenabled ()  {}            Take a look at the public method provided by its integrated parent class Iccrecords: [Java] View plain Copy Public adnrecordcache getadncache ()  {}   public string geticcid ()  {}   Public void setimsi (string imsi)  {}   public string  getserviceprovidername ()  {}   public boolean getvoicemessagewaiting ()  {}    public int getvoicemessagecount ()  {}   public boolean  getrecordsloaded ()  {}   Public void setvoicecallforwardingflag (int line,  Boolean enable, string number)  {}   public boolean isprovisioned  ( )  {}   public isimrecords getisimrecords ()  {}   public void  Registerforrecordsloaded (handler h, int what, object obj)  {}   public  void registerforimsiready (handler h, int what, object obj)  {}    PUBLIC VOid registerforrecordsevents (handler h, int what, object obj)  {}    Public void registerfornewsms (handler h, int what, object obj)  { }   public void registerfornetworkselectionmodeautomatic ( Handler h, int  what, object obj)  {}           from these methods, the main functions of iccrecords are divided into two parts:
1, provide the SIM card commonly used information inquiry, including IMSI, voicemail, ICCID, simrecords and so on information;

2, register common information listener, including Simrecords, IMSI, Recordevents, Newsms, networkselection and other events;


second, the creation of simrecords process


From its inheritance the relationship can be seen that hisNature is also handler[Java]View plain copy public class Simrecords extends Iccrecords {} public abstract class Iccrecords extends Handler implement S iccconstants {} then look at his constructor:[Java] View Plain copy public simrecords (uicccardapplication app, context c, commandsinterface  CI)  {       //Initializes variables such as MCI, MFH, and so on in the parent class         Super (APP, C, CI);          //Create ADN cache for working with SIM contacts        madncache = new adnrecordcache (mFh);           //Create voicemail Cache        mVmConfig = new  Voicemailconstants ();       mspnoverride = new spnoverride ();           mrecordsrequested = false;  // no  load request is made till SIM ready        mrecordstoload = 0;          mci.setonsmsonsim (this,  Event_sms_on_sim, null);       mci.registerforiccrefresh (this, event_sim_refresh, null);           //Initialize member variables        resetrecords ();        //Monitor Uicccardapplication's ready status         Mparentapp.registerforready (this, event_app_ready, null);  }         The creation process of   above has completed two important tasks:
1, create ADN and voicemail cache, where the ADN cache for SIM card contacts of the increase, delete, change, check and other functions;

2, monitor the ready state of uicccardapplication;


third, the update process of Simrecords


When the listening uicccardapplication sends the ready state, simrecords updates its own ADN and voicemail caches:[Java] View plain Copy protected void fetchsimrecords ()  {        mrecordsrequested = true;          //get SIM card imsi       mci.getimsiforapp (Mparentapp.getaid (),  obtainmessage (EVENT_GET_IMSI_DONE));        mRecordsToLoad++;          //get SIM card iccid        mfh.loadeftransparent (Ef_iccid, obtainmessage (Event_get_iccid_done));        mRecordsToLoad++;          new  Adnrecordloader (mFh). LOADFROMEF (Ef_msisdn, ef_ext1, 1, obtainmessage (EVENT_GET_MSISDN_DONE));        mRecordsToLoad++;          // Update voicemail       mfh.loadeflinearfixed (Ef_mbi, 1, obtainmessage (EVENT_ Get_mbi_done));       mRecordsToLoad++;           Mfh.loadeftransparent (Ef_ad, obtainmessage (event_get_ad_done));        mrecordstoload++;          // Record number is  subscriber profile       mfh.loadeflinearfixed (EF_MWIS, 1,  Obtainmessage (Event_get_mwis_done));       mRecordsToLoad++;           mfh.loadeftransparent ( ef_voice_mail_indicator_cphs, obtainmessage ( Event_get_voice_mail_indicator_cphs_done));       mRecordsToLoad++;       mfh.loadeflinearfixed (Ef_cfis, 1, obtainmessage (EVENT_GET_CFIS_DONE));        mRecordsToLoad++;       mfh.loadeftransparent (ef_ Cff_cphs, obtainmessage (evenT_get_cff_done));       mRecordsToLoad++;        GETSPNFSM (true, null);       mfh.loadeftransparent (EF_SPDI,  Obtainmessage (Event_get_spdi_done));       mRecordsToLoad++;        mfh.loadeflinearfixed (Ef_pnn, 1, obtainmessage (event_get_pnn_done));       mRecordsToLoad++;       mfh.loadeftransparent (EF_SST,  obtainmessage (Event_get_sst_done));       mRecordsToLoad++;       mfh.loadeftransparent (Ef_info_cphs, obtainmessage (EVENT_GET_INFO_CPHS_DONE));        mRecordsToLoad++;       mfh.loadeftransparent (Ef_csp_cphs,obtainmessage (Event_get_csp_cphs_done));       mRecordsToLoad++;       &NBSp;mfh.loadeftransparent (Ef_gid1, obtainmessage (event_get_gid1_done));        mRecordsToLoad++;  }  

As can be seen from the above,the simrecords update process is to use Iccfilehandler SIM card information, read and save , including IMSI and iccid information.


Iv. setting and reading of voicemail


Since voicemail's numbers and names are more commonly used, we specifically look at the following voicemail read and update mechanisms.
First of all, the use of voice mail: voice mail needs and call forwarding to match each other to use , through call forwarding to set the conditions triggering the voicemail. For example, you can set the "No answer transfer" to voicemail, so that when there is a call, if there is no answer for a long time, the operator will be transferred to a pre-set voice mail, and then accept the call audio, and the user to play voice mail to the user.
and the voice mailbox number of different operators is not fixed, some operators voice mail number is fixed, some can let users set up, for China Mobile, a region of the voice mail is the same.
In this case, Google design, the source of voicemail can be two places, one is read from the SIM card, that is, the operator in the SIM card presets. Another is read from the built-in configuration file, that is, for some commonly used operators, if their voicemail is fixed, then can be directly preset in the code, because the operator's voicemail number is known to be fixed, so the user is unable to modify the voice mailbox number .

The second approach allows for richer custom operations. Let's look at these two ways separately.


4.1. Read voicemail information from SIM card

There are two places in the SIM card that can store voicemail information (EF_MBDN, ef_mailbox_cphs), and we can retrieve the voicemail storage location by reading the Ef_mbi partition. As previously analyzed, simrecords updates simrecords information after receiving a ready notification from uicccardapplication, including requesting storage location information for the voicemail in the SIM from the modem:[Java]View plain copy @SIMRecords. Java protected void Fetchsimrecords () {//Update voicemail mfh.loadeflinearfixed (ef_m       BI, 1, Obtainmessage (Event_get_mbi_done));   mrecordstoload++; When the information in Ef_mbi is received, it is parsed by Handlemessage ():[Java] View Plain copy public void handlemessage (message msg)  {        switch  (msg.what)  {           case event_get_ mbi_done:               boolean  isvalidmbdn;                isrecordloadresponse = true;                ar =  (AsyncResult) msg.obj;                data =  (byte[])  ar.result;                isValidMbdn = false;                if  (ar.exception == null)  {                   mmailboxindex = data[0]  & 0xff;                    if  (MMAILBOXINDEX != 0 && MMAILBOXINDEX != 0XFF)  {                        //Get voicemail storage location                         isValidMbdn = true;                    }                }                mRecordsToLoad += 1;                  if  (ISVALIDMBDN)  {                    // note: mbdn  was not included in NUM_OF_SIM_RECORDS_LOADED                    //reading the voicemail   in EF_MBDN                 new  Adnrecordloader (mFh). LOADFROMEF (Ef_mbdn, ef_ext6, mmailboxindex, obtainmessage (EVENT_GET_MBDN_ Done));               } else {                    // Read voicemail               in ef_mailbox_cphs      New adnrecordloader (mFh). LOADFROMEF (Ef_mailbox_cphs, ef_ext1, 1, obtainmessage (EVENT_GET_ Cphs_mailbox_done));               }                break;        }  }           We see that, after parsing the return value, we get the storage location of the voicemail, Then to the modem to apply for the location of the voicemail information, when received the modem feedback, will again enter the Handlemessage () Resolved: [Java] View Plain copy public void handlemessage (message msg)  {        switch  (msg.what)  {           case event_get_ cphs_mailbox_done:           case event_get_mbdn_done:                mVoiceMailNum =  null;               mvoicemailtag =  null;                isrecordloadresponse = true;                ar =  (AsyncResult) msg.obj;                adn =  (Adnrecord) ar.result;                   if  (Adn.isempty ()  && msg.what == event_get_mbdn_ Done)  {                    mRecordsToLoad += 1;             &

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.