CRI ADX  Last Updated: 2024-07-17 10:47 p
Error Callback

Samples Directory

/CRIWARE/SDK/pc/samples/criatomex/error_callback


Sample Description

Error callback is provided as a feature to detect errors occurred in CRI Atom.

Application can define and register callback function, get error ID or error message, and handle errors.

#define SMP_ERROR_STR_LENGTH (256)
static CriChar8 g_smp_error_msg[SMP_ERROR_STR_LENGTH];
{
/* Register error callback function */
criErr_SetCallback(user_error_callback_func);
/* Initialize the library */
criAtomEx_Initialize(NULL, NULL, 0);
:
:
:
}
/* Error callback function */
static void user_error_callback_func(const Char8 *errid, Uint32 p1, Uint32 p2, Uint32 *parray)
{
const Char8 *errmsg;
UNUSED(parray);
/* Print error string */
errmsg = criErr_ConvertIdToMessage(errid, p1, p2);
criFwPrt_DebugPrintf("%s\n", errmsg);
/* Store error message to the global area in the application */
/* Note: Since error callback may be invoked in threads other than main thread,
* you must ensure exclusive control for accessing global resources.
*/
smputl_strcpy(g_smp_error_msg, errmsg);
return;
}
CriBool criAtomEx_Initialize(const CriAtomExConfig *config, void *work, CriSint32 work_size)
Initialize the library.
const CriChar8 * criErr_ConvertIdToMessage(const CriChar8 *errid, CriUint32 p1, CriUint32 p2)
Convert error ID to error message.
void criErr_SetCallback(CriErrCbFunc cbf)
Register error callback function.


Most errors that invoke error callback are critical errors.
When these errors occur, be sure to not ignore these errors, but solve them.
If you are not sure how to solve the errors, please contact CRI technical support.