UniToken API Reference: Difference between revisions
| Line 156: | Line 156: | ||
</p> | </p> | ||
== UT_OpenDevice == | == UT_OpenDevice == | ||
'''Prototype '''<br> <br>UT_RV UT_API UT_OpenDevice( <br>UT_SLOT_ID SlotID, <br> UT_HANDLE* lputHandle <br> ) <br> <br>'''Description '''<br> <br>To open the device in the specified slot <br> <br>'''Parameters '''<br> <br>PARAMETERS DESCRIPTION <br>SlotID [in] the specified slot <br>lputHandle [out] device handle <br> <br>'''Returned value '''<br> <br>RETURNED VALUE DESCRIPTION <br>UT_OK Successful operation <br>UT_NOT_INITIALIZE Library not initialized <br>UT_ARGUMENTS_BAD Invalid argument <br>UT_SLOT_ID_INVALUD Invalid slot ID <br> <br>'''Usage note '''<br> <br>SlotID should be gotten from UT_GetTokenList instead of manually input. <br>Therefore, this function cannot be called before UT_GetTokenList. <br> <br>'''Sample'''<br> | |||
See also the sample of UT_GetTokenList <br> | |||
== UT_CloseDevice == | == UT_CloseDevice == | ||
Revision as of 13:33, 12 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);
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