net.rim.device.api.bluetooth
Class BluetoothSerialPort

java.lang.Object
  extended by net.rim.device.api.system.IOPort
      extended by net.rim.device.api.bluetooth.BluetoothSerialPort

public final class BluetoothSerialPort
extends IOPort

Provides access to the Bluetooth Serial Port profile.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

Field Summary
Category: Signed static int BAUD_115200
          115200 baud.
Category: Signed static int BAUD_19200
          19200 baud.
Category: Signed static int BAUD_230400
          230400 baud.
Category: Signed static int BAUD_2400
          2400 baud.
Category: Signed static int BAUD_38400
          38400 baud.
Category: Signed static int BAUD_4800
          4800 baud.
Category: Signed static int BAUD_57600
          57600 baud.
Category: Signed static int BAUD_7200
          7200 buad.
Category: Signed static int BAUD_9600
          9600 baud.
Category: Signed static int DATA_FORMAT_DATA_BITS_5
          Five data bits per byte.
Category: Signed static int DATA_FORMAT_DATA_BITS_6
          Six data bits per byte.
Category: Signed static int DATA_FORMAT_DATA_BITS_7
          Seven data bits per byte.
Category: Signed static int DATA_FORMAT_DATA_BITS_8
          Eight data bits per byte.
Category: Signed static int DATA_FORMAT_PARITY_EVEN
          Connection uses even parity (only useful in conjunction with BluetoothSerialPort.DATA_FORMAT_PARITY_ON).
Category: Signed static int DATA_FORMAT_PARITY_MARK
          Connection uses mark parity (only useful in conjunction with BluetoothSerialPort.DATA_FORMAT_PARITY_ON).
Category: Signed static int DATA_FORMAT_PARITY_NONE
          Connection has no parity.
Category: Signed static int DATA_FORMAT_PARITY_ODD
          Connection uses odd parity (only useful in conjunction with BluetoothSerialPort.DATA_FORMAT_PARITY_ON).
Category: Signed static int DATA_FORMAT_PARITY_ON
          Connection has parity.
Category: Signed static int DATA_FORMAT_PARITY_SPACE
          Connection uses space parity (only useful in conjunction with BluetoothSerialPort.DATA_FORMAT_PARITY_ON).
Category: Signed static int DATA_FORMAT_STOP_BITS_1
          Connection pauses for one bit's transfer time for stop action.
Category: Signed static int DATA_FORMAT_STOP_BITS_1_5
          Connection pauses for one and a half bit's transfer time for stop action.
Category: Signed static byte[] DEFAULT_UUID
          The standard serial port UUID.
Category: Signed static int FLOW_CONTROL_DTR_DSR
          Connection supports DTR/DSR flow control.
Category: Signed static int FLOW_CONTROL_NONE
          Connection supports no flow control.
Category: Signed static int FLOW_CONTROL_RTC_CTS
          Connection supports RTC/CTS flow control.
Category: Signed static int FLOW_CONTROL_XON_XOFF
          Connection supports XON/XOFF flow control.
 
Constructor Summary
Category: Signed BluetoothSerialPort(byte[] uuid, String serviceName, int baudRate, int dataFormat, int flowControl, int rxBufferSize, int txBufferSize, BluetoothSerialPortListener listener)
          Constructs a new BluetoothSerialPort instance for server use.
Category: Signed BluetoothSerialPort(String serviceName, int baudRate, int dataFormat, int flowControl, int rxBufferSize, int txBufferSize, BluetoothSerialPortListener listener)
          Constructs a new BluetoothSerialPort instance for server use.
Category: Signed BluetoothSerialPort(BluetoothSerialPortInfo info, int baudRate, int dataFormat, int flowControl, int rxBufferSize, int txBufferSize, BluetoothSerialPortListener listener)
          Constructs a new BluetoothSerialPort instance for client use.
 
Method Summary
Category: Signed  void close()
          Closes the serial port.
Category: Signed  void disconnect()
          Disconnects the serial port.
Category: Signed  boolean getDtr()
          Retrieves state of the DTR line.
Category: Signed static BluetoothSerialPortInfo[] getSerialPortInfo()
          Retrieves serial port information for the currently paired devices.
Category: Signed static boolean isSupported()
          Determines if this device supports Bluetooth serial ports.
Category: Signed  int read()
          Reads one data byte from the receive buffer.
Category: Signed  int read(byte[] data)
          Reads data bytes from the receive buffer.
Category: Signed  int read(byte[] data, int offset, int length)
          Reads some data bytes from the receive buffer.
Category: Signed  void setDsr(boolean state)
          Sets DSR modem control line.
Category: Signed  void setProperties(int baudRate, int dataFormat, int flowControl)
          Deprecated. setProperties is no longer supported
Category: Signed  int write(byte[] data)
          Places bytes to send into the transmit buffer.
Category: Signed  int write(byte[] data, int offset, int length)
          Places some bytes to send into the transmit buffer.
