Device-Conrad-RelaisControl
view release on metacpan or search on metacpan
RelaisControl.pm view on Meta::CPAN
{
return new Device::Conrad::Frame(0,0,0);
}
my $frameIn = Device::Conrad::Frame::createFromPacket($packetIn);
return $frameIn;
}
sub DESTROY
{
my($self) =shift;
unlink $LOCKFILE;
}
sub END
{
my($self) =shift;
unlink $LOCKFILE;
}
1;
# Autoload methods go after =cut, and are processed by the autosplit program.
1;
__END__
# Below is stub documentation for your module. You better edit it!
=head1 NAME
Device::Conrad::RelaisControl - Perl extension for accessing a Conrad Electronic Relaiscard
=head1 SYNOPSIS
use Device::Conrad::RelaisControl;
=head2 Constructor
$control = new Device::Conrad::RelaisControl("/dev/ttyS0");
=head2 Initialization
$control->init;
=head2 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);
=head1 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.
=head2 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.
=head2 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.
=head2 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.
B<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)
=head2 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.
=head2 EXPORT
None by default.
=head1 AUTHOR
Norbert Hartl, E<lt>noha@cpan.orgE<gt>
=head1 SEE ALSO
Device::Conrad::RelaisCard,
Device::Conrad::Frame
=cut
( run in 0.776 second using v1.01-cache-2.11-cpan-df04353d9ac )