Class StatusSignalNative
Static class holding the methods for interfacing to the native StatusSignal API
public static class StatusSignalNative
- Inheritance
-
StatusSignalNative
- Inherited Members
Methods
GetAppliedUpdateFrequency(StatusSignalInfo)
Gets the applied update frequency for the specified signal
public static double GetAppliedUpdateFrequency(StatusSignalNative.StatusSignalInfo signal)
Parameters
signalStatusSignalNative.StatusSignalInfoSignal to get update frequency from
Returns
- double
Update frequency in Hertz
GetUnits(ushort)
Gets the units of the specified SPN index
public static string GetUnits(ushort spn)
Parameters
spnushortSPN index to get units for
Returns
- string
The units of that SPN
OptimizeUpdateFrequencies(string, uint, double, double)
Optimizes the device's bus utilization by reducing the update frequencies of its status signals.
All status signals that have not been explicitly given an update frequency will be slowed down. Note that if other status signals in the same status frame have been given an update frequency, the update frequency will be honored for the entire frame. This function only needs to be called once on this device in the robot program.Additionally, this method does not necessarily need to be called after setting the update frequencies of other signals. To restore the default status update frequencies, call ResetSignalFrequencies(double). Alternatively, remove this method call, redeploy the robot application, and power-cycle the device on the bus. The user can also override individual status update frequencies using SetUpdateFrequency(double, double).public static int OptimizeUpdateFrequencies(string network, uint deviceHash, double optimizedFreqHz, double timeoutSeconds)
Parameters
networkstringNetwork to apply optimization to
deviceHashuintDevice to apply optimization to
optimizedFreqHzdoubleThe update frequency to apply to the optimized status signals.
timeoutSecondsdoubleTimeout for operation
Returns
- int
Status code of the optimization
RefreshSignal(ref StatusSignalInfo, double)
Gets the signal in a non-blocking manner and updates the StatusSignalNative.StatusSignalInfo struct with the updated information.
public static int RefreshSignal(ref StatusSignalNative.StatusSignalInfo signal, double timeoutSeconds)
Parameters
signalStatusSignalNative.StatusSignalInfoReference of struct to update information to
timeoutSecondsdoubleHow long to determine the signal is "stale"
Returns
- int
Status code response of the Refresh operation
ResetUpdateFrequencies(string, uint, double)
Resets the update frequencies of all the device's status signals to the defaults.
This restores the default update frequency of all status signals, including status signals explicitly given an update frequency using SetUpdateFrequency(double, double) and status signals optimized out using OptimizeBusUtilization(double, double).public static int ResetUpdateFrequencies(string network, uint deviceHash, double timeoutSeconds)
Parameters
networkstringNetwork to apply restore to
deviceHashuintDevice to apply restore to
timeoutSecondsdoubleTimeout for operation
Returns
- int
Status code of the restore
SetUpdateFrequency(StatusSignalInfo, double, double)
Sets the update frequency of the specified signal to the specified frequency.
public static int SetUpdateFrequency(StatusSignalNative.StatusSignalInfo signal, double frequencyHz, double timeoutSeconds)
Parameters
signalStatusSignalNative.StatusSignalInfoSignal to set the update frequency to
frequencyHzdoubleFrequency to apply to signal
timeoutSecondsdoubleTimeout for the apply to take
Returns
- int
Status of the apply
SetUpdateFrequencyForAll(double, StatusSignalInfo[], double)
Sets the update frequency for all specified signals.
public static int SetUpdateFrequencyForAll(double frequencyHz, StatusSignalNative.StatusSignalInfo[] signals, double timeoutSeconds)
Parameters
frequencyHzdoubleFrequency to apply to
signalsStatusSignalInfo[]The list of signals to apply the frequency
timeoutSecondsdoubleTimeout for the apply to take
Returns
- int
Status of the apply
WaitForAll(string, double, ref StatusSignalInfo[])
Gets all the signals in a blocking manner and updates the StatusSignalNative.StatusSignalInfo structs with the updated information.
public static int WaitForAll(string network, double timeoutSeconds, ref StatusSignalNative.StatusSignalInfo[] signals)
Parameters
networkstringNetwork to perform the waiting operation on
timeoutSecondsdoubleHow long to wait for all the signals to arrive
signalsStatusSignalInfo[]Reference of the signals to wait for and update
Returns
- int
First non-OK signal of the wait operation
WaitForSignal(ref StatusSignalInfo, double)
Gets the signal in a blocking manner and updates the StatusSignalNative.StatusSignalInfo struct with the updated information.
public static int WaitForSignal(ref StatusSignalNative.StatusSignalInfo signal, double timeoutSeconds)
Parameters
signalStatusSignalNative.StatusSignalInfoReference of struct to update information to
timeoutSecondsdoubleHow long to wait for the signal to arrive
Returns
- int
Status code response of the WaitForSignal operation