Comedi-Lib

 view release on metacpan or  search on metacpan

Lib.pm  view on Meta::CPAN

sub find_subdevice_by_type {
   my $self  = shift;
   my $type  = shift;
   my $start = shift;
   $self->_assert_open();
   return lib_find_subdevice_by_type($self->{handle}, $type, $start);
}

=item get_read_subdevice

Find streaming input subdevice.

Example code,

   my $streaming_input_support = $cref->get_read_subdevice();

   if ($streaming_input_support == -1) {
      print "No streaming input support available\n";
   }
   else {
      print "Comedi subdevice no. $streaming_input_support ",
            "allows streaming input\n";
   }

This class method returns the subdevice whose streaming input buffer is
accessible through the previous opened device. If there is no such subdevice,
-1 is returned.

=cut

sub get_read_subdevice {
   my $self = shift;
   $self->_assert_open();
   return lib_get_read_subdevice($self->{handle});
}

=item get_write_subdevice

Find streaming output subdevice.

Example code,

   my $streaming_output_support = $cref->get_write_subdevice();

   if ($streaming_output_support == -1) {
      print "No streaming output support available\n";
   }
   else {
      print "Comedi subdevice no. $streaming_output_support ",
            "allows streaming output\n";
   }

This class method returns the subdevice whose streaming output buffer is
accessible through the previous opened device. If there is no such subdevice,
-1 is returned.

=cut

sub get_write_subdevice {
   my $self = shift;
   $self->_assert_open();
   return lib_get_write_subdevice($self->{handle});
}

Lib.pm  view on Meta::CPAN


Streaming buffer size of subdevice.

Example code,

   my $buf_size = $cref->get_buffer_size($subdev);
   croak "An error has occurred" if $buf_size == -1;

   print "Streaming buffer size for the subdevice - $buf_size Bytes\n";
    
This class method returns the size -in Bytes- of the streaming buffer for the
specified subdevice. On error, -1 is returned.

=cut

sub get_buffer_size {
   my $self   = shift;
   my $subdev = shift;
   $self->_assert_open();
   return lib_get_buffer_size($self->{handle}, $subdev);
}

=item get_max_buffer_size

Maximum streaming buffer size.

Example code,

   my $max_size = $cref->get_max_buffer_size($subdev);
   croak "An error has occurred" if $max_size == -1;

   print "Max. streaming buffer size for the subdevice - $max_size Bytes\n";

This class method returns the maximum allowable size -in Bytes- of the
streaming buffer for the specified subdevice. On error, -1 is returned.

=cut

sub get_max_buffer_size {
   my $self   = shift;
   my $subdev = shift;
   $self->_assert_open();
   return lib_get_max_buffer_size($self->{handle}, $subdev);
}

Lib.pm  view on Meta::CPAN

Streaming buffer size of subdevice.

Example code,

   # First, determine the virtual memory page size (look at the Comedi docu)
   require POSIX;

   my $vmps = POSIX::sysconf(&POSIX::_SC_PAGESIZE);
   $vmps   *= 2;

   print "Trying to set the streaming buffer size to $vmps\n";

   if ($cref->set_buffer_size($subdev, $vmps) == -1) {
      print "Warning: Couldn't set new streaming buffer size\n";
   }

The C<set_buffer_size()> class method returns the new buffer size in Bytes.
On error, -1 is returned.

=cut

sub set_buffer_size {
   my $self   = shift;
   my $subdev = shift;

Lib.pm  view on Meta::CPAN

=cut

sub get_cmd_generic_timed {
   print STDERR __PACKAGE__, '::',
         "get_cmd_generic_timed: Sorry, I've no functionality at this time\n";
   return;
}

=item cancel

Stop streaming input/output in progress.

Example code,

   # This class method is useful in combination with command()
   # and this class method is not completely implemented yet.

If successful, C<cancel()> returns 0, otherwise -1.

=cut

Lib.pm  view on Meta::CPAN

   print STDERR __PACKAGE__, '::',
         "cancel: U use me at your own _risk_\n";
   my $self   = shift;
   my $subdev = shift;
   $self->_assert_open();
   return lib_cancel($self->{handle}, $subdev);
}

=item command

Start streaming input/output.

Note that this subroutine has no functionality as long as I have no testing
device with the associated driver.

Patches or suggestions are welcome, send me an email (Subject: Comedi::Lib).

=cut

sub command {
   print STDERR __PACKAGE__, '::',
         "command: Sorry, I've no functionality at this time\n";
   return;
}

=item command_test

Test streaming input/output configuration.

Note that this subroutine has no functionality as long as I have no testing
device with the associated driver.

Patches or suggestions are welcome, send me an email (Subject: Comedi::Lib).

=cut

sub command_test {
   print STDERR __PACKAGE__, '::',
         "command: Sorry, I've no functionality at this time\n";
   return;
}

=item poll

Force updating of streaming buffer.

Example code,

   my $retval = $cref->poll($subdev);
   croak "An error has occurred" if $retval == -1;

If successful, this class method returns the number of additional bytes
available. If there is an error, -1 is returned.

=cut

Lib.pm  view on Meta::CPAN

=item get_buffer_contents

Streaming buffer status.

Example code,

   # This class method is useful in combination with command()
   # and this class method is not completely implemented yet.
   
This class method returns the number of bytes that are available in the
streaming buffer. If there is an error, -1 is returned.

=cut

sub get_buffer_contents {
   print STDERR __PACKAGE__, '::',
         "get_buffer_contents: U use me at your own _risk_\n";
   my $self   = shift;
   my $subdev = shift;
   $self->_assert_open();
   return lib_get_buffer_contents($self->{handle}, $subdev);

Lib.pm  view on Meta::CPAN

=item get_buffer_offset

Streaming buffer status.

Example code,

   # This class method is useful in combination with command()
   # and this class method is not completely implemented yet.

This class method returns the offset in bytes of the read pointer in the
streaming buffer. If there is an error, -1 is returned.

=cut

sub get_buffer_offset {
   print STDERR __PACKAGE__, '::',
         "get_buffer_offset: U use me at your own _risk_\n";
   my $self   = shift;
   my $subdev = shift;
   $self->_assert_open();
   return lib_get_buffer_offset($self->{handle}, $subdev);



( run in 0.243 second using v1.01-cache-2.11-cpan-a5abf4f5562 )