5.1 Card Plug-in

To check the Card Service you may open the following URL: https://127.0.0.1:8440/api/v1/card/getmessage?nowait.

The response format:

{
result: [<status>],
cardid: <card id>,
readerid: <reader id>
}

The following statuses are implemented:

  • NO_READER means that the Card service didn't detect a card reader connected,

  • READER_ON means that the Card service detected a card reader connected,

  • NO_CARD means that there is no card on the reader,

  • CARD_ON means that a card is presented to the reader.

NOTE:cardid is used only with CARD_ON and NO_CARD statuses.

Examples of commands:

  • https://127.0.0.1:8440/api/v1/card/getmessage?nowait - immediately returns a current status. Possible values [NO_READER, NO_CARD, CARD_ON]

  • https://127.0.0.1:8440/api/v1/card/getmessage?wait - waits for a next event (e.g. card presented or card removed)

    NOTE:When you disconnect the reader with a card on, two messages will arrive: NO_CARD, NO_READER. But the first one will be caught with getmessage?wait.When you plug in a reader with a card on, there will be the two events: READER_ON, CARD_ON. And as a result READER_ON will be returned.

  • https://127.0.0.1:8440/api/v1/card/getreaderon?nowait - immediately returns READER_ON if a reader is attached and NO_READER otherwise.

  • https://127.0.0.1:8440/api/v1/card/getreaderon?wait - immediately returns READER_ON if a reader is attached or waits till it's attached

  • https://127.0.0.1:8440/api/v1/card/getcardon?nowait - immediately returns NO_READER if a reader isn't attached, NO_CARD if a card isn't presented or CARD_ON if a card is presented

  • https://127.0.0.1:8440/api/v1/card/getcardon?wait - immediately returns NO_READER if a reader isn't attached or wait till the card will be presented on a reader.

    NOTE:It will wait the next tap of a card even if a card is already on a reader.

  • https://127.0.0.1:8440/api/v1/card/getcardoff?nowait&cardid=<cardid> - immediately returns NO_READER if a reader isn't attached, NO_CARD if a card isn't presented on the reader or CARD_ON if a card is presented on the reader. Use cardid to wait when a specific card is removed.

  • https://127.0.0.1:8440/api/v1/card/getcardoff?wait - returns immediately with NO_READER if a reader isn't attached. If there is no card presented on a reader, it returns NO_CARD immediately else waits till the card is removed from the reader

  • https://127.0.0.1:8440/api/abort?cancel-cookie=xxx - all of the "wait" methods support cancel-cookie=xxx parameter.E.g. https://127.0.0.1:8440/api/v1/card/getmessage?wait&cancel-cookie=xxx.And by calling abort with a cancel-cookie, all waiting methods with the same specfied cookie are terminated.