Net-Rovio

 view release on metacpan or  search on metacpan

lib/Net/Rovio.pm  view on Meta::CPAN

        if ($answer =~ m/responses = 15/ig) { return "FAILED_TO_WRITE_TO_FLASH"; };
        if ($answer =~ m/responses = 14/ig) { return "FAILED_TO_READ_FROM_FLASH"; };
        if ($answer =~ m/responses = 13/ig) { return "FAILED_TO_DELETE_PATH"; };
        if ($answer =~ m/responses = 12/ig) { return "FLASH_NOT_INITIALIZED"; };
        if ($answer =~ m/responses = 11/ig) { return "NOT_RECORDING_PATH"; };
        if ($answer =~ m/responses = 10/ig) { return "PATH_NAME_NOT_SPECIFIED"; };
        if ($answer =~ m/responses = 1/ig)  { return "FAIL"; };
        return 0;
    };
};

1;
__END__

=head1 NAME

Net::Rovio - A Perl module for Rovio manipulation

=head1 SYNOPSIS

  use Net::Rovio;
  my $rovio = Net::Rovio->new('my-rovio.ath.cx', 'admin', 'password');
  $rovio->light('on');
  $rovio->send_photo();
  sleep 1;
  $rovio->camera_head('mid');
  $rovio->send_photo();
  sleep 1;
  $rovio->camera_head('up');
  $rovio->send_photo();
  sleep 1;
  $rovio->camera_head('mid');
  sleep 1;
  $rovio->camera_head('down');
  sleep 1;
  $rovio->light('off');

  # Any functions that need parameters can have them sent in this fashion:
  @params = {   "Forward" => 8,
              "DriveTurn" => 6,
             "HomingTurn" => 8
             };
  $rovio->settuningparameters(@params);
  
  # Any functions that return parameters can be accessed in this fashion:
  
  $tuning = $rovio->gettuningparameters();
  print "Forward Value: $tuning->{Forward}";

  # Send the Rovio home to the charging cradle.

  $rovio->dock();


=head1 DESCRIPTION

Use Net::Rovio to control your Rovio robot from Perl. Uses basic Rovio API commands.

The Rovio L<http://www.wowwee.com/en/products/tech/telepresence/rovio/rovio> is a
Wi-Fi enabled mobile webcam that lets you view and interact with its environment
through streaming video and audio.

=head1 FUNCTIONS

Functions usually return "OK" upon success, unless otherwise noted per function.

=over 4

=head2 C<$rovio = Net::Rovio->new('hostname'[, 'username', 'password'])>

Opens the Rovio for communication.

=head2 $rovio->abortrecording()

Cancels the recording of a path and discards the path.

=head2 $rovio->camera_head('up'|'down'|'mid')

Moves the camera head to the up, down, or middle position.

=head2 $rovio->camimg()

Returns a picture from the camera in JPEG format. You can then save the data down as a binary file.

=head2 $rovio->changebrightness(0..6)

Sets the brightness level of the camera. Accepts values from 0 to 6, with 6 being the brightest.

=head2 $rovio->changecompressratio(0..2)

Change the quality setting of camera's images (only available with MPEG4). Accepts values from 0 to 2, representing low, medium and high quality, with 2 being the high quality setting.

=head2 $rovio->changeframerate(2..32)

Change the frame rate setting of camera's images. Accepts values from 2 - 32 frames per second.

=head2 $rovio->changemicvolume(0..31)

Changes the Mic volume on the Rovio. Accepts values from 0 - 31, with 31 being the highest.

=head2 $rovio->changeresolution(0..3)

Changes the resolution of the camera. Accepts values from 0 - 3 as defined below:

=over 4

          0 - {176, 144}
          1 - {352, 288}
          2 - {320, 240} (Default)
          3 - {640, 480}

=back

=head2 $rovio->changespeakervolume(0..31)

Changes the Speaker volume on the Rovio. Accepts values from 0 - 31, with 31 being the highest.

=head2 $rovio->clearallpaths()

Delete all saved paths within the Rovio.

=head2 $rovio->deletepath("PathName")

Delete a specific saved path within the Rovio. Accepts the name of the path to delete.

=head2 $rovio->dock() or $rovio->gohomeanddock()

Sends the Rovio to the charging base to dock. This only works when Rovio has navigation signal
available. To match up with the Rovio API, this command is synonymous with the
gohomeanddock() command.

=head2 $rovio->getcamera()

Returns the camera sensor setting:

=over 4

          50 - 50Hz
          60 - 60Hz
          0 - Auto detect

=back

=head2 $rovio->getdata()

Enables streaming video. Incomplete at this time.

=head2 $rovio->getddns()

Gets the Dynamic DNS settings within the Rovio. Returns

GetDDNS Returns:

=over 4

          'User' => '',
          'Pass' => '',
          'Service' => '',
          'ProxyPass' => '',
          'Proxy' => '',
          'ProxyPort' => '0',
          'Info' => 'Not Update',
          'ProxyUser' => '',
          'Enable' => '0',
          'IP' => '0.0.0.0',
          'DomainName' => ''

          Info above can return:

          Updated
          Updating
          Failed
          Updating IP
          Checked
          Not Update

=back

=head2 $rovio->gethttp()

Returns the http server port settings within the Rovio for both possible ports.

GetHTTP Returns:

=over 4

          'Port1' => '',
          'Port0' => '80'

=back

Note that the Port0 setting should only be changed if you know what you are doing.
This can complicate communication to the Rovio. See sethttp() to change the settings using the same parameters.

=head2 $rovio->getip()

Returns the settings for IP within the Rovio.

GetIP Returns:

=over 4

          'CurrentDNS0' => '4.2.2.3',
          'DNS2' => '0.0.0.0',
          'IPWay' => 'manually',
          'CurrentNetmask' => '255.255.255.0',



( run in 0.658 second using v1.01-cache-2.11-cpan-140bd7fdf52 )