background image

TC45 TC45 JAVA User's Guide 

Confidential / Released 

 
 

 

 

 

TC45_JAVA User's Guide_V02 

Page 21 of 72 

30.06.2003 

The following Java instruction was used for calculation of the typical jPS: 
 

value = ( 2 x number of calculation statements ) /  

( ( 1 / frequencyB ) - ( 1 / frequencyA ) ); 

 
Measurement and calculation were done using: 
 

· 

duration of each loop 

= 600 s 

· 

number of calculation statements

 = 5 

result=(CONSTANT_VALUE/variable_value);

-

Instructions 
(executed twice per pin cycle) 

· 

frequencyA

 as measured with universal counter 

· 

frequencyB

 as measured with universal counter 

 

The reference loop has the same structure as the measurement loop except the 
measurement sequence is moved. 
 

State jPS-Value 

(mean) 

TC45 module in IDLE mode / Not connected 

~750 jPS 

CSD connection 

~450 jPS 

 
These mean values may be sporadically reduced depending on dynamic conditions. 
 

3.7.2 Pin-IO 

The pin IO test was defined to find out how fast a Java MIDlet can process URCs caused by 
Pin IO and react on these URCs. 
The URCs are generated by feeding an input pin with an external frequency. As soon as the 
Java MIDlet gets informed about the URC, it tries to regenerate the feeding frequency by 
toggling another output pin. 
 
 

external frequency

generated frequency

Test MIDlet

poll input pin

input pin

output pin

set output pin

ATCommand.

send(...)

send URC

ATCommandListener.

ATEvent()

 

Figure 2: Test overview 

 
The results of this test show that the delay from changing the state on the pin to processing 
the URC in the MIDlet is at least 20 TDMA frames, but depends mainly on the amount of 
garbage to collect and number of thread to serve by the virtual machine.  So Pin IO is not 
suitable to generate or detect frequencies. 

Summary of Contents for TC45

Page 1: ...Siemens Cellular Engine JAVA User s Guide Version 02 DocID TC45_JAVA User s Guide_V02 ...

Page 2: ... not be liable for any consequential incidental direct indirect punitive or other damages whatsoever including without limitation damages for loss of business profits business interruption loss of business information or data or other pecuniary loss arising out the use of or inability to use the documentation and or product even if Siemens has been advised of the possibility of such damages The fo...

Page 3: ...2 1 2 Module Exchange Suite 13 2 2 1 3 IMPSiemens 13 2 2 1 4 AT Java Open Framework AJOF 13 2 3 SMTK installation 14 2 3 1 Installing the Standard Development Toolkit 14 2 3 2 Installing the SMTK environment 14 2 3 3 Installing Sun ONE Studio 4 1 Mobile Edition 15 2 3 4 Installing Borland JBuilder MobileSet 3 15 2 3 4 1 JBuilder Enterprise Edition MobileSet 3 15 2 3 4 2 JBuilder Personal Edition M...

Page 4: ...2 2 General Purpose I O 23 4 2 3 ASC1 23 4 2 4 Digital Audio Interface DAI 23 4 2 5 JVM interfaces 24 4 2 5 1 IMP 1 0 API to TCP IP 24 4 3 Data flow of a Java application running on the module 25 4 4 Handling interfaces and data service resources 26 4 4 1 Module states 26 4 4 1 1 State 1 default no Java application is running 27 4 4 1 2 State 2 no Java application is running general purpose I O 27...

Page 5: ... 35 6 1 6 Pin I O 35 7 File transfer to module 36 7 1 Module Exchange Suite 36 7 1 1 Windows based 36 7 1 2 Command line based 36 7 2 Over the Air Provisioning 36 7 3 Security issues 36 7 3 1 Module Exchange Suite 37 7 3 2 OTAP 37 8 Over The Air Provisioning OTAP 38 8 1 Introduction to OTAP 38 8 2 OTAP overview 38 8 3 OTAP Parameters 39 8 4 Short message format 40 8 5 Java file format 41 8 6 Proce...

Page 6: ...on 51 10 2 1 1 Switching emulators 52 10 2 1 2 Projects 53 10 2 1 3 Templates 54 10 2 1 4 Examples 54 10 2 1 5 Compile and run 54 10 2 2 JBuilder Mobile Edition 54 10 2 2 1 TC45 SMTK in Personal Edition 54 10 2 2 1 1 Integration of TC45 SMTK 55 10 2 2 1 2 Restoring original settings 57 10 2 2 2 TC45 SMTK in Enterprise Edition 58 10 2 2 3 Examples 59 10 2 2 4 Projects and templates 60 10 2 2 5 Comp...

Page 7: ...5_JAVA User s Guide_V02 Page 7 of 72 30 06 2003 11 1 3 1 ATEvents 66 11 1 3 2 Implementation 66 11 1 3 3 Registering a listener with an ATCommand instance 67 11 2 Programming the MIDlet 68 11 2 1 Threads 68 11 2 2 Example 68 11 3 AJOF 70 11 3 1 Example 70 ...

Page 8: ...lete Information Flow 43 Figure 15 Data flow of a Java application in the debug environment 49 Figure 16 Sun ONE Studio The installed emulators 51 Figure 17 Sun ONE Studio Switching to the Siemens emulator 52 Figure 18 Sun ONE Studio Project Manager 53 Figure 19 Sun ONE Studio Selecting a template 54 Figure 20 Different JDK must be set in User Home 55 Figure 21 Dialog box after changing the JDK to...

Page 9: ...ential Released TC45_JAVA User s Guide_V02 Page 9 of 72 30 06 2003 0 Document history Preceding document TC45 JAVA User s Guide Version 01 New document TC45 JAVA User s Guide Version 02 Chapter Page What is new 11 3 1 70 Revised example ...

Page 10: ...r Application TC45 ROM Customer SW RAM Customer Application ROM RAM TCxx µC Customer SW Old solution The customer application was distributed across 2 µC external µC and internal µC on the module New solution The customer application exists only on the module Figure 1 Overview 1 2 Related documents In addition to the Java Docs for the development API see Chapter 4 the following documents are inclu...

Page 11: ...nsfer Protocol I O Input Output IDE Integrated Development Environment IMP Information Module Profile IP Internet Protocol J2ME Java 2 Mobile Edition J2SE Java 2 Standard Edition JAD Java Application Description JAR Java Archive JDK Java Development Kit JVM Java Virtual Machine LED Light Emitting Diode ME Mobile Engine MIDP Mobile Information Device Protocol OTA Over The Air OTAP Over The Air Prov...

Page 12: ...Enterprise MobileSet 3 or JBuilder Personal MobileSet 3 is installed it can be integrated into the SMTK environment during the installation of the SMTK To install Sun ONE Studio or Borland JBuilder follow the installation instructions in Section 2 3 3 and Section 2 3 4 respectively 2 2 Installation CD The Siemens Mobility Toolkit TC45 Installation CD includes MuxInstall pdf mux_driver_installation...

Page 13: ...le 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 2 2 1 3 IMPSiemens IMPSiemens is the directory where all the necessary components for the SMTK are stored The virtual machine all necessary interfaces and packages the RS 232 emulator and the Flash file system emulator are included The AT ...

Page 14: ...n about the installation and use of the SMTK is shown Press Next to continue 4 The installation software checks for the SDK If there is no SDK on the system the installation procedure will not continue Please follow the instructions in Section 2 3 1 above for installing the SDK 5 At this point the installation software checks for a Java IDE to be integrated with the SMTK A Java IDE is not necessar...

Page 15: ...rst time If more then one user uses the computer each user may have their own Java folder Note The integration of the SMTK into Sun ONE Studio 4 Update 1 Mobile Edition is only possible if the personal user folder is set It can only be rolled back by the user who installed the SMTK If all users use the same Java folder any user may roll back the integration 2 3 4 Installing Borland JBuilder Mobile...

