lib/Quancom.pm
changeset 20 94281ba012c8
parent 19 6acf8ea44e0a
child 21 298db85d9c1d
equal deleted inserted replaced
19:6acf8ea44e0a 20:94281ba012c8
    92     foreach (@bits) {
    92     foreach (@bits) {
    93         my $group = int($_ / 8);
    93         my $group = int($_ / 8);
    94         my $bit   = $_ % 8;
    94         my $bit   = $_ % 8;
    95         $groups[$group] |= (1 << $bit);
    95         $groups[$group] |= (1 << $bit);
    96     }
    96     }
    97     $_ = "SX 0100 " . join "", map { sprintf "%02x ", $_ } reverse @groups;
    97 
    98     $self->cmd($_);
    98     my $cmd = $value ? "S" : "C";
       
    99     $cmd .= "X 0100";
       
   100     $cmd .= join "", map { sprintf "%02x ", $_ } reverse @groups;
       
   101     $self->cmd($cmd);
    99 }
   102 }
   100 
   103 
   101 sub set_timeout {
   104 sub set_timeout {
   102     my $self = shift;
   105     my $self = shift;
   103     my $to   = shift;
   106     my $to   = shift;
   185 This method returns a new Quancom object if the connection was
   188 This method returns a new Quancom object if the connection was
   186 successfully established. For testing you may use "0.0.0.0" as address,
   189 successfully established. For testing you may use "0.0.0.0" as address,
   187 this disables the socket communication and just simulates the Quancom
   190 this disables the socket communication and just simulates the Quancom
   188 module.
   191 module.
   189 
   192 
       
   193 =item B<set>( $bit, ... => $value )
       
   194 
       
   195 This sets one or more bits the specified values (true, false).
       
   196 
   190 =item B<cmd>( I<string> )
   197 =item B<cmd>( I<string> )
   191 
   198 
   192 Send a Quancom string to the device. The string here should be
   199 Send a Quancom string to the device. The string here should be
   193 B<without> the leading STX and Jobid as well without the trailing CR.
   200 B<without> the leading STX and Jobid as well without the trailing CR.
   194 It returns a L<Quancom::Result> object.
   201 It returns a L<Quancom::Result> object.