简体   繁体   English

Sim Application Toolkit - 无法在选择时显示文本(实际上没有)

[英]Sim Application Toolkit - cant display text (actually nothing) on selection

I try to develop a Sim Application Toolkit Applet.. Many simple examples found in internet, but no success.. 我尝试开发一个Sim Application Toolkit Applet。在互联网上发现了许多简单的例子,但没有成功..

The problem is; 问题是; My menu entry comes in the STK menu, but if I select it, nothing happens.. I try to display text on event EVENT_MENU_SELECTION. 我的菜单条目来自STK菜单,但如果我选择它,则没有任何反应..我尝试在事件EVENT_MENU_SELECTION上显示文本。 (Actually not only displaying text, also sms, ussd, sub items doesn't work too..) (实际上不仅显示文本,还有短信,ussd,子项也不起作用..)

  • I have real sim cards from the manufacturer to develop and test some applets with the auth keys. 我有来自制造商的真实SIM卡,用auth键开发和测试一些applet。
  • I test it on a Android 2.3 NFC smartphone. 我在Android 2.3 NFC智能手机上测试它。
  • To load the applet into SIM, I use ACR1281U as reader and Giesecke & Devrient JLoad 2.3.0 as loader. 要将小程序加载到SIM中,我使用ACR1281U作为阅读器,使用Giesecke&Devrient JLoad 2.3.0作为加载程序。
  • In the Sim Toolkit is default a menu entry, working fine. 在Sim Toolkit中默认是一个菜单项,工作正常。

Here is my sample code.. Hope anybody has an idea.. (Maybe some specific install parameter on loading applet?) 这是我的示例代码..希望任何人都有一个想法..(可能在加载applet时有一些特定的安装参数?)

Thanks in advance, Kutschka 先谢谢Kutschka

package proactive_cmd;

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

public class display_text extends Applet 
  implements ToolkitConstants, ToolkitInterface
{
  private static final byte CMD_QUALIFIER = (byte)0x80;

  private byte[] menuEntry = {'M','y','M','e','n','u'};
  private byte[] textBuf = {'H','e','l','l','o'};

  private ToolkitRegistry reg;
  private SIMView gsmFile;

  public display_text() {
    //Get the GSM application reference
    gsmFile = SIMSystem.getTheSIMView();

    reg = ToolkitRegistry.getEntry();

    reg.initMenuEntry(menuEntry,
                      (short) 0, 
                      (short) menuEntry.length,
                      PRO_CMD_DISPLAY_TEXT,
                      false,
                      (byte) 0,
                      (short) 0);
  }

  public static void install(byte[] bArray, short bOffset, byte bLength)
    throws ISOException
  {

    display_text dt = new display_text();
    dt.register();
  }

  public void processToolkit(byte event)
    throws ToolkitException
  {
    ProactiveHandler ph = ProactiveHandler.getTheHandler();

    if (event == EVENT_MENU_SELECTION) {


       ph.init((byte) PRO_CMD_DISPLAY_TEXT, (byte) CMD_QUALIFIER, DEV_ID_DISPLAY);
       ph.appendTLV((byte)(TAG_TEXT_STRING | TAG_SET_CR),
                    textBuf,
                    (short) 0, 
                    (short) textBuf.length);
      ph.send();
    }
  }


  public void process(APDU apdu) {
    if (selectingApplet()) {
      return;
    }
  }

}

In order to use STK commands you have to properly install your applet. 要使用STK命令,您必须正确安装applet。 For SIM Toolkit it has to be CA tag in INSTALL MAKE SELECTABLE command. 对于SIM Toolkit,它必须是INSTALL MAKE SELECTABLE命令中的CA标记。 If you'll use UICC toolkit you have to use EA tag. 如果您将使用UICC工具包,则必须使用EA标记。 Please refer to ETSI 102 226 standard for full details. 有关详细信息,请参阅ETSI 102 226标准

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM