UniToken API Reference
UT_GetLibraryVersion
API Prototype
unsigned long UT_API UT_GetLibraryVersion().
Description
To get the version of the present library
Parameters
n/a
Returned value
| RETURNED VALUE | DESCRIPTION |
| Library version | the version of the current library |
Sample
unsigned long ulLibraryVersion;
ulLibraryVersion = UT_GetLibraryVersion();
UT_Initialize
API Prototype
UT_RV UT_API UT_Initialize()
Description
To initialize the UniToken. It should be called before all the other functions except UT_GetLibraryVersion.
Parameters
n/a
Returned value
| RETURNED VALUE | DESCRIPTION |
| UT_OK | Successful operation |
| UT_ALREADY_INITIALIZE | Library already initialized |
Sample
UT_RV ret;
ret = UT_Initialize();
UT_Finalize
API Prototype
UT_RV UT_API UT_Finalize()
Description
Call this function to end any interaction with UniToken and free the memory.
Parameters
n/a
Returned value
| RETURNED VALUE | DESCRIPTION |
| UT_OK | Successful operation |
| UT_NOT_INITIALIZE | Library not initialized |
Sample
UT_RV ret;
ret = UT_Finalize();
UT_GetTokenList
API Prototype
UT_RV UT_API UT_GetTokenList(UT_SLOT_ID* lpSlotID, unsigned long* lpTokenCount)
Description
To get the list of Slot ID and the number of Slot ID
Parameters
| PARAMETERS | DESCRIPTION |
| lpSlotID | [out] slot ID list |
| lpTokenCount | [in] size of buffer (0~32 bytes) [out]number of token |
Returned value
| RETURNED VALUE | DESCRIPTION |
| UT_OK | Successful operation |
| UT_NOT_INITIALIZE | Library not initialized |
Sample
UT_RV ret;
UT_HANDLE utHandle;
UT_SLOT_ID* lpSlotID = NULL;
unsigned long ulTokenCount = 0;
ret = UT_GetTokenList(lpSlotID,&ulTokenCount);
if (ret == UT_BUFFER_TOO_SMALL){
lpSlotID = new UT_SLOT_ID[ulTokenCount];
ret = UT_GetTokenList(lpSlotID,&ulTokenCount);
}
ret = UT_OpenDevice(lpSlotID[0],&utHandle);
ret = UT_GetHandle(lpSlotID[0],&utHandle);
ret = UT_GetSlotID(utHandle,&lpSlotID[0]);
ret = UT_CloseDevice(utHandle);
UT_OpenDevice
Prototype
UT_RV UT_API UT_OpenDevice(
UT_SLOT_ID SlotID,
UT_HANDLE* lputHandle
)
Description
To open the device in the specified slot
Parameters
PARAMETERS DESCRIPTION
SlotID [in] the specified slot
lputHandle [out] device handle
Returned value
RETURNED VALUE DESCRIPTION
UT_OK Successful operation
UT_NOT_INITIALIZE Library not initialized
UT_ARGUMENTS_BAD Invalid argument
UT_SLOT_ID_INVALUD Invalid slot ID
Usage note
SlotID should be gotten from UT_GetTokenList instead of manually input.
Therefore, this function cannot be called before UT_GetTokenList.
Sample
See also the sample of UT_GetTokenList