Category: Signed  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
 



Field Detail

BAUD_2400

public static final int BAUD_2400
2400 baud.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BAUD_4800

public static final int BAUD_4800
4800 baud.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BAUD_7200

public static final int BAUD_7200
7200 buad.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BAUD_9600

public static final int BAUD_9600
9600 baud.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BAUD_19200

public static final int BAUD_19200
19200 baud.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BAUD_38400

public static final int BAUD_38400
38400 baud.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BAUD_57600

public static final int BAUD_57600
57600 baud.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BAUD_115200

public static final int BAUD_115200
115200 baud.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BAUD_230400

public static final int BAUD_230400
230400 baud.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_DATA_BITS_5

public static final int DATA_FORMAT_DATA_BITS_5
Five data bits per byte.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_DATA_BITS_6

public static final int DATA_FORMAT_DATA_BITS_6
Six data bits per byte.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_DATA_BITS_7

public static final int DATA_FORMAT_DATA_BITS_7
Seven data bits per byte.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_DATA_BITS_8

public static final int DATA_FORMAT_DATA_BITS_8
Eight data bits per byte.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_STOP_BITS_1

public static final int DATA_FORMAT_STOP_BITS_1
Connection pauses for one bit's transfer time for stop action.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_STOP_BITS_1_5

public static final int DATA_FORMAT_STOP_BITS_1_5
Connection pauses for one and a half bit's transfer time for stop action.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_PARITY_NONE

public static final int DATA_FORMAT_PARITY_NONE
Connection has no parity.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_PARITY_ON

public static final int DATA_FORMAT_PARITY_ON
Connection has parity.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_PARITY_ODD

public static final int DATA_FORMAT_PARITY_ODD
Connection uses odd parity (only useful in conjunction with BluetoothSerialPort.DATA_FORMAT_PARITY_ON).

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_PARITY_EVEN

public static final int DATA_FORMAT_PARITY_EVEN
Connection uses even parity (only useful in conjunction with BluetoothSerialPort.DATA_FORMAT_PARITY_ON).

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_PARITY_MARK

public static final int DATA_FORMAT_PARITY_MARK
Connection uses mark parity (only useful in conjunction with BluetoothSerialPort.DATA_FORMAT_PARITY_ON).

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DATA_FORMAT_PARITY_SPACE

public static final int DATA_FORMAT_PARITY_SPACE
Connection uses space parity (only useful in conjunction with BluetoothSerialPort.DATA_FORMAT_PARITY_ON).

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

FLOW_CONTROL_NONE

public static final int FLOW_CONTROL_NONE
Connection supports no flow control.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

FLOW_CONTROL_RTC_CTS

public static final int FLOW_CONTROL_RTC_CTS
Connection supports RTC/CTS flow control.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

FLOW_CONTROL_DTR_DSR

public static final int FLOW_CONTROL_DTR_DSR
Connection supports DTR/DSR flow control.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

FLOW_CONTROL_XON_XOFF

public static final int FLOW_CONTROL_XON_XOFF
Connection supports XON/XOFF flow control.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

DEFAULT_UUID

public static final byte[] DEFAULT_UUID
The standard serial port UUID.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.2.0


Constructor Detail

BluetoothSerialPort

public BluetoothSerialPort(BluetoothSerialPortInfo info,
                           int baudRate,
                           int dataFormat,
                           int flowControl,
                           int rxBufferSize,
                           int txBufferSize,
                           BluetoothSerialPortListener listener)
                    throws IOException
Constructs a new BluetoothSerialPort instance for client use.

Parameters:
baudRate - One of the BAUD_* values. Note that the baud setting does not actually affect Bluetooth throughput.
dataFormat - A combination of the DATA_FORMAT_* values.
flowControl - One of the FLOW_CONTROL_* values.
rxBufferSize - Receive buffer size.
txBufferSize - Transmit buffer size.
listener - Listener to receive and handle Bluetooth port events.
Throws:
IOException - If the port could not be opened.
UnsupportedOperationException - if the handheld or simulator does not support Bluetooth.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BluetoothSerialPort

public BluetoothSerialPort(String serviceName,
                           int baudRate,
                           int dataFormat,
                           int flowControl,
                           int rxBufferSize,
                           int txBufferSize,
                           BluetoothSerialPortListener listener)
                    throws IOException
Constructs a new BluetoothSerialPort instance for server use.

Parameters:
serviceName - The service name to include in the SDP record.
baudRate - One of the BAUD_* values. Note that the baud setting does not actually affect Bluetooth throughput.
dataFormat - A combination of the DATA_FORMAT_* values.
flowControl - One of the FLOW_CONTROL_* values.
rxBufferSize - Receive buffer size.
txBufferSize - Transmit buffer size.
listener - Listener to receive and handle Bluetooth port events.
Throws:
IOException - If the port could not be opened.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

BluetoothSerialPort

public BluetoothSerialPort(byte[] uuid,
                           String serviceName,
                           int baudRate,
                           int dataFormat,
                           int flowControl,
                           int rxBufferSize,
                           int txBufferSize,
                           BluetoothSerialPortListener listener)
                    throws IOException
Constructs a new BluetoothSerialPort instance for server use.

Parameters:
uuid - The service class UUID to include in the SDP record; this must be a 16, 32 or 128-bit, big-endian value.
serviceName - The service name to include in the SDP record.
baudRate - One of the BAUD_* values. Note that the baud setting does not actually affect Bluetooth throughput.
dataFormat - A combination of the DATA_FORMAT_* values.
flowControl - One of the FLOW_CONTROL_* values.
rxBufferSize - Receive buffer size.
txBufferSize - Transmit buffer size.
listener - Listener to receive and handle Bluetooth port events.
Throws:
IOException - If the port could not be opened.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2


Method Detail

isSupported

public static boolean isSupported()
Determines if this device supports Bluetooth serial ports.

Returns:
True if the device supports Bluetooth serial ports; otherwise, false.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

setProperties

public void setProperties(int baudRate,
                          int dataFormat,
                          int flowControl)
                   throws IOException
Deprecated. setProperties is no longer supported

Changes this port's configuration.

Parameters:
baudRate - One of the BAUD_* values. Note that the baud setting does not actually affect Bluetooth throughput.
dataFormat - A combination of the DATA_FORMAT_* values.
flowControl - One of the FLOW_CONTROL_* values.
Throws:
IOException - If the port is not currently open.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

setDsr

public void setDsr(boolean state)
            throws IOException
Sets DSR modem control line.

Parameters:
state - Desired DSR signal state.
Throws:
IOException - If the port is not currently open.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

getDtr

public boolean getDtr()
               throws IOException
Retrieves state of the DTR line.

Returns:
Current state of the DTR line.
Throws:
IOException - If the port is not currently open.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

disconnect

public void disconnect()
Disconnects the serial port.

If this is server port, the connection is severed, and the server is made ready to accept subsequent connections. If this is a client port, the behaviour is identical to close().

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

close

public void close()
Closes the serial port.

Invoking this method closes this port, disables the line drivers, and frees any buffer memory that was allocated when the port was opened.

The system automatically invokes this method when the device is shut off. Applications may not assume that the port is still open once the device is powered on again.

Specified by:
close in class IOPort
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

write

public int write(byte[] data)
          throws IOException
Places bytes to send into the transmit buffer.

Note that after calling this method, you must wait for the system to invoke IOPortListener.dataSent() before writing additional data.

Specified by:
write in class IOPort
Parameters:
data - Bytes of data to send.
Returns:
Number of bytes placed in the buffer.
Throws:
IOException - If the port is not currently open.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

write

public int write(byte[] data,
                 int offset,
                 int length)
          throws IOException
Places some bytes to send into the transmit buffer.

Note that after calling this method, you must wait for the system to invoke IOPortListener.dataSent() before writing additional data.

Use this method to place only a portion of a byte array into the transmit buffer.

Specified by:
write in class IOPort
Parameters:
data - Bytes array containing data to send.
offset - First data byte from array to send.
length - Number of data bytes to send.
Returns:
Number of bytes actually placed in the buffer.
Throws:
IOException - If the port is not currently open.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

write

public int write(int b)
          throws IOException
Places a single byte to send into the transmit buffer.

Note that after calling this method, you must wait for the system to invoke IOPortListener.dataSent() before writing additional data.

Specified by:
write in class IOPort
Parameters:
b - Byte of data to send.
Returns:
Number of bytes actually placed in the buffer (1 or 0).
Throws:
IOException - If the port is not currently open.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

read

public int read(byte[] data)
         throws IOException
Reads data bytes from the receive buffer.

Specified by:
read in class IOPort
Parameters:
data - Buffer to contain the received bytes.
Returns:
Number of bytes placed in the data buffer.
Throws:
IOException - If the port is not currently open.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

read

public int read(byte[] data,
                int offset,
                int length)
         throws IOException
Reads some data bytes from the receive buffer.

Invoke this method to stuff only a portion of your data buffer with bytes from the receive buffer.

Specified by:
read in class IOPort
Parameters:
data - Buffer to contain the received bytes.
offset - Position from the start of the buffer to begin stuffing bytes from the receive buffer.
length - Maximum number of bytes to read.
Returns:
Actual number of bytes placed in the receive buffer.
Throws:
IOException - If the port is not currently open.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

read

public int read()
         throws IOException
Reads one data byte from the receive buffer.

Specified by:
read in class IOPort
Returns:
Byte read, or a negative number if an error occurred or no bytes available.
Throws:
IOException - Thrown if the port is not currently open.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

getSerialPortInfo

public static BluetoothSerialPortInfo[] getSerialPortInfo()
Retrieves serial port information for the currently paired devices.

Throws:
UnsupportedOperationException - if the handheld or simulator does not support Bluetooth.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal