Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

Mr Ransika deSilva and every one please reply this mail

 
Salman Faraz
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Report post to moderator
Respected Mr Ransika deSilva ,
Thanks for your previous reply.According to your suggestion I tryed to use the System.getProperty("microedition.commports") method but it continiously returned me null does this means that no ports are supported.The code after making changes is as follows:

import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import java.io.*;

public class TestSerial extends MIDlet implements CommandListener
{
Form form1;
TextField tf1;
Display disp1=null;
Command command1;
StreamConnection sc;
OutputConnection oc;
Connection connection1;

/****************************Defining Constructor*****************************/

public TestSerial()
{
disp1=Display.getDisplay(this);
command1=new Command("Start",Command.OK,1);
form1=new Form("Serial Port Connection");
form1.addCommand(command1);
form1.setCommandListener(this);
}
/********************************************************************************/
public void startApp()
{
disp1.setCurrent(form1);
}

public void pauseApp()
{
}

public void destroyApp(boolean b)
{
}

public void commandAction(Command c,Displayable d)
{
if(c==command1)
{
try
{
/************Establishing serial port connection****************/
/*connection1= Connector.open("comm:0;baudrate=9000");
connection1.close();*/
String string1=System.getProperty("microedition.commports");
System.out.println(string1);
}

catch(Exception e)
{
System.out.println(e.toString());
}
}
}
}

If you run the above code you will get null which means that no ports are present,how is this possible,since my PC has all three parallel,serial and USB ports.Can you please mail the correct code so that I can successfully establish connection with the serial ports.Please mail it as soon as possible since it is very important for me.

Thanking You,
Salman Faraz.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Salman, you already have a thread for this issue. Please keep the discussion contained to the same thread. Basically, this then becomes a duplicate post and I have to close it because of that. Sorry.

Mark
 
    Bookmark Topic Watch Topic
  • New Topic