eid-viewer
eid-viewer library
|
Files | |
file | eid-viewer.h |
Main include file. | |
file | oslayer.h |
contains the functions, enums and structures that need to be known by the ui | |
Data Structures | |
struct | _slotdesc |
struct | eid_vwr_ui_callbacks |
Callbacks which the backend can perform towards the UI. More... | |
struct | eid_vwr_preview |
Enumerations |
Functions | |
DllExport void | eid_vwr_pinop (enum eid_vwr_pinops op) |
Perform a PIN operation. More... | |
DllExport int | eid_vwr_createcallbacks (struct eid_vwr_ui_callbacks *cb) |
Initialize the callbacks. More... | |
DllExport struct eid_vwr_ui_callbacks * | eid_vwr_cbstruct () |
Create the eid_vwr_ui_callbacks struct. More... | |
DllExport struct eid_vwr_preview * | eid_vwr_get_preview (const EID_CHAR *filename) |
Create a preview for the given file. More... | |
DllExport void | eid_vwr_poll () |
Check if there is an event to be handled. More... | |
DllExport void | eid_vwr_be_mainloop () |
Loop over eid_vwr_poll(). More... | |
DllExport void | eid_vwr_be_serialize (const EID_CHAR *target_file) |
Save the currently-open data. More... | |
DllExport void | eid_vwr_be_deserialize (const EID_CHAR *source_file) |
Open a file. More... | |
DllExport const char * | eid_vwr_be_get_xmlform () |
Get the currently-open data in XML form. More... | |
DllExport void | eid_vwr_be_select_slot (int automatic, unsigned long manualslot) |
Select the current reader. More... | |
DllExport void | eid_vwr_be_set_invalid () |
Mark the current data as invalid. More... | |
DllExport void | eid_vwr_close_file () |
Close the current file. More... | |
DllExport void | eid_vwr_convert_set_lang (enum eid_vwr_langs which) |
Set the backend language. More... | |
DllExport enum eid_vwr_langs | eid_vwr_convert_get_lang () |
Return the backend language. More... | |
enum eid_vwr_langs |
enum eid_vwr_loglevel |
enum eid_vwr_pinops |
enum eid_vwr_result |
enum eid_vwr_source |
Types of data sources we can have
enum eid_vwr_states |
Possible states.
DllExport void eid_vwr_be_deserialize | ( | const EID_CHAR * | source_file | ) |
Open a file.
Returns before the file has been opened; reading the file and parsing it is done in a background thread. The immediate effect of calling this function is a state transition to STATE_FILE. If a read or parser error occurs, the state reverts to STATE_NO_TOKEN.
source_file | the file to read |
DllExport const char* eid_vwr_be_get_xmlform | ( | ) |
Get the currently-open data in XML form.
This method can be called when the state machine is in one of the STATE_FILE or STATE_TOKEN_WAIT states.
DllExport void eid_vwr_be_mainloop | ( | ) |
Loop over eid_vwr_poll().
DllExport void eid_vwr_be_select_slot | ( | int | automatic, |
unsigned long | manualslot | ||
) |
Select the current reader.
automatic | if nonzero, let the backend decide which reader and ignore the value of manualslot. |
manualslot | if automatic is zero, ignore all readers except for the one with this as the slot id. |
DllExport void eid_vwr_be_serialize | ( | const EID_CHAR * | target_file | ) |
Save the currently-open data.
Returns before the save operation has finished. The state machine will switch to the STATE_TOKEN_SERIALIZE state while data is being saved, and will revert to STATE_TOKEN_WAIT when the operation has finished, or to STATE_TOKEN_ERROR if an error occurs.
target_file | the name of the file in which to save data. |
DllExport void eid_vwr_be_set_invalid | ( | ) |
Mark the current data as invalid.
If the UI detects that the card data is invalid for some reason, then this method will move the state machine to the STATE_CARD_INVALID state. The backend will not perform this operation by itself.
This method is only valid if the state machine is currently in STATE_TOKEN or one of its child states.
DllExport struct eid_vwr_ui_callbacks* eid_vwr_cbstruct | ( | ) |
Create the eid_vwr_ui_callbacks struct.
While it is possible, in theory, to create the struct by malloc()ing it manually, doing so will fail when the eid-viewer library is updated and a new callback function is added. For this reason, applications that want to continue working with future versions of the library without compatibility issues must use this function to allocate a correctly-sized structure.
DllExport void eid_vwr_close_file | ( | ) |
Close the current file.
If the current state is STATE_FILE, switch to STATE_NO_TOKEN. In all other cases, does nothing.
DllExport enum eid_vwr_langs eid_vwr_convert_get_lang | ( | ) |
Return the backend language.
DllExport void eid_vwr_convert_set_lang | ( | enum eid_vwr_langs | which | ) |
Set the backend language.
This method sets the current backend language to the given language. If any data has been loaded (i.e., the state machine is in state STATE_FILE or STATE_TOKEN_WAIT), this will also re-issue eid_vwr_ui_callbacks::newstringdata() events for which the representation in the new language may be different.
which | the language to which to switch |
DllExport int eid_vwr_createcallbacks | ( | struct eid_vwr_ui_callbacks * | cb | ) |
Initialize the callbacks.
Must be called by every application which wants to make use of this API, otherwise nothing will happen.
cb | the callback functions which this application implements |
DllExport struct eid_vwr_preview* eid_vwr_get_preview | ( | const EID_CHAR * | filename | ) |
Create a preview for the given file.
This function simply parses the XML file and extracts the embedded JPEG photo. It is useful for an "open file" dialog, or similar.
filename | the full path to the filename from which to extract the photo |
DllExport void eid_vwr_pinop | ( | enum eid_vwr_pinops | op | ) |
Perform a PIN operation.
If the state machine is currently in the TOKEN_WAIT state, issue a PIN operation. In all other cases, does nothing.
op | the operation to perform; EID_VWR_PINOP_TEST to log on as a test to see if the PIN code is valid, or EID_VWR_PINOP_CHG to change the PIN code. |
DllExport void eid_vwr_poll | ( | ) |
Check if there is an event to be handled.
Will handle one event and then return. Useful if an event loop exists elsewhere; otherwise, using eid_vwr_be_mainloop() is recommended.