The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Rovio - A Perl module for Rovio manipulation

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();

DESCRIPTION

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

The Rovio 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.

FUNCTIONS

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

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

Opens the Rovio for communication.

$rovio->abortrecording()

Cancels the recording of a path and discards the path.

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

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

$rovio->camimg()

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

$rovio->changebrightness(0..6)

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

$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.

$rovio->changeframerate(2..32)

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

$rovio->changemicvolume(0..31)

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

$rovio->changeresolution(0..3)

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

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

$rovio->changespeakervolume(0..31)

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

$rovio->clearallpaths()

Delete all saved paths within the Rovio.

$rovio->deletepath("PathName")

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

$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.

$rovio->getcamera()

Returns the camera sensor setting:

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

$rovio->getdata()

Enables streaming video. Incomplete at this time.

$rovio->getddns()

Gets the Dynamic DNS settings within the Rovio. Returns

GetDDNS Returns:

              '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

$rovio->gethttp()

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

GetHTTP Returns:

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

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.

$rovio->getip()

Returns the settings for IP within the Rovio.

GetIP Returns:

              'CurrentDNS0' => '4.2.2.3',
              'DNS2' => '0.0.0.0',
              'IPWay' => 'manually',
              'CurrentNetmask' => '255.255.255.0',
              'Netmask' => '255.255.255.0',
              'DNS1' => '0.0.0.0',
              'Gateway' => '192.168.1.1',
              'DNS0' => '4.2.2.3',
              'CurrentGateway' => '192.168.1.1',
              'CurrentDNS1' => '0.0.0.0',
              'CameraName' => 'RovioCam',
              'CurrentIP' => '192.168.1.200',
              'Enable' => '1',
              'CurrentDNS2' => '0.0.0.0',
              'IP' => '192.168.1.200',
              'CurrentIPState' => 'STATIC_IP_OK'

$rovio->getlog()

Returns the log data from the Rovio. Currently an incomplete function, though still functional.

GetLog Returns:

              'Time' => '0000001029',
              'LogLines' => [
                             '27    C0A8017D18F09FE518F00000000007'
                            ]

    The Time represents time since power on in seconds. LogLines are individual log events.

    Log Lines -

              byte 0, 1 - reason for recording this log, refer to table below. eg: 27 is shown that new client connect to the IP Camera.
              byte 2 ~ 5 - reserved.
              byte 6 ~ 13 - operator's IP. eg: 0A820B57 is 10.130.11.87.
              byte 14 ~ 25 - operator's MAC. eg: 0000E8E26A88 is 00:00:E8:E2:6A:88.
              byte 26 ~ 35 - time of this log.
    
              For byte 0, 1 - Log reason
              0 Information
              1 Error
              11 Set user
              12 Del user
              13 Set user check
              14 Open camera
              15 Close camera
              16 Change resolution
              17 Change quality
              18 Change brightness
              19 Change contrast
              20 Change saturation
              21 Change hue
              22 Change Sharpness
              23 Set email
              24 Set ftp server
              25 Dial (pppoe)
              26 Dial (modem)
              27 New client
              28 Set Motion Detect
              29 Set Monitor Area
              30 Set Server Time
              31 Set Server IP
              32 Set Http Port

$rovio->getlogo()

Gets the 2 possible strings of text currently overlayed on the image, and thier position.

GetLogo Returns:

              'ShowString' => '',
              'ShowPos' => '0',
              'ShowString2' => '',
              'ShowPos2' => '0'

$rovio->getmail()

Gets the current email settings within the Rovio.

GetMail Returns:

              'Subject' => 'Rovio Snapshot',
              'User' => '',
              'MailServer' => '',
              'Port' => '25',
              'Sender' => '',
              'CheckFlag' => '0',
              'Enable' => '0',
              'Receiver' => '',
              'PassWord' => '',
              'Body' => 'Check out this photo from my Rovio.'

$rovio->getmcureport()

Incomplete function.

GetMCUReport Currently Returns:

              'rear_encoder_ticks' => '00',
              'packet_length' => 14,
              'right_encoder_ticks' => '00',
              'right_wheel_dir' => '0',
              'left_encoder_ticks' => '00',
              'head_position' => '0',
              'picture_index' => '0',
              'rear_wheel_dir' => '0',
              'left_wheel_dir' => '1'

$rovio->getmediaformat()

Gets the current media format setting in the Rovio.

GetMediaFormat Returns:

              'Video' => '1',
              'Audio' => '4'
    
              The possible return values are:
    
              For Audio:
              0 - AMR
              1 - PCM
              2 - IMAADPCM
              3 - ULAW
              4 - ALAW
    
              For Video:
              1 - H263
              2 - MPEG4

The same values can be used with the setmediaformat() command. Note that some Video settings will not work with the built-in Rovio webpage controls.

$rovio->getname()

This returns the currently defined camera name for the Rovio.

$rovio->getpathlist()

This returns an array of the current saved paths. You may then reference these paths to tell the Rovio to navigate to them.

$rovio->getreport()

This returns a large amount of status data from the Rovio.

GetReport Returns:

              'wifi_ss' => '200',
              'show_time' => '0',
              'theta' => '1.098',
              'frame_rate' => '24',
              'state' => '0',
              'y' => '2936',
              'ss' => '12383',
              'speaker_volume' => '31',
              'next_room_ss' => '48',
              'video_compression' => '2',
              'mic_volume' => '30',
              'ui_status' => '0',
              'brightness' => '6',
              'email_state' => '0',
              'resolution' => '2',
              'privilege' => '0',
              'beacon' => '0',
              'x' => '-426',
              'room' => '0',
              'battery' => '118',
              'Cmd' => 'nav
    responses = 0',
              'beacon_x' => '0',
              'user_check' => '1',
              'flags' => '0005',
              'next_room' => '1',
              'pp' => '1',
              'sm' => '15',
              'charging' => '72',
              'head_position' => '203',
              'ac_freq' => '2',
              'resistance' => '0',
              'ddns_state' => '0'

$rovio->getstatus()

Returns detailed status of the Rovio.

GetStatus Returns:

              'ftp_state' => '0',
              'saturation' => '000',
              'camera_state' => '01',
              'show_time' => '0',
              'monitor_rect' => '0000000000000000',
              'frame_rate' => '024',
              'pppoe_state' => '00',
              'sensors_frequency' => '0',
              'motion_detected_index' => '999999',
              'channel_mode' => '0',
              'picture_index' => '999999',
              'wifi_strength' => 8,
              'bright' => '006',
              'speaker_volume' => '031',
              'modem_state' => '00',
              'mic_volume' => '030',
              'audio_volume' => '000',
              'compression_ratio' => '2',
              'email_state' => '0',
              'resolution' => '2',
              'privilege' => '0',
              'audio_state' => '0',
              'focus' => '000',
              'motion_detect_way' => '0',
              'dynamic_dns_state' => '0',
              'x_direction' => '000',
              'y_direction' => '000',
              'user_check' => '1',
              'hue' => '000',
              'contrast' => '000',
              'battery_level' => 118,
              'channel_value' => '00',
              'image_file_length' => '00000000',
              'sharpness' => '000'

$rovio->gettime()

Returns time information from the Rovio.

GetTime Returns:

              'TimeZone' => '240',
              'NtpServer' => '',
              'UseNtp' => '0',
              'Sec1970' => '99663'

$rovio->gettuningparameters()

Returns the tuning parameters from the Rovio.

GetTuningParameters Returns:

              'ManTurn' => '8',
              'ManDrive' => '7',
              'DockTimeout' => '72',
              'Reverse' => '6',
              'LeftRight' => '6',
              'Cmd' => 'nav
    responses = 0',
              'Forward' => '8',
              'DriveTurn' => '6',
              'HomingTurn' => '8'

$rovio->getver()

Returns Version information.

GetVer Returns:

     Ver: Jan 12 2010 14:41:24 $Revision: 5.3503$

$rovio->getwlan()

Returns Wireless LAN information from the Rovio.