Page 16: ... facility open the Control Panel select Add Remove Programs select TC45 and follow the instructions 2 4 1 Uninstall WinMux The WinMux multiplexer must be manually uninstalled with the Hardware Manager It can also be uninstalled with Control Panel Add Remove Hardware Choose the uninstall options and select the Serial Multiplexer to be uninstalled 2 5 Upgrades The SMTK can be modified repaired or re...

Page 17: ...d that the signal must be constant for at least 2 12s to detect changes For further details refer to 5 Java power saving efficiency As long as any Java thread is active power consumption cannot be reduced regardless whether any SLEEP mode has been activated or not So a Java application that wants to be power efficient should not have any unnecessarily active threads e g no busy loops 3 2 Charging ...

Page 18: ...T SMSO command This procedure lets the engine log off from the network and allows the software to enter into a secure state and save all data Further details can be found in 5 3 4 1 Automatic shutdown The module is switched off automatically in different situations under or overtemperature under or overvoltage This will happen without a warning notification unless the appropriate URC has been acti...

Page 19: ...TART ALARM MODE etc to the MIDlet This is done via URC to the AT Command API instance which executes the very first AT Command from within Java To read this URC it is necessary to register a listener see 8 on this AT Command API instance before passing the first AT Command 3 5 3 Long responses The AT Command API can handle responses of AT commands up to a length of 1024 bytes Some AT commands have...

Page 20: ...s a larger amount of memory smaller than 16kBytes even though the reported amount of free memory is larger than the amount needed by the object If this happens an OutOfMemoryError will be thrown 3 7 Performance statements Scope of the performance study was getting comparable values that indicate the performance under certain circumstances 3 7 1 Java This section gives information about the Java co...

Page 21: ...on 450 jPS These mean values may be sporadically reduced depending on dynamic conditions 3 7 2 Pin IO The pin IO test was defined to find out how fast a Java MIDlet can process URCs caused by Pin IO and react on these URCs The URCs are generated by feeding an input pin with an external frequency As soon as the Java MIDlet gets informed about the URC it tries to regenerate the feeding frequency by ...

Page 22: ...ot include the graphical interface LCDUI TCP IP API is part of IMP Additional Java virtual machine interfaces AT Command API RS 232 API File I O API The data flow through these interfaces is shown in Figure 4 and Figure 15 Note RS 232 API does not presume that the serial interface is using the RS 232 signal level refer to Hardware Interface Description 5 about signal levels Memory space for Java p...

Page 23: ...se as input The pins are divided into two GPIO pin groups Pin group 0 GPIO 0 3 is the set also used as ASC1 The second pin group GPIO 4 8 shares resources with the DAI Pins 0 3 can be configured either as general purpose I O GPIO or ASC1 but not both The same for pins 4 8 they can be configured either as GPIO or as DAI See 4 and 5 about configuring the pins 4 2 3 ASC1 ASC1 is the second serial int...

Page 24: ... interface LCDUI Siemens developed the File I O API and the AT command API TC45 also provides an RS 232 interface related to the RS 232 API of MIDP2 0 Documentation for J2ME and CLDC can be found at http java sun com j2me Documentation for the other APIs is found in Java doc 6 4 2 5 1 IMP 1 0 API to TCP IP IMP 1 0 provides access to TCP IP with these interfaces DatagramConnection HttpConnection St...

Page 25: ...tion running in the debug environment can be found in Figure 15 The compiled Java applications are stored as JAR files in Flash File System of module When the application is started the JVM interprets the JAR file and calls the interfaces to module environment The module environment consists of Flash File System available memory for Java applications TCP IP module internal TCP IP stack GPIO genera...

