libsmoco
Low-level interface library for Segment Motion Controller system
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Long-Running Command Functions

Functions in this group invoke and manage background execution of long-running SMOCO commands (movement commands) within an event-driven "transaction" context. More...

Collaboration diagram for Long-Running Command Functions:

Functions

SMOCO_ResponseID smoco_run_command (SMOCO_CTX ctx, SMOCO_CommandID cmd_id, SMOCO_NodeID node_id, SMOCO_ActuatorID act_id, SMOCO_Parameters *params, SMOCO_EventCB_t cb_response, void *cbdata)
 Runs a SMOCO command on a single node and actuator within a transaction-tracking context and waits for the completion of the transaction. More...
 
SMOCO_STATUS smoco_start_command (SMOCO_CTX ctx, SMOCO_CommandID cmd_id, SMOCO_NodeID node_id, SMOCO_ActuatorID act_id, SMOCO_Parameters *params, SMOCO_EventCB_t cb_response, void *cbdata)
 Starts a SMOCO command on a single node and actuator within a transaction-tracking context. More...
 

Detailed Description

Functions in this group invoke and manage background execution of long-running SMOCO commands (movement commands) within an event-driven "transaction" context.

Function Documentation

SMOCO_ResponseID smoco_run_command ( SMOCO_CTX  ctx,
SMOCO_CommandID  cmd_id,
SMOCO_NodeID  node_id,
SMOCO_ActuatorID  act_id,
SMOCO_Parameters params,
SMOCO_EventCB_t  cb_response,
void *  cbdata 
)

Runs a SMOCO command on a single node and actuator within a transaction-tracking context and waits for the completion of the transaction.

Implemented as a general-purpose wrapper for smoco_start_command(), providing a simple default response callback, runcmd_cb(). Intended for long-running movement commands, smoco_run_commmand() creates a transaction-tracking context for the given command, sends the command to SMOCO, and then waits for its completion.

Parameters
ctxContext handle for this session
cmd_idThe ID of the command to be sent.
node_idThe SMOCO node ID to receive the command. A value of ALL_SMOCO_NODES will return an error and no command will be sent.
act_idThe actuator ID to receive the command, if the command is actuator-specific. A value of ACT_ALL will return an error and no command will be sent. Specify ACT_NONE if the command is not actuator-specific.
paramsA pointer to a SMOCO_Parameters structure containing parameter information specific to the given command.
cb_responseA SMOCO_EventCB_t function pointer, to be called in response to events generated by the transaction tracker. This event handler will be called BEFORE the actions in the default handler.
cbdataAn opaque pointer to be provided to the callback function provided in cb_response
Returns
The final response ID returned by SMOCO when this command has completed.
SMOCO_STATUS smoco_start_command ( SMOCO_CTX  ctx,
SMOCO_CommandID  cmd_id,
SMOCO_NodeID  node_id,
SMOCO_ActuatorID  act_id,
SMOCO_Parameters params,
SMOCO_EventCB_t  cb_response,
void *  cbdata 
)

Starts a SMOCO command on a single node and actuator within a transaction-tracking context.

Intended for long-running movement commands, smoco_start_commmand() creates a transaction-tracking context for the given command, sends the command to SMOCO and waits for an initial response. The processing of the command then continues in the background. A callback function can be specified to handle events generated by the transaction created for this command.

Parameters
ctxContext handle for this session
cmd_idThe ID of the command to be sent.
node_idThe SMOCO node ID to receive the command. A value of ALL_SMOCO_NODES will return an error and no command will be sent.
act_idThe actuator ID to receive the command, if the command is actuator-specific. A value of ACT_ALL will return an error and no command will be sent. Specify ACT_NONE if the command is not actuator-specific.
paramsA pointer to a SMOCO_Parameters structure containing parameter information specific to the given command.
cb_responseA SMOCO_EventCB_t function pointer, to be called in response to events generated by the transaction tracker.
cbdataAn opaque pointer to be provided to the callback function provided in cb_response
Returns
SMOCO_ST_SUCCESS if the command was sent successfully, and response from SMOCO was either SMOCO_RSP_OK or SMOCO_RSP_STARTED. Any other return value indicates an error.