TC65 JAVA User's Guide Siemens Cellular Engine Version: DocID: 05 TC65 JAVA User's Guide_V05 JAVA™ Users Guide s
s TC65 JAVA User's Guide Strictly confidential / Released Document Name: TC65 JAVA User's Guide Version: 05 Date: September 26, 2005 DocId: TC65 JAVA User's Guide_V05 Status: Strictly confidential / Released General Notes Product is deemed accepted by recipient and is provided without interface to recipient’s products. The documentation and/or product are provided for testing, evaluation, integration and information purposes.
s TC65 JAVA User's Guide Strictly confidential / Released Table of Contents 1 Preamble ........................................................................................................................8 2 Overview ........................................................................................................................9 3 4 2.1 Related Documents ...............................................................................................9 2.2 Terms and Abbreviations.........
s TC65 JAVA User's Guide Strictly confidential / Released 5 6 7 8 Maintenance ................................................................................................................24 5.1 IP Service ............................................................................................................24 5.2 Power Saving.......................................................................................................25 5.3 Charging ................................................
s TC65 JAVA User's Guide Strictly confidential / Released 8.4 Short Message Format ........................................................................................41 8.5 Java File Format ..................................................................................................42 8.6 Procedures ..........................................................................................................43 8.6.1 Install/Update .................................................................
s TC65 JAVA User's Guide Strictly confidential / Released 11.4 Structure and Description of the Java Security Commands ................................76 11.4.1 Structure of the Java Security Commands ............................................77 11.4.2 Build Java Security Command...............................................................78 11.4.3 Send Java Security Command to the Module........................................79 11.5 Create a Java Security Environment Step by Step....................
s TC65 JAVA User's Guide Strictly confidential / Released Figure 22: Sun Java Studio Mobility 6 - Switching Emulators ................................................ 55 Figure 23: Sun Java Studio Mobility 6 - Project Manager ..................................................... 56 Figure 24: Sun Java Studio Mobility 6 - Selecting a template ............................................... 57 Figure 25: JBuilderX – JDK settings................................................................................
s TC65 JAVA User's Guide Strictly confidential / Released 1 Preamble This document is also valid for the TC65 Terminal with the main exception that the terminal does not feature the USB, ASC1, DAC and DAI interface. For other exceptions and differences please see [3] and [4]. TC65 JAVA User's Guide_V05 Page 8 of 90 26.09.
s TC65 JAVA User's Guide Strictly confidential / Released 2 Overview The TC65 module features an ultra-low profile and low-power consumption for data (CSD and GPRS), voice, SMS and fax. Java technology and several peripheral interfaces on the module allow you to easily integrate your application. This document explains how to work with the TC65 module, the installation CD and the tools provided on the installation CD.
s TC65 JAVA User's Guide Strictly confidential / Released 2.
s TC65 JAVA User's Guide Strictly confidential / Released 3 Installation 3.1 System Requirements The Siemens Mobility Toolkit (SMTK) TC65 requires that you have: 1. Windows 2000 or Windows XP installed 2. 40Mbytes free disk space for SMTK 3. Administration privileges 4. Java 2 SDK, Standard Edition 1.4. To install the JDK version 1.4.2_07 provided, follow the instructions in Section 3.3.1. If a Java IDE such as Sun Java Studio Mobility 6 2004Q3, Eclipse 3.0.1, Eclipse 3.0.
s TC65 JAVA User's Guide Strictly confidential / Released 3.2.1 Components 3.2.1.1 Module Exchange Suite The Module Exchange Suite allows the developer to access the Flash file system on the cellular engine from the development environment over a serial interface. File transfers from PC to module are greatly facilitated by this suite. 3.2.1.2 WTK wtk is the directory where all the necessary components for TC65 Java application creation and debugging are stored. 3.2.1.
s TC65 JAVA User's Guide Strictly confidential / Released 3.3 Siemens Mobility Toolkit Installation The SMTK comes with an installation CD. The installation program automatically installs the necessary components and IDE integrations. Software can be uninstalled and updated with the install program. The next sections cover the installation and removal of the SMTK and the installation of the SDK and the supported IDEs. 3.3.1 Installing the Standard Development Toolkit 1. The JDK version 1.4.
s TC65 JAVA User's Guide Strictly confidential / Released 7. If the SDK and one or more Java IDEs are found, you will be asked to choose which IDE you want integrated into the TC65 development environment. Once an IDE has been found and selected, press "Next" to continue. Ensure that your Java IDE is closed. 8. Select the folder where the TC65 SMTK will be installed. A folder will be suggested to you but you may browse to select a different one. 9.
s TC65 JAVA User's Guide Strictly confidential / Released 3.4 SMTK Uninstall The TC65 SMTK install package comes with an uninstall facility. The entire SMTK or parts of the package can be removed. To start the uninstall facility, open the Control Panel, select Add/Remove Programs, select TC65 Software Development Kit and follow the instructions. The Module Exchange Suite (MES) is not uninstalled automatically with the SMTK.
s TC65 JAVA User's Guide Strictly confidential / Released 4 Software Platform In this chapter, we discuss the software architecture of the SMTK and the interfaces to it. 4.1 Software Architecture The SMTK enables a customer to develop a Java application on a PC and have it be executable on the TC65 module. The application is then loaded onto the module. The platform is comprised of: • the Java™ 2 Micro Edition (J2ME™), which forms the base of the architecture.
s TC65 JAVA User's Guide Strictly confidential / Released 4.2 Interfaces 4.2.1 ASC0 - Serial Device ASC0, an Asynchronous Serial Controller, is a 9-wire serial interface. It is described in the Hardware Interface Description [4]. Without a running Java application the module can be controlled by sending AT commands over ASC0. Furthermore, ASC0 is designed for transferring files from the development PC to the module and for controlling the module with AT commands.
s TC65 JAVA User's Guide Strictly confidential / Released 4.2.7 JVM Interfaces IMP-NG File API AT Command API Connected Limited Device Configuration (CLDC) J2ME Figure 2: Interface Configuration J2ME, CLDC and MIDP were implemented by SUN. IMP-NG is a stripped down version of MIDP 2.0 prepared by Siemens and does not include the graphical interface LCDUI. Siemens developed the File I/O API and the AT command API. Documentation for J2ME and CLDC can be found at http://java.sun.com/j2me/.
s TC65 JAVA User's Guide Strictly confidential / Released 4.3 Data Flow of a Java Application Running on the Module AT Parser system.out ASC1 Flash File System JVM AT Command API File I/O API IMP-NG GPIO DAI I2C/SPI DAC/ADC TCP/IP ASC0 Figure 3: Data flow of a Java application running on the module. The diagram shows the data flow of a Java application running on the module. The data flow of a Java application running in the debug environment can be found in Figure 20.
s TC65 JAVA User's Guide Strictly confidential / Released 4.4 Handling Interfaces and Data Service Resources To develop Java applications the developer must know which resources, data services and hardware access are available. • There are three AT parsers available • There is hardware access over - two serial interfaces: ASC1 (System.out only) and ASC0 (fully accessible). - general purpose I/O.
s TC65 JAVA User's Guide Strictly confidential / Released 4.4.1.1 State 1: Default – No Java Running This is the default state. The Java application is inactive and there is an AT interface with CSD on ASC0 as well as ASC1. All HW interface pins are configured as inputs. AT parser with CSD AT parser with CSD ASC 0 ASC1 or USB 10 GPIO, I2C/SPI pins (unused) Figure 4: Module State 1 4.4.1.2 State 2: No Java Running, General Purpose I/O and I2C The Java application is inactive.
s TC65 JAVA User's Guide Strictly confidential / Released 4.4.1.5 State 5: Java Application Active, General Purpose I/O and I2C The Java application is active, ASC1 is used as System.out and the Java instance of the RS232 serial interface is connected to ASC0. The Java application is activated with at^sjra. The I/O pins are configured with at^scpin or at^sspi. Refer to the AT Command Set [3] for AT command details. Java access to serial interface (CommConnection) System.
s TC65 JAVA User's Guide Strictly confidential / Released 4.4.2 Module State Transitions switch on no Java autostart Java autostart start java: at^sjra State 1: Default, no Java appl. running close I2C State 4: Default, Java active destroy java application open I2C State 2: no Java appl.
s TC65 JAVA User's Guide Strictly confidential / Released 5 Maintenance The basic maintenance features of the TC65 are described below. Explicit details of these functions and modes can be found in the AT Command Set [3] and the Hardware Interface Description [4]. 5.1 IP Service Apart from the standard Java IP networking interfaces (UDPDatagramConnection, SocketConnection, ...) the TC65 also supports a set of Internet Services via AT command.
s TC65 JAVA User's Guide Strictly confidential / Released 5.2 Power Saving The module supports several power saving modes which can be configured by the AT command at+cfun [3]. Power saving affects the Java application in two ways. First, it limits access to the serial interface (RS-232-API) and the GPIO pins. Second, power saving efficiency is directly influenced by the way a Java application is programmed.
s TC65 JAVA User's Guide Strictly confidential / Released 5.4 Airplane Mode The main characteristic of this mode is that the RF is switched off and therefore only a limited set of AT commands is available. The mode can be entered or left using the appropriate at^scfg command. This AT command can also be used to configure the airplane mode as the standard startup mode, see [4]. The JVM is started when autostart is enabled. A Java application must be able to handle this mode.
s TC65 JAVA User's Guide Strictly confidential / Released 5.6.2 Manual Shutdown The module can be switched off manually with the AT command, at^smso or when using the TC65 terminal by pressing the ignition key for a period of time (see [4]). In these cases the midlets destroyApp method is called and the application has 5s time to clean up and call the notifydestroy method. After the 5s the VM is shut down. 5.6.
s TC65 JAVA User's Guide Strictly confidential / Released 5.7.4 Configuration of Serial Interface While a Java application is running on the module, only the AT Command API is able to handle AT commands. All AT commands referring to a serial interface are ignored. In particular these commands: • AT+IPR • AT\Q3 If Java is running, the firmware will ignore any settings from these commands. Responses to the read, write or test commands will be invalid or deliver “ERROR”.
s TC65 JAVA User's Guide Strictly confidential / Released 5.9 Performance The performance study was focused on comparable performance values under various circumstances. 5.9.1 Java This section gives information about the Java command execution throughput (“jPS”= Java statements per second). The scope of this measurement is only the statement execution time, not the execution delay (Java command on AT interface Î Java instruction execution Î reaction on GPIO).
s TC65 JAVA User's Guide Strictly confidential / Released 5.9.2 Pin I/O The pin I/O test was designed to find out how fast a Java MIDlet can process URCs caused by Pin I/O and react to these URCs. The URCs are generated by feeding an input pin with an external frequency. As soon as the Java MIDlet is informed about the URC, it tries to regenerate the feeding frequency by toggling another output pin. input pin Test MIDlet external frequency poll input pin send URC set output pin ATCommandListener.
s TC65 JAVA User's Guide Strictly confidential / Released 5.9.3.1 Plain Serial Interface Scenario: A device is connected to ASC0 (refer to 4.2.4). The Java application must handle data input and output streams. A simple Java application (with only one thread) which loops incoming data directly to output, reaches data rates up to 180kbit/s.
s TC65 JAVA User's Guide Strictly confidential / Released 5.9.3.3 Scenarios with GPRS Connection The biggest challenges to the module performance are setting up a GPRS connection, receiving data on javax.microedition.io interfaces and sending or receiving the data on the RS232 API with the help of a Java application. 5.9.3.3.1 Upload Since the TC65 supports GPRS class 12, up to four timeslots for upload data are available.
s TC65 JAVA User's Guide Strictly confidential / Released 5.9.3.3.2 Download The data rate for downloading data over GPRS depends on the number of assigned timeslots and the coding schemes given by the net. Since TC65 supports GPRS class 12, the number of assigned timeslots can be up to 4. For the measurements, the Java application receives data from the server over GPRS and sends them over RS232 to an external device.
s TC65 JAVA User's Guide Strictly confidential / Released 6 MIDlets The J2ME™ Mobile Information Device Profile (MIDP) provides a targeted Java API for writing wireless applications. The MIDP runs on top of the Connected Limited Device Configuration (CLDC), which in turn, runs on top of the J2ME™. MIDP applications are referred to as MIDlets. MIDlets are controlled by the mobile device implementation that supports the CLDC and MIDP. Since IMP-NG is a subset of MIDP 2.0, IMP includes MIDlets.
s TC65 JAVA User's Guide Strictly confidential / Released Table 5: A typical sequence of MIDlet execution Application Management Software MIDlet The application management software creates a new instance of a The default (no argument) MIDlet. constructor for the MIDlet is called; it is in the Paused state. The application management software has decided that it is an The MIDlet acquires any appropriate time for the MIDlet to run, so it calls the resources it needs and begins to perform its service.
s TC65 JAVA User's Guide Strictly confidential / Released 6.3 Hello World MIDlet Here is a sample HelloWorld program. /** * HelloWorld.java */ package example.helloworld; import javax.microedition.midlet.*; import java.io.*; public class HelloWorld extends MIDlet { /** * HelloWorld - default constructor */ public HelloWorld() { System.out.println("HelloWorld: Constructor"); } /** * startApp() */ public void startApp() throws MIDletStateChangeException { System.out.
s TC65 JAVA User's Guide Strictly confidential / Released 7 File Transfer to Module 7.1 Module Exchange Suite The Module Exchange Suite allows you to view the Flash file system on the module as a directory from Windows Explorer. Make sure that the module is turned on and that one of the module’s serial interfaces (ASC0, ASC1 or USB) is connected to the COM port that the Module Exchange Suite is configured to. The configured COM port can be checked or changed under Properties of the Module directory.
s TC65 JAVA User's Guide Strictly confidential / Released 7.2 Over the Air Provisioning See Chapter 8 for OTA provisioning. 7.3 Security Issues The developer should be aware of the following security issues. Security aspects in general are discussed in chapter 11. 7.3.1 Module Exchange Suite The serial interface should be mechanically protected. The copy protection rules for Java applications prevent opening, reading, copying, moving or renaming of JAR files.
s TC65 JAVA User's Guide Strictly confidential / Released 8 Over The Air Provisioning (OTAP) 8.1 Introduction to OTAP OTA (Over The Air) Provisioning of Java Applications is a common practice in the Java world. OTAP describes mechanisms to install, update and delete Java applications over the air. The TC65 product implements the Over The Air Application Provisioning as specified in the IMP-NG standard (JSR228).
s TC65 JAVA User's Guide Strictly confidential / Released 8.3 OTAP Parameters There is a set of parameters that control the OTAP procedures. These parameters can either be set by AT command (at^sjotap, refer to AT Command Set [7]) during the production of the device, or by SM (see Section 8.4) during operation of the device in the field. None of the parameters, which are set by AT command, can be overwritten by SM. • JAD File URL: the location of the JAD file is used to install or update procedures.
s TC65 JAVA User's Guide Strictly confidential / Released The length of the string parameters in the AT command is limited (see Table 6), the length in the SM is only limited by the maximum SM length. The minimum set of required parameters depends on the intended operation (see Table 6). “optional/P” indicates that this parameter is only necessary when a POST result is desired. 8.4 Short Message Format An OTAP control SM must use a Submit PDU with Class1, PID $7d and 8 bit encoding.
s TC65 JAVA User's Guide Strictly confidential / Released The values of APPDIR, BEARER and START are used internally and must be lower case. The password (PWD) is case sensitive. The case sensitivity of the other parameter values depends on the server application or the network. It is likely that not all parameters can be sent in one SM. They can be distributed over several SMs.
s TC65 JAVA User's Guide Strictly confidential / Released Example: MIDlet-Name: MyTest MIDlet-Version: 1.0.1 MIDlet-Vendor: TLR Inc. MIDlet-Jar-URL: http://192.168.1.3/datafiles/MyTest.jar MIDlet-Description: My very important test MIDlet-1: MyTest, , example.mytest.MyTest MIDlet-Jar-Size: 1442 MicroEdition-Profile: IMP-NG MicroEdition-Configuration: CLDC-1.1 A suitable Manifest file for the JAD file above might look like: Manifest-Version: 1.0 MIDlet-Name: MyTest MIDlet-Version: 1.0.
s TC65 JAVA User's Guide Strictly confidential / Released When an SM with keyword START:install is received and there is a valid parameter set for the operation, the module always reboots either when the operation completed, an error occurred or the safety timer expired. If there is any error during an update operation the old application is kept untouched, with one exception.
s TC65 JAVA User's Guide Strictly confidential / Released 8.
s TC65 JAVA User's Guide Strictly confidential / Released 8.9 OTAP Tracer For easy debugging of the OTAP scenario, the OTAP procedure can be traced over the serial interface. The trace output shows details of the OTAP procedure and the used parameters. To enable the OTAP trace output use the at command at^scfg, e.g. AT^SCFG=Trace/Syslog/OTAP,1 The serial interface on which you issue this command is then exclusively used for the OTAP tracer.
s TC65 JAVA User's Guide Strictly confidential / Released 8.11 How To This chapter is a step-by-step guide for using OTAP. 1. Do you need OTAP? Is there any chance that it might be necessary to update the Java application, install a new one or delete it? It could be that device is in the field and you cannot or do not want to update it over the serial line.
s TC65 JAVA User's Guide Strictly confidential / Released 9 Compile and Run a Program without a Java IDE This chapter explains how to compile and run a Java application without a Java IDE. 9.1 Build Results A JAR file must be created by compiling an SMTK project. A JAR file will contain the class files and auxiliary resources associated with an application. A JAD file contains information (file name, size, version, etc.) on the actual content of the associated JAR file.
s TC65 JAVA User's Guide Strictly confidential / Released 9.2 Compile • Launch a Command Prompt. This can be done from the Programs menu or by typing “cmd” at the Run… prompt in the Start menu. • Change to the directory where the code to be compiled is kept. • Compile the program with the SDK. Examples of build batch files can be found in each sample program found in the examples directory, \Siemens\SMTK\TC65\wtk\src\example. • If the compile was successful the program can be run from the command line.
s TC65 JAVA User's Guide Strictly confidential / Released 9.4.1 Switch on Autostart • There is an AT command, at^scfg, for configuring the autostart functionality. Please refer to the AT Command Set [3]. • Restart the module. 9.4.2 Switch off Autostart There are two methods for switching off the autostart feature: • the at^scfg AT command, or • the “autostart_off.
s TC65 JAVA User's Guide Strictly confidential / Released 10 Debug Environment Please note that this section is not intended as a tutorial in debugging or how to use Sun Java Studio, Borland JBuilder or Eclipse. Documents for these IDEs can be found on their respective homepages. Once the proper emulator has been selected (as described in the relevant IDE sections below), your Java application can be built, debugged and executed. 10.1 Data Flow of a Java Application in the Debug Environment system.
s TC65 JAVA User's Guide Strictly confidential / Released In the debug environment the module is connected to a PC via a serial interface. This can be a USB or an RS232 line. The application can then be edited, built, debugged or run within an IDE on the PC. When running or debugging the MIDlet under IDE control it is executed on the module (on-device execution) not on the PC.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3 Java IDE The SMTK is integrated into your Java IDE during installation. Please note that the IDE integration is intended to create MIDlets suitable for TC65 module and for debugging using the emulator. JAR files used in the module must be configured according to the batch file examples given.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.1 Sun Java Studio Mobility 6 2004Q3 This section indicates the changes to your IDE you will see after integrating the SMTK and describes how to exploit these features to build and debug your applications. In the Runtime Explorer, Figure 21, the installed emulators can be seen under the Device Emulator Registry. The Default Emulator is set to the Siemens Emulator.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.1.1 Switching emulators You can easily switch to the SMTK emulator by using the combo box in the main menu bar and choosing IMP_NG_DefaultDevice, see Figure 22. Any projects built and run when the Siemens emulator is selected will be compiled and run with the Siemens emulator. Directly after executing the IDE integration with the SMTK setup program the IMP_NG_DefaultDevice is activated by default.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.1.2 Projects After integration, there is a new project in the Project Manager. This project contains the example and the additional libraries. The Project Manager is accessed through the Project menu. Directly after executing the IDE integration with the SMTK setup program the “Siemens TC65” project is opened by default. Figure 23: Sun Java Studio Mobility 6 - Project Manager TC65 JAVA User's Guide_V05 Page 56 of 90 26.09.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.1.3 Templates Templates for a Siemens MIDlet can be found in the file explorer and under File->New. The MIDlet template provides the skeleton of a MIDlet application. Figure 24: Sun Java Studio Mobility 6 - Selecting a template 10.3.1.4 Examples There are sample MIDlets in the …\Siemens\SMTK\TC65\SUNStudioSamples directory. 10.3.1.5 Compile and run Ensure that the proper emulator will be used and compile the project as normal.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.2 Borland JBuilder X If you want to use JBuilderX and it is not installed, first install JBuilderX and follow the installation wizard instructions. Run the TC65 SMTK the installation program in maintenance mode. The SMTK will find the installed JBuilderX IDE. Select JBuilderX to integrate the SMTK into JBuilderX.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.2.1 Examples There are sample projects provided with the TC65 SMTK. These projects can be found in the JBuilderSamples directory of the TC65 SMTK installation directory. This directory is accessed by opening a project using the menu File Æ Open Project… (see Figure below) Figure 27: JBuilderX – Sample Projects TC65 JAVA User's Guide_V05 Page 59 of 90 26.09.
s TC65 JAVA User's Guide Strictly confidential / Released Open the Project (e.g. “HelloWorld.jpx”), rebuild the sources and start the debugger using the micro edition (context menu “HelloWorld.jad” Æ Micro Debug using “HelloWorld”). Figure 28: JBuilderX – Starting the debugging session TC65 JAVA User's Guide_V05 Page 60 of 90 26.09.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.3 Borland JBuilder 2005 If JBuilder2005 is not installed, run the JBuilder2005 install program and follow the installation wizard instructions. Use the TC65 SMTK installation routine in maintenance mode. The SMTK will find the installed JBuilder2005 IDE. Select JBuilder2005 to integrate the SMTK into JBuilder2005.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.3.1 Examples There are sample projects provided with the TC65 SMTK. These projects can be found in the JBuilderSamples directory of the TC65 SMTK installation directory. This directory is accessed by opening a project using the menu File Æ Open Project… (see Figure below) Figure 31: JBuilder2005 – Sample Projects Starting the debugging session is done in the same way as for JBuilderX (see chapter for JBuilderX above) 10.3.4 Eclipse 3.
s TC65 JAVA User's Guide Strictly confidential / Released Figure 32: Eclipse – Plug-in installation If the installation of the plugin was successful you need to restart your IDE. (see figure below). Figure 33: Eclipse – Plug-in installation, restart Close the IDE! Now start the TC65 SMTK installation routine to automatically configure Eclipse.
s TC65 JAVA User's Guide Strictly confidential / Released Figure 34: Eclipse – IMP-NG component Set the timeout under WindowsÆ PreferencesÆJ2ME Æ Debug Server Delay to 15000. If you develop an extremely large application you may have to increase this timeout. 10.3.4.2 Switching Emulators You can easily switch between installed SMTK by using the preferences of a project and choosing IMP_NG_DefaultDevice, see figure below.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.4.3 Example After the integration you can import one example. Open menu: FileÆImportÆExisting Project into Workspace and choose the root directory of the example. (see figure below) Figure 36: Eclipse – Project import The following figure shows the “Hello World” example in the IDE. TC65 JAVA User's Guide_V05 Page 65 of 90 26.09.
s TC65 JAVA User's Guide Strictly confidential / Released Figure 37: Eclipse - Example The html help files of the SMTK can be accessed directly by pressing Alt+F2 while the cursor points to a Java expression in a Java source file. TC65 JAVA User's Guide_V05 Page 66 of 90 26.09.
s TC65 JAVA User's Guide Strictly confidential / Released 10.3.4.4 Compile and debug To build the jar and jad files you have rebuild the project with the “create package” function. Open the context menu of the project and go to J2MEÆCreate Package Figure 38: Eclipse – Create package Now you are ready to debug your project. RunÆDebug… A TC65 launcher with pre settings is provided for starting the debugging session. Please ensure that you have selected the right project and executable midlet.
s TC65 JAVA User's Guide Strictly confidential / Released Figure 39: Eclipse - Configuration Restriction: The integration of the SMTK depends selecting the offered default workspace “\workspace” of Eclipse. 10.4 Breakpoints Breakpoints can be set as usual within the IDE. The debugger cannot step through methods or functions whose source code is not available. TC65 JAVA User's Guide_V05 Page 68 of 90 26.09.
s TC65 JAVA User's Guide Strictly confidential / Released 11 Java Security The Java Security Model follows the specification of IMP 2.0 but does not integrate the protection domain concept. The protection domain concept is not needed. If the software is enabled, all domains are available. Java Security is divided into two main areas: • secure MIDlet data links (HTTPS, Secure Connection) (see chapter 11.1) • execution of signed MIDlets (see chapter 11.
s TC65 JAVA User's Guide Strictly confidential / Released 11.1 Secure Data Transfer This feature makes it possible for MIDlets to use safe data links to external communications partners. The specification IMP 2.0 defines two java classes with this characteristic HTTPSConnection and SecureConnection. The Siemens implementation follows the recommendations in IMP 2.0: HTTPSConnection • HTTP over TLS as documented in RFC 2818 and TLS Protocol Version 1.0 as specified in RFC 2246.
s TC65 JAVA User's Guide Strictly confidential / Released CA Root Certificate (X.509) self singned public key from owner of the certificate (CA) private key from owner of the certificate as er c serv e as cate rtifi jav as ec ur ity ce rt ific a te TCP/IP Connection HTTPS Server Module test whether certificates are identical Figure 41: Mode 2 - Java Security activated (server certificate = certificate into module) chain of certificates Server Certificate (X.
s TC65 JAVA User's Guide Strictly confidential / Released 11.1.1 Create a Secure Data Transfer Environment Step by Step The following steps describe the creation of the configuration: • Java Security Mode is activated (see 11.2.1 Change to Secured Mode) • Certificate verification is activated for a data connection (HTTPS or SecureConnection) The steps described below use the cygwin + openssl environment (for installation see http://www.cygwin.com/, the openssl documentation can be found here http://www.
s TC65 JAVA User's Guide Strictly confidential / Released -keyfile ./democa/private/cakey.der -certfile ./democa/cacert.der 6. Export private key from server certificate The private key is needed for the (HTTPS or Secure Connection)server configuration. execute command >java -jar getprivatekey.jar -alias server -keystore customer.ks -storepass keystorepass -keypass keypass -keyfile server_privkey.der Result: - 11.
s TC65 JAVA User's Guide Strictly confidential / Released 11.2.1 Change to Secured Mode Concept generate key pair private key public key generate customer root certificate Customer Root Certificate (X.
s TC65 JAVA User's Guide Strictly confidential / Released 11.2.2 Concept for the Signing the Java MIDlet generate HASH Java-MIDlet JAR-File private key encoding with private key JAR-File HASH (SHA1) Customer Environment encoding base64 encoded JAR-File HASH add the signature (is base64 encoded) into the JAD file as the value of the MIDlet-Jar-RSA-SHA1 attribute Java-MIDlet JAD-File Figure 44: Prepare MIDlet for Secured Mode TC65 JAVA User's Guide_V05 Page 75 of 90 26.09.
s TC65 JAVA User's Guide Strictly confidential / Released 11.3 Application and Data Protection In addition to the Java secured mode it is possible to prevent the activation of the Module Exchange Suite. When Module Exchange Suite access is deactivated with at^sjsec, it is no longer possible to access to the Flash file system on the module. 11.4 Structure and Description of the Java Security Commands Special commands are used in t he Java security environment.
s TC65 JAVA User's Guide Strictly confidential / Released 11.4.1 Structure of the Java Security Commands General structure total len cmd param num parameter unit UINT16 UINT16 UINT16 parameter unit ... signature unit UINT16 param len param id param data UINT16 UINT16 ...
s TC65 JAVA User's Guide Strictly confidential / Released 11.4.2 Build Java Security Command param num parameter unit ... generate HASH cmd private key Customer Environment encoding with private key HASH (SHA1) build total command signature cmd len + cmd param num parameter unit ... + signature unit Figure 45: Build Java Security Command TC65 JAVA User's Guide_V05 Page 78 of 90 26.09.
s TC65 JAVA User's Guide Strictly confidential / Released 11.4.3 Send Java Security Command to the Module Use a terminal program. enter: at^sjsec wait for the answer: CONNECT JSEC READY: SEND COMMAND ... Now you can send the binary data of the command (for example: from a file with the binary data of the command). The module’s answer depends on the result of the operation. The read command, at^sjsec?, can be used to request the current Java security status.
s TC65 JAVA User's Guide Strictly confidential / Released 11.5 Create a Java Security Environment Step by Step 11.5.1 Create Key store The key store contains the key pairs for signing data. For producing the key store with keys the tool “keytool.exe” can be used. The program is in the Java SDK. (for a description see http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/keytool.html) Example: keytool -genkey -alias keyname -keypass keypassword -keystore customer.
s TC65 JAVA User's Guide Strictly confidential / Released Command: switch on module exchange functionality java -jar jseccmd.jar -cmd ObexActivationOn –imei 012345678901234 -alias keyname -storepass keystorepassword -keypass keypassword -keystore customer.ks > ObexActivationOn.bin Command: switch off module exchange functionality java -jar jseccmd.jar -cmd ObexActivationOff –imei 012345678901234 -alias keyname -storepass keystorepassword -keypass keypassword -keystore customer.ks > ObexActivationOff.
s TC65 JAVA User's Guide Strictly confidential / Released 12 Java Tutorial This small tutorial includes explanations on how to use the AT Command API and suggestions for programming MIDlets. The developer should read about MIDlets, Threads and AT commands as a complement to this tutorial. 12.1 Using the AT Command API Perhaps the most important API for the developer is the AT command API. This is the API that lets the developer issue commands to control the module.
s TC65 JAVA User's Guide Strictly confidential / Released 12.1.1.2 Sending an AT Command to the Device, the send() Method An AT command is sent to the device by using the send() method. The AT command is sent as a string which must include the finalizing line feed "\r" or the corresponding line end character. String response = atc.send(“at+cpin?\r”); /* method returns when the module returns a response */ System.out.println(response); Possible response printed to System.
s TC65 JAVA User's Guide Strictly confidential / Released while(((char)rcv != 'q') && ((char)rcv != 'Q') && (rcv != -1)){ rcv = dataIn.read(); if (rcv >= 0) { System.out.print((char)rcv); } } /* The example continues after the next block of text */ In …/Siemens/SMTK/TC65/wtk/src/example a complete data connection example, DataConnectionDemo.java, can be found. These streams behave slightly differently than regular data streams. The streams are not closed by using the close() method.
s TC65 JAVA User's Guide Strictly confidential / Released 12.1.1.4 Synchronization For performance reasons no synchronization is done in the ATCommand class. If an instance of this class has to be accessed from different threads ensure that the send() functions, the release() function, the cancelCommand() function and the breakConnection() function are synchronized in the user implementation. 12.1.
s TC65 JAVA User's Guide Strictly confidential / Released 12.1.3 ATCommandListener Interface The ATCommandListener interface implements callback functions for: • URCs • Changes of the serial interface signals RING, DCD and DSR • Opening and closing of data connections The user must create an implementation class for ATCommandListener to receive AT events. The ATEvent method of this class must contain the processing code for the different AT-Events (URCs).
s TC65 JAVA User's Guide Strictly confidential / Released /* take some action when the DCD signal changes if you want to */ } public void DSRChanged(boolean SignalState {} /* take some action when the DSR signal changes if you want to */ } public void CONNChanged(boolean SignalState {} /* take some action when the state of a connection changes if you want to */ } } 12.1.3.
s TC65 JAVA User's Guide Strictly confidential / Released 12.2 Programming the MIDlet The life cycle and structure of MIDlets are described in Chapter 6. Since the MIDlets will run on J2ME™, all of J2ME™’s features, including threads, are available. Small applications, such as those without any timer functions or those used only for tests and simple examples, can be written without using threads. Longer applications should be implemented with threads. 12.2.
s TC65 JAVA User's Guide Strictly confidential / Released try { Thread.sleep(1000); } catch(InterruptedException e) { System.out.println(e); } } System.out.println("Thread(" + loops + "): Finished naturally"); } } /** * ThreadDemo - constructor */ public ThreadDemo() { System.out.println("ThreadDemo: Constructor, creating threads"); thread1 = new DemoThread(2); thread2 = new DemoThread(6); } /** * startApp() */ public void startApp() throws MIDletStateChangeException { System.out.
s TC65 JAVA User's Guide Strictly confidential / Released 13 Differences from the TC45 For those who are familiar with the Siemens WM TC45 product this is an overview of the main differences between TC45 and TC65. • “real” TCP and UDP access interfaces: SocketConnection, ServerSocketConnection, UDPDatagramConnection. Use of StreamConnection, StreamConnectionNotifier, DatagramConnection is now discouraged. • Serial interfaces are swapped: Standard.