Home > Dev Tools > Developer Suite > Usability Lab - Zyrcon Cinemas (new) > Step 4 - Pushing information to the Mobile

Step 4 - Pushing information to the Mobile   

pdf Mail Impression

The aim of this step is to:

  • Update the list of current Movies from the Server

After completing this step you will be able to:

  • Simulate the communication between the Server and the Mobile / Card within the end-to-end Simulation Environment
  • Send text and data SMS from the Server Simulator
  • Create a Server Side Scenario used to send Administrative Commands to the Applet

For this, you will use the following tools:

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

 

 

For this step, you will need the files available in the Files needed for this Usability Lab section.

Now that we saw how to modify the generated code, let's replace the whole Applet source code with the final one.  The aim of this Usability Lab is not to teach you how to program an applet but to drive you though the most important features of the Developer Suite.

Creating a new EF to store the list of movies

The list of current movies will be saved in a new EF_4F99 under DF TELECOM. We need to create this File before using the Applet. For this, we will need the following script:

Description APDU
Verify PIN [1234] A0 20 00 01 08 31 32 33 34 FF FF FF FF
Verify ADM2 [ADM_AUTH] A0 20 00 0B 08 41 44 4D 5F 41 55 54 48
Select MF [3F 00] A0 A4 00 00 02 3F 00
Select DF TELECOM [7F 10] A0 A4 00 00 02 7F 10
Create EF 4F99 A0 E0 00 00 10 85 0E 20 0A 4F 99 01 00 01 01 01 11 03 01 01 01
Select MF [3F 00] (release EF 4F99) A0 A4 00 00 02 3F 00

 

We already created this Personalization File for you as STEP_4_CREATE_EF_4F99.atf (in the archive available in the Files needed for this Usability Lab section). Copy it to your Personalization Scripts directory and add it in the run / debug configuration.

This time, we will not add the movies using a Personalization Script. Instead, we will use the Server Simulator to send Administrative Commands to our Applet.

So far, we only used the Mobile Simulator 2G to debug / run our Applet. From now on, we will use the full end-to-end Simulation Environment. Go the run / debug configuration of your project and change the client application to Simulation Chain 2G.

Now, start a debug session, you get access to the whole Simulation Chain 2G:

For this tutorial, we will use the GemXplore Xpresso v3.2 OTA Profile.

Start the Mobile Simulator and the Server Simulator.

Let's try to send a regular SMS to our Mobile Simulator.

Once you press OK, the Mobile Simulator notifies you about the reception of the SMS.

If you double click the New Message icon, you access the Text SMS received by your Mobile Simulator:

And in the Server Simulator, you may see that the SMS has been sent and delivered.

Let's go back to our project. So far, if you choose the 'Movies' STK menu item, nothing happens. The File 4F99 is still empty. We should update the EF 4F99 over the air using the Applet Administrative Commands:

 

Command CLA INS P1 P2 LC DATA
UPDATE_MOVIE 28 01 ID 00 Length Movie Name

This command updates a record inside the 3F00/7F10/4F99 file.

ID: Absolute index of the record to be updated
Length: Length of the Movie Name, in bytes

Response status word:
90 00: The action succeeded.
6F F0: The action failed because the file 4F99 is not found.
6F F1: The action failed because the index is out of range.
6F F2: The action failed because the data length exceeds the record size.

Command CLA INS P1 P2 LC DATA
CLEAR_MOVIE 28 02 ID 00 00 N/A

This command will clear a record inside 3F00/7F10/4F99.

Record index: Absolute index of the record to be deleted
Response status word:
90 00: The action succeeded.
6F F0: The action failed because the file 4F99 is not found.
6F F1: The action failed because the index is out of range.


And here is the list of current movies we would like to add:

Description Length APDU
The Bourne Ultimatum 0x14 54 68 65 20 42 6F 75 72 6E 65 20 55 6C 74 69 6D 61 74 75 6D
Transformers 0x0C 54 72 61 6E 73 66 6F 72 6D 65 72 73
The Simpsons Movie 0x12 54 68 65 20 53 69 6D 70 73 6F 6E 73 20 4D 6F 76 69 65
Live Free or Die Hard 0x15 4C 69 76 65 20 46 72 65 65 20 6F 72 20 44 69 65 20 48 61 72 64


Let's add the first movie from the Server Simulator. For this, we will send a Data SMS and send it to our Applet by specifying its TAR. The easiest is to first use the ASCII mode to input the Movie's name...

And then to switch back to the Hexadecimal mode to add the CLASS, INS, P1, P2 and length of our administrative command. Remember to specify the TAR, which defaults to 52 41 44 in our Developer Suite.

Once we click 'OK', our SMS is automatically sent and we may verify the addition of the Movie using the Mobile Simulator.

Now, if we want to remove this Movie and add the other Movies, we could send another SMS Data. Instead, we might want to use a Scenario. It will make it more readable and easier to modify.

The content of our script is quite simple:

public class UpdateMovieList {

  public void script() {

    ByteStream s = new ByteStream();

    // Remove Movie 1
    s.write("0x2802010000");

    // Add Movie 2: Transformers
    s.write("0x0x280102000C5472616E73666F726D657273");
    //Add Movie 3: The Simpsons Movie
    s.write("0x28010300125468652053696D70736F6E73204D6F766965");
    // Add Movie 4: Live Free or Die Hard
    s.write("0x28010400154C69766520467265"
            + "65206F72204469652048617264");
    passThrough(s);

  }
}

Once we send the scenario to the Mobile, the 4F99 File is updated and the new Movies appear:

 

Next: Step 5 - Pulling some information from the Server