Jerome Eteve > Nabaztag-0.03 > Nabaztag

Download:
Nabaztag-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 0.03   Source   Latest Release: Nabaztag-0.04

NAME ^

Nabaztag - A module to interface your nabaztag!

VERSION ^

Version 0.03

ABOUT ^

Nabaztag.pm complies with nabaztag API V1 from violet company.

old APIV01 :http://www.nabaztag.com/vl/FR/nabaztag_api_version01.pdf

API V1 WILL BE SOON PUBLISHED.

See api mailing list at http://fr.groups.yahoo.com/group/nabaztag_api/

See help at http://www.nabaztag.com/

DESCRIPTION ^

This module is designed to allow you to control a nabaztag with perl programming language. See ABOUT section to know which api it fits.

It has been tested with my own nabaztag and seems to work perfectly.

It also provide a simple command line tool to try your nabaztag: nabaztry (see SYNOPSIS). This tool is install in /usr/bin/

It makes great use of LWP::Simple to interact with the rabbit.

PROXY issues:

 If you're behind a proxy, see LWP::Simple proxy issues to know how to deal with that.
 Basically, set env variable HTTP_PROXY to your proxi url in order to make it work.
 For instance : export HTTP_PROXY=http://my.proxy.company:8080/ 

SYNOPSIS ^

Commandline:

    $ nabaztry.pl MAC TOKEN POSLEFT POSRIGHT

Perl code:

    use Nabaztag ; # OR
    # use Nabaztag { 'debug' => 1 } ;

    
    my $nab = Nabaztag->new();
    
    # MANDATORY
    $nab->mac($mac);
    $nab->token($tok);
   
    # See new function to have details about how to get these properties.
 
    $nab->leftEarPos($left);
    $nab->rightEarPos($right);

    $nab->syncState();

    $nab->sayThis("Demain, il pleuvra des grillons jusqu'a extinction totale de la race humaine.");
    .....

See detailled methods for full possibilities.

Gory details :

You can access or modify BASE_URL by accessing: $Nabaztag::BASE_URL ;

For application id : $Nabaztag::ID_APP ;

FUNCTIONS ^

new

Returns a new software nabaztag with ears position fetched from the hardware one if the mac and token is given.

It has following properties:

  mac : MAC Adress of nabaztag - equivalent to Serial Number ( SN ). Written at the back
        of your nabaztag !!
  token :  TOKEN Given by nabaztag.com to allow interaction with you nabaztag. See
           http://www.nabaztag.com/vl/FR/api_prefs.jsp to obtain yours !!
  leftEarPos : position of left ear.
  rightEarPos : position of right ear.

usage: my $nab = Nabaztag->new($mac , $token ); print $nab->leftEarPos(); print $nab->rightEarPos();

OR:

    my $nab = Nabaztag->new();
    $nab->mac($mac);
    $nab->token($token);
    $nab->fetchEars();

    print $nab->leftEarPos();
    print $nab->rightEarPos();

leftEarPos

Get/Sets the left ear position of the nabaztag.

Usage: $nab->leftEarPos($newPos);

The new position has to be between 0 (vertical ear) and 16 included

rightEarPos

 See leftEarPos. Same but for right.

sendMessageNumber

Given a message number, sends this message to this nabaztag.

To obtain message numbers, go to http://www.nabaztag.com/vl/FR/messages-disco.jsp and choose a message !!

Usage: $nab->sendMessageNumber($num);

syncState

Synchronise the current state of the soft nabaztag with the hardware one. Actually sends the state to the hardware nabaztag.

Usage:

    $nab->syncState();

fetchEars

Fetches the real position of ear from the device and fill the leftEarPos and the rightEarPos properties.

sayThis

Makes the rabbit tell the sentence you give as parameter

Usage:

    $nab->sayThis("Demain, il pleuvra des grillons jusqu'a extinction totale de la race humaine."); # (example)

danceThis

Sends a choregraphy to the rabbit, with the optionnaly given title

Please refer to the APIV1 documentation to know how to compose your choregraphy

Usage: my $chor = '10,0,motor,1,20,0,0,0,led,2,0,238,0,2,led,1,250,0,0,3,led,2,0,0,0' ; my $title = 'example' ; $nab->danceThis($chor, $title);

nabcastMessage

Sends the given message id to the given nabcast id with given title

Please refer to nabaztag website to get these identifiers.

usage: $nab->nabcastMessage($nabcastId, $title, $idMessage);

nabcastText

Sends the given texttosay to the given nabcast id with given title

Please refer to nabaztag website to get these identifiers.

usage: $nab->nabcastText($nabcastId, $title, $texttosay);

_cookUrl

Returns a cooked url ready for sending something usefull

Usage:

    my $url = $this->_cookUtl();

AUTHOR ^

Jerome Eteve, <jerome@eteve.net>

BUGS ^

Please report any bugs or feature requests to bug-nabaztag@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Nabaztag. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS ^

COPYRIGHT & LICENSE ^

Copyright 2005 Jerome Eteve, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: