wcWebCamClient lib  v0.8.2
Library functions to manage with background tasks

Functions

wcRCode DLLEXPORT wcTaskGetClass (wcTask task, wcTaskClass *id)
 Get the class of the task. More...
 
wcRCode DLLEXPORT wcTaskGetUserData (wcTask task, void **data)
 Get the user data for the task. More...
 
wcRCode DLLEXPORT wcTaskSetUserData (wcTask task, void *data)
 Set the user data for the task. More...
 
wcRCode DLLEXPORT wcTaskLock (wcTask task)
 Lock the task object for threadsafe access. More...
 
wcRCode DLLEXPORT wcTaskUnLock (wcTask task)
 Unlock the task object. More...
 
wcRCode DLLEXPORT wcTaskGetStrValue (wcTask task, wcTaskStateId aStateId, char **aStateVal)
 Get a C-style string value for the selected task state. More...
 
wcRCode DLLEXPORT wcTaskGetStrNValue (wcTask task, wcTaskStateId aStateId, uint32_t sz, char *aStateVal)
 Get a C-style string value for the selected task state. More...
 

Detailed Description

Function Documentation

◆ wcTaskGetClass()

wcRCode DLLEXPORT wcTaskGetClass ( wcTask  task,
wcTaskClass id 
)

Get the class of the task.

Possible results for the id parameter:
WC_TASK,
WC_IN_STREAM_TASK,
WC_OUT_STREAM_TASK.

Parameters
taskPointer to the task object.
idPointer to the variable of wcTaskClass type to return the task class.
Returns
wcRCode WC_OK or error code.
See also
wcRCode
Examples
theora_test/input_strm/main.cpp, and theora_test/output_strm/main.cpp.

◆ wcTaskGetUserData()

wcRCode DLLEXPORT wcTaskGetUserData ( wcTask  task,
void **  data 
)

Get the user data for the task.

Parameters
taskPointer to the task object.
dataPointer to the variable of void * type to return the user data.
Returns
wcRCode WC_OK or error code.
See also
wcRCode, wcTaskSetUserData, Library functions to send common requests by client
Examples
media_test/main.cpp, and multithread_test/main.cpp.

◆ wcTaskSetUserData()

wcRCode DLLEXPORT wcTaskSetUserData ( wcTask  task,
void *  data 
)

Set the user data for the task.

Data is not deleted by library.

Parameters
taskPointer to the task object.
dataThe user data.
Returns
wcRCode WC_OK or error code.
See also
wcRCode, wcTaskGetUserData, Library functions to send common requests by client

◆ wcTaskLock()

wcRCode DLLEXPORT wcTaskLock ( wcTask  task)

Lock the task object for threadsafe access.

Parameters
taskPointer to the task object.
Returns
wcRCode WC_OK or error code.
See also
wcRCode, wcTaskUnLock

◆ wcTaskUnLock()

wcRCode DLLEXPORT wcTaskUnLock ( wcTask  task)

Unlock the task object.

Parameters
taskPointer to the task object.
Returns
wcRCode WC_OK or error code.
See also
wcRCode, wcTaskLock

◆ wcTaskGetStrValue()

wcRCode DLLEXPORT wcTaskGetStrValue ( wcTask  task,
wcTaskStateId  aStateId,
char **  aStateVal 
)

Get a C-style string value for the selected task state.

As a result of successful execution of the function, the aStateVal parameter will contain a pointer to NULL-terminated string. (Don't forget to free up memory after using the aStateVal). Acceptable values of the state param are:
wctstError - get the last error for the task - acceptable for WC_ALL_TASKS,
wctstPath - get the target path for the task - acceptable for WC_ALL_TASKS,
wctstSubProto - get the specified protocol for the output streaming task - acceptable for WC_OUT_STREAM_TASK - wcLaunchOutStream,
wctstDeviceName - get the specified device name for the input streaming task - acceptable for WC_IN_STREAM_TASK - wcLaunchInStream.

Parameters
taskPointer to the task object.
aStateIdThe selected task state.
aStateValThe pointer to the variable of char * type initialized with NULL value
Returns
wcRCode WC_OK or error code.

Example

char * res = NULL;
wcRCode aCode = wcTaskGetStrValue(client, wctstPath, &res);
if (aCode == WC_OK) {
cout << "task path is " << res << endl;
free(res);
} else {
cout << "error occurred " << aCode << endl;
}
@ wctstPath
Definition: wcwebcamclient.h:205
const wcRCode WC_OK
Definition: wcwebcamclient.h:74
int wcRCode
Operation completion codes.
Definition: wcwebcamclient.h:65
wcRCode DLLEXPORT wcTaskGetStrValue(wcTask task, wcTaskStateId aStateId, char **aStateVal)
Get a C-style string value for the selected task state.
See also
wcTaskStateId, wcRCode, wcStateVal, wcTaskGetStrNValue

◆ wcTaskGetStrNValue()

wcRCode DLLEXPORT wcTaskGetStrNValue ( wcTask  task,
wcTaskStateId  aStateId,
uint32_t  sz,
char *  aStateVal 
)

Get a C-style string value for the selected task state.

As a result of successful execution of the function, the requested value will be copied to the passed array aStateVal. If the size of the passed array is less than the requested state value, the function returns an WC_NOT_ENOUGH_MEM error. Acceptable values of the state param are listed in wcTaskGetStrValue

Parameters
taskPointer to the task object.
aStateIdThe selected task state.
aStateValThe pointer to allocated char array with at least sz+1 chars.
szThe size of the given char array.
Returns
wcRCode WC_OK or error code.

Example

static const uint32_t LEN = 128;
char res [LEN];
wcRCode aCode = wcTaskGetStrNValue(client, wctstPath, LEN-1, res);
if (aCode == WC_OK) {
cout << "task path is " << res << endl;
} else {
cout << "error occurred " << aCode << endl;
}
wcRCode DLLEXPORT wcTaskGetStrNValue(wcTask task, wcTaskStateId aStateId, uint32_t sz, char *aStateVal)
Get a C-style string value for the selected task state.
See also
wcTaskStateId, wcRCode, wcStateVal, wcTaskGetStrValue