public class BrickletCANV2 extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletCANV2.ErrorLog |
class |
BrickletCANV2.ErrorLogLowLevel |
static interface |
BrickletCANV2.ErrorOccurredListener
This listener is triggered if any error occurred while writing, reading or transmitting CAN frames.
|
static interface |
BrickletCANV2.FrameReadableListener
This listener is triggered if a data or remote frame was received by the CAN
transceiver.
|
static interface |
BrickletCANV2.FrameReadListener
This listener is triggered if a data or remote frame was received by the CAN
transceiver.
|
static interface |
BrickletCANV2.FrameReadLowLevelListener |
class |
BrickletCANV2.QueueConfiguration |
class |
BrickletCANV2.QueueConfigurationLowLevel |
class |
BrickletCANV2.ReadFilterConfiguration |
class |
BrickletCANV2.ReadFrame |
class |
BrickletCANV2.ReadFrameLowLevel |
class |
BrickletCANV2.SPITFPErrorCount |
class |
BrickletCANV2.TransceiverConfiguration |
Device.Identity
Constructor and Description |
---|
BrickletCANV2(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addErrorOccurredListener(BrickletCANV2.ErrorOccurredListener listener)
Adds a ErrorOccurred listener.
|
void |
addFrameReadableListener(BrickletCANV2.FrameReadableListener listener)
Adds a FrameReadable listener.
|
void |
addFrameReadListener(BrickletCANV2.FrameReadListener listener)
Adds a FrameRead listener.
|
void |
addFrameReadLowLevelListener(BrickletCANV2.FrameReadLowLevelListener listener)
Adds a FrameReadLowLevel listener.
|
int |
getBootloaderMode()
Returns the current bootloader mode, see
setBootloaderMode(int) . |
int |
getChipTemperature()
Returns the temperature as measured inside the microcontroller.
|
int |
getCommunicationLEDConfig()
Returns the configuration as set by
setCommunicationLEDConfig(int) |
int |
getErrorLEDConfig()
Returns the configuration as set by
setErrorLEDConfig(int) . |
BrickletCANV2.ErrorLog |
getErrorLog()
Returns information about different kinds of errors.
|
BrickletCANV2.ErrorLogLowLevel |
getErrorLogLowLevel()
Returns information about different kinds of errors.
|
boolean |
getErrorOccurredCallbackConfiguration()
Returns *true* if the
BrickletCANV2.ErrorOccurredListener listener is enabled, *false* otherwise. |
boolean |
getFrameReadableCallbackConfiguration()
Returns *true* if the
BrickletCANV2.FrameReadableListener listener is enabled, *false* otherwise. |
boolean |
getFrameReadCallbackConfiguration()
Returns *true* if the
BrickletCANV2.FrameReadListener listener is enabled, *false* otherwise. |
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.
|
BrickletCANV2.QueueConfiguration |
getQueueConfiguration()
Returns the queue configuration as set by
setQueueConfiguration(int, int, int, int[], int) . |
BrickletCANV2.QueueConfigurationLowLevel |
getQueueConfigurationLowLevel()
Returns the queue configuration as set by
setQueueConfiguration(int, int, int, int[], int) . |
BrickletCANV2.ReadFilterConfiguration |
getReadFilterConfiguration(int bufferIndex)
Returns the read filter configuration as set by
setReadFilterConfiguration(int, int, long, long) . |
BrickletCANV2.SPITFPErrorCount |
getSPITFPErrorCount()
Returns the error count for the communication between Brick and Bricklet.
|
int |
getStatusLEDConfig()
Returns the configuration as set by
setStatusLEDConfig(int) |
BrickletCANV2.TransceiverConfiguration |
getTransceiverConfiguration()
Returns the configuration as set by
setTransceiverConfiguration(long, int, int) . |
BrickletCANV2.ReadFrame |
readFrame()
Tries to read the next data or remote frame from the read queue and returns it.
|
BrickletCANV2.ReadFrameLowLevel |
readFrameLowLevel()
Tries to read the next data or remote frame from the read queue and returns it.
|
long |
readUID()
Returns the current UID as an integer.
|
void |
removeErrorOccurredListener(BrickletCANV2.ErrorOccurredListener listener)
Removes a ErrorOccurred listener.
|
void |
removeFrameReadableListener(BrickletCANV2.FrameReadableListener listener)
Removes a FrameReadable listener.
|
void |
removeFrameReadListener(BrickletCANV2.FrameReadListener listener)
Removes a FrameRead listener.
|
void |
removeFrameReadLowLevelListener(BrickletCANV2.FrameReadLowLevelListener listener)
Removes a FrameReadLowLevel 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 |
setCommunicationLEDConfig(int config)
Sets the communication LED configuration.
|
void |
setErrorLEDConfig(int config)
Sets the error LED configuration.
|
void |
setErrorOccurredCallbackConfiguration(boolean enabled)
Enables and disables the
BrickletCANV2.ErrorOccurredListener listener. |
void |
setFrameReadableCallbackConfiguration(boolean enabled)
Enables and disables the
BrickletCANV2.FrameReadableListener listener. |
void |
setFrameReadCallbackConfiguration(boolean enabled)
Enables and disables the
BrickletCANV2.FrameReadListener listener. |
void |
setQueueConfiguration(int writeBufferSize,
int writeBufferTimeout,
int writeBacklogSize,
int[] readBufferSizes,
int readBacklogSize)
Sets the write and read queue configuration.
|
void |
setQueueConfigurationLowLevel(int writeBufferSize,
int writeBufferTimeout,
int writeBacklogSize,
int readBufferSizesLength,
int[] readBufferSizesData,
int readBacklogSize)
Sets the write and read queue configuration.
|
void |
setReadFilterConfiguration(int bufferIndex,
int filterMode,
long filterMask,
long filterIdentifier)
Set the read filter configuration for the given read buffer index.
|
void |
setStatusLEDConfig(int config)
Sets the status LED configuration.
|
void |
setTransceiverConfiguration(long baudRate,
int samplePoint,
int transceiverMode)
Sets the transceiver configuration for the CAN bus communication.
|
void |
setWriteFirmwarePointer(long pointer)
Sets the firmware pointer for
writeFirmware(int[]) . |
int |
writeFirmware(int[] data)
Writes 64 Bytes of firmware at the position as written by
setWriteFirmwarePointer(long) before. |
boolean |
writeFrame(int frameType,
long identifier,
int[] data)
Writes a data or remote frame to the write queue to be transmitted over the
CAN transceiver.
|
boolean |
writeFrameLowLevel(int frameType,
long identifier,
int dataLength,
int[] dataData)
Writes a data or remote frame to the write queue to be transmitted over the
CAN transceiver.
|
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_FRAME_LOW_LEVEL
public static final byte FUNCTION_READ_FRAME_LOW_LEVEL
public static final byte FUNCTION_SET_FRAME_READ_CALLBACK_CONFIGURATION
public static final byte FUNCTION_GET_FRAME_READ_CALLBACK_CONFIGURATION
public static final byte FUNCTION_SET_TRANSCEIVER_CONFIGURATION
public static final byte FUNCTION_GET_TRANSCEIVER_CONFIGURATION
public static final byte FUNCTION_SET_QUEUE_CONFIGURATION_LOW_LEVEL
public static final byte FUNCTION_GET_QUEUE_CONFIGURATION_LOW_LEVEL
public static final byte FUNCTION_SET_READ_FILTER_CONFIGURATION
public static final byte FUNCTION_GET_READ_FILTER_CONFIGURATION
public static final byte FUNCTION_GET_ERROR_LOG_LOW_LEVEL
public static final byte FUNCTION_SET_COMMUNICATION_LED_CONFIG
public static final byte FUNCTION_GET_COMMUNICATION_LED_CONFIG
public static final byte FUNCTION_SET_ERROR_LED_CONFIG
public static final byte FUNCTION_GET_ERROR_LED_CONFIG
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_SET_ERROR_OCCURRED_CALLBACK_CONFIGURATION
public static final byte FUNCTION_GET_ERROR_OCCURRED_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 FRAME_TYPE_STANDARD_DATA
public static final int FRAME_TYPE_STANDARD_REMOTE
public static final int FRAME_TYPE_EXTENDED_DATA
public static final int FRAME_TYPE_EXTENDED_REMOTE
public static final int TRANSCEIVER_MODE_NORMAL
public static final int TRANSCEIVER_MODE_LOOPBACK
public static final int TRANSCEIVER_MODE_READ_ONLY
public static final int FILTER_MODE_ACCEPT_ALL
public static final int FILTER_MODE_MATCH_STANDARD_ONLY
public static final int FILTER_MODE_MATCH_EXTENDED_ONLY
public static final int FILTER_MODE_MATCH_STANDARD_AND_EXTENDED
public static final int TRANSCEIVER_STATE_ACTIVE
public static final int TRANSCEIVER_STATE_PASSIVE
public static final int TRANSCEIVER_STATE_DISABLED
public static final int COMMUNICATION_LED_CONFIG_OFF
public static final int COMMUNICATION_LED_CONFIG_ON
public static final int COMMUNICATION_LED_CONFIG_SHOW_HEARTBEAT
public static final int COMMUNICATION_LED_CONFIG_SHOW_COMMUNICATION
public static final int ERROR_LED_CONFIG_OFF
public static final int ERROR_LED_CONFIG_ON
public static final int ERROR_LED_CONFIG_SHOW_HEARTBEAT
public static final int ERROR_LED_CONFIG_SHOW_TRANSCEIVER_STATE
public static final int ERROR_LED_CONFIG_SHOW_ERROR
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 BrickletCANV2(java.lang.String uid, IPConnection ipcon)
public boolean writeFrameLowLevel(int frameType, long identifier, int dataLength, int[] dataData) throws TinkerforgeException
setQueueConfiguration(int, int, int, int[], int)
).
The write queue can overflow if frames are written to it at a higher rate
than the Bricklet can transmitted them over the CAN transceiver. This may
happen if the CAN transceiver is configured as read-only or is using a low baud
rate (see setTransceiverConfiguration(long, int, int)
). It can also happen if the CAN
bus is congested and the frame cannot be transmitted because it constantly loses
arbitration or because the CAN transceiver is currently disabled due to a high
write error level (see getErrorLog()
).TinkerforgeException
public BrickletCANV2.ReadFrameLowLevel readFrameLowLevel() throws TinkerforgeException
writeFrame(int, long, int[])
.
The ``data`` return value can be up to 15 bytes long. For data frames up to the
first 8 bytes are the actual received data. All bytes after the 8th byte are
always zero and only there to indicate the length of a data or remote frame
with excess length. For remote frames the length of the ``data`` return value
represents the requested length. The actual ``data`` bytes are always zero.
A configurable read filter can be used to define which frames should be
received by the CAN transceiver and put into the read queue (see
setReadFilterConfiguration(int, int, long, long)
).
Instead of polling with this function, you can also use listeners. See the
setFrameReadCallbackConfiguration(boolean)
function and the BrickletCANV2.FrameReadListener
callback.TinkerforgeException
public void setFrameReadCallbackConfiguration(boolean enabled) throws TinkerforgeException
BrickletCANV2.FrameReadListener
listener.
By default the listener is disabled. Enabling this listener will disable the BrickletCANV2.FrameReadableListener
listener.TinkerforgeException
public boolean getFrameReadCallbackConfiguration() throws TinkerforgeException
BrickletCANV2.FrameReadListener
listener is enabled, *false* otherwise.TinkerforgeException
public void setTransceiverConfiguration(long baudRate, int samplePoint, int transceiverMode) throws TinkerforgeException
TinkerforgeException
public BrickletCANV2.TransceiverConfiguration getTransceiverConfiguration() throws TinkerforgeException
setTransceiverConfiguration(long, int, int)
.TinkerforgeException
public void setQueueConfigurationLowLevel(int writeBufferSize, int writeBufferTimeout, int writeBacklogSize, int readBufferSizesLength, int[] readBufferSizesData, int readBacklogSize) throws TinkerforgeException
writeFrame(int, long, int[])
writes a frame into the write backlog. The Bricklet moves
the frame from the backlog into a free write buffer. The CAN transceiver then
transmits the frame from the write buffer to the CAN bus. If there are no
write buffers (``write_buffer_size`` is zero) or there is no write backlog
(``write_backlog_size`` is zero) then no frames can be transmitted and
writeFrame(int, long, int[])
returns always *false*.
The CAN transceiver receives a frame from the CAN bus and stores it into a
free read buffer. The Bricklet moves the frame from the read buffer into the
read backlog. readFrame()
reads the frame from the read backlog and
returns it. If there are no read buffers (``read_buffer_sizes`` is empty) or
there is no read backlog (``read_backlog_size`` is zero) then no frames can be
received and readFrame()
returns always *false*.
There can be multiple read buffers, because the CAN transceiver cannot receive
data and remote frames into the same read buffer. A positive read buffer size
represents a data frame read buffer and a negative read buffer size represents
a remote frame read buffer. A read buffer size of zero is not allowed. By
default the first read buffer is configured for data frames and the second read
buffer is configured for remote frame. There can be up to 32 different read
buffers, assuming that no write buffer is used. Each read buffer has its own
filter configuration (see setReadFilterConfiguration(int, int, long, long)
).
A valid queue configuration fulfills these conditions::
write_buffer_size + abs(read_buffer_size_0) + abs(read_buffer_size_1) + ... + abs(read_buffer_size_31) <= 32
write_backlog_size + read_backlog_size <= 768
The write buffer timeout has three different modes that define how a failed
frame transmission should be handled:
* Single-Shot (< 0): Only one transmission attempt will be made. If the
transmission fails then the frame is discarded.
* Infinite (= 0): Infinite transmission attempts will be made. The frame will
never be discarded.
* Milliseconds (> 0): A limited number of transmission attempts will be made.
If the frame could not be transmitted successfully after the configured
number of milliseconds then the frame is discarded.
The current content of the queues is lost when this function is called.TinkerforgeException
public BrickletCANV2.QueueConfigurationLowLevel getQueueConfigurationLowLevel() throws TinkerforgeException
setQueueConfiguration(int, int, int, int[], int)
.TinkerforgeException
public void setReadFilterConfiguration(int bufferIndex, int filterMode, long filterMask, long filterIdentifier) throws TinkerforgeException
setQueueConfiguration(int, int, int, int[], int)
).
The default mode is accept-all for all read buffers.TinkerforgeException
public BrickletCANV2.ReadFilterConfiguration getReadFilterConfiguration(int bufferIndex) throws TinkerforgeException
setReadFilterConfiguration(int, int, long, long)
.TinkerforgeException
public BrickletCANV2.ErrorLogLowLevel getErrorLogLowLevel() throws TinkerforgeException
setQueueConfiguration(int, int, int, int[], int)
).
* A read buffer overflow occurs if a read buffer of the CAN transceiver
still contains the last received frame when the next frame arrives. In this
case the last received frame is lost. This happens if the CAN transceiver
receives more frames than the Bricklet can handle. Using the read filter
(see setReadFilterConfiguration(int, int, long, long)
) can help to reduce the amount of
received frames. This count is not exact, but a lower bound, because the
Bricklet might not able detect all overflows if they occur in rapid succession.
* A read backlog overflow occurs if the read backlog of the Bricklet is already
full when the next frame should be read from a read buffer of the CAN
transceiver. In this case the frame in the read buffer is lost. This
happens if the CAN transceiver receives more frames to be added to the read
backlog than are removed from the read backlog using the readFrame()
function. Using the BrickletCANV2.FrameReadListener
listener ensures that the read backlog
can not overflow.
The read buffer overflow counter counts the overflows of all configured read
buffers. Which read buffer exactly suffered from an overflow can be figured
out from the read buffer overflow occurrence list
(``read_buffer_overflow_error_occurred``). Reading the error log clears the
occurence list.TinkerforgeException
public void setCommunicationLEDConfig(int config) throws TinkerforgeException
TinkerforgeException
public int getCommunicationLEDConfig() throws TinkerforgeException
setCommunicationLEDConfig(int)
TinkerforgeException
public void setErrorLEDConfig(int config) throws TinkerforgeException
getErrorLog()
). If
the CAN transceiver is in active state the LED turns off.
If the LED is configured as show-error then the error LED turns on if any error
occurs. If you call this function with the show-error option again, the LED will
turn off until the next error occurs.
You can also turn the LED permanently on/off or show a heartbeat.
If the Bricklet is in bootloader mode, the LED is off.TinkerforgeException
public int getErrorLEDConfig() throws TinkerforgeException
setErrorLEDConfig(int)
.TinkerforgeException
public void setFrameReadableCallbackConfiguration(boolean enabled) throws TinkerforgeException
BrickletCANV2.FrameReadableListener
listener.
By default the listener is disabled. Enabling this listener will disable the BrickletCANV2.FrameReadListener
listener.
.. versionadded:: 2.0.3$nbsp;(Plugin)TinkerforgeException
public boolean getFrameReadableCallbackConfiguration() throws TinkerforgeException
BrickletCANV2.FrameReadableListener
listener is enabled, *false* otherwise.
.. versionadded:: 2.0.3$nbsp;(Plugin)TinkerforgeException
public void setErrorOccurredCallbackConfiguration(boolean enabled) throws TinkerforgeException
BrickletCANV2.ErrorOccurredListener
listener.
By default the listener is disabled.
.. versionadded:: 2.0.3$nbsp;(Plugin)TinkerforgeException
public boolean getErrorOccurredCallbackConfiguration() throws TinkerforgeException
BrickletCANV2.ErrorOccurredListener
listener is enabled, *false* otherwise.
.. versionadded:: 2.0.3$nbsp;(Plugin)TinkerforgeException
public BrickletCANV2.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 boolean writeFrame(int frameType, long identifier, int[] data) throws TinkerforgeException
setQueueConfiguration(int, int, int, int[], int)
).
The write queue can overflow if frames are written to it at a higher rate
than the Bricklet can transmitted them over the CAN transceiver. This may
happen if the CAN transceiver is configured as read-only or is using a low baud
rate (see setTransceiverConfiguration(long, int, int)
). It can also happen if the CAN
bus is congested and the frame cannot be transmitted because it constantly loses
arbitration or because the CAN transceiver is currently disabled due to a high
write error level (see getErrorLog()
).TinkerforgeException
public BrickletCANV2.ReadFrame readFrame() throws TinkerforgeException
writeFrame(int, long, int[])
.
The ``data`` return value can be up to 15 bytes long. For data frames up to the
first 8 bytes are the actual received data. All bytes after the 8th byte are
always zero and only there to indicate the length of a data or remote frame
with excess length. For remote frames the length of the ``data`` return value
represents the requested length. The actual ``data`` bytes are always zero.
A configurable read filter can be used to define which frames should be
received by the CAN transceiver and put into the read queue (see
setReadFilterConfiguration(int, int, long, long)
).
Instead of polling with this function, you can also use listeners. See the
setFrameReadCallbackConfiguration(boolean)
function and the BrickletCANV2.FrameReadListener
callback.TinkerforgeException
public void setQueueConfiguration(int writeBufferSize, int writeBufferTimeout, int writeBacklogSize, int[] readBufferSizes, int readBacklogSize) throws TinkerforgeException
writeFrame(int, long, int[])
writes a frame into the write backlog. The Bricklet moves
the frame from the backlog into a free write buffer. The CAN transceiver then
transmits the frame from the write buffer to the CAN bus. If there are no
write buffers (``write_buffer_size`` is zero) or there is no write backlog
(``write_backlog_size`` is zero) then no frames can be transmitted and
writeFrame(int, long, int[])
returns always *false*.
The CAN transceiver receives a frame from the CAN bus and stores it into a
free read buffer. The Bricklet moves the frame from the read buffer into the
read backlog. readFrame()
reads the frame from the read backlog and
returns it. If there are no read buffers (``read_buffer_sizes`` is empty) or
there is no read backlog (``read_backlog_size`` is zero) then no frames can be
received and readFrame()
returns always *false*.
There can be multiple read buffers, because the CAN transceiver cannot receive
data and remote frames into the same read buffer. A positive read buffer size
represents a data frame read buffer and a negative read buffer size represents
a remote frame read buffer. A read buffer size of zero is not allowed. By
default the first read buffer is configured for data frames and the second read
buffer is configured for remote frame. There can be up to 32 different read
buffers, assuming that no write buffer is used. Each read buffer has its own
filter configuration (see setReadFilterConfiguration(int, int, long, long)
).
A valid queue configuration fulfills these conditions::
write_buffer_size + abs(read_buffer_size_0) + abs(read_buffer_size_1) + ... + abs(read_buffer_size_31) <= 32
write_backlog_size + read_backlog_size <= 768
The write buffer timeout has three different modes that define how a failed
frame transmission should be handled:
* Single-Shot (< 0): Only one transmission attempt will be made. If the
transmission fails then the frame is discarded.
* Infinite (= 0): Infinite transmission attempts will be made. The frame will
never be discarded.
* Milliseconds (> 0): A limited number of transmission attempts will be made.
If the frame could not be transmitted successfully after the configured
number of milliseconds then the frame is discarded.
The current content of the queues is lost when this function is called.TinkerforgeException
public BrickletCANV2.QueueConfiguration getQueueConfiguration() throws TinkerforgeException
setQueueConfiguration(int, int, int, int[], int)
.TinkerforgeException
public BrickletCANV2.ErrorLog getErrorLog() throws TinkerforgeException
setQueueConfiguration(int, int, int, int[], int)
).
* A read buffer overflow occurs if a read buffer of the CAN transceiver
still contains the last received frame when the next frame arrives. In this
case the last received frame is lost. This happens if the CAN transceiver
receives more frames than the Bricklet can handle. Using the read filter
(see setReadFilterConfiguration(int, int, long, long)
) can help to reduce the amount of
received frames. This count is not exact, but a lower bound, because the
Bricklet might not able detect all overflows if they occur in rapid succession.
* A read backlog overflow occurs if the read backlog of the Bricklet is already
full when the next frame should be read from a read buffer of the CAN
transceiver. In this case the frame in the read buffer is lost. This
happens if the CAN transceiver receives more frames to be added to the read
backlog than are removed from the read backlog using the readFrame()
function. Using the BrickletCANV2.FrameReadListener
listener ensures that the read backlog
can not overflow.
The read buffer overflow counter counts the overflows of all configured read
buffers. Which read buffer exactly suffered from an overflow can be figured
out from the read buffer overflow occurrence list
(``read_buffer_overflow_error_occurred``). Reading the error log clears the
occurence list.TinkerforgeException
public void addFrameReadLowLevelListener(BrickletCANV2.FrameReadLowLevelListener listener)
public void removeFrameReadLowLevelListener(BrickletCANV2.FrameReadLowLevelListener listener)
public void addFrameReadableListener(BrickletCANV2.FrameReadableListener listener)
public void removeFrameReadableListener(BrickletCANV2.FrameReadableListener listener)
public void addErrorOccurredListener(BrickletCANV2.ErrorOccurredListener listener)
public void removeErrorOccurredListener(BrickletCANV2.ErrorOccurredListener listener)
public void addFrameReadListener(BrickletCANV2.FrameReadListener listener)
public void removeFrameReadListener(BrickletCANV2.FrameReadListener listener)
Copyright © 2020 Tinkerforge GmbH. All rights reserved.