The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Device::Conrad::RelaisControl - Perl extension for accessing a Conrad Electronic Relaiscard

SYNOPSIS

  use Device::Conrad::RelaisControl;

Constructor

  $control = new Device::Conrad::RelaisControl("/dev/ttyS0");

Initialization

  $control->init;

Portswitching

  $control->close(0,1);
  $control->open(0,1);

  $cardNum = $control->getNumCards();
  $card = $control->getCard(0);

  $card->ports(255);

  $card->close(1);
  $card->open(1);

DESCRIPTION

This module provides an abstraction layer for accessing a Conrad Electronic Relaiscard. It acts as a container for several cards (the cards are cascadeable) and controls the communication over the serial port.

Creation

At time of creation of the RelaisControl Object the serial port is initialized. It is the only operation which works without having a card attached to the serial port.

Initialization

The init method communicates with the card(s) in order to figure out out how many cards are attached and what their status is. For every responding card a card object is assigned and is being put on the container list.

Opening and closing ports

As this module is the container for any of the cards you can either switch port via absolute addressing or get a card object from the container and switch via this object.

  $control->close(0,1);

will switch port 1 on card 0. The other approach is to get a card instance and operate on this

  $card = $control->getCard(0);
  $card->close(1);

will get the same result as the command above.

Caution! The close() method activates the port (it closes the relais circuit). While it tend to be confusing I decided to name it this way round. General usage will look like: close(port); wait some time; open(port)

card methods

Only the RelaisCard's close() and open() methods are direct accesible through this module. Instead of delegating every card method i suggest working with the card objects if you need specific functionality.

EXPORT

None by default.

AUTHOR

Norbert Hartl, <noha@cpan.org>

SEE ALSO

Device::Conrad::RelaisCard, Device::Conrad::Frame