public class BrickletRS232V2 extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletRS232V2.BufferConfig |
class |
BrickletRS232V2.BufferStatus |
class |
BrickletRS232V2.Configuration |
class |
BrickletRS232V2.ErrorCount |
static interface |
BrickletRS232V2.ErrorCountListener
This listener is called if a new error occurs.
|
static interface |
BrickletRS232V2.FrameReadableListener
This listener is called if at least one frame of data is readable.
|
static interface |
BrickletRS232V2.ReadListener
This listener is called if new data is available.
|
class |
BrickletRS232V2.ReadLowLevel |
static interface |
BrickletRS232V2.ReadLowLevelListener |
class |
BrickletRS232V2.SPITFPErrorCount |
Device.Identity
Constructor and Description |
---|
BrickletRS232V2(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addErrorCountListener(BrickletRS232V2.ErrorCountListener listener)
Adds a ErrorCount listener.
|
void |
addFrameReadableListener(BrickletRS232V2.FrameReadableListener listener)
Adds a FrameReadable listener.
|
void |
addReadListener(BrickletRS232V2.ReadListener listener)
Adds a Read listener.
|
void |
addReadLowLevelListener(BrickletRS232V2.ReadLowLevelListener listener)
Adds a ReadLowLevel listener.
|
void |
disableReadCallback()
Disables the
BrickletRS232V2.ReadListener listener. |
void |
enableReadCallback()
Enables the
BrickletRS232V2.ReadListener listener. |
int |
getBootloaderMode()
Returns the current bootloader mode, see
setBootloaderMode(int) . |
BrickletRS232V2.BufferConfig |
getBufferConfig()
Returns the buffer configuration as set by
setBufferConfig(int, int) . |
BrickletRS232V2.BufferStatus |
getBufferStatus()
Returns the currently used bytes for the send and received buffer.
|
int |
getChipTemperature()
Returns the temperature as measured inside the microcontroller.
|
BrickletRS232V2.Configuration |
getConfiguration()
Returns the configuration as set by
setConfiguration(long, int, int, int, int) . |
BrickletRS232V2.ErrorCount |
getErrorCount()
Returns the current number of overrun and parity errors.
|
int |
getFrameReadableCallbackConfiguration()
Returns the listener configuration as set by
setFrameReadableCallbackConfiguration(int) . |
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.
|
BrickletRS232V2.SPITFPErrorCount |
getSPITFPErrorCount()
Returns the error count for the communication between Brick and Bricklet.
|
int |
getStatusLEDConfig()
Returns the configuration as set by
setStatusLEDConfig(int) |
boolean |
isReadCallbackEnabled()
Returns *true* if the
BrickletRS232V2.ReadListener listener is enabled,
*false* otherwise. |
char[] |
read(int length)
Returns up to *length* characters from receive buffer.
|
BrickletRS232V2.ReadLowLevel |
readLowLevel(int length)
Returns up to *length* characters from receive buffer.
|
long |
readUID()
Returns the current UID as an integer.
|
void |
removeErrorCountListener(BrickletRS232V2.ErrorCountListener listener)
Removes a ErrorCount listener.
|
void |
removeFrameReadableListener(BrickletRS232V2.FrameReadableListener listener)
Removes a FrameReadable listener.
|
void |
removeReadListener(BrickletRS232V2.ReadListener listener)
Removes a Read listener.
|
void |
removeReadLowLevelListener(BrickletRS232V2.ReadLowLevelListener listener)
Removes a ReadLowLevel listener.
|
void |
reset()
Calling this function will reset the Bricklet.
|
int |
setBootloaderMode(int mode)
Sets the bootloader mode and returns the status after the requested
mode change was instigated.
|
void |
setBufferConfig(int sendBufferSize,
int receiveBufferSize)
Sets the send and receive buffer size in byte.
|
void |
setConfiguration(long baudrate,
int parity,
int stopbits,
int wordlength,
int flowcontrol)
Sets the configuration for the RS232 communication.
|
void |
setFrameReadableCallbackConfiguration(int frameSize)
Configures the
BrickletRS232V2.FrameReadableListener listener. |
void |
setStatusLEDConfig(int config)
Sets the status LED configuration.
|
void |
setWriteFirmwarePointer(long pointer)
Sets the firmware pointer for
writeFirmware(int[]) . |
int |
write(char[] message)
Writes characters to the RS232 interface.
|
int |
writeFirmware(int[] data)
Writes 64 Bytes of firmware at the position as written by
setWriteFirmwarePointer(long) before. |
int |
writeLowLevel(int messageLength,
int messageChunkOffset,
char[] messageChunkData)
Writes characters to the RS232 interface.
|
void |
writeUID(long uid)
Writes a new UID into flash.
|
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_LOW_LEVEL
public static final byte FUNCTION_READ_LOW_LEVEL
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_BUFFER_CONFIG
public static final byte FUNCTION_GET_BUFFER_CONFIG
public static final byte FUNCTION_GET_BUFFER_STATUS
public static final byte FUNCTION_GET_ERROR_COUNT
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_GET_SPITFP_ERROR_COUNT
public static final byte FUNCTION_SET_BOOTLOADER_MODE
public static final byte FUNCTION_GET_BOOTLOADER_MODE
public static final byte FUNCTION_SET_WRITE_FIRMWARE_POINTER
public static final byte FUNCTION_WRITE_FIRMWARE
public static final byte FUNCTION_SET_STATUS_LED_CONFIG
public static final byte FUNCTION_GET_STATUS_LED_CONFIG
public static final byte FUNCTION_GET_CHIP_TEMPERATURE
public static final byte FUNCTION_RESET
public static final byte FUNCTION_WRITE_UID
public static final byte FUNCTION_READ_UID
public static final byte FUNCTION_GET_IDENTITY
public static final int PARITY_NONE
public static final int PARITY_ODD
public static final int PARITY_EVEN
public static final int STOPBITS_1
public static final int STOPBITS_2
public static final int WORDLENGTH_5
public static final int WORDLENGTH_6
public static final int WORDLENGTH_7
public static final int WORDLENGTH_8
public static final int FLOWCONTROL_OFF
public static final int FLOWCONTROL_SOFTWARE
public static final int FLOWCONTROL_HARDWARE
public static final int BOOTLOADER_MODE_BOOTLOADER
public static final int BOOTLOADER_MODE_FIRMWARE
public static final int BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT
public static final int BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT
public static final int BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT
public static final int BOOTLOADER_STATUS_OK
public static final int BOOTLOADER_STATUS_INVALID_MODE
public static final int BOOTLOADER_STATUS_NO_CHANGE
public static final int BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT
public static final int BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT
public static final int BOOTLOADER_STATUS_CRC_MISMATCH
public static final int STATUS_LED_CONFIG_OFF
public static final int STATUS_LED_CONFIG_ON
public static final int STATUS_LED_CONFIG_SHOW_HEARTBEAT
public static final int STATUS_LED_CONFIG_SHOW_STATUS
public BrickletRS232V2(java.lang.String uid, IPConnection ipcon)
public int writeLowLevel(int messageLength, int messageChunkOffset, char[] messageChunkData) throws TinkerforgeException
setConfiguration(long, int, int, int, int)
for configuration possibilities
regarding baud rate, parity and so on.TinkerforgeException
public BrickletRS232V2.ReadLowLevel readLowLevel(int length) throws TinkerforgeException
enableReadCallback()
and BrickletRS232V2.ReadListener
listener.TinkerforgeException
public void enableReadCallback() throws TinkerforgeException
BrickletRS232V2.ReadListener
listener. This will disable the BrickletRS232V2.FrameReadableListener
listener.
By default the listener is disabled.TinkerforgeException
public void disableReadCallback() throws TinkerforgeException
BrickletRS232V2.ReadListener
listener.
By default the listener is disabled.TinkerforgeException
public boolean isReadCallbackEnabled() throws TinkerforgeException
BrickletRS232V2.ReadListener
listener is enabled,
*false* otherwise.TinkerforgeException
public void setConfiguration(long baudrate, int parity, int stopbits, int wordlength, int flowcontrol) throws TinkerforgeException
TinkerforgeException
public BrickletRS232V2.Configuration getConfiguration() throws TinkerforgeException
setConfiguration(long, int, int, int, int)
.TinkerforgeException
public void setBufferConfig(int sendBufferSize, int receiveBufferSize) throws TinkerforgeException
write(char[])
and
can not be written yet. The receive buffer holds data that is
received through RS232 but could not yet be send to the
user, either by read(int)
or through BrickletRS232V2.ReadListener
listener.TinkerforgeException
public BrickletRS232V2.BufferConfig getBufferConfig() throws TinkerforgeException
setBufferConfig(int, int)
.TinkerforgeException
public BrickletRS232V2.BufferStatus getBufferStatus() throws TinkerforgeException
setBufferConfig(int, int)
for buffer size configuration.TinkerforgeException
public BrickletRS232V2.ErrorCount getErrorCount() throws TinkerforgeException
TinkerforgeException
public void setFrameReadableCallbackConfiguration(int frameSize) throws TinkerforgeException
BrickletRS232V2.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 BrickletRS232V2.ReadListener
listener.
By default the listener is disabled.
.. versionadded:: 2.0.3$nbsp;(Plugin)TinkerforgeException
public int getFrameReadableCallbackConfiguration() throws TinkerforgeException
setFrameReadableCallbackConfiguration(int)
.
.. versionadded:: 2.0.3$nbsp;(Plugin)TinkerforgeException
public BrickletRS232V2.SPITFPErrorCount getSPITFPErrorCount() throws TinkerforgeException
TinkerforgeException
public int setBootloaderMode(int mode) throws TinkerforgeException
TinkerforgeException
public int getBootloaderMode() throws TinkerforgeException
setBootloaderMode(int)
.TinkerforgeException
public void setWriteFirmwarePointer(long pointer) throws TinkerforgeException
writeFirmware(int[])
. The pointer has
to be increased by chunks of size 64. The data is written to flash
every 4 chunks (which equals to one page of size 256).
This function is used by Brick Viewer during flashing. It should not be
necessary to call it in a normal user program.TinkerforgeException
public int writeFirmware(int[] data) throws TinkerforgeException
setWriteFirmwarePointer(long)
before. The firmware is written
to flash every 4 chunks.
You can only write firmware in bootloader mode.
This function is used by Brick Viewer during flashing. It should not be
necessary to call it in a normal user program.TinkerforgeException
public void setStatusLEDConfig(int config) throws TinkerforgeException
TinkerforgeException
public int getStatusLEDConfig() throws TinkerforgeException
setStatusLEDConfig(int)
TinkerforgeException
public int getChipTemperature() throws TinkerforgeException
TinkerforgeException
public void reset() throws TinkerforgeException
TinkerforgeException
public void writeUID(long uid) throws TinkerforgeException
TinkerforgeException
public long readUID() throws TinkerforgeException
TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public int write(char[] message) throws TinkerforgeException
setConfiguration(long, int, int, int, int)
for configuration possibilities
regarding baud rate, parity and so on.TinkerforgeException
public char[] read(int length) throws TinkerforgeException
enableReadCallback()
and BrickletRS232V2.ReadListener
listener.TinkerforgeException
public void addReadLowLevelListener(BrickletRS232V2.ReadLowLevelListener listener)
public void removeReadLowLevelListener(BrickletRS232V2.ReadLowLevelListener listener)
public void addErrorCountListener(BrickletRS232V2.ErrorCountListener listener)
public void removeErrorCountListener(BrickletRS232V2.ErrorCountListener listener)
public void addFrameReadableListener(BrickletRS232V2.FrameReadableListener listener)
public void removeFrameReadableListener(BrickletRS232V2.FrameReadableListener listener)
public void addReadListener(BrickletRS232V2.ReadListener listener)
public void removeReadListener(BrickletRS232V2.ReadListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.