libsting
Step Timing and INformation Gathering Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
API Functions
Collaboration diagram for API Functions:

Functions

STING_CTX sting_init (STING_CALLBACK cb_op, st_relmv_t step_buffer, st_relmv_t minimum_move, unsigned steps_per_sec)
 Initialize libsting session and start working threads. More...
 
STING_STATUS sting_terminate (STING_CTX ctx)
 Terminate libsting session. Terminate any running threads and deallocate all resources. More...
 
STING_ACT sting_act_register (STING_CTX ctx, void *data)
 Allocate a new actuator resource, and associate with client-supplied data. More...
 
STING_ACT sting_act_find (STING_CTX ctx, void *data)
 Find an actuator resource based on the application data pointer provided to sting_act_register. More...
 
STING_ACT sting_act_get (STING_CTX ctx, void *data)
 Find an actuator resource based on the application data pointer provided to sting_act_register, allocating it with minimal/default details if necessary. More...
 
STING_STATUS sting_act_move_relative (STING_CTX ctx, STING_ACT actuator, st_relmv_t distance)
 Move an actuator a given distance from its current location. More...
 
const char * sting_get_status_uilabel (STING_STATUS stat)
 Find the descriptive string associated with a libsting status code. More...
 

Detailed Description

Function Documentation

STING_ACT sting_act_find ( STING_CTX  ctx,
void *  data 
)

Find an actuator resource based on the application data pointer provided to sting_act_register.

Note that the client data pointer is optional when calling sting_act_register(). If not provided, then sting_act_find() will not be usable.

Parameters
ctxlibsting context handle
dataPointer to client data associated with actuator
Returns
handle to actuator resource, or NULL if not found
STING_ACT sting_act_get ( STING_CTX  ctx,
void *  data 
)

Find an actuator resource based on the application data pointer provided to sting_act_register, allocating it with minimal/default details if necessary.

Note that the client data pointer is optional when calling sting_act_register(). If not provided, then sting_act_get() will not be usable.

Parameters
ctxlibsting context handle
dataPointer to client data associated with actuator
Returns
handle to actuator resource
STING_STATUS sting_act_move_relative ( STING_CTX  ctx,
STING_ACT  actuator,
st_relmv_t  distance 
)

Move an actuator a given distance from its current location.

Parameters
ctxlibsting context handle.
actuatorActuator to move.
distanceDistance to move.
Returns
STING_ST_SUCCESS if successful; any other value indicates an error or aborted operation.
STING_ACT sting_act_register ( STING_CTX  ctx,
void *  data 
)

Allocate a new actuator resource, and associate with client-supplied data.

sting_act_register() creates a definition of an actuator within libsting, and provides the application data (opaque to libsting) that will be necessary to operate the motor. This application data is provided back to the application during operation callbacks.

Parameters
ctxlibsting context handle.
dataOpaque pointer to data structure for libsting to associate with actuator.
Returns
handle to actuator resource
const char* sting_get_status_uilabel ( STING_STATUS  stat)

Find the descriptive string associated with a libsting status code.

Use sting_get_status_uilabel() to provide status messages in an application user interface, or for logging errors in a human-readable representation.

Parameters
statStatus code from a libsting API function.
Returns
Pointer to a string containing a short description of the status.
STING_CTX sting_init ( STING_CALLBACK  cb_op,
st_relmv_t  step_buffer,
st_relmv_t  minimum_move,
unsigned  steps_per_sec 
)

Initialize libsting session and start working threads.

Applications should call sting_init() once to initialize the library and obtain a context handle for all subsequent API calls. Generally this should only be done once; multiple concurrent sessions are not required (and not well tested).

Parameters
cb_opPointer to user-supplied callback for executing hardware-dependent operations.
step_bufferNumber of actuator steps to "buffer" before thermal rate limits begin.
minimum_moveMinimum number of steps for a single move request, unless number of remaining steps in a requested movement is less.
steps_per_secOverall maximum average rate of travel to maintain thermal equilibrium.
Returns
libsting context handle, or NULL if an error occurred
STING_STATUS sting_terminate ( STING_CTX  ctx)

Terminate libsting session. Terminate any running threads and deallocate all resources.

Applications must call sting_terminate() prior to exit.

Parameters
ctxlibsting context handle, invalid after sting_terminate() returns
Returns
STING_ST_SUCCESS on success; any other value indicates an error