beautypg.com

Benefits of a control language and driver – MagTek 99875125 User Manual

Page 10

background image

MagTek Device Driver for Windows

`MagTek devices are attached to the host in different ways. MagTek devices may be
attached to a serial port, parallel port, to another device or even to the keyboard port. All
these ports differ greatly in nature and would all have to be accessed by the application.
Additionally, meaningful communication with a device attached to the keyboard port
would be tricky at best. This is because the operating system does not provide a means to
send data to the keyboard port nor any mechanism to discriminate between the device
data and manual keystrokes.


BENEFITS OF A CONTROL LANGUAGE AND DRIVER

A device control language is defined to support most of the functionality of all MagTek devices.
As noted previously, most devices of a particular class have similar functionality. The control
language defines a common set of commands that perform these functions in the same way for
all MagTek devices, thus eliminating device-specific coding for most applications. If the need
arises to perform an operation on a device not covered by the common command set, a “raw”
send and receive command can be used to communicate directly with the device, effectively
eliminating any limitations on the amount of control you have over the device.

The control language is based on a simple property/command model. This model is familiar to
most developers who deal with properties and methods in development environments such as
Visual Basic or Delphi. You set up the device by getting and setting properties and operate it by
invoking commands.

The command set presents a synchronous interface to the application even though the device
operates asynchronously, greatly simplifying the effort in retrieving responses from a device.
The pattern is simple: send a command to the device and invoke a read command, which will not
complete until after the entire response is received from the device.

The control language is implemented by a driver, which completes the solution for the
application developer. The driver adds the following benefits:

Gives easy access to the device. All MagTek devices are presented uniformly as a virtual
serial port, regardless of how they are actually attached to the host.

Hides the communication protocol. Adding and stripping frames, performing
checksums, detecting and correcting communication errors, etc, are handled completely
by the driver. The application sees only the data that it is interested in and can be assured
that it is free from transport errors.

Converts the incoming data stream into complete responses. The application receives
data from the device in easy to use packets. The entire response to a command is
received in a single operation.

Makes it easier to upgrade to a new device. The driver shields you from differences in
the new device’s commands or interface. When upgrading the device, an application can

2