API Documentation
Node
The Node API implements the PolySync node template. This is recommended for all runtime nodes to conform to. The API provides the ability to query and set the nodes state, set quality of service requirements for messages, and activate/recover from faults.
Usage
#include <polysync_node.h>
Functions
psync_node_activate_fault ( … )
This will activate a node fault and transition to the supplied node state.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the node that will transition to the fault state. |
in | const ps_dtc | dtc_code | The fault code. |
in | const ps_node_state_kind | next_state | The state to transition to as a result of the fault. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_get_flag ( … )
This will get a node flag state.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the node. |
in | const ps_node_flag_kind | flag | A bit-flag key. |
out | unsigned int * const | state | The pointer to the nodes state flag. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_get_flags ( … )
This will get the state of all node flag bits.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the node. |
out | ps_node_flags * const | flags | A pointer to bit-flags. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_get_guid ( … )
This will get the supplied node’s GUID.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the node. |
out | ps_guid * const | guid | A pointer to the GUID. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_get_publisher_reliability_qos ( … )
This will get the node’s default publisher reliability QoS for a given message type.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the node. |
in | const ps_msg_type | msg_type | The message type. |
out | ps_reliability_qos_kind * const | qos | A pointer to the QoS type. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_get_state ( … )
This will get the node’s current state.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | const ps_node_ref | node_ref | Reference to the node. |
out | ps_node_state_kind *const | state | A pointer to ps_node_state_kind that receives the state value. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_get_subscriber_reliability_qos ( … )
This will get a node’s subscriber reliability QoS for a given message type.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the node. |
in | const ps_msg_type | msg_type | The message type. |
out | ps_reliability_qos_kind *const | qos | A pointer to the Qos type. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_init_fault_machine ( … )
This will create needed resources in the node required for using the fault machine. This is also used by the node template. This places the node into the INIT state.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the node that will have its state machine resources initialized. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_is_fault_active ( … )
This will check if the node has an active fault.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | const ps_node_ref | node_ref | Reference to the node. |
in | const ptc_dtc | dtc_code | The fault to check for. |
Returns
- DTC Code:
- DTC_NONE - If DTC is active
- DTC_USAGE - If argument is invalid
- DTC_CONFIG - If node is invalid
- DTC_UNAVAILABLE - If DTC is not active
psync_node_recover_fault ( … )
This will recover from a node fault, and transitions to the supplied node state.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | context | Reference to the node. |
in | const ps_dtc | fault_code | Fault code from which to recover. |
in | const ps_node_state_kind | next_state | The state to transition to as a result of the recovery. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_set_flag ( … )
This wills set the state of a node flag.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the node that will have a flag modified. |
in | const ps_node_flag_kind | flag | Bit-flag key. |
in | const unsigned int | set | The state of a flag. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_set_flags ( … )
This will set the state of all node flag bits.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the node that will have its flags modified. |
in | const ps_node_flags | flags | Bit-flags. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_set_publisher_reliability_qos ( … )
This will set a node’s default publisher reliability QoS for a given message type.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the modified node. |
in | const ps_msg_type | msg_type | The message type to which the settings apply. |
in | const ps_reliability_qos_kind | qos | A QoS type. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_set_subscriber_reliability_qos ( … )
This will set a node’s default subscriber reliability QoS for a given message type.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | Reference to the modified node. |
in | const ps_msg_type | msg_type | The message type to which the settings apply. |
in | const ps_reliability_qos_kind | qos | A QoS type. |
Returns
- DTC Code:
- DTC_NONE - If success
psync_node_transition_state ( … )
This will manually transition a node’s state.
Parameters
In/Out | Type | Name | Description |
---|---|---|---|
in | ps_node_ref | node_ref | The node reference that receives the configurations. |
in | const ps_node_state_kind | state | The state to transition to. |
Returns
- DTC Code:
- DTC_NONE - If success
Macros
Macro
An invalid value for ps_node_ref.
Value | Type | Description |
---|---|---|
NULL | void * | Invalid reference to node. |
Typedefs
ps_node_ref
Data Type | Name | Description |
---|---|---|
void * | ps_node_ref | Opaque node reference data type. Represents reference to a PolySync node. |