libsmoco
Low-level interface library for Segment Motion Controller system
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Cache query operations

Functions for interacting with cached state information about SMOCO nodes and actuators. More...

Collaboration diagram for Cache query operations:

Functions

SMOCO_STATUS smoco_cache_verify_node (SMOCO_CTX ctx, SMOCO_NodeID node_id)
 Verify existence of cache information for a SMOCO node. More...
 
SMOCO_STATUS smoco_cache_get_act_position (SMOCO_CTX ctx, unsigned *p_position, SMOCO_NodeID node_id, SMOCO_ActuatorID act_id)
 Find cached position of an actuator. More...
 
SMOCO_STATUS smoco_cache_get_act_velocity (SMOCO_CTX ctx, unsigned *p_velocity, SMOCO_NodeID node_id, SMOCO_ActuatorID act_id)
 Get current velocity of actuator from cache. More...
 
SMOCO_STATUS smoco_cache_get_act_vmax (SMOCO_CTX ctx, unsigned *p_vmax, SMOCO_NodeID node_id, SMOCO_ActuatorID act_id)
 Find maximum velocity setting for an actuator. More...
 
SMOCO_STATUS smoco_cache_get_act_limitstatus (SMOCO_CTX ctx, uint8_t *p_lstat, SMOCO_NodeID node_id, SMOCO_ActuatorID act_id)
 Find cached limit switch status of an actuator, in the form of a bit field. More...
 
SMOCO_STATUS smoco_cache_get_act_mvstatus (SMOCO_CTX ctx, uint8_t *p_mvstat, SMOCO_NodeID node_id, SMOCO_ActuatorID act_id)
 Find cached movement status of an actuator, in the form of a bit field. More...
 

Detailed Description

Functions for interacting with cached state information about SMOCO nodes and actuators.

Responses from SMOCO that contain state information are intercepted and cached automatically. smoco_cache functions provide an interface for accessing that cached state information. Note that the cached values may vary from the current real values; for best possible accuracy these functions should be invoked immediately after commands that refresh the cache information (eg. GETACTSTAT).

Function Documentation

SMOCO_STATUS smoco_cache_get_act_limitstatus ( SMOCO_CTX  ctx,
uint8_t *  p_lstat,
SMOCO_NodeID  node_id,
SMOCO_ActuatorID  act_id 
)

Find cached limit switch status of an actuator, in the form of a bit field.

Parameters
ctxContext handle for this session
p_lstatPointer to receive limit status value. This value will consist of bits set corresponding to both upper and lower limit switches, at bit positions defined by the Actuator_Limit_Flags enumeration in smoco_types.h
node_idIdentifier of node to query. Must be a single valid node; a value of ALL_SMOCO_NODES will result in an error.
act_idIdentifier of an actuator to query. Must be a single valid actuator; a value of ACT_ALL or ACT_NONE will result in an error.
Returns
SMOCO_ST_SUCCESS if cached limit switch value was found; all other values indicate an error.
SMOCO_STATUS smoco_cache_get_act_mvstatus ( SMOCO_CTX  ctx,
uint8_t *  p_mvstat,
SMOCO_NodeID  node_id,
SMOCO_ActuatorID  act_id 
)

Find cached movement status of an actuator, in the form of a bit field.

Parameters
ctxContext handle for this session
p_mvstatPointer to receive movement status value. Bits in this value are defined in the SMOCO_Status_Flags enumeration in smoco_types.h
node_idIdentifier of node to query. Must be a single valid node; a value of ALL_SMOCO_NODES will result in an error.
act_idIdentifier of an actuator to query. Must be a single valid actuator; a value of ACT_ALL or ACT_NONE will result in an error.
Returns
SMOCO_ST_SUCCESS if cached limit switch value was found; all other values indicate an error.
SMOCO_STATUS smoco_cache_get_act_position ( SMOCO_CTX  ctx,
unsigned *  p_position,
SMOCO_NodeID  node_id,
SMOCO_ActuatorID  act_id 
)

Find cached position of an actuator.

Parameters
ctxContext handle for this session
p_positionPointer to receive position value.
node_idIdentifier of node to query. Must be a single valid node; a value of ALL_SMOCO_NODES will result in an error.
act_idIdentifier of an actuator to query. Must be a single valid actuator; a value of ACT_ALL or ACT_NONE will result in an error.
Returns
SMOCO_ST_SUCCESS if cached position was found; all other values indicate an error.
SMOCO_STATUS smoco_cache_get_act_velocity ( SMOCO_CTX  ctx,
unsigned *  p_velocity,
SMOCO_NodeID  node_id,
SMOCO_ActuatorID  act_id 
)

Get current velocity of actuator from cache.

Be aware that the value fetched by this function is likely to be stale unless immediately preceded by a status response from the SMOCO controller.

Parameters
ctxContext handle for this session
p_velocityPointer to receive velocity value, in steps per second.
node_idIdentifier of node to query. Must be a single valid node; a value of ALL_SMOCO_NODES will result in an error.
act_idIdentifier of an actuator to query. Must be a single valid actuator; a value of ACT_ALL or ACT_NONE will result in an error.
Returns
SMOCO_ST_SUCCESS if cached position was found; all other values indicate an error.
SMOCO_STATUS smoco_cache_get_act_vmax ( SMOCO_CTX  ctx,
unsigned *  p_vmax,
SMOCO_NodeID  node_id,
SMOCO_ActuatorID  act_id 
)

Find maximum velocity setting for an actuator.

Parameters
ctxContext handle for this session
p_vmaxPointer to receive maximum velocity value.
node_idIdentifier of node to query. Must be a single valid node; a value of ALL_SMOCO_NODES will result in an error.
act_idIdentifier of an actuator to query. Must be a single valid actuator; a value of ACT_ALL or ACT_NONE will result in an error.
Returns
SMOCO_ST_SUCCESS if cached maximum velocity was found; all other values indicate an error.
SMOCO_STATUS smoco_cache_verify_node ( SMOCO_CTX  ctx,
SMOCO_NodeID  node_id 
)

Verify existence of cache information for a SMOCO node.

Parameters
ctxContext handle for this session
node_idIdentifier of node to query
Returns
SMOCO_ST_SUCCESS if node cache found, SMOCO_ST_BADNODE if not found