GetWlan Returns:

              'Wep128type' => 'Wep128HEX',
              'Wep64type' => 'Wep64HEX',
              'Channel' => '5',
              'ESSID' => 'YourSSID',
              'WepSet' => 'Asc',
              'CurrentWiFiState' => 'OK',
              'Mode' => 'Managed',
              'Key' => '',
              'WepGroup' => '0',
              'WepAsc' => ''

$rovio->halt()

Cancel current processing within the Rovio.

$rovio->light()

Controls the integrated light within the Rovio.

Sample:

    $rovio->light('on'); $rovio->light('off');

$rovio->lights_blue()

Controls the blue LED lights around the Rovio. This supports two methods of controlling the LEDs, shown below:

Sample:

              $rovio->lights_blue('on');        # Turn on all LEDs
              $rovio->lights_blue('off');       # Turn off all LEDs
              $rovio->lights_blue("00100000");  # Turn on right front LED
              $rovio->lights_blue("00010000");  # Turn on right mid LED
              $rovio->lights_blue("00001000");  # Turn on right back LED
              $rovio->lights_blue("00000100");  # Turn on left back LED
              $rovio->lights_blue("00000010");  # Turn on left mid LED
              $rovio->lights_blue("00000001");  # Turn on left front LED
              $rovio->lights_blue("00100001");  # Turn on two front LEDs (etc)

$rovio->manualdrive(<drive value>,<speed value>)

Allows manual control of the Rovio movement.

Sample:

              $rovio->manualdrive("1","2");
    
              Drive Values:
              0 (Stop)
              1 (Forward)
              2 (Backward)
              3 (Straight left)
              4 (Straight right)
              5 (Rotate left by speed)
              6 (Rotate right by speed)
              7 (Diagonal forward left)
              8 (Diagonal forward right)
              9 (Diagonal backward left)
              10 (Diagonal backward right)
              11 (Head up)
              12 (Head down)
              13 (Head middle)
              14 (Reserved)
              15 (Reserved)
              16 (Reserved)
              17 (Rotate left by 20 degree angle increments)
              18 (Rotate right by 20 degree angle increments)
    
              Speed Values:
              1 (fastest) - 10 (slowest)

$rovio->pauseplaying()

Pause the currently playing path.

$rovio->playpathbackward(<pathname>)

Replay a stored path from the closest point to the beginning.

$rovio->playpathforward(<pathname>)

Replay a stored path from the closest point to the end.

$rovio->reboot()

Reboot the Rovio.

$rovio->renamepath(<old pathname>,<new pathname>)

Rename an existing path to a new name.

$rovio->resetnavstatemachine()

Stops the Rovio, and resets back to idle.

$rovio->send_photo() also as $rovio->sendmail()

Send a snapshot of the current camera image to the email address specified in the Rovio settings.

$rovio->sethttp()

Sets the webserver ports within the Rovio. See gethttp() for acceptable parameters.

$rovio->setmail(@params)

See getmail() for the acceptable parameters to send.

$rovio->setmediaformat(@params)

See getmediaformat() for acceptable parameters to send.

$rovio->setname(<newname>)

Sets the Camera name within the Rovio.

$rovio->settuningparameters(%params)

Sets the speed and other parameters in the Rovio. See the acceptable values in gettuningparameters().

Sample:

              @params = {   "Forward" => 8,
                          "DriveTurn" => 6,
                         "HomingTurn" => 8
                         };
              $rovio->settuningparameters(@params);

$rovio->startrecording()

Begins recording.

$rovio->state()

Reports the current state of the Rovio.

State Returns:

              idle
              driving home
              docking
              executing path
              recording path

$rovio->stopplaying()

Stops playing the current path.

$rovio->stoprecording(<save pathname>)

Stops recording the current path, and saves it in the Rovio with the name given.

$rovio->updatehomeposition()

Updates the saved home position within the Rovio to the current location of the Rovio.

DEPENDENCIES

LWP::Simple

TODO

Finish all functions available for the Rovio. Clean up the documentation (alot)

AUTHOR

Ivan Greene (ivantis@ivantis.net) Ty Roden (tyroden@cpan.org)

SEE ALSO

LWP::Simple WWW::Mechanize

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 1209:

You forgot a '=back' before '=head2'

Around line 1831:

=back without =over