|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.rim.device.api.system.IOPort
|
+--net.rim.device.api.system.USBPort
Provides low-level access to the device's USB port.
You should avoid using this class in applications, as it is not
portable. Rather, if you need to gain access to the USB port, use the CLDC
Connector factory to serve a connection.
| Constructor Summary | ||
USBPort(int channel)
Constructs a new USB object, opening the specified channel. |
||
| Method Summary | ||
void |
close()
Closes the channel. |
|
static void |
deregisterChannel(int channel)
De-registers a channel. |
|
static boolean |
isSupported()
Determines if the device has a serial port. |
|
int |
read()
Reads single data byte from the receive buffer. |
|
int |
read(byte[] data)
Reads data bytes from the receive buffer. |
|
int |
read(byte[] data,
int offset,
int length)
Reads some data bytes from the receive buffer. |
|
static int |
registerChannel(String name,
int maxRxSize,
int maxTxSize)
Registers a channel. |
|
int |
write(byte[] data)
Places bytes to send into the transmit buffer. |
|
int |
write(byte[] data,
int offset,
int length)
Places some bytes to send into the transmit buffer. |
|
int |
write(int b)
Places a single byte to send into the transmit buffer. |
|
| Methods inherited from class net.rim.device.api.system.IOPort |
registerNotifyPattern |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public USBPort(int channel)
throws IOException
channel - The channel to open.IOException - If the port could not be opened.| Method Detail |
public static boolean isSupported()
public int write(byte[] data)
throws IOException
data - Bytes of data to send.IOException - If the port is not currently open.
public int write(byte[] data,
int offset,
int length)
throws IOException
Use this method to place only a portion of a byte array into the transmit buffer.
data - Bytes array containing data to send.offset - First data byte from array to send.length - Number of data bytes to send.IOException - If the port is not currently open.
public int write(int b)
throws IOException
b - Byte of data to send.IOException - If the port is not currently open.
public int read(byte[] data)
throws IOException
data - Buffer to contain the received bytes; to flush the
receive buffer, pass null.IOException - If the port is not currently open.
public int read(byte[] data,
int offset,
int length)
throws IOException
Invoke this method to stuff only a portion of your data buffer with bytes from the receive buffer.
data - Buffer to contain the received bytes; to flush the receive
buffer, pass null.offset - Position from the start of the buffer to begin stuffing
bytes from the receive buffer.length - Maximum number of bytes to read.IOException - If the port is not currently open.
public int read()
throws IOException
IOException - If the port is not currently open.public static int registerChannel(String name, int maxRxSize, int maxTxSize) throws IOException
name - The name of the channel.maxRxSize - The maximum receive size.maxTxSize - The maximum transmit size.IOException - Thrown if an I/O error occurs.
public static void deregisterChannel(int channel)
throws IOException
channel - The channel handle.IOException - Thrown if an I/O error occurs.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.