UniToken API Reference: Difference between revisions
| Line 101: | Line 101: | ||
== UT_GetTokenList == | == UT_GetTokenList == | ||
'''API Prototype''' | |||
<p>UT_RV UT_API UT_GetTokenList(UT_SLOT_ID* lpSlotID, unsigned long* lpTokenCount)</p> | |||
'''Description''' | |||
<p>To get the list of Slot ID and the number of Slot ID</p> | |||
'''Parameters''' | |||
{| cellspacing="0" cellpadding="0" border="0" width="" | |||
|- | |||
|width="180"|PARAMETERS | |||
|DESCRIPTION | |||
|- | |||
|lpSlotID | |||
|[out] slot ID list | |||
|- | |||
|lpTokenCount | |||
|[in] size of buffer (0~32 bytes)<br> | |||
[out]number of token | |||
|} | |||
'''Returned value''' | |||
{| cellspacing="0" cellpadding="0" border="0" width="" | |||
|- | |||
|width="180"|RETURNED VALUE | |||
|DESCRIPTION | |||
|- | |||
|UT_OK | |||
|Successful operation | |||
|- | |||
|UT_NOT_INITIALIZE | |||
|Library not initialized | |||
|} | |||
'''Sample''' | |||
<p> | |||
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); | |||
</p> | |||
== UT_OpenDevice == | == UT_OpenDevice == | ||
Revision as of 21:30, 11 April 2012
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);