Remote Listener

From Tekkotsu Wiki

Jump to: navigation, search

You can subscribe to events on other robots by creating a remote listener. This only requires knowing the other robot's IP address. The other robot must be running Tekkotsu but needn't be executing any specific behavior; the Tekkotsu system itself will transmit events to any remote listener that requests them.

    int ipaddr = string_util::stringToIntIP("");

    erouter->addRemoteListener(this, ipaddr, EventBase::buttonEGID);

When processEvent receives an event, you can write event.getHostID() to check whether this was a local event or an event snooped from a remote robot. The method returns -1 for local events. Currently it returns the IP address for remote events.

See the RemoteButtonEvent Demo for an example of how to use remote events with state machines.