Note
This Bricklet is currently in the prototype stage and the software/hardware as well as the documentation is in an incomplete state.
This is the description of the Java API bindings for the ARINC429 Bricklet. General information and technical specifications for the ARINC429 Bricklet are summarized in its hardware description.
An installation guide for the Java API bindings is part of their general description.
Generally, every method of the Java bindings that returns a value can
throw a TimeoutException
. This exception gets thrown if the
device did not respond. If a cable based connection is used, it is
unlikely that this exception gets thrown (assuming nobody unplugs the
device). However, if a wireless connection is used, timeouts will occur
if the distance to the device gets too big.
Beside the TimeoutException
there is also a NotConnectedException
that
is thrown if a method needs to communicate with the device while the
IP Connection is not connected.
Since Java does not support multiple return values and return by reference is not possible for primitive types, we use small classes that only consist of member variables. The member variables of the returned objects are described in the corresponding method descriptions.
The package for all Brick/Bricklet bindings and the IP Connection is
com.tinkerforge.*
All methods listed below are thread-safe.
BrickletARINC429
(String uid, IPConnection ipcon)¶Parameters: |
|
---|---|
Returns: |
|
Creates an object with the unique device ID uid
:
BrickletARINC429 arinc429 = new BrickletARINC429("YOUR_DEVICE_UID", ipcon);
This object can then be used after the IP Connection is connected.
BrickletARINC429.
getCapabilities
()¶Return Object: |
|
---|
Gets the capabilities of the ARINC429 Bricklet as of the currently loaded firmware:
BrickletARINC429.
setChannelConfiguration
(int channel, int parity, int speed)¶Parameters: |
|
---|
Sets the data transmission properties of the selected channel:
When parity set to 'parity_auto', frames received with a parity error will be counted in the lost frames counter but discarded otherwise.
The following constants are available for this function:
For channel:
For parity:
For speed:
BrickletARINC429.
getChannelConfiguration
(int channel)¶Parameters: |
|
---|---|
Return Object: |
|
Gets the data transmission properties of the selected channel. The channel parameter and the data returned use the same constants
as the setChannelConfiguration()
, despite that the all-channels constants CHANNEL_TX and CHANNEL_RX can not be used.
The following constants are available for this function:
For channel:
For parity:
For speed:
BrickletARINC429.
setChannelMode
(int channel, int mode)¶Parameters: |
|
---|
Sets the operating mode of the selected channel(s):
The following constants are available for this function:
For channel:
For mode:
BrickletARINC429.
getChannelMode
(int channel)¶Parameters: |
|
---|---|
Returns: |
|
Gets the operating mode of the selected channel. The channel parameter and the data returned use the same constants as the
setChannelConfiguration()
, despite that the all-channels constants CHANNEL_TX and CHANNEL_RX can not be used.
The following constants are available for this function:
For channel:
For mode:
BrickletARINC429.
clearAllRXFilters
(int channel)¶Parameters: |
|
---|
Clears all receive filters on the selected RX channel(s). The RX channels will only process those Arinc429 frames that pass the input filtering stage. With this command, all filters are cleared, thus all incoming Arinc429 frames will be blocked from further processing.
The following constants are available for this function:
For channel:
BrickletARINC429.
clearRXFilter
(int channel, int label, int sdi)¶Parameters: |
|
---|---|
Returns: |
|
Clears a specific receive filter on the selected RX channel(s). The RX channels will only process those Arinc429 frames that pass the input filtering stage. With this command, an Arinc429 frame matching the given parameters will be blocked by the filter.
The function either returns 'True' if the filter was cleared or 'False' if a respective filter was not set.
The following constants are available for this function:
For channel:
For sdi:
BrickletARINC429.
setRXStandardFilters
(int channel)¶Parameters: |
|
---|
Sets a receive filter for each label value (0-255 / 0o000-0o377) with the SDI bits set for data. Any previously existing filters will be overwritten.
The following constants are available for this function:
For channel:
BrickletARINC429.
setRXFilter
(int channel, int label, int sdi)¶Parameters: |
|
---|---|
Returns: |
|
Sets a specific receive filter on the selected channel(s):
The function either returns 'True' if the filter was set or 'False' if a respective filter could not be created e.g. because the given combination
of label and SDI collides with an already existing filter, or because all available filters are used up (see the getCapabilities()
function).
The following constants are available for this function:
For channel:
For sdi:
BrickletARINC429.
getRXFilter
(int channel, int label, int sdi)¶Parameters: |
|
---|---|
Returns: |
|
Queries if a filter for the given combination of label and SDI is set up or not:
The function will return 'True' if the queried filter filter exists, else 'False'.
The following constants are available for this function:
For channel:
For sdi:
BrickletARINC429.
readFrame
(int channel, int label, int sdi)¶Parameters: |
|
---|---|
Return Object: |
|
Executes a direct read of an Arinc429 frame, i.e. without using the listener mechanism. In order to be able to do a direct read of a frame with a certain label and SDI combination, a respective receive filter needs to be set up beforehand.
The function return the following data:
setRXCallbackConfiguration()
will be returned.The following constants are available for this function:
For channel:
For sdi:
BrickletARINC429.
writeFrameDirect
(int channel, long frame)¶Parameters: |
|
---|
Immediately transmits an Arinc429 frame, given that the channel is in either ACTIVE or RUN mode. If the channel is in RUN mode and frames are sent as per programmed schedule, using this function will inject additional frames into the transmission, independent of the scheduler's activities.
The frame needs to be passed as a 32 bit integer. Opposite to the line transmission format, in the API functions the label code is mirrored such that the label code can be directly written 1:1 into the lower 8 bits. Beware that the label codes are usually given in octal notation, so make sure to use the correct notation (i.e. 0o377). If 'parity_auto' is set for the channel, the parity bit will be set (adjusted) automatically.
Between the API and the actual Arinc429 line output, there is a 32 entry deep FIFO. If frames are written via the API and/or in combination with a running TX scheduler, the FIFO may become overfilled and subsequently frames will get lost. Such frame losses will be indicated in the statistics data sent with the heartbeat listener.
The following constants are available for this function:
For channel:
BrickletARINC429.
writeFrameScheduled
(int channel, int frameIndex, long frame)¶Parameters: |
|
---|
Sets or updates an Arinc429 frame that is to be transmitted via the scheduler using the scheduler job types 'Single' or 'Cyclic'.
The frame needs to be passed as a 32 bit integer. Opposite to the line transmission format, in the API functions the label code is mirrored such that the label code can be directly written 1:1 into the lower 8 bits. Beware that the label codes are usually given in octal notation, so make sure to use the correct notation (i.e. 0o377). If 'parity_auto' is set for the channel, the parity bit will be set (adjusted) automatically.
If the frame is used by a 'single transmit' scheduler job entry, setting or updating the frame with this function arms the frame for its next transmission.
The following constants are available for this function:
For channel:
BrickletARINC429.
clearScheduleEntries
(int channel, int jobIndexFirst, int jobIndexLast)¶Parameters: |
|
---|
Clears a range of transmit scheduler job table entries:
To clear a single entry, set 'First' and 'Last' to the one index of the one entry to be cleared. Clearing scheduler entries actually means they are set to the job command 'Skip'.
The following constants are available for this function:
For channel:
BrickletARINC429.
setScheduleEntry
(int channel, int jobIndex, int job, int frameIndex, int dwellTime)¶Parameters: |
|
---|
Sets an entry in the transmit scheduler job table:
getCapabilities()
function for the total number of job indexes available. In firmware 2.4.0 it is 1000.writeFrameScheduled()
.When the scheduler is set to 'run' mode via the setChannelMode()
, it continuously loops through the job table and executes
the assigned tasks. It starts with the job stored at job index 0.
The scheduler can execute the following activity types (jobs):
writeFrameScheduled()
, then the process repeats.The value assigned to the 'Frame Index' parameter varies with the activity type (job):
writeFrameScheduled()
of the frame to transmit. Valid range: 0-255The setScheduleEntry()
can be called while the TX scheduler is running, i.e. the channel mode is set to 'RUN'.
Any change will take immediate effect once the scheduler passes along and executes the changed job entry.
Every time the scheduler is started, it will begin with the job stored at job index 0.
At the end of the programmed schedule there should be a 'Jump' command back to index 0 to avoid the scheduler wasting time in processing all the remaining 'Skip' commands.
Two or more TX schedules can be pre-programmed and then selected for execution by placing - and changing as desired - a 'Jump' at index 0 that then branches to the
sequence of commands destined to be executed. This can be arranged in arbitrary ways, e.g. to create schedules with fixed and variable parts, just by using the 'Jump'
command alike a track switch in railway.
When the dwell time of a transmit command is set to zero, the respective Arinc429 frames will be transmitted back-to-back on the physical link. Beware that there is a FIFO between the scheduler and the actual physical transmitter that is limited to 32 frames. So after latest 32 frames enqueued with zero dwell time, the scheduler needs to be commanded to do some dwelling. How much dwelling is required can be computed by the number of back-to-back frames and the speed setting: in high speed mode each frame takes 0.36 ms, in low speed mode 2.88 ms. If a certain sequence of frames is to be transmitted multiple times in a schedule, this sequence just needs to be put once into the scheduler table with a 'Return' command at its end. This way, this sequence can be called from multiple placed (job indexes) throughout the main schedule using the 'Jump' command. Please note that this kind of calling a subroutine can not be nested, i.e. there is no return index stack, the 'Return' command always branches to the job index following the index of the last 'Jump' command encountered. In case a dwell time > 0 is set with the 'Jump' command, this dwell time will actually be executed on encountering the 'Return' command, thus as a dwell time to be done after the execution of the subsequence that was jumped to before.
The 'Callback' command can be used to notify the application program via a listener when the scheduler passes at the respective job index. This can be used for pure reporting / surveillance purpose, or as a means to set up a self-clocked system in which the called application program's function in return does some modification of the programmed sequence or alike. The scheduler can also be programmed to stop itself via the 'Stop' command, e.g. to run a pre-programmed, accurately timed single-shot sequence of frame transmissions. Placing a' Listener' command right before the 'Stop' command will inform the application program via a listener when the sequence is done. When using several 'Callback' commands in a schedule, each of them can be uniquely identified in the receiving application program by assigning a different 'userdata' value to each listener command.
With the aid of the 'Retrans' commands, a frame transmission schedule can be set up whose frame timing is defined by the schedule, but whose frame's payload is taken from the frames received via the RX1 or RX2 channel. This opens possibilities to create an autonomously operating time base corrector or re-scheduling machinery, to zip the frames from two A429 buses onto one common bus, to create inline filers to remove certain frames (by their label & SDI code), to insert frames into a stream, to exchange the payload of certain frames on-the-fly, and much more.
The following constants are available for this function:
For channel:
For job:
BrickletARINC429.
getScheduleEntry
(int channel, int jobIndex)¶Parameters: |
|
---|---|
Return Object: |
|
Gets the definition of a transmit scheduler job table entry, refer to the setScheduleEntry()
.
The following constants are available for this function:
For channel:
For job:
BrickletARINC429.
restart
()¶Reverts the whole bricklet into its power-up default state.
BrickletARINC429.
setFrameMode
(int channel, int frameIndex, int mode)¶Parameters: |
|
---|
Stops / resumes the transmission of a specific frame or trigger another single-transmit. This function only works on frames that are sent via the TX scheduler jobs 'single' and 'cyclic'.
The following constants are available for this function:
For channel:
For mode:
BrickletARINC429.
getSPITFPErrorCount
()¶Return Object: |
|
---|
Returns the error count for the communication between Brick and Bricklet.
The errors are divided into
The errors counts are for errors that occur on the Bricklet side. All Bricks have a similar function that returns the errors on the Brick side.
BrickletARINC429.
setStatusLEDConfig
(int config)¶Parameters: |
|
---|
Sets the status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets.
You can also turn the LED permanently on/off or show a heartbeat.
If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
The following constants are available for this function:
For config:
BrickletARINC429.
getStatusLEDConfig
()¶Returns: |
|
---|
Returns the configuration as set by setStatusLEDConfig()
The following constants are available for this function:
For config:
BrickletARINC429.
getChipTemperature
()¶Returns: |
|
---|
Returns the temperature as measured inside the microcontroller. The value returned is not the ambient temperature!
The temperature is only proportional to the real temperature and it has bad accuracy. Practically it is only useful as an indicator for temperature changes.
BrickletARINC429.
reset
()¶Calling this function will reset the Bricklet. All configurations will be lost.
After a reset you have to create new device objects, calling functions on the existing ones will result in undefined behavior!
BrickletARINC429.
getIdentity
()¶Return Object: |
|
---|
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.
The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an Isolator Bricklet is always at position 'z'.
The device identifier numbers can be found here. There is also a constant for the device identifier of this Bricklet.
BrickletARINC429.
setHeartbeatCallbackConfiguration
(int channel, boolean enabled, boolean valueHasToChange, int period)¶Parameters: |
|
---|
Sets the bricklet heartbeat listener function which reports the statistics counters for processed frames and lost frames.
The period is the period with which the HeartbeatMessageListener
listener is triggered periodically. A value of 0 turns the listener off.
When 'Value Has To Change' is enabled, the heartbeat will only be sent if there is a change in the statistics numbers.
The following constants are available for this function:
For channel:
BrickletARINC429.
getHeartbeatCallbackConfiguration
(int channel)¶Parameters: |
|
---|---|
Return Object: |
|
Gets the current configuration of the bricklet heartbeat listener, see setHeartbeatCallbackConfiguration()
.
The following constants are available for this function:
For channel:
BrickletARINC429.
setRXCallbackConfiguration
(int channel, boolean enabled, boolean valueHasToChange, int timeout)¶Parameters: |
|
---|
Sets the configuration of the Arinc429 frame reception listener:
Despite on frame reception, a listener is also generated if a frame encounters a timeout, i.e. if it is not periodically received again before the set timeout period has expired. In order to have listeners being generated at all, respective receive filters need to be set up.
The following constants are available for this function:
For channel:
BrickletARINC429.
getRXCallbackConfiguration
(int channel)¶Parameters: |
|
---|---|
Return Object: |
|
Gets the configuration of the frame reception listener, see the setRXCallbackConfiguration()
.
The following constants are available for this function:
For channel:
Listeners can be registered to receive
time critical or recurring data from the device. The registration is done
with add*Listener()
functions of the device object.
The parameter is a listener class object, for example:
device.addExampleListener(new BrickletARINC429.ExampleListener() {
public void property(int value) {
System.out.println("Value: " + value);
}
});
The available listener classes with inherent methods to be overwritten
are described below. It is possible to add several listeners and
to remove them with the corresponding remove*Listener()
function.
Note
Using listeners for recurring events is always preferred compared to using getters. It will use less USB bandwidth and the latency will be a lot better, since there is no round trip time.
BrickletARINC429.
HeartbeatMessageListener
()¶This listener can be added with the addHeartbeatMessageListener()
function.
An added listener can be removed with the removeHeartbeatMessageListener()
function.
heartbeatMessage
(int channel, int status, int seqNumber, int timestamp, int framesProcessed, int framesLost)Parameters: |
|
---|
This listener is triggered periodically according to the configuration set by
setHeartbeatCallbackConfiguration()
. It reports the statistics counters
for processed frames and lost frames for all TX and RX channels.
The following constants are available for this function:
For channel:
For status:
BrickletARINC429.
FrameMessageListener
()¶This listener can be added with the addFrameMessageListener()
function.
An added listener can be removed with the removeFrameMessageListener()
function.
frameMessage
(int channel, int status, int seqNumber, int timestamp, long frame, int age)Parameters: |
|
---|
This listener is triggered according to the configuration set by setRXCallbackConfiguration()
.
setRXCallbackConfiguration()
will be returned.The following constants are available for this function:
For channel:
For status:
BrickletARINC429.
SchedulerMessageListener
()¶This listener can be added with the addSchedulerMessageListener()
function.
An added listener can be removed with the removeSchedulerMessageListener()
function.
schedulerMessage
(int channel, int status, int seqNumber, int timestamp, int userdata)Parameters: |
|
---|
This listener is triggered by the 'Callback' job in the transmit schedule.
The following constants are available for this function:
For channel:
For status:
Virtual functions don't communicate with the device itself, but operate only on the API bindings device object. They can be called without the corresponding IP Connection object being connected.
BrickletARINC429.
getAPIVersion
()¶Return Object: |
|
---|
Returns the version of the API definition implemented by this API bindings. This is neither the release version of this API bindings nor does it tell you anything about the represented Brick or Bricklet.
BrickletARINC429.
getResponseExpected
(byte functionId)¶Parameters: |
|
---|---|
Returns: |
|
Returns the response expected flag for the function specified by the function ID parameter. It is true if the function is expected to send a response, false otherwise.
For getter functions this is enabled by default and cannot be disabled,
because those functions will always send a response. For listener configuration
functions it is enabled by default too, but can be disabled by
setResponseExpected()
. For setter functions it is disabled by default
and can be enabled.
Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is sent and errors are silently ignored, because they cannot be detected.
The following constants are available for this function:
For functionId:
BrickletARINC429.
setResponseExpected
(byte functionId, boolean responseExpected)¶Parameters: |
|
---|
Changes the response expected flag of the function specified by the function ID parameter. This flag can only be changed for setter (default value: false) and listener configuration functions (default value: true). For getter functions it is always enabled.
Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is sent and errors are silently ignored, because they cannot be detected.
The following constants are available for this function:
For functionId:
BrickletARINC429.
setResponseExpectedAll
(boolean responseExpected)¶Parameters: |
|
---|
Changes the response expected flag for all setter and listener configuration functions of this device at once.
Internal functions are used for maintenance tasks such as flashing a new firmware of changing the UID of a Bricklet. These task should be performed using Brick Viewer instead of using the internal functions directly.
BrickletARINC429.
setBootloaderMode
(int mode)¶Parameters: |
|
---|---|
Returns: |
|
Sets the bootloader mode and returns the status after the requested mode change was instigated.
You can change from bootloader mode to firmware mode and vice versa. A change from bootloader mode to firmware mode will only take place if the entry function, device identifier and CRC are present and correct.
This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.
The following constants are available for this function:
For mode:
For status:
BrickletARINC429.
getBootloaderMode
()¶Returns: |
|
---|
Returns the current bootloader mode, see setBootloaderMode()
.
The following constants are available for this function:
For mode:
BrickletARINC429.
setWriteFirmwarePointer
(long pointer)¶Parameters: |
|
---|
Sets the firmware pointer for writeFirmware()
. 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.
BrickletARINC429.
writeFirmware
(int[] data)¶Parameters: |
|
---|---|
Returns: |
|
Writes 64 Bytes of firmware at the position as written by
setWriteFirmwarePointer()
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.
BrickletARINC429.
writeUID
(long uid)¶Parameters: |
|
---|
Writes a new UID into flash. If you want to set a new UID you have to decode the Base58 encoded UID string into an integer first.
We recommend that you use Brick Viewer to change the UID.
BrickletARINC429.
readUID
()¶Returns: |
|
---|
Returns the current UID as an integer. Encode as Base58 to get the usual string version.
BrickletARINC429.
DEVICE_IDENTIFIER
¶This constant is used to identify a ARINC429 Bricklet.
The getIdentity()
function and the
IPConnection.EnumerateListener
listener of the IP Connection have a deviceIdentifier
parameter to specify
the Brick's or Bricklet's type.
BrickletARINC429.
DEVICE_DISPLAY_NAME
¶This constant represents the human readable name of a ARINC429 Bricklet.