public final class FcsUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FcsUtils.AsyncTasks |
static class |
FcsUtils.AutoTimed
class to be used in a try-with-resource block to report the time spent in the
block.
|
| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
FCSLOG |
static int |
MAX_NODE_ID
The maximum number of CANopen devices which can be on a CANbus.
|
static int |
MAX_VALUE_2BYTES
The maximum value which a number coded on 2 bytes can reach.
|
static int |
TICKMILLIS
A value for all fcs Modules tickmillis.
|
| Constructor and Description |
|---|
FcsUtils() |
| Modifier and Type | Method and Description |
|---|---|
static FcsUtils.AsyncTasks |
asyncRun() |
static FcsUtils.AsyncTasks |
asyncRun(Runnable task) |
static String |
buildRsdoCommand(int nodeID,
int index,
int subindex)
build a Can Open rsdo Command that can understand the C wrapper.
|
static String |
buildWsdoCommand(int nodeID,
int index,
int subindex,
int size,
int data)
build a Can Open wsdo Command that can understand the C wrapper.
|
static void |
checkAndWaitCondition(Callable<Boolean> condition,
Runnable update,
String name,
String error)
Wait for a condition to be true, with increasing wait time from 10ms to 200ms
Will run the update function if not null while waiting
Will exit ok if condition is met before timeout (1000 ms)
Otherwise will raise exception
|
static void |
checkCommand(String command) |
static void |
checkPositive(int arg) |
static void |
checkSocketName(String name) |
static int |
computeNewCurrentValue(int stepHeight,
int currentValue,
int finalValue) |
static short |
convertInteger16(long integer16)
Convert a number coded on 16 bits which represents a signed number
(INTEGER16) to a short.
|
static int |
convertInteger32(long integer32)
Convert a number coded on 32 bits which represents a signed number
(INTEGER32) to an int.
|
static byte |
convertInteger8(long integer8)
Convert a number coded on 8 bits which represents a signed number (INTEGER8)
to a byte.
|
static String |
displayListParameters()
Displays the list of parameters.
|
static String |
displayListParameters(String modeInString)
Displays the list of parameters that we have to define for a given mode.
|
static void |
endAsync() |
static boolean |
finalValueReached(int stepHeight,
int newCurrentValue,
int finalValue)
Returns true if the final value is reached.
|
static int |
force2one(int val,
int bit)
Return a new value where the digit (bit number given as argument) has been
replaced by 1.
|
static int |
force2zero(int val,
int bit)
Computes a new value given as argument in replacing bit which is at position
given as argument by 0.
|
static int |
forceBit(int val,
int bit,
int zeroOne)
Sets the nth bit
|
static int |
getSignedStepHeight(int initialValue,
int finalValue,
int increment)
For online clamps.
|
static int |
getTimingLevel() |
static boolean |
isJUnitTest() |
static boolean |
isSimu() |
static boolean |
isValidCommandWord(String command)
returns true if the command given as argument is an available CANopen
command.
|
static void |
main(String[] args) |
static void |
parallelRun(Runnable... tasks)
execute in parallel a list of tasks will wait for all tasks to terminate if a
task throws an exception it will be propagated
|
static int |
returnIndex(int byteNumero)
Compute index to read a byte on a CanOpenPlutoGateway
|
static int |
returnSubindex(int byteNumero)
Compute subindex to read a byte on a CanOpenPlutoGateway
|
static void |
sleep(int duration,
String itemName) |
static void |
startAsync(int level) |
static void |
waitCondition(Callable<Boolean> condition,
Runnable update,
String name,
long timeout)
Wait for a condition to be true, with increasing wait time from 10ms to 200ms
Will run the update function if not null while waiting
Will exit ok if condition is met or upon timeout
|
protected static final Logger FCSLOG
public static final int MAX_VALUE_2BYTES
public static final int MAX_NODE_ID
public static final int TICKMILLIS
public static void checkSocketName(String name)
name - public static int force2zero(int val,
int bit)
val - value to transformbit - bit numero to be replacedIllegalArgumentException - if bit <0 or bit >15public static int force2one(int val,
int bit)
val - bit - public static int forceBit(int val,
int bit,
int zeroOne)
val - the value to modifiybit - the bit number to setzeroOne - if zero forces to zero. Forces to one otherwisepublic static String buildWsdoCommand(int nodeID, int index, int subindex, int size, int data)
nodeID - index - subindex - size - data - public static String buildRsdoCommand(int nodeID, int index, int subindex)
nodeID - index - subindex - public static boolean isValidCommandWord(String command)
command - public static void checkCommand(String command)
command - IllegalArgumentException - if command is not a valid command.public static byte convertInteger8(long integer8)
integer8 - public static short convertInteger16(long integer16)
integer16 - a long because readSDO command returns a long.public static int convertInteger32(long integer32)
integer32 - public static String displayListParameters(String modeInString)
modeInString - public static String displayListParameters()
public static int getSignedStepHeight(int initialValue,
int finalValue,
int increment)
initialValue - finalValue - increment - public static void main(String[] args)
args - the command line argumentspublic static boolean finalValueReached(int stepHeight,
int newCurrentValue,
int finalValue)
stepHeight - newCurrentValue - finalValue - public static int computeNewCurrentValue(int stepHeight,
int currentValue,
int finalValue)
public static void sleep(int duration,
String itemName)
public static void checkPositive(int arg)
public static int returnIndex(int byteNumero)
byteNumero - public static int returnSubindex(int byteNumero)
byteNumero - public static void checkAndWaitCondition(Callable<Boolean> condition, Runnable update, String name, String error)
condition - update - name - error - public static void waitCondition(Callable<Boolean> condition, Runnable update, String name, long timeout)
condition - update - name - timeout - public static int getTimingLevel()
public static void startAsync(int level)
public static void endAsync()
public static void parallelRun(Runnable... tasks)
tasks - public static FcsUtils.AsyncTasks asyncRun(Runnable task)
public static FcsUtils.AsyncTasks asyncRun()
public static boolean isJUnitTest()
public static boolean isSimu()
Copyright © 2022 LSST. All rights reserved.