Table of Contents

Class StatusSignalNative

Namespace
CTRE.Phoenix6.Native
Assembly
Phoenix6.Hardware.dll

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

signal StatusSignalNative.StatusSignalInfo

Signal 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

spn ushort

SPN 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

network string

Network to apply optimization to

deviceHash uint

Device to apply optimization to

optimizedFreqHz double

The update frequency to apply to the optimized status signals.

timeoutSeconds double

Timeout 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

signal StatusSignalNative.StatusSignalInfo

Reference of struct to update information to

timeoutSeconds double

How 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

network string

Network to apply restore to

deviceHash uint

Device to apply restore to

timeoutSeconds double

Timeout 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

signal StatusSignalNative.StatusSignalInfo

Signal to set the update frequency to

frequencyHz double

Frequency to apply to signal

timeoutSeconds double

Timeout 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

frequencyHz double

Frequency to apply to

signals StatusSignalInfo[]

The list of signals to apply the frequency

timeoutSeconds double

Timeout 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

network string

Network to perform the waiting operation on

timeoutSeconds double

How long to wait for all the signals to arrive

signals StatusSignalInfo[]

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

signal StatusSignalNative.StatusSignalInfo

Reference of struct to update information to

timeoutSeconds double

How long to wait for the signal to arrive

Returns

int

Status code response of the WaitForSignal operation