Page 26: ...section 4 4 1 A Java application has three instances of the AT command class each of which would in turn be attached to one of the three AT parsers one instance of access to a serial interface ASC1 through the RS 232 API System out over the serial interface ASC0 for debugging 4 4 1 Module states The module can exist in the following six states vis à vis a Java application and the four I O pins pin...

Page 27: ...t 4 ASC 0 AT parser with CSD 4 pins GPIO Figure 6 Module State 2 4 4 1 3 State 3 no Java application is running AT interface on ASC1 The Java application is inactive and there is an AT interface with CSD on ASC0 and a second AT interface without CSD on ASC1 The second AT interface is activated by at shifm refer to AT Command Set 4 ASC 0 AT parser with CSD 4 pins ASC 1 AT parser without CSD Figure ...

Page 28: ...A Tparser0 w ithC S D JavaA Tcom m andA P I w ithoutC S D A Tparser w ithoutC S D JavaA Tcom m andA P I w ithoutC S D A Tparser w ithoutC S D Figure 9 Module State 5 4 4 1 6 State 6 Java application active Java interface to ASC1 The Java application is running ASC0 is used as System out and the Java instance of the RS 232 serial interface is connected to ASC1 The Java application is activated with...

Page 29: ...se GPIO close second at interface open second at interface start java at sjra open GPIO start java at sjra State 4 Default Java active destroy java application open ASC1 for Java close ASC1 for Java close GPIO open GPIO State 5 Java active using GPIO on ASC1 State 2 no Java appl running using GPIO on ASC1 Figure 11 Module State Transition Diagram Note No AT parser is available over serial interfac...

Page 30: ...connection Phonebook management AT commands Java AT command API with CSD l l l l 2 l l Java AT command API without CSD l l l 2 l l 1 l indicates that the functionality is available from the Java AT command API indicates that the functionality is not available from the Java AT command API 1 except for AT commands related to data calls 2 only two Java AT command API s can be used in parallel to tran...

Page 31: ...ed The MIDlet is initialised and is quiescent It should not be holding or using any shared resources The Paused state in IMP 1 0 is only used during MIDlet construction it will never reached again after changed state from paused state Active The MIDlet is functioning normally Destroyed The MIDlet has released all of its resources and terminated This state is only entered once State changes are aff...

Page 32: ...uctor for the MIDlet A MIDlet pauseApp method is not necessary The MIDlet stops performing its service and might choose to release some resources it currently holds The application management software has determined that the MIDlet is no longer needed or perhaps needs to make room for a higher priority application in memory so it signals the MIDlet that it is a candidate to be destroyed by calling...

Page 33: ...TC45 TC45 JAVA User s Guide Confidential Released TC45_JAVA User s Guide_V02 Page 33 of 72 30 06 2003 destroyApp public void destroyApp boolean cond System out println HelloWorld destroyApp cond ...

Page 34: ...s framework 6 1 1 Mobile engine status This area abstracts AT commands which affect the ME status either by setting or returning device parameters The methods supplied in this category are mostly query methods Most of the methods in this category can be called regardless of the ME s current status The values set by these methods remain valid after the method call is finished 6 1 2 Voice call handl...

Page 35: ...de access to the phonebook storage media This class provides methods to select a storage medium list the stored entries write into browse through read or delete from a storage medium 6 1 6 Pin I O The pin I O class provides methods for configuring the pins writing to and reading from the pins configuring the pins as a port and listening to the pins port ...

Page 36: ...led in the Windows System directory so that the tools are available from any directory The module s file system is accessed with mod The tools included in this suite are MESdel MEScopy MESdir MESmkdir MESrmdir and MESformat Entering one of these commands without arguments will describe the command s usage The tools mimic the standard directory and file commands A path inside the module s file syst...

Page 37: ... Suite The serial interface should be mechanically protected 7 3 2 OTAP A password should be used to update with OTA SMS Authentication Parameters should be set to fixed values at sjotap whenever possible so that they cannot be changed over the air The http server should be secure e g Access control via basic authentication ...

