Home > Dev Tools > Developer Suite > Usability Lab - Zyrcon Cinemas (new) > Step 2 - It works out of the box!

Step 2 - It works out of the box!   

pdf Mail Impression

The aim of this step is to:

  • Generate the basic structure of our Applet for Zyrcon Company.

After completing this step you will be able to:

  • Create a Java Card Project
  • Generate a SIM Toolkit Applet
  • One-click run and debug your Applet with the Mobile Simulator

For this, you will use the following tools:

  • Developer Suite (Eclipse)
  • Card Simulator SIM R5
  • Mobile Simulator 2G

 

 

 

Creation of a Java Card Project

 

The creation of a new Java Card Project is easily started, from the Application Wizards View, by clicking on Java Card Project.

 

You may also start the Creation of the Java Card Project from the File Menu of Eclipse, click on 'New' and then on 'Project...'. Choose the Java Card Project to continue with the Java Card Project creation Wizard.

Now, we will define the important properties of our Project, starting with its name.

Then, we input its Package name and Package AID. For this example, we keep the default Package AID.

On the next page, you have to select the target card. Our example will target SIM Card R5, available in the Free Evaluation.

Now, we could decide to generate our project based on some default templates/examples. For this Usability Lab, we will start from scratch and therefore skip this step.

While creating the Java Card Project, you may already define a Personalization Script that would be run before loading the Project's Applets.

Once you will have developed your Applet, you will need to test and debug it. For this, you will need a Test Application to stimulate the Applet. The Developer Suite provides a full range of Test Applications. For the moment, you may continue with the default, the Mobile Simulator GSM.

You might also want to define some additional Export Files, Class Path or Source Path if your Card has additional functionalities, not defined in the Standard Specification. For this Project, we will keep these settings empty.

Click Finish and wait for your project to be generated.

Note that you could have stopped at any of the Wizard Pages by clicking Finish. The defaults would have been used, providing you with a default working Java Card Project.

 

Creation of a SIM Toolkit Applet

 

Now that we have a Java Card Project, we may proceed with the creation of our Toolkit Applet. Some additional buttons appeared in the Application Wizards View. If you cannot see them, make sure you selected your Java Card Project in the Package Explorer. Click on Toolkit Applet.

Creating a Toolkit Applet is as easy as creating the Java Card Project. You could also directly click on Finish to get a working default Toolkit Applet but we will spend some time with the wizard, already specifying the structure of our Applet for the Zyrcon Cinemas.

Our Applet's name is ZyrconCinemas and we keep the default value for the Applet AID. The Package has been defined before for the whole Java Card Project.

We will also keep the default Instance AID.

The next Wizard page gets more interesting. Here, we may start describing the structure of our Toolkit Applet. Which Toolkit Events will trigger our Applet? From the description of the Zyrcon Cinemas Wireless Solution, we see that our Applet will be triggered either by a Menu Selection or by the reception of a Formatted SMS PP Envelope.

In the next Wizard Page, we may further define the Installation Parameters. Amongst them is the Menu Item Structure for this Applet. For our Zyrcon Applet, let's define we need 2 Menu Items.

We will keep the Position defaulted to zero as we will not need it in this example. It will be managed by the Card OS. So, in the next Wizard Page, we just give the names of the two Menu Items: 'Cinemas' and 'Movies'.

We still have no Personalization Script we want to run.

So, let's click Finish to start the auto-generation of our Toolkit Applet's source code.

The Java Source File of our Applet has been generated in our Java Card Project.

 

One-click Debug

 

If we select it in the Package Explorer, the One-Click Debug and One-Click Run button are enabled in the Toolbar.

 

Let's click on the One-Click Debug button. The Card Simulator Starts...

And the ZyrconCinemas Applet is loaded.

Then, the Mobile Simulator (defined as the default Test Application for our Project) starts.

 

 

We now have our Mobile Simulator. Let's enter the PIN Code, 1234 for the Card Simulator.

Now, we have access to the STK Menu in our Mobile Simulator.

That's where we will access our Applet's Menu. Let's click the OK button (green handset icon) to open the STK Applications menu.

If we select the 'Cinemas' menu by pressing the OK button, 'Cinemas' is displayed on the Mobile Simulator Screen.

What happened? In the trace at the right side of the Mobile Simulator GUI, we see that a DISPLAY TEXT Proactive Command has been issued to the Mobile with a Normal Priority and a Clearing after a delay.

We started the Applet within the Card Simulator, using the Mobile Simulator as the Test Application... in Debug Mode!

So, let's go back to Eclipse, inspect the generated source code and insert a breakpoint when the 'Cinemas' Menu is selected. The 'Cinemas' menu corresponds to the idMenu1 in the code. Double click at the left of the menu1Action method call to add a breakpoint.

Let's continue with the Mobile Simulator, no need to restart the Debug Session. We select the STK Applications menu again and then the 'Cinemas' menu item. As expected, we reach the breakpoint and Eclipse proposes to switch to the Debug Perspective.

We may now use the Debug Toolbar to Step Into the menu1Action method.

We discover that the menu1Action method only DISPLAYS TEXT the name of the first menu item.

Resume the normal execution of your Applet.

Power Off the Mobile Simulator and close its GUI.

Back in Eclipse, switch to the Developer Suite Perspective.

Don't forget to stop the Card Simulator.

Now, it's time to add your own business logic inside your Applet...

Next : Step 3 - Building the Menu Structure from a File