Overview of Java SIM GSM03.19

來源:互聯網
上載者:User

Sun gave out the specification of the JCDK(2.2.1 or 2.2.2), ETSI gave out the specification Java SIM GSM03.19. GSM03.19 included the java package sim.access and sim.toolkit, with the sim.access, we can access the GSM data and file system, compliant to the GSM11.11. with the sim.toolkit, we can handle the TLV input and output from the SIM card, which is compliant to the GSM11.14, in one word, by using GSM03.19, we can do all the things Native STK program previously can do. let's have a brief overview about this.

 

First we have to import the package.

import sim.toolkit.*;
import sim.access.*;
import javacard.framework.*;

Easy example about the sim.access

 

Declare the SIMview instance, sim.access.SIMView, the instance name is gsmFile.

private SIMView gsmFile;

if we want to read the SMSP(The SMS center, 6F42) in the SIM card, we can do as below,

gsmFile.select(SIMView.FID_DF_TELECOM );
gsmFile.select(SIMView.FID_EF_SMSP);
gsmFile.readRecord((short)0x01,(byte)0x04,(short)0x18,Alphalength, (short)0x00, (short)0x01);                                           
gsmFile.readRecord((short)0x01,(byte)0x04,(short)0x19,byteArrayBuffer, (short)0x00, (short)(Alphalength[0]));

the SMSP will be stored in the byte Array 'byteArrayBuffer' which was declared in advance.

Easy example about the sim.toolkit

Declare the Handler instance, 

ProactiveHandler proHdlr = ProactiveHandler.getTheHandler();

We can construct SMS APDU by below methods,

proHdlr.init((byte) PRO_CMD_SEND_SHORT_MESSAGE, (byte)0x00, (byte)DEV_ID_NETWORK);
proHdlr.appendArray(AlphaBuffer, (short)0x0, (short)0x2);              
proHdlr.appendTLV((byte)(ToolkitConstants.TAG_ADDRESS), byteArrayBuffer,
                  (short)0, (short)(Alphalength[0]));
proHdlr.appendTLV((byte)(ToolkitConstants.TAG_SMS_TPDU), TPDU,
                  (short)0, (short)(byteBuffer));                                         
proHdlr.send();

There are 6 Handler we can use in GSM03.19, we can find more detail in the specs, here give the inheritance structure of the 6 Handler.

java.lang.Object
  |
  +--sim.toolkit.ViewHandler
        |
        +--sim.toolkit.EditHandler
              |
              +--sim.toolkit.EnvelopeResponseHandler
 
java.lang.Object
  |
  +--sim.toolkit.ViewHandler
        |
        +--sim.toolkit.EditHandler
              |
              +--sim.toolkit.ProactiveHandler
 
java.lang.Object
  |
  +--sim.toolkit.ViewHandler
        |
        +--sim.toolkit.EnvelopeHandler
 
java.lang.Object
  |
  +--sim.toolkit.ViewHandler
        |
        +--sim.toolkit.ProactiveResponseHandler

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.