Page 38: ...OTAP overview To use OTAP the developer needs apart from the device fitted with the TC45 module an http server which is reachable through a TCP IP connection either over GPRS or CSD and a SMS sender which can send Class1 PID 7d short messages This is the PID reserved for module s data download Java Application Server HTTP Server jar file jad file Device containing TC45 jad file jar file OTAP Contr...

Page 39: ...the selected network bearer this is either an access point name for GPRS or a telephone number for CSD Net User a username used for authentication with the network Net Password a password used for authentication with the network DNS a Domain Name Server s IP address used to query hostnames There is one additional parameter that can only be set by AT command SM Password it is used to authenticate i...

Page 40: ...ify an OTAP SM All other lines are optional and their order is insignificant each line is terminated with an LF n even the last one The keywords in capital letters are case sensitive A colon separates the keywords from their values The values of APPDIR BEARER and START are used internally and have to be lower case The password PWD is case sensitive The case sensitivity of the other parameter value...

Page 41: ...herwise this JAD file is useless for OTAP MIDlet Install Notify this is an optional entry specifying a URL to which the result of an update install operation is posted That is the only way to get any feedback about the outcome of an install update operation The format of the posted URL complies with the MIDP OTA Provisioning specification In contrast to the jar and jad file this URL must not be pr...

Page 42: ... If success install and change autostart Reboot OTAP Controller Safety Timeout Reboot Start install update procedure Closedown Timeout Figure 13 OTAP Install Update Information Flow The messages in brackets are optional 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 occurr...

Page 43: ... complete Close running Java application Delete application dir reboot OTAP Controller Safety Timeout Reboot Start delete procedure Closedown Timeout Figure 14 OTAP Delete Information Flow When an SM with keyword START delete is received and there is a valid parameter set for this operation the module reboots either when the operation completed an error occurred or the safety timer expired If ther...

Page 44: ...ns can only be downloaded from one special server As a side effect OTAP can be used to simply reboot the module Just start an OTAP procedure with a parameter set which does not really do anything like a delete operation on a nonexistent directory If you don t want to start OTAP by SMS let your Java application do it by issuing the at sjotap command That triggers a install update operation as descr...

Page 45: ...using a common web browser on a PC which can reach your http server through TCP IP 6 Prepare the SMS sender The sender must be able to send SMs which conform to chapter 0 to your device When in doubt try to send normal SMs to your device which can than be read out through the at command interface 7 Test with a local device Send a suitable short message to your device which completes the necessary ...

Page 46: ... When the module is provisioned with the Module Exchange Suite as described in Section 7 1 only the JAR file is needed The JAD file is additionally necessary for OTA provisioning OTA provisioning is described in Chapter 8 Note The path to your installed SIEMENS SMTK TC45 IMPSiemens lib classes zip is needed to build a JAR file 9 1 1 JAD file In addition to class and resource files a JAR file conta...

Page 47: ... requested In this scenario any AT commands issued by the application are sent to the module by the emulator over ASC0 9 3 Run on the module with manual start The application can be compiled at the prompt as discussed in Section 9 2 or in an IDE Transfer the jar and or jad file from the development platform to the desired directory on the module using the Module Exchange Suite or OTA provisioning ...

Page 48: ...t the module 9 4 2 Switch off Autostart To switch off autostart functionality there are two possibilities at command at scfg tool autostart_off exe included in the Installation CD software To disable the automatic start of a user application in a module these steps have to be done 1 Connect the module to the PC 2 Make sure that the module is switched off 3 Start the Autostart_Off program 4 Select ...

Page 49: ...he relevant IDE sections below your Java application can be built debugged and executed as usual 10 1Data flow of a Java application in the debug environment Multiplexer ASC0 Com Port Multiplexer AT command API RS 232 API File I O API IMP 1 0 Com Port File System TCP IP JKVM Debug environment Module PC Disabled This section is emulated on the PC JVM Flash File System File I O API IMP 1 0 RS 232 AP...

