Control: send a direct command to the PC/SC reader

Role

This method gives access to the SCardControl function.

If the reader is not connected (no token provided), then it will auto-connect to it and once the command is done, it will disconnect automatically.

In case the reader is already connected, it will not disconnect it at the end of the command and the timer will be reseted.

Request

URL : /pcsc/reader/{$id}/control

Method : POST

URL Params : {$id} : the ReaderId of the device. Use GET /pcsc/readers to enumerate the available readers.

Content : see below

Request content

Field name Type Status Description
Token string option Token provided by the Connect method
Command string mandatory The direct command to send to the reader (hexadecimal string)

Remark : The "Token" field is optional. If absent, the Companion Service will try to open a direct connection to the reader. This connection is temporary and will be closed before the request returns.

Example

{
	"Token": "0AAZZevyX99hu1Py0Suib6",
	"Command": "582005"
}

Success Response

Code : 200 OK

Content : see below

Response content

Field name Type Status Description
result string always success if the PC/SC subsystem has returned SCARD_S_SUCCESS
Response string always The response returned by the reader to the direct command (hexadecimal string)

Example

{
  "Result": "success",
  "Response": "00322E33352D32372D676139383532376131"
}

Error Response

See Error Responses. An ERROR object is returned in case of a PC/SC-specific error, with the "Error" field present and populated.