Class: MSR::MSR206

Inherits:
Object
  • Object
show all
Defined in:
lib/msr/msr206.rb,
ext/msr/msr206.c

Overview

Represents a connection to an MSR206 (or MSR206-compatible device).

Instance Method Summary collapse

Constructor Details

#initializeObject

Create a new MSR::MSR206 instance for a serial device.

Examples:

msr = MSR::MSR206.new("/dev/ttyUSB0")

Parameters:

  • device (String)

    the serial device to connect to

Raises:

  • (RuntimeError)

    if the device can't be opened and/or initialized



15
# File 'ext/msr/msr206.c', line 15

static VALUE initialize(VALUE self, VALUE rb_string);

Instance Method Details

#bpc=Object

Set the bits-per-character on each track.

Parameters:

  • bpc_ary (Array<Fixnum>)

    the array of BPC values

Raises:

  • (RuntimeError)

    if the device returns a bad response



84
# File 'ext/msr/msr206.c', line 84

static VALUE set_bpc(VALUE self, VALUE bpc_ary);

#bpi=Object

Note:

This only applies to the second track.

Set the bits-per-inch on the second track.

Parameters:

  • bpi (Fixnum)

    the BPI setting, either 75 or 210

Raises:

  • (RuntimeError)

    if the device returns a bad response



77
# File 'ext/msr/msr206.c', line 77

static VALUE set_bpi(VALUE self, VALUE bpi);

#coercivitySymbol

Get the device's current coercivity level.

Returns:

  • (Symbol)

    :hi if the device is in Hi-Co mode, :lo if Lo-Co

Raises:

  • (RuntimeError)

    if the device returns a bad response



61
# File 'ext/msr/msr206.c', line 61

static VALUE get_coercivity(VALUE self);

#coercivity=Object

Set the device's coercivity level.

Parameters:

  • coercivity (Symbol)

    :hi for Hi-Co, and :lo for Lo-Co

Raises:

  • (ArgumentError)

    if the coercivity level is unrecognized

  • (RuntimeError)

    if the device returns a bad response



69
# File 'ext/msr/msr206.c', line 69

static VALUE set_coercivity(VALUE self, VALUE co_sym);

#comm_test!Symbol

Run a communications test between the system and the device.

Returns:

  • (Symbol)

    :pass if the test succeeded, or :fail if it failed



21
# File 'ext/msr/msr206.c', line 21

static VALUE comm_test(VALUE self);

#firmwareString

Get the device's firmware version.

Returns:

  • (String)

    the firmware version, in "REV?X.XX" format

Raises:

  • (RuntimeError)

    if the device returns a bad response



47
# File 'ext/msr/msr206.c', line 47

static VALUE firmware(VALUE self);

#iso_readMSR::Tracks

Note:

This method is interactive.

Read ISO-formatted data from a card.

Returns:

  • (MSR::Tracks)

    a new tracks object containing the ISO card data



106
# File 'ext/msr/msr206.c', line 106

static VALUE iso_read(VALUE self);

#iso_writeObject

Note:

This method is interactive.

Write ISO-formatted data to a card.

Parameters:

  • tracks (MSR::Tracks)

    the ISO tracks to write to the card



120
# File 'ext/msr/msr206.c', line 120

static VALUE iso_write(VALUE self, VALUE tks_obj);

#led=Object

Control the LEDs on the device.

Parameters:

  • led (Symbol)

    the LED command (:green, :yellow, :red, :all, :none)

Raises:

  • (ArgumentError)

    if the LED command is unrecognized



92
# File 'ext/msr/msr206.c', line 92

static VALUE set_led(VALUE self, VALUE led_sym);

#linked?Boolean

Whether or not the device is currently linked. Corresponds to #comm_test! being passed.

Returns:

  • (Boolean)

    true if linked, false otherwise



9
10
11
# File 'lib/msr/msr206.rb', line 9

def linked?
  comm_test! == :pass
end

#modelString

Get the device's model.

Returns:

  • (String)

    the model, in "MSR-206-?" format

Raises:

  • (RuntimeError)

    if the device returns a bad response



54
# File 'ext/msr/msr206.c', line 54

static VALUE model(VALUE self);

#ram_test!Symbol

Run a test of the device's internal RAM.

Returns:

  • (Symbol)

    :pass if the test succeeded, or :fail if it failed



34
# File 'ext/msr/msr206.c', line 34

static VALUE ram_test(VALUE self);

#raw_readMSR::Tracks

Note:

This method is interactive.

Read raw data from a card.

Returns:

  • (MSR::Tracks)

    a new tracks object containing the raw card data



99
# File 'ext/msr/msr206.c', line 99

static VALUE raw_read(VALUE self);

#raw_writeObject

Note:

This method is interactive.

Write raw data to a card.

Parameters:

  • tracks (MSR::Tracks)

    the raw tracks to write to the card



113
# File 'ext/msr/msr206.c', line 113

static VALUE raw_write(VALUE self, VALUE tks_obj);

#reset!Object

Note:

This method pauses for 100ms.

Reset the device to a ready state.



40
# File 'ext/msr/msr206.c', line 40

static VALUE reset(VALUE self);

#sensor_test!Symbol

Note:

This method is interactive.

Run a test of the device's magnetic sensor.

Returns:

  • (Symbol)

    :pass if the test succeeded, or :fail if it failed



28
# File 'ext/msr/msr206.c', line 28

static VALUE sensor_test(VALUE self);