--- a/lib/Quancom.pm Tue Jan 06 15:07:03 2009 +0100
+++ b/lib/Quancom.pm Tue Jan 06 22:33:39 2009 +0100
@@ -81,9 +81,28 @@
$self->cmd("WB 0007 00");
}
+sub set {
+ my $self = shift;
+ my $value = pop @_ ? 1 : 0;
+ my @bits = map { $_ - 1 } @_;
+ my @groups = map { 0 } 0 .. 7;
+
+ # input is a list of bits to set and the value (0/1)
+ # we'll map it to SX 0100 xx.xx.xx.xx xx.xx.xx.xx
+ foreach (@bits) {
+ my $group = int($_ / 8);
+ my $bit = $_ % 8;
+ $groups[$group] |= (1 << $bit);
+ }
+ $_ = "SX 0100 " . join "", map { sprintf "%02x ", $_ } reverse @groups;
+ $self->cmd($_);
+}
+
sub set_timeout {
my $self = shift;
- my $to = shift;
+ my $to = shift;
+
+ carp "setting timeouts does not work!";
# timeout 3 (2.8s)
# [__--.-___]
@@ -134,6 +153,7 @@
local $/ = "\r"; # CR is the delimiter
local $_ = $self->{socket}->getline;
+
# chomp; warn "<<$_>>\n";
return $self->{last_result} = new Quancom::Result($_);
}