Hello All
I want to send and receive data through the serial port of the mobile , but it doesn't work , i handled the exception from the "open" function the exception is as follows:
"javax.microedition.io.ConnectionNotFoundException:The requested protocol does not exist
comm:com0;baudrate=19200"
and i tried many times to change the protocol parameters which path to the "open" function, but there is no use from this, i don't know want i can do, i thinking in two things the fault maybe in them
1- the mobile which we try on in is series 40 NOKIA 6020 , and i think this mobile may be can't support the serial connections , or need spetial way
2- I reed in the book , when an application wanna send to the serial port must have a permission form the system to access it
the book says:
"Access to serial ports is restricted to prevent unauthorized transmission or reception of data. MIDlet suites needing to use serial ports must request the javax.microedition.io.Connector.comm permission for Trusted MIDlet suites as described in Section 18.3, "Trusted MIDlet Suite Security Model."
and in my program i do not know how i can do this
my code as follows:
//In command Action function in the displayable class
if (command==Send) {
try {
CommConnection cc = (CommConnection) Connector.open("comm:com0;baudrate=19200");
OutputStream os = cc.openOutputStream();
os.write(97);//A
os.write(98);//B
cc.close();
os.close();
} catch (IOException ex) {
alert2.setString(ex.toString());
Display.getDisplay(MIDlet1.instance).setCurrent(alert2);
}
}
I need help please , i do not knaw exactaly where is the fault or how i can fix it ,please help me


Reply With Quote


