eid-viewer
eid-viewer library
Data Fields
eid_vwr_ui_callbacks Struct Reference

Callbacks which the backend can perform towards the UI. More...

#include <oslayer.h>

Data Fields

void(* newsrc )(enum eid_vwr_source new_source)
 Called when the data source has changed. More...
 
void(* newstringdata )(const EID_CHAR *label, const EID_CHAR *data)
 new string data to be displayed in UI. More...
 
void(* newbindata )(const EID_CHAR *label, const unsigned char *data, int datalen)
 New binary data to be displayed in UI. More...
 
void(* log )(enum eid_vwr_loglevel level, const EID_CHAR *line)
 Log a string at the given level. More...
 
void(* logv )(enum eid_vwr_loglevel level, const EID_CHAR *line, va_list ap)
 Log a string using varargs. More...
 
void(* newstate )(enum eid_vwr_states new_state)
 State machine transition. More...
 
void(* pinop_result )(enum eid_vwr_pinops op, enum eid_vwr_result res)
 Return the result of a PIN operation. More...
 
void(* readers_changed )(unsigned long nreaders, slotdesc *slots)
 The number of known readers has changed. More...
 

Detailed Description

Callbacks which the backend can perform towards the UI.

To ensure forward compatibility, a UI implementation must call eid_vwr_cbstruct() to allocate an eid_vwr_ui_callbacks struct. Failure to do so may result in crashes in future versions of the eid-viewer library.

An implementation may leave one or more of the below function pointers empty (i.e., at NULL). If this happens, the backend will simply not issue that event.

Field Documentation

void(* log) (enum eid_vwr_loglevel level, const EID_CHAR *line)

Log a string at the given level.

Parameters
levelthe level at which to log.
linethe string to log at the given level.
Note
only one of log() or logv() needs to be implemented; the backend will use whichever version is available.
void(* logv) (enum eid_vwr_loglevel level, const EID_CHAR *line, va_list ap)

Log a string using varargs.

The advantage of having this function (as opposed to log()) is that it allows for allocating a string using whatever memory management the frontend uses. If this is not necessary or desirable, implementing log() rather than this function should suffice.

Parameters
levelthe level at which to log.
linethe printf()-formatted string to log.
aparguments to line's format string.
Note
only one of log() or logv() needs to be implemented; the backend will use whichever version is available.
void(* newbindata) (const EID_CHAR *label, const unsigned char *data, int datalen)

New binary data to be displayed in UI.

Data with the given label and which should be interpreted as a binary blob was found. This will not change when the language is modified.

Parameters
labelthe label (identifier) of the data item. Should never change.
datathe data as it is on the card.
datalenthe length of the data, in bytes.
void(* newsrc) (enum eid_vwr_source new_source)

Called when the data source has changed.

When the viewer library starts looking at a new file or eID card, this event is issued. When this happens, a user interface should clear whatever data it has received from the backend – it is not valid anymore.

Parameters
new_sourcethe type of the new source.
void(* newstate) (enum eid_vwr_states new_state)

State machine transition.

This event is issued whenever the state machine changes state. For more information, see the state machine diagram as documented at struct eid_vwr_states.

Parameters
new_statethe new state we're in right now.
void(* newstringdata) (const EID_CHAR *label, const EID_CHAR *data)

new string data to be displayed in UI.

Data with the given label and which should be interpreted as a string was found. These may be re-issued (with modified data) after a call to eid_vwr_convert_set_lang().

Parameters
labelthe label (identifier) of the data item. Should never change.
datathe data as represented in the currently active language.
See also
beidsdk_card_data.pdf contains the possible labels
void(* pinop_result) (enum eid_vwr_pinops op, enum eid_vwr_result res)

Return the result of a PIN operation.

When the user interface calls eid_vwr_pinop(), then at some later point this function may be called with the result of the requested PIN operation.

If the state machine is not in the TOKEN_WAIT state when eid_vwr_pinop() was called, this event will never be fired.

Parameters
opthe operation for which this is a result
resthe result of the operation
void(* readers_changed) (unsigned long nreaders, slotdesc *slots)

The number of known readers has changed.

Parameters
nreadersthe new reader count
slotsthe slot IDs and human-readable descriptions of all known readers

The documentation for this struct was generated from the following file: