SmartCardRW Class

2/27/2008

Defines the programmatic interface for a UPOS smart card reader/writer device.

Namespace: Microsoft.PointOfService
Assembly: Microsoft.PointOfService (in microsoft.pointofservice.dll)

Syntax

'Declaration
Public MustInherit Class SmartCardRW
    Inherits PosCommon
public abstract class SmartCardRW : PosCommon
public ref class SmartCardRW abstract : public PosCommon
public abstract class SmartCardRW extends PosCommon
public abstract class SmartCardRW extends PosCommon

Remarks

Capabilities

The smart card reader/writer (SCR/W) device has the following capabilities.

  • Support for the reading and writing of smart cards that conform to the ISO/IEC 7816 standard (contact type) and ISO/IEC 14443 (contactless type).

  • Interface with simple memory cards, protected or segmented memory cards, stored value memory cards, and CPU/MPU multifunction cards.

  • Functions are limited to the actual smart card read and write operations only. Full function type devices such as a “Payment Terminal” (defined as a unit that incorporates a SCR/W plus additional devices such as a PIN pad, display, signature capture, and MSR reader in an integrated device) are not covered in this peripheral class.

  • Support for smart cards that use physical electrical contacts and/or close range radio frequency to exchange power and data.

  • Ability to sense when a card is present or absent is supported.

  • Optional support of Security Application Modules (SAM) for CPU/MPU cards may be provided.

  • Up to four types of API communication methods to the SCR/W can be supported:

    Model

    Meaning

    Command and Data Mode

    Very basic ASCII format for commands and data interchange.

    Data Block Mode

    A block of string data that contains commands and data is sent to the SCR/W Device Service. The application and the SCR/W Service need to agree upon a communication protocol and data format before using this mode.

    APDU Mode

    Same as Data Block Mode except that the block of string data that contains commands and data sent to the SCR/W Service conforms to the ISO/IEC 7816 APDU (Application Protocol Data Units) standard for smart cards. ISO and EMV messaging formats are supported and selectable if the SCR/W has the capability to switch to one of these formats.

    XML Data Block Mode

    A block of string data that contains commands and data is sent to the SCR/W Service. The application and the SCR/W Service agree to use a communication protocol and data format defined in this standard consistent with the XML Data Dictionary and XML schema guidelines as outlined in the NRF-ARTS IXRetail XML standard.

Model

The general model of Smart Card Reader / Writer is as follows:

The Smart Card Reader / Writer (SCR/W) device has a wide range of uses that depend upon a variety of ISO 7816 compliant smart cards. These include cards with or without physical electrical contacts and proximity types that may function as memory cards, processor cards (T0 and/or T1 TransmissionProtocol), electronic purse cards, security access module (SAM) processor cards, and security cards. The SCR/W scope is limited to providing access to the smart card so that data retrieval, data storage, or program execution on the smart card can be implemented.

It is the responsibility of the application to have knowledge of which types of smart card transactions the SCR/W device allows. To help facilitate a wide range of uses, four different communication command and data interchange methods (InterfaceMode) are provided. As part of the initialization sequence, the application should query the CapInterfaceMode property to determine what is allowed and set the InterfaceMode property to the mode to use.

To begin operation, the application must call the Open and Claim methods to set up a communication path to the SCR/W device. When the application is ready to interact with a smart card, the DeviceEnabled property must be set to true. Then the SCR/W is able to accept a smart card; a StatusUpdateEvent is fired when one has been detected. The BeginInsertion method, with its time-out value set to a finite value, provides a way to allow the application to wait for a smart card to be detected. If the time-out value expires, the program must call another BeginInsertion method to continue its quest for detecting a smart card. Once the smart card has been detected, the application must call the EndInsertion method.

Device Sharing

The SCR/W is an exclusive-use device, as follows:

  • The application must claim the device before enabling it.

  • The application must claim and enable the device before accessing many of the SCR/W specific properties.

  • The application must claim and enable the device before calling methods that manipulate the device.

Data Transfer Modes

The SCR/W has the flexibility to be able to operate in one or more modes to enable the transfer of data to and from the smart card. When the SCR/W is initialized, the application must determine what communication and operation mode will be used based upon a query of the capabilities of the SCR/W device. The InterfaceMode property is used to store the current communication mode.

In the Command / Data mode, a simple read and write data functionality is defined between the application and the SCR/W. The commands cause the data to be retrieved from, placed onto, or placed onto and executed on the smart card currently available to the SCR/W device. Greater knowledge of the specific SCR/W device is required in this mode. The application should query the PhysicalDeviceName and/or PhysicalDeviceDescription properties and create the write data and resultant read data based upon the type of SCR/W that is connected to the system.

In the Block Transfer mode, blocks of commands/data are sent to and retrieved from the SCR/W Service. It is up to the service object to parse the commands and data from the block of information sent to it from the application and invoke the necessary function and response in the smart card currently in the SCR/W. Knowledge of the message content between the application and the SCR/W must be established when the Open method is called. The application should query the PhysicalDeviceName and/or PhysicalDeviceDescription properties and base its message content upon the type of SCR/W that is connected to the system.

In the APDU Transfer mode, blocks of data are sent to and retrieved from the SCR/W Service similar to the Block Transfer mode described above. However, in this mode the commands and data consist of string data elements that conform to the ISO/IEC 7816 APDU (Application Protocol Data Units) standard for smart card communication. Provision has been made to support the messaging requirements of ISO or EMV for operating in the APDU mode. You can query the CapIsoEmvMode property to determine what modes are supported by the device. The application then sets the IsoEmvMode property to the desired messaging scheme before sending data to and receiving data from the SCR/W device.

In the XML Block Transfer mode, blocks of data are sent to and retrieved from the SCR/W Service similar to the Block Transfer mode described above. However, in this mode the commands and data are in the form of XML messages. The data elements and schemas of these messages conform to the IXRetail Standard XML messaging as they apply to the SCR/W device.

Inheritance Hierarchy

System.Object
   Microsoft.PointOfService.PosDevice
     Microsoft.PointOfService.PosCommon
      Microsoft.PointOfService.SmartCardRW
         Microsoft.PointOfService.BasicServiceObjects.SmartCardRWBasic

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.

See Also

Reference

SmartCardRW Members
Microsoft.PointOfService Namespace