
Orange Tree Technologies
Page 36 of 57
ZestSC1RegisterErrorHandler
ZESTSC1_STATUS ZestSC1RegisterErrorHandler(
ZESTSC1_ERROR_FUNC Function);
Parameters
Function Pointer to error handler function to receive all error
notifications for this application.
Return Value
ZESTSC1_SUCCESS Function succeeded
Description
ZestSC1RegisterErrorHandler can be called to install a central error handling routine
for a user program. If any of the following ZestSC1 library function calls fail, the user
error handler will be called giving details of the failure. This mechanism means that
status codes need not be checked for every library call which simplifies code
considerably.
ZESTSC1_ERROR_FUNC is a function declared as follows:
typedef void (*ZESTSC1_ERROR_FUNC)(const char *Function,
ZESTSC1_HANDLE Handle,
ZESTSC1_STATUS Status,
const char *Msg);
Function is a string containing the name of the function that failed. Handle is the handle
of the card being accessed at the time of the failure. This may be NULL for functions that
do not take a card handle. Status is the status code describing the failure and Msg is a
string describing the failure.
For example:
/* Error handler function */
void ErrorHandler(const char *Function,
ZESTSC1_HANDLE Handle,
ZESTSC1_STATUS Status,
const char *Msg)
{
printf(“**** Function %s returned an error\n”, Function);
printf(“**** 0x%08lx : \"%s\"\n\n", Status, Msg);
exit(1);
}
void main(void)
{
ZestSC1RegisterErrorHandler(ErrorHandler);
Comentarios a estos manuales