Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Developer
Posts: 2
Registered: ‎07-14-2009
My Device: Not Specified

Java, USB and BBDevMgr.exe

I've been trying to convert the C++ USBClient.cpp example into Java (USBClient.cpp is the PC side of the BB UsbDemo.java sample).

I've nearly got it working, but the last step has defeated me for the moment :smileyhappy:. I thought I'd pass on what I've done to this forum.

USBClient.cpp uses BB's BBDevMgr.exe as a COM component. There are several Java-COM bridge tools around, but the only one that could deal with BBDevMgr.exe was J-Integra for COM, a commercial tool with a 30-day free trial (http://j-integra.intrinsyc.com/products/com/).

It generated a large set of Java classes, which allowed me to re-implement USBClient.cpp in Java. The code almost works except for the Java version of writePacket() which crashes the JVM. The problem means I cannot send messages from the PC to the BB. However, the PC-side can receive messages from the BB.

The error in writePacket() is triggered down at the lowest level of J-Integra when the function's arguments are being converted into COM data prior to its call. My guess is that the type library for BBDevMgr, which J-Integra uses to generate the Java code, is not quite correct.

All my tests were done on the BB JDE 4.7.0 device simulator.

One general comment is that RIM should really offer a Java version of the BBDevMgr COM component.

Another comment is that since the BB cannot be a USB host, it limits the usefulness of the USB port for programming.