How to communicate between J2ME midlet and PC?

How do I set up the JMM Midlet to communicate with a java program or some application on a PC via a connected cable?

+2


source to share


3 answers


Incredible_Honk is almost right. The key is to use the (standard) system property "microedition.commports". This provides a comma separated list of COM ports available to your application. To open a connection, use CommConnection

as follows:

CommConnection con = (CommConnection) Connector.open("com:<commport name>");

      



Typically this will provide access to a serial USB connection, possibly also infrared, if available. Iterate through each one to see which one matches the connection you are looking for.

On Windows, at least you need to install the correct drivers for your phone first. This will allow you to open the serial connection and communicate with the application.

+3


source


There is no general way to do this. It hardly depends on the capabilities of the mobile. There may be a vendor API giving you special access to the USB, but I don't know about it.



Some telephones support communication via serial ports. Have a look at the javax.microedition.io.CommConnection interface for more information.

+2


source


Sonyericsson phones offer a way to debug your midlet on the device and return console messages via cable.

+1


source







All Articles