Motorola MOTORAZR maxx V6 Developer's Manual page 186

Java me developer guide
Hide thumbs Also See for MOTORAZR maxx V6:
Table of Contents

Advertisement

Java ME Developer Guide
Chapter 28 - CommConnection Interface
plementing profile. The security model will be applied on the invocation of the
method with a valid serial port connection string. Should the applic-
ation not be granted access to the serial port through the profile authorization
scheme, a
method. The security model will be applied during execution, specifically when the
methods
Code Sample 13 shows the implementation of CommConnection:
Sample of a CommConnection accessing a simple loopback program
CommConnection cc = (CommConnection)
Connector.open("comm:com0;baudrate=19200");
int baudrate = cc.getBaudRate();
InputStream is = cc.openInputStream();
OutputStream os = cc.openOutputStream();
int ch = 0;
while(ch != 'Z') {
os.write(ch);
ch = is.read();
ch++;
}
is.close();
os.close();
cc.close();
Sample of a CommConnection discovering available comm Ports
String port1;
String ports = System.getProperty("microedition.commports");
int comma = ports.indexOf(',');
if (comma > 0) {
// Parse the first port from the available ports list.
port1 = ports.substring(0, comma);
} else {
// Only one serial port available.
port1 =ports;
}
DRAFT - Subject to Change
will be thrown from the
are invoked.
Code Sample 13 CommConnection implementation
[186/201]

Advertisement

Table of Contents
loading

Table of Contents