Tux ID

From Tuxisalive

Jump to: navigation, search

Contents

[edit] Goal

As of now, you can't decide from the computer on which tux you want to connect. The dongle starts the initialization and as soon as you switch on a tux, it will connect to the first dongle it will discover. You can't decide on which tux you want to connect.

We propose to add an ID number that will be different for each tux. The ID would be known by the computer and used to connect to the correct tux. That way it's possible to have many tux in the same room without conflicts between them. It will be possible to connect the dongle to whatever tux you want to reach.

The daemon can also have a table of ID's and associate a name to each of them, that way the user could connect to a tux directly from its name.

[edit] Implementation

As we want to identify a tux from the daemon, we suggest to have the ID stored in eeprom in tux and stored by the daemon on the computer. We don't need any ID on the dongle at all as we don't care about which dongle we use. That way we can connect to different tux (one at a time) from the same dongle.

A brand new tux will have a randomly generated ID. In case you have 2 tux and are unfortunate enough to get the same ID on both, there's a way to change it.

[edit] Typical connection

The dongle sends frames containing the ID as a header and sends that on different channels. Tux watches one channel and should get that frame and read the ID. If it matches its own ID, it will reply to the connection request with its ID as parameter. Otherwise it will ignore the request.

A sucessful connection will be:

 D: [ ID(16) | 0xXXXX ]           (Dongle sends a 16 bits ID)
 T: [ ID(16) ]                    (Tux sends its 16 bits ID)

[edit] Requesting the ID

0xFFFF is a special ID value which can be used to connect to any tux which is not already connected and request or change its ID.

If the daemon doesn't know the ID of the tux you want to connect to, we can use the 0xFFFF special ID. Any unconnected tux that receives a connection request with [ 0xFFFF | 0xFFFF ] will reply to the connection with its current ID.

Here is the protocol:

 D: [ 0xFFFF | 0xFFFF ]           (Dongle sends this frame to request the ID)
 T: [ ID(16) ]                    (Tux aknowledges the request by replying with its current ID, possibly 0xFFFF)

Then the daemon knows the ID of the tux. If this ID is 0xFFFF, it should first initialize the ID, otherwise it can request a connection to it directly.

[edit] Changing the ID

To change the ID, you also need to use the special 0xFFFF ID and provide the new ID you want to set in the request connection.

You need to keep the head button pushed for 5 seconds when changing the ID. This should be enough to prevent someone from stealing your tux too easily :-)

Here's the protocol to change an ID:

  : switch on tux, push on its head button
 D: [ 0xFFFF | newID(16) ]           (Dongle sends 0xFFFF followed by the ID to set)
 T: [ newID(16) ]                    (Tux aknowledges the request by replying with the new ID)
  : keep the head button pushed for 5 seconds, the ID is now stored in eeprom

At this point, the dongle will have to restart the connection with the 'newID'.

[edit] Handling the ID from the daemon

  • table of ID's with names
  • scan for

[edit] Notes

Personal tools