# HG changeset patch # User Heiko Schlittermann # Date 1232593047 -3600 # Node ID 7690e12fafdaa9b60da21b19a67f96a006c9db82 # Parent 298db85d9c1d2008e09812e8869d80bba2913014 Updated the documentation, enhanced examples. diff -r 298db85d9c1d -r 7690e12fafda examples/client --- a/examples/client Wed Jan 21 19:44:38 2009 +0100 +++ b/examples/client Thu Jan 22 03:57:27 2009 +0100 @@ -13,6 +13,10 @@ my $q = new Quancom $ARGV[0]; my $r; + + $q->set(1..64 => 1); sleep 1; + $q->set(1..64 => 0); sleep 1; + foreach (1..64) { $q->set($_ => 1); usleep 1e6/20; diff -r 298db85d9c1d -r 7690e12fafda lib/Quancom.pm --- a/lib/Quancom.pm Wed Jan 21 19:44:38 2009 +0100 +++ b/lib/Quancom.pm Thu Jan 22 03:57:27 2009 +0100 @@ -161,6 +161,8 @@ if ($result->error) { die $result->error_message } else { print $result->data } + $q->set(1 .. 64 => 1); # switch on all the lights + =head1 METHODS @@ -187,6 +189,10 @@ all bits on the first relais. Some other (untested) string for setting just the lowest bit on the first relais should be "WB010001". +B This function is provided for functionality not covered by the +above L function. Whenever possible, you should avoid using this +L, since it binds you tightly to the specific hardware. + =item B( ) This resets the device by setting the reset control flag. @@ -198,7 +204,6 @@ This clears the outputs AND resets timeouts by writing zero to all control bits. - =item B( ) This returns an object containing the last result. @@ -206,11 +211,25 @@ =back -=head1 MORE EXAMPLES +=head1 EXAMPLES use Quancom; my $quancom = new Quancom("172.20.20.1"); - die "Sorry" if $quancom->cmd("xxxx")->error; + + my $result; + + $result = $quancom->set(1, 7 => 1); + die $quancom->error_message if $quancom->error; + + $result = $quancom->set(23 => 0); + die $quancom->error_message if not $quancom->ok; + + $quancom->set(12 => 1); + $result = $quancom->last_result; + die $quancom->error_message if not $quancom->ok; + + $quancom->set(1..63 => 1)->ok + or die $quancom->last_result->error_message; =head1 SEE ALSO @@ -218,8 +237,8 @@ =head1 AUTHOR - Maik Schueller - Heiko Schlittermann + Maik Schueller + Heiko Schlittermann =head1 THANKS