PointCardRW Class

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

Usage

'Usage
Dim pointCardRW1 As New PointCardRW()

Syntax

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

Remarks

Capabilities

The Point Card Reader/Writer has the following capabilities:

  • Supports reading and writing of the magnetic data of the point card.

  • Supports reading and writing of data from up to six tracks. The data on the tracks is in a device-specific format (see the device manual for specific definitions). The data is usually in ASCII format.

  • Supports point cards with or without a printing area. Actual printing support depends on the capabilities of the device.

  • Supports both card insertion and ejection.

  • No special security capabilities (for example, encryption) are supported.

Model

The Point Card Reader/Writer reads all the magnetic stripes on a point card. The data length and reading information are placed in the property corresponding to a track.

The Point Card Reader/Writer follows the input model of event-driven input during the card insertion process. Also, writing to the printing area and the magnetic stripe follows the output model.

Input Model

  • An application must call the Open and Claim methods, then set the DeviceEnabled property to TRUE.

  • When an application wants a card inserted, it calls the BeginInsertion method, specifying a timeout value.

  • If a card is not inserted before the timeout period elapses, the Point Card Reader/Writer returns an error.

  • Even if a timeout occurs, the Point Card Reader/Writer remains in insertion mode. If the application still wants a card inserted, it must call the BeginInsertion method again.

  • To exit insertion mode after a card was inserted or when the application wants to abort insertion, the application calls the EndInsertion method.

  • If there is a point card in the Point Card Reader/Writer when EndInsertion is called, the point card’s data tracks are automatically read and a DataEvent is queued. When the application sets the DataEventEnabled property to TRUE, the DataEvent is delivered.

  • If an error occurs while reading the point card’s data tracks, an ErrorEvent is queued instead of a DataEvent. When the application sets the DataEventEnabled property to TRUE, the ErrorEvent is delivered.

  • The application can obtain the current number of queued data events by reading the DataCount property.

  • All queued but undelivered input can be deleted by calling the ClearInput method.

Output Model

  • To write data to a card, the application calls the PrintWrite method. The ability to write data depends upon the capabilities of the device.

  • The PrintWrite method is always performed asynchronously. All asynchronous output is performed on a first-in, first-out basis.

  • When the application calls PrintWrite, the Point Card Reader/Writer assigns a unique identification number for this request. This ID is stored in the property OutputId. The Point Card Reader/Writer then either queues the request or starts its processing. Either way, the Point Card Reader/Writer returns to the application quickly.

  • When the PrintWrite method completes, an OutputCompleteEvent is delivered to the application. The OutputId associated with the completed request is passed in the OutputCompleteEvent.

  • If the PrintWrite method fails during its processing, an ErrorEvent is delivered to the application. If the application has multiple outstanding output requests, the OutputId of the request that failed can be determined by watching which requests have successfully completed by monitoring OutputCompleteEvents. The request that failed is the one that was issued immediately after the last request that successfully completed.

  • All incomplete output requests can be deleted by calling the ClearOutput method. This method also stops any output that is in progress, if possible. No OutputCompleteEvents are delivered for output requests terminated in this manner.

  • When done accessing the point card, the application calls the BeginRemoval method, specifying a timeout value.

  • If the card is not removed before the timeout period elapses, the Point Card Reader/Writer returns an error.

  • Even if a timeout occurs, the Point Card Reader/Writer remains in removal mode. If the application still wants the card removed, it must call the BeginRemoval method again.

  • To exit removal mode, after the card was physically removed or the application wishes to abort removal, the application calls the EndRemoval method.

Printing Capability

  • The Point Card Reader/Writer supports devices that allow for rewriting the print area of a card.

  • The Point Card Reader/Writer supports printing specified either by dot units or by line units. When CapPrintMode is TRUE, the unit type is determined by the value of the MapMode property. When CapPrintMode is false, the unit type is defined as lines.

  • The data to print is passed to the PrintWrite method as the data parameter. Special character modifications, such as double height, depend on the capabilities of the device. The verticalPosition and horizontalPosition parameters indicate the vertical and horizontal start position respectively, expressed in units defined by the MapMode property value.

  • When using line units, the start position for lines containing both single and double-high characters is the top of a single-high character for horizontal printing and the bottom of all characters for vertical printing.

Cleaning Capability

  • The Point Card Reader/Writer must be cleaned to prevent errors caused by dirt build-up inside the device.

  • A special cleaning card is used: either a wet card (such as a card wet with ethanol before use) or a dry card.

  • To clean, the inserted cleaning card makes several passes over the read heads inside the device.

  • Some Point Card Reader/Writers perform the cleaning operation by use of a switch on the device. Others perform the cleaning operation entirely under control of the application.

Initialization of Magnetic Stripe Data

  • Some Point Card Reader/Writers can initialize the magnetic stripe data to prevent the illegal use of a point card.

  • Three initialization techniques can be used for Point Card Reader/Writers:

    • Initialize all of the data, including the start sentinel, end sentinel, and a correct LRC.

    • Write an application-specific code into the data area, using no sentinels.

    • Initialize all tracks to empty by writing only start and end sentinels.

  • Initialization of the magnetic stripe is dependent upon the capability of the device.

Device Sharing

The Point Card Reader/Writer 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 Point Card Reader/Writer-specific properties.

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

Data Characters and Escape Sequences

The default character set of all Point Card Reader/Writers is assumed to support at least the ASCII characters 20-hex through 7F-hex, which include spaces, digits, uppercase, lowercase, and some special characters. If the Point Card Reader/Writer does not support lowercase characters, the service object can translate them to uppercase.

Every escape sequence begins with the escape character ESC, whose value is 27 decimal, followed by a vertical bar (|). This is followed by zero or more digits and/or lowercase alphabetic characters. The escape sequence is terminated by an uppercase alphabetic character. Sequences that do not begin with ESC | are passed through to the Point Card Reader/Writer. Also, sequences that begin with ESC | but which are not valid OPOS for .NET escape sequences are passed through to Point Card Reader/Writer.

To determine if escape sequences or data can be performed on Point Card Reader/Writer, the application can call the ValidateData method. (For some escape sequences, corresponding capability properties can also be used.)

The following escape sequences are recognized. If an escape sequence specifies an operation that is not supported by the Point Card Reader/Writer, then it is ignored.

Print Mode Characteristics that are remembered until explicitly changed.

Name

Data

Remarks

Font typeface selection

ESC |#fT

Selects a new typeface for the following data. Values for the character ‘#’ are:

0 = Default typeface.1 = Select first typeface from the FontTypefaceList property.2 = Select second typeface from the FontTypefaceList property.And so on.

Print Line Characteristics that are reset at the end of each print method or by a “Normal” sequence.

Name

Data

Remarks

Bold

ESC |bC

Prints in bold or double-strike.

Underline

ESC |#uC

Prints with underline. The character ‘#’ is replaced by an ASCII decimal string telling the thickness of the underline in printer dot units. If ‘#’ is omitted, then a printer-specific default width is used.

Italic

ESC |iC

Prints in italics.

Reverse video

ESC |rvC

Prints in a reverse-video format.

Single high and wide

ESC |1C

Prints normal size.

Double wide

ESC |2C

Prints double-wide characters.

Double high

ESC |3C

Prints double-high characters.

Double high and wide

ESC |4C

Prints double-high/double-wide characters.

Scale horizontally

ESC |#hC

Prints with the width scaled ‘#’ times the normal size, where ‘#’ is replaced by an ASCII decimal string.

Scale vertically

ESC |#vC

Prints with the height scaled ‘#’ times the normal size, where ‘#’ is replaced by an ASCII decimal string.

Center

ESC |cA

Aligns following text in the center.

Right justify

ESC |rA

Aligns following text at the right.

Normal

ESC |N

Restores printer characteristics to normal condition.

Inheritance Hierarchy

System.Object
   Microsoft.PointOfService.PosDevice
     Microsoft.PointOfService.PosCommon
      Microsoft.PointOfService.PointCardRW
         Microsoft.PointOfService.BasicServiceObjects.PointCardRWBasic

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.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, and Windows 2000

Target Platforms

See Also

Reference

PointCardRW Members
Microsoft.PointOfService Namespace