PC/SC Guide
Prox–DU & Prox–SU
www.gemalto.com
DOC119811A Public Use Page 51/129
SCARD_PROTOCOL_T1: T=1 is the active protocol.
SCARD_PROTOCOL_UNDEFINED: SCARD_SHARE_DIRECT has been
specified, so that no protocol negotiation has occurred. It is possible that there is no
card in the reader.
Return Value:
This function returns different values depending on whether it succeeds or fails:
Success: SCARD_S_SUCCESS.
Failure: An error code. For more information, see Smart Card Return Values.
Remarks:
The SCardConnect function is a smart card and reader access function. For more
information about other access functions, see Smart Card and Reader Access Functions.
Examples:
The following example creates a connection to a reader. The example assumes that
hContext is a valid handle of type SCARDCONTEXT received from a previous call to
SCardEstablishContext.
SCARDHANDLE hCardHandle;
LONG lReturn;
DWORD dwAP;
lReturn = SCardConnect( hContext,
(LPCTSTR)"Rainbow Technologies SCR3531 0",
SCARD_SHARE_SHARED,
SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1,
&hCardHandle,
&dwAP );
if ( SCARD_S_SUCCESS != lReturn )
{
printf("Failed SCardConnect\n");
exit(1); // Or other appropriate action.
}
// Use the connection.
// Display the active protocol.
switch ( dwAP )
{
case SCARD_PROTOCOL_T0:
printf("Active protocol T0\n");
break;
case SCARD_PROTOCOL_T1:
printf("Active protocol T1\n");
break;