Thales IoT Developer Community
Midlet Autostart configuration (Eclipse)
Tutorial, November 30, 2018 - 12:11am, 3104 views
Gemalto offers a variety of cellular modules with an embedded Java environment to provide customers the opportunity to run Java applications directly on the module to save costs for an external application processor.
A so called MIDlets can be configured in a way that it will either be started automatically during module start up or it requires a manual start command.
This tutorial covers how the autostart setting can be configured for MIDlets within the Eclipse developement environment.
The Gemalto module provides two different ways to configure the autostart. It is important that both are configured properly.
Global Autostart Setting:
First the below at command configures the autostart functionality globaly. Once the autostart of MIDlets is disbaled every installed MIDlet has to be started manually. Keep in mind that also the JRC will stay silent. The JRC is part of the module firmware and if not started it will affect the proper functionality of the module.
AT^SCFG="Userware/Autostart","1" <- Autostart globally enabled
AT^SCFG="Userware/Autostart","0" <- Autostart globally disabled
Apart from the on/offswitch capability the "autostart" feature can also be delayed:
AT^SCFG="Userware/Autostart/Delay","0" <- no delay
AT^SCFG="Userware/Autostart/Delay","10" <- 1s (delay time is specified in 100ms steps)
Local Autostart Setting:
Furthermore each and every MIDlet can be configured seperately in its "Java Application Descriptor" file. A few parameters such as MIDlet Jar URL, MIDlet Name etc. are mandatory. Apart from that there are a lot of other parameters such as the "autostart". The Java User Guide specifies three parameters:
- Oracle-MIDlet-Autostart: [0-5], autostart order. 0 means no autostart. For MIDlets with
the same level the order is not defined. Lower values mean higher autostart order in priority. Note that if MIDlet’s startApp contains incentive system resources access operation, e.g., File system resources, it will block JRC MIDlet initialize procedure which may lead to JRC
MIDlet initialization failure. It is recommended to separate thread or set lower autostart
order than JRC MIDlet’s in order to move incentive system access from startApp.
- Oracle-MIDlet-Restart: [true|false], if true the MIDlet is automatically restarted if it terminates
non gracefully, e.g. by an uncaught exception.
- Oracle-MIDlet-Restart-Count: [number], number of allowed MIDlets restarts before the
whole module is rebooted. If the given number is invalid (e.g., negative, 0, or an alphabetic
character), the default value 3 is used instead.
There are situations in which the module restarts continously caused by a malfunctioning MIDlet (e.g. uncaught exception). Each time the Java ends and the module reboots within 20s a counter is incremented. If this happens six ***** in a row, autostart will be disabled temporarily.
The module can recover from that by a reboot or if the module runs longer than 20s in between of reboots the autostart fail-safe counter will be set to zero.
For further information please have a look into the Java User's Guide (chapter 9.4.3)
Configuring Autostart in Eclipse:
See in the following how these three parameters can be configured in the Eclipse environment:
After a MIDlet project is created the above screen is seen as the start page. Within the project creation process all required MIDlet parameters are set already. In order to set the autostart related parameters a register card called "User Defined" can be found below (1).
Press "Add" button (2) to append the described autostart parameter with its values one by one. Make sure that after finishing the input this configuration is saved (CTRL+S). This can be checked whether at point (3) a star is still shown up. In this case it is not saved and this changes will not be taken over into the JAD file.
Once this is completed click on register card "Application Descriptor" (4) and see the created JAD file.