public class BrickletRS232 extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletRS232.Configuration |
static interface |
BrickletRS232.ErrorCallbackListener
This listener is called if an error occurs.
|
static interface |
BrickletRS232.ErrorListener
This listener is called if an error occurs.
|
static interface |
BrickletRS232.FrameReadableListener
This listener is called if at least one frame of data is readable.
|
class |
BrickletRS232.Read |
static interface |
BrickletRS232.ReadCallbackListener
This listener is called if new data is available.
|
class |
BrickletRS232.ReadFrame |
static interface |
BrickletRS232.ReadListener
This listener is called if new data is available.
|
Device.Identity
Constructor and Description |
---|
BrickletRS232(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addErrorCallbackListener(BrickletRS232.ErrorCallbackListener listener)
Adds a ErrorCallback listener.
|
void |
addErrorListener(BrickletRS232.ErrorListener listener)
Adds a Error listener.
|
void |
addFrameReadableListener(BrickletRS232.FrameReadableListener listener)
Adds a FrameReadable listener.
|
void |
addReadCallbackListener(BrickletRS232.ReadCallbackListener listener)
Adds a ReadCallback listener.
|
void |
addReadListener(BrickletRS232.ReadListener listener)
Adds a Read listener.
|
void |
disableReadCallback()
Disables the
BrickletRS232.ReadListener listener. |
void |
enableReadCallback()
Enables the
BrickletRS232.ReadListener listener. |
BrickletRS232.Configuration |
getConfiguration()
Returns the configuration as set by
setConfiguration(short, short, short, short, short, short) . |
short |
getFrameReadableCallbackConfiguration()
Returns the listener configuration as set by
setFrameReadableCallbackConfiguration(short) . |
Device.Identity |
getIdentity()
Returns the UID, the UID where the Bricklet is connected to,
the position, the hardware and firmware version as well as the
device identifier.
|
boolean |
isReadCallbackEnabled()
Returns *true* if the
BrickletRS232.ReadListener listener is enabled,
*false* otherwise. |
BrickletRS232.Read |
read()
Returns the currently buffered message.
|
BrickletRS232.ReadFrame |
readFrame()
Returns up to one frame of bytes from the read buffer.
|
void |
removeErrorCallbackListener(BrickletRS232.ErrorCallbackListener listener)
Removes a ErrorCallback listener.
|
void |
removeErrorListener(BrickletRS232.ErrorListener listener)
Removes a Error listener.
|
void |
removeFrameReadableListener(BrickletRS232.FrameReadableListener listener)
Removes a FrameReadable listener.
|
void |
removeReadCallbackListener(BrickletRS232.ReadCallbackListener listener)
Removes a ReadCallback listener.
|
void |
removeReadListener(BrickletRS232.ReadListener listener)
Removes a Read listener.
|
void |
setBreakCondition(int breakTime)
Sets a break condition (the TX output is forced to a logic 0 state).
|
void |
setConfiguration(short baudrate,
short parity,
short stopbits,
short wordlength,
short hardwareFlowcontrol,
short softwareFlowcontrol)
Sets the configuration for the RS232 communication.
|
void |
setFrameReadableCallbackConfiguration(short frameSize)
Configures the
BrickletRS232.FrameReadableListener listener. |
short |
write(char[] message,
short length)
Writes a string of up to 60 characters to the RS232 interface.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final java.lang.String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_WRITE
public static final byte FUNCTION_READ
public static final byte FUNCTION_ENABLE_READ_CALLBACK
public static final byte FUNCTION_DISABLE_READ_CALLBACK
public static final byte FUNCTION_IS_READ_CALLBACK_ENABLED
public static final byte FUNCTION_SET_CONFIGURATION
public static final byte FUNCTION_GET_CONFIGURATION
public static final byte FUNCTION_SET_BREAK_CONDITION
public static final byte FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION
public static final byte FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION
public static final byte FUNCTION_READ_FRAME
public static final byte FUNCTION_GET_IDENTITY
public static final short BAUDRATE_300
public static final short BAUDRATE_600
public static final short BAUDRATE_1200
public static final short BAUDRATE_2400
public static final short BAUDRATE_4800
public static final short BAUDRATE_9600
public static final short BAUDRATE_14400
public static final short BAUDRATE_19200
public static final short BAUDRATE_28800
public static final short BAUDRATE_38400
public static final short BAUDRATE_57600
public static final short BAUDRATE_115200
public static final short BAUDRATE_230400
public static final short PARITY_NONE
public static final short PARITY_ODD
public static final short PARITY_EVEN
public static final short PARITY_FORCED_PARITY_1
public static final short PARITY_FORCED_PARITY_0
public static final short STOPBITS_1
public static final short STOPBITS_2
public static final short WORDLENGTH_5
public static final short WORDLENGTH_6
public static final short WORDLENGTH_7
public static final short WORDLENGTH_8
public static final short HARDWARE_FLOWCONTROL_OFF
public static final short HARDWARE_FLOWCONTROL_ON
public static final short SOFTWARE_FLOWCONTROL_OFF
public static final short SOFTWARE_FLOWCONTROL_ON
public static final short ERROR_OVERRUN
public static final short ERROR_PARITY
public static final short ERROR_FRAMING
public BrickletRS232(java.lang.String uid, IPConnection ipcon)
public short write(char[] message, short length) throws TinkerforgeException
setConfiguration(short, short, short, short, short, short)
for configuration possibilities
regarding baudrate, parity and so on.TinkerforgeException
public BrickletRS232.Read read() throws TinkerforgeException
enableReadCallback()
and BrickletRS232.ReadListener
listener.TinkerforgeException
public void enableReadCallback() throws TinkerforgeException
BrickletRS232.ReadListener
listener. This will disable the BrickletRS232.FrameReadableListener
listener.
By default the listener is disabled.TinkerforgeException
public void disableReadCallback() throws TinkerforgeException
BrickletRS232.ReadListener
listener.
By default the listener is disabled.TinkerforgeException
public boolean isReadCallbackEnabled() throws TinkerforgeException
BrickletRS232.ReadListener
listener is enabled,
*false* otherwise.TinkerforgeException
public void setConfiguration(short baudrate, short parity, short stopbits, short wordlength, short hardwareFlowcontrol, short softwareFlowcontrol) throws TinkerforgeException
TinkerforgeException
public BrickletRS232.Configuration getConfiguration() throws TinkerforgeException
setConfiguration(short, short, short, short, short, short)
.TinkerforgeException
public void setBreakCondition(int breakTime) throws TinkerforgeException
TinkerforgeException
public void setFrameReadableCallbackConfiguration(short frameSize) throws TinkerforgeException
BrickletRS232.FrameReadableListener
listener. The frame size is the number of bytes, that have to be readable to trigger the listener.
A frame size of 0 disables the listener. A frame size greater than 0 enables the listener and disables the BrickletRS232.ReadListener
listener.
By default the listener is disabled.
.. versionadded:: 2.0.4$nbsp;(Plugin)TinkerforgeException
public short getFrameReadableCallbackConfiguration() throws TinkerforgeException
setFrameReadableCallbackConfiguration(short)
.
.. versionadded:: 2.0.4$nbsp;(Plugin)TinkerforgeException
public BrickletRS232.ReadFrame readFrame() throws TinkerforgeException
setFrameReadableCallbackConfiguration(short)
.
If the returned length is 0, no new data was available.
.. versionadded:: 2.0.4$nbsp;(Plugin)TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addReadListener(BrickletRS232.ReadListener listener)
public void removeReadListener(BrickletRS232.ReadListener listener)
public void addErrorListener(BrickletRS232.ErrorListener listener)
public void removeErrorListener(BrickletRS232.ErrorListener listener)
public void addFrameReadableListener(BrickletRS232.FrameReadableListener listener)
public void removeFrameReadableListener(BrickletRS232.FrameReadableListener listener)
public void addReadCallbackListener(BrickletRS232.ReadCallbackListener listener)
public void removeReadCallbackListener(BrickletRS232.ReadCallbackListener listener)
public void addErrorCallbackListener(BrickletRS232.ErrorCallbackListener listener)
public void removeErrorCallbackListener(BrickletRS232.ErrorCallbackListener listener)
Copyright © 2020 Tinkerforge GmbH. All rights reserved.