Development

Following the publication of the specifications from Violet, two kinds of development are now possible with the Nabaztag.

HTTP API

The most immediate development to setup relies onthe HTTP API which allows every Web clients to interact with Violet's servers. Note that the Web client can be a browser as well as a program.

The existing commands allow:

  • retrieving the actual position of the ears
  • changing the ears' position
  • sending a message from Violet's library or your own MP3
  • sending a text message to be reproduced vocally
  • sending to a nabcast
  • sending a choregraphy, or a visual animation for the rabbit

The HTTP API is widely used on Web sites which allows you to send commands to the rabbit. It is mainly discussed on forumactif, the Nabaztag forum, in the API section ; its documentation is available on Violet's site.

NabazLab does not rely on this API, but some of its functionnalities offer some useful tools for using it. For instance, the choregraphy editor built in Studio allows you to create and export a choregraphy in a format compatible witht the HTTP API as well as sending it to Violet's server.

Client-server

The aim of NabazLab is to be an alternative to Violet's system through a development tool and an independant server for the Nabaztag. This combination allows the creation of special services which would otherwise not be available or usable from a distant server.

This kind of application is distributed between the server and the rabbit:

  • Rabbit side
    The internal firmware of the rabbit cannot be updated but it includes a virtual machine which is able to execute some programs in the same way of a Java or .NET virtual machine. All Violet's services are designed like this.

    When starting, the virtual machine is empty and the rabbit connects to its server to get a program to execute. Then, the rabbit connects the server on a regular basis to retrieve the updates of its program and parameters.

    NabazLab contains an assembly language for the virtual machine. Accessible from a command line, in Studio, from the Service or from any .NET program, it converts the source of the program to a list of bytecodes understandable by the virtual machine.

    The assembly language is a very low level language. Beside the common calculation and flow's execution control operations, it allows to control some of the Nabaztag's hardware components. The documentation of this language is available on Violet's web site. Specific extensions used by NabazLab are described in the Assembly page.

    NabazLab Studio contains a text editor and an embedded server to test your program.

  • Server side
    The server controls the rabbit's behaviour by answering its requests based on external parameters. Some of these parameters cab ne the number of messages in a mailbox, the sound messages awaiting in a database, the computation of a byorithm or anhything you can think of.

    A complete answer from the server is a set of sounds, midi files, executable bytecode and parameters for this bytecode. A partial answer to update only some parameters is also possible.

    NabazLab Service contains a standalone and modular server which can be controlled from a Web interface. A library allows to create a module and a simple service in just a few lines of C#, VB.NET or Java (J#).

These two components are tightly linked and have to be developed and debugged together.

NabazLab aims at providing a support as well as an environment for these two aspects of the development.

Best of both worlds

It has to be noticed that due to the architecture, it is normally not possible to get Violet's services and specific services working together. At one time, the bytecode loaded in the rabbit is either the one from Violet of a particular development.

Despite the fact that it is possible for a module or proxy to modify data exchanged between the rabbit and Violet's server on the fly to add or modify a service, this way of doing things is not recommended. Indeed, a minor change from Violet could break everything

If the two services must work together, the best way to achieve this is to implement an automated switch between two working modes inside the module:

  • Proxy mode, or Violet
    The requests from the rabbit are sent to Violet and answers are Les requêtes du lapin sont retransmises a Violet et les réponses retournées au lapin, sans modification. Quand le module souhaite prendre le contrôle du lapin suite a un évènement extérieur ou chronologique, il provoque un rechargement de la VM avec son propre bytecode.
  • Server mode or local
    When controlling is no more necessary, the first request received by the rabbit is modified by the module to contain some reinitialization parameters then sent to Violet. In return, Violet sends an answer containing the original bytecode and the module reverts to the proxy mode.