1 Reply Latest reply: Mar 28, 2012 8:26 PM by 922951 RSS

    Java Card Applet

    926887
      Hi Everybody,

      I am a beginner in the this field and trying to explore some things.

      I am trying to develop a applet for a SIM card which will read the LOCI file in the File System and return the current location to the CAD.

      It would be very helpful if you can guide me how to select a file from a java applet and then read the file.

      Thanks a lot in advance.
        • 1. Re: Java Card Applet
          922951
          Dear Anurag ,

          Peace upon you.

          From API:

          The SIMView interface is the interface between the GSM System Services and any applet (SIM Toolkit or other). It offers some methods to communicate with the GSM System Services without compromising the GSM file system integrity (e.g. ME file context, conflicting access to files ...).

          Sample code to read the LOCI file look like this :

          <pre>

          private SIMView theGsmApplet;

          private byte[] buffer;//buffer that will contains the Location Area Information that will be shown on mobile screen

               public ConstructorToYourApplet()
               {     
               
               // get a reference to the GSM interface
          theGsmApplet = SIMSystem.getTheSIMView();

          // create the exchange buffer
          buffer = new byte[5];

                    register();
          }

                    private void read_LOCI_File() {

                    // select file using its path
                    
                    theGsmApplet.select((short)0x3F00);//select MF
                    theGsmApplet.select(SIMView.FID_DF_GSM);//select GSM
                    theGsmApplet.select(SIMView.FID_EF_LOCI);//select LOCI
                    
                    theGsmApplet.readBinary((byte)4,buffer,(byte)0, (byte)5);          
          }

          </pre>


          then use ProactiveHandler inside processToolkit() to send Proactive command "Display Text" to display buffer with MCC value from LOCI file like this:

          ProactiveHandler phandler;

          phandler.initDisplayText((byte) 0x80, (byte) 0x04,buffer, (short) 0, (short)buffer.length);
                    
          phandler.send();



          Hope to be useful

          BR
          Nabil