Share via


Msr Class

2/27/2008

Defines the programmatic interface for a UPOS magnetic stripe reader (MSR) device.

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

Syntax

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

Remarks

MSR devices support the following functionality:

  • The reading of encoded data from a magnetic stripe. The data is read from any combination of Tracks 1, 2, 3 and JIS-II. The alphanumeric data bytes can be decoded into their corresponding alphanumeric codes. Furthermore, this decoded alphanumeric data can be divided into specific fields accessed as device properties.

An MSR device can also support:

  • Specific card types ISO, JIS Type I, and/or JIS Type II. The following conventions are assumed:

    • Track 1 is ISO or JIS-I Track 1.

    • Track 2 is ISO or JIS-I Track 2.

    • Track 3 is ISO or JIS-I Track 3.

    • Track 4 is JIS-II data.

    • Determination of the type of card is based on the type of content the card tracks are expected to hold.

  • The optional return of the track sentinels with track data.

To remain compatible with prior versions, the service object can also store the JIS-II data in a previously used TracknData property. In such cases, the service object should set the DataEventArgs.Status property and the ErrorCodeExtended property to reflect both Track4Data and TracknData. Note that this programming code may not be readily portable.

Four writable properties control MSR data handling:

  • The TracksToRead property controls which combination of the four tracks should be read. It is not an error to swipe a card containing less than this set of tracks. Rather, TracksToRead should be set to the set of tracks that the application may need to process;

  • The DecodeData property controls decoding of track data from raw format into displayable data;

  • The ParseDecodeData property controls parsing of decoded data into fields, based on common MSR standards; and

  • The ErrorReportingType property controls the type of handling that occurs when a track containing invalid data is read.

Programming Model

MSR devices follow the general input model for event-driven input:

  • When input is received by the service object, it queues a DataEvent.

  • If the AutoDisable property is true, then the service object automatically disables itself when a DataEvent is queued.

  • A queued DataEvent can be delivered to the application when the DataEventEnabled property is true. Just before delivering this event, the service object copies the data into properties, then disables further data events by setting the DataEventEnabled property to false. Subsequent input data is queued while the application processes the current input and associated properties. When the application is ready to receive more data, it sets DataEventEnabled back to true.

  • If the service object encounters an error while gathering or processing input, it queues an ErrorEvent event, which is delivered to the application when it sets the DataEventEnabled property to true.

  • The DataCount property may be read to obtain the number of DataEvent events currently queued by the service object.

  • All input queued by the service object can be deleted by calling the ClearInput method.

Device Sharing

The MSR is an exclusive-use device. Therefore:

  • The application must claim the device before enabling it.

  • The application must claim and enable the device before the device begins reading input, or before calling methods that manipulate the device.

Inheritance Hierarchy

System.Object
   Microsoft.PointOfService.PosDevice
     Microsoft.PointOfService.PosCommon
      Microsoft.PointOfService.Msr
         Microsoft.PointOfService.BasicServiceObjects.MsrBasic

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

Msr Members
Microsoft.PointOfService Namespace