站内搜索: 请输入搜索关键词

当前页面: 开发资料首页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

摘要: On-Device Debugging with the Siemens TC65 and the NetBeans Mobility Pack 5.0

What is the Siemens TC65?

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.

On-Device Debugging with the TC65

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.

Requirements

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.

Configuring the modem

To begin, you must first install the modem. This is a fairly straightforward process.

  1. Connect the modem to serial port.
  2. On your Windows system, choose Start > Settings > Control Panel. Then open the Modems settings.
  3. Add the TC65 modem, which should be listed either as "Standard 19200 bps Modem" or "TC65 14400 bps Modem". Be sure to set the maximum Port speed for the serial line to 115200 Bd, because the speed of debugging is directly depending on this.

The image below shows what the dialog should look like when you're done.

Modem properties

The next step is to configure the IP connection.

Configuring IP connection

Configuring the IP Connection is the most difficult part of this process.

  1. In the Control Panel, open Network Connections.
  2. Choose the New Connection Wizard.
    1. Choose Connect to the Internet.
    2. Choose Set up my connection manually.
    3. Choose Connect using a dial-up modem.
    4. Select a Device--use the modem device you configured in the previous step.
    5. For the ISP name, enter "IP connection for remote debugging".
    6. Set the telephone number to *88#.
    7. Set the user name and password to whatever values you want, but set the wizard to remember these values, otherwise you'll be asked for them each time you try to debug.
    8. Disable the Redial If Line Dropped option and enable Connect Automatically.
  3. Set the General Properties for the connection as shown in the image below.
  4. IP connection for remote debugging

  5. Click the Configure button and make sure that the serial line speed matches the speed you set when you configured the modem.
  6. Modem configuration

  7. Set the rest of the options as shown in the image below.
  8. Properties

  9. If you have done everything as described above, you see one more network connection in Network Connections setting window.
  10. Add COM port

  11. The final step is to go to:
    Siemens SMTK install location/WTK/bin/WM_Debug_config.ini
    and set the Port and Baud Rate parameters to the desired values.

Now you are ready to take off!

Installing the Sample Project

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.

  1. Open the IDE and choose Tools > Java Platform Manager.
  2. In the Java Platform Manager, choose the J2ME Platform folder. Then click Add Platform.
  3. Use the Add Platform wizard to seamlessly install the Siemens "IMP-NG" Wireless Toolkit platform and "IMP_NG_Default" device.
Next, open the project in the IDE:
  1. Unzip the sample application.
  2. Choose File > Open Project and navigate to the directory where you unzipped the project.

Now you are ready to build the project as well as run and debug it.
So let's go debugging!

Debugging with TC65

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.

Debugger starting

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.

Dial up 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.

Debugging the source - click to enlarge

Believe or not, this breakpoint is not in the emulator, but is in the real TC65 device. Enjoy!

Migrating old projects

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.

NetBeans Mobility project configuration - click to enlarge

Flash Demo

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.

TC65 Technical Information

Send Us Your Success Stories

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

About the Authors

Troubleshooting

There have been several issues reported when using TC65 and On-Device Debugging. Please read the following section before submitting bugs.

Emulator does not connect

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.

IP Connection for Remote Debugging Drops After Establishing Connection

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.

Next Steps


↑返回目录
前一篇: NetBeans Server-Skeleton Module Tutorial
后一篇: Packaging and Deploying Desktop Java Applications