Page 50: ...module Much effort has been taken to ensure that both virtual machines behave in the same way but accordingly since they are completely different systems there might be some differences nevertheless Besides the obvious differences in timing and execution speed there are also differences in file system handling The Flash file system of the module is simulated in a special sub directory of the PC de...

Page 51: ...cates the changes to your IDE that you will see after the integration of the SMTK and how to exploit these features to build and debug your applications In the Runtime Explorer Figure 16 the installed emulators can be seen under the Device Emulator Registry The Default Emulator is not affected by the integration Figure 16 Sun ONE Studio The installed emulators ...

Page 52: ...g the Tools menu selecting Siemens TC45 and choosing Switch Emulator Siemens IMP Wireless Toolkit 1 0 see Figure 3 The default emulator can be switched back to by choosing Switch Emulator J2ME Wireless Toolkit Any projects built and run when the Siemens emulator is selected will be compiled and run with the Siemens emulator Figure 17 Sun ONE Studio Switching to the Siemens emulator ...

Page 53: ...s After integration there are two new projects in the Project Manager The first is a sample HelloWorld project and the second is an empty project that the developer can begin using or use as a model for a new TC45 project The Project Manager is accessed through the Project menu Figure 18 Sun ONE Studio Project Manager ...

Page 54: ... 19 Sun ONE Studio Selecting a template 10 2 1 4 Examples There are sample MIDlets in the IMPSiemens src examples directory This directory is mounted in Sun ONE Studio and can be seen in the Explorer window 10 2 1 5 Compile and run Ensure that the proper emulator will be used and compile the project as normal Any output will be shown in the output window in the IDE 10 2 2 JBuilder Mobile Edition 1...

Page 55: ... JBuilder Personal Edition user must configure the JDK being used according to following steps 1 Start Jbuilder Personal Edition 2 Open dialog box ToolsàConfigure JDKs see Figure 3 Change JDK by selecting User Home Press Change and set path to installation directory TC45 IMPSiemens and complete configuration by pressing OK Figure 20 Different JDK must be set in User Home ...

Page 56: ...45_JAVA User s Guide_V02 Page 56 of 72 30 06 2003 Figure 21 Dialog box after changing the JDK to Siemens IMP Wireless Toolkit After closing dialog box the Siemens IMP Wireless Toolkit will be used by JBuilder Personal Edition as system wide configuration ...

Page 57: ...ings For user s convenience the original settings of JBuilder Personal Edition at initial start up is shown below Figure 22 Original setting for User Home To switch back to JDK shipped with JBuilder press Change and select location as shown in figure above Note JDK home path shown in this figure depends on user s installation directory ...

Page 58: ...lled as a second emulator in JBuilder Similarly to the Sun ONE Studio integration the default emulator of JBuilder is untouched The Siemens emulator settings can be examined by opening Tools Configure JDKs Figure 23 JBuilder JDK settings The libraries included with the Siemens emulator can be examined by opening Tools Configure Libraries Figure 24 JBuilder Siemens Library ...

Page 59: ...72 30 06 2003 10 2 2 3 Examples There are sample projects provided with the SMTK These projects can be found in the JBuilderSamples directory of the Siemens TC45 SMTK installation directory This directory is accessed by opening a project File Open Project Figure 25 JBuilder Sample Projects ...

Page 60: ...Wizard will be launched An existing project can be used as a template for new project This means that the initial default values for the new project will be the same as the project chosen as the template If no project is chosen as a template the second step of the New Project Wizard gives you the opportunity to choose the emulator used with the project Figure 26 JBuilder Configuring a new project ...

Page 61: ... from the Project menu Figure 27 JBuilder Project Properties 10 2 2 5 Compile and run Ensure that the proper emulator will be used and compile the project as normal Any output will be shown in the output window in the IDE 10 3Breakpoints Breakpoints can be set as usual within the IDE The debugger cannot step through methods or functions whose source code is not available ...

Page 62: ...to the device s AT parsers 11 1 1 1 Instantiation with or without CSD support There can be only exactly as many ATCommand instances as there are parsers on the device If there are no more parsers available the ATCommand constructor will throw ATCommandFailedException A parser with CSD support may be requested through the constructor As is mentioned in Section 4 3 only one of the parsers supports C...

Page 63: ...tance when it becomes available The method itself returns immediately The ATCommandResponseListener and the non blocking send method are described in Section 11 1 2 Note Using the send methods with strings with incorrect AT command syntax will cause mistakes 11 1 1 3 Data connections If a data connection is created with the ATCommand class for instance with atd an input stream is opened to receive...

Page 64: ...n System out println n n rBreaking connection try strRcv ATCmd breakConnection catch Exception e System out println e System out println received strRcv else Received EOF somebody else broke the connection System out println n n rSomebody else switched to command mode System out println Hanging up strRcv ATCmd send ATH r System out println received strRcv catch IOException e System out println e e...

Page 65: ...been passed to the AT parser the function returns immediately and the response to the AT command is passed to this callback class later when it becomes available Somewhere in the application MyListener connect_list new MyListener CONNECT atc send ATD CALLED_NO r connect_list Application continues while the AT command is processed When the module delivers its response to the AT command the callback...

Page 66: ... 1 0 take desired action after receiving the reminder else if Event indexOf CALA Reminder 2 0 take desired action after receiving the reminder else if Event indexOf CALA Reminder 3 0 take desired action after receiving the reminder No action taken for these events public void RINGChanged boolean SignalState public void DCDChanged boolean SignalState public void DSRChanged boolean SignalState class...

Page 67: ...he corresponding device AT parser we have two ATCommands instances atc1 and atc2 ATListenerA reminder_listener new ATListenerA ATListenerB card_listener new ATListenerB atc1 addListener reminder_listener atc2 addListener card_listener The ATCommand removeListener method removes a listener object that has been previously added to the internal list table of listener objects After it has been removed...

Page 68: ...destroyed in destroyApp Note that destroying Java threads can be tricky It is recommended that the developer read the Java documentation on threads It may be necessary to poll a variable within the thread to see if it is still alive 11 2 2 Example This example derives a class from Thread and creates two instances of the subclass One thread instance finishes itself the other one is stopped by the m...

Page 69: ...mo startApp starting threads thread1 start thread2 start System out println ThreadDemo Waiting 4 seconds before stopping threads try Thread sleep 4000 catch InterruptedException e System out println e destroyApp true System out println ThreadDemo Closing application notifyDestroyed pauseApp public void pauseApp System out println ThreadDemo pauseApp destroyApp public void destroyApp boolean cond S...

Page 70: ...rt com siemens icm io ATCommandFailedException import com siemens icm ajof WmMIDlet import com siemens icm ajof AtChannel import com siemens icm ajof AtChannel SendTimeoutException import com siemens icm ajof AjofException import com siemens icm ajof status WmLock import com siemens icm ajof status WmLockException import com siemens icm ajof phonebook SimplePhonebook import com siemens icm ajof ph...

Page 71: ...sponse Set elaborated error messages atch send AT CMEE 2 r Enter the SIM PIN System out println Entering PIN WmLock lockControl new WmLock atch try lockControl sendSimPin SIM_PIN We create a CSimplePhonebook instance to look into the module s phonebook SimplePhonebook pbk new SimplePhonebook atch try Now let s look for the SMS s recipient The number is stored in the phonebook System out println Lo...

Page 72: ... System out println e catch SendTimeoutException e System out println AT_Command timeout finally Terminate the application You don t need to care about closing open AT channels CWmMIDlet does this for you System out println Now terminating application destroyApp true Your application does not necessarily need to override code destroyApp code but if it does make sure that code super destroyApp code...

Reviews: