当前页面: 开发资料首页 → Netbeans 专题 → On-Device Debugging with the Siemens TC65 and the NetBeans Mobility Pack 5.0
摘要: On-Device Debugging with the Siemens TC65 and the NetBeans Mobility Pack 5.0
When people talk about the features and tools they would use on a phone that supports JavaTM Micro Edition (JavaTM ME), they talk about doing what most end-users already do--play games, manage their calendars, or keep their contact lists. These are certainly the most popular uses for cell phones today.
But there are other users, business and industrial users, who have uses far beyond those the end-customer sees. Businesses want to employ wireless modules and terminals that provide functionality for machine-to-machine communications applications in the field such as fleet management, security, remote control. remotely control, and perform many other tasks that don't require a high resolution display or fancy keyboard. Instead, they utilize serial and I/O ports and A/D converters to control remote processes, grab status reports and other information, guard objects, and perform many other functions. That's where industrial modules like the TC65 become useful.
Siemens has been building industrial modules since the M1 model, many years ago. They began using Java as a good and easy development platform with the TC45 models, and the TC65 continues take advantage of the benefits Java offers.
There are two defined Java ME profiles: The Information Module Profile IMP 1.0 JSR 195 and the Information Module Profile Next Generation IMP-NG JSR 228. You can find many similarities between these profiles and MIDP 1.0 or 2.0. IMP-related profiles are strict subsets of MIDP profiles, without the user interface (UI)-related packages as the devices that use IMP are supposed to be used in industrially-oriented applications. The TC65 uses the IMP-NG profile and also adds hardware-specific classes you can use for controlling device-specific functionality.
An article explaining the differences between MIDP 1.0 and IMP 1.0 is available at Sun Developer Network.
While you can use the the NetBeans Mobility pack to develop applications for the TC45 as well as the TC65, this tutorial primarily concentrates on setting up and developing for the TC65. It also includes tips on how to use the Mobility Pack's device fragmentation solution to migrate your project from TC45 to TC65 while still preserving your original configuration.
You can get the TC65 module as a small circuit that must be embedded to a target application board, terminal, or development kit (such as the DSB 75). Generally, the steps are similar for all configurations. Be aware, though, that these instructions are valid only for the current R1 version of the module and software. We will update the article for the upcoming R2 module when it comes out.
To set up the TC65 with the NetBeans Mobility Pack 5.0. you will need:
This tutorial also assumes you are using Windows XP PRO SP2.
To begin, you must first install the modem. This is a fairly straightforward process.
The image below shows what the dialog should look like when you're done.
The next step is to configure the IP connection.
Configuring the IP Connection is the most difficult part of this process.
Siemens SMTK install location/WTK/bin/WM_Debug_config.iniand set the Port and Baud Rate parameters to the desired values.
Now you are ready to take off!
If you do not know how to how to write code for the TC65, you can use this sample project. Before opening it however, you must install the Siemens IMP-NG Wireless Toolkit platform.
Now you are ready to build the project as well as run and debug it.
So let's go debugging!
To start debugging, choose Run > Debug Main Project. The IDE compiles the project and automatically deploys the application to the TC65 device. You will see messages similar to the ones below displayed in the console.
After the application is uploaded to the device, the device starts in debugging mode. To connect to device, the IDE creates and establishes a special connection.
A breakpoint is already set in the application. After the debugger starts, you will see the message that debugger is connected. Soon after this, the breakpoint is reached! You can also see watches, local variables and more in the debugger window.
Believe or not, this breakpoint is not in the emulator, but is in the real TC65 device. Enjoy!
If you are migrating your project from TC45 and it is still necessary to build for both TC45 and TC65 modules, and you are using, for example, a serial port, you'll fall in love with device fragmentation solution included in NetBeans Mobility Pack.
The following example shows fragmented code for TC45 and TC65 together.
Watch this Flash demo to learn how to add the Siemens TC65 emulator platform to the IDE and use project configurations to create a single application that can be compiled for both TC45 and TC65 devices.
Have you written an application for the TC65 that guards your house, gets your location, or measures some values remotely? We'd like to hear your success stories. Please let us
There have been several issues reported when using TC65 and On-Device Debugging. Please read the following section before submitting bugs.
In this case, the emulator does not connect, you get a "Connecting JPDA
Debugger to emulator time out after 4 attempts!" error message, and the output
says: Missing port for address option
.
The probable cause is that you are using the wrong version of the SMTK. To
verify which version you are using, use the -version
and
-Xquery
commands. You should get following output (note that this is
the SMTK default installation location):
C:\Program Files\Siemens\SMTK\TC65\WTK\bin>emulator.exe -version Siemens IMP-NG Wireless Toolkit Version: 1.0.4 Profile: IMP-NG Configuration: CLDC-1.1 C:\Program Files\Siemens\SMTK\TC65\WTK\bin>emulator.exe -Xquery # List of supported devices device.list: IMP_NG_DefaultDevice # Properties for device IMP_NG_DefaultDevice IMP_NG_DefaultDevice.description: Siemens IMP-NG Default Device IMP_NG_DefaultDevice.bootclasspath: C:/Program Files/Siemens/SMTK/TC65/WTK/lib/classes.zip
If the result says Version: 1.0.0
, the wrong binary is installed.
Contact your local Siemens technical department to get the correct version,
as version 1.0.0 does not support debugging.
If your project name or the name of its JAR and JAD files contain an underscore character (for example, "my_project"), the IP connection of the debugger will disconnect.
Make sure that the project name and the names of the JAD and JAR files do not contain this character; rename any project, JAD or JAR file names that do contain the character. After this fix, debugging should work normally.