Connect to the card in the reader

Role

This method gives access to the SCardConnect function.

If the reader is already connected, it will failed because a client has the handle to this card.

When connected a 10s timer will be started and will be reseted at each command (Transmit or control). When the timer reach its end, the card is disconnected.

Prototype

Method : pcsc.reader.{$id}.connect

where {$id} is the ReaderId, as found from an earlier call to the List PC/SC readers method.

Params : None

Example

--> { "jsonrpc": "2.0", "id": 1,
		"method": "pcsc.reader.mvQ5w5-6ZUbGfl76Q6w-lw.connect",
		"params": {}
    }

Success

Result :

Field Description
Result success if the PC/SC subsystem has returned SCARD_S_SUCCESS
Protocol The protocol that has been negociated between the reader and the card. Either T=0 or T=1
ATR The card’s ATR (answer to reset), as an hexadecimal string
Token The token that must be provided to any subsequent command send to this crad until a disconnect happen

Example

<-- { "jsonrpc": "2.0", "id": 1,
		"result": {
			"Result": "success",
			"Protocol": "T=1",
			"ATR": "3B8F8001804F0CA000000306030001000000006A",
			"Token": "0AAZZevyX99hu1Py0Suib6"
		}
    }

Errors

A result response is returned in case of a PC/SC-error:

<-- { "jsonrpc": "2.0", "id": 1,
		"result": {
			"Result": "error",
			"Error": "SCARD_E_NO_SMARTCARD",
			"Message": "The operation requires a Smart Card, but no Smart Card is currently in the device."
		}			 
    }

The error code 403 is returned in an error response if the specified {$id} is not found:

<-- { "jsonrpc": "2.0", "id": 1,
		"error": {
			"code": 403,
			"message": "Not found"
		}	
    }