Skip to content
Snippets Groups Projects
ButtonBehaviours.cpp 1.96 KiB
Newer Older
Matthew's avatar
Matthew committed
int ButtonHeld::start(String args) {
    //This is where you do your stuff for a simple behaviour
    String str = "{\"id\":\"" + String(_node->getId()) + "\",\"Input\":{\"type\":\"" + String(name()) + "\",\"button\":\"" + args + "\"}}";
    _node->announce(str);
    return "ButtonHeld behaviour " + _name + " with (" + args + ")";
  };
char * ButtonHeld::args() {return "<String buttonId>"; };
int ButtonReleased::start(String args) {
    //This is where you do your stuff for a simple behaviour
    String str = "{\"id\":\"" + String(_node->getId()) + "\",\"Input\":{\"type\":\"" + String(name()) + "\",\"button\":\"" + args + "\"}}";
    _node->announce(str);
    return "ButtonReleased behaviour " + _name + " with (" + args + ")";
  };
char * ButtonReleased::args() {return "<String buttonId>"; };
int ButtonClicked::start(String args) {
    //This is where you do your stuff for a simple behaviour
    String str = "{\"id\":\"" + String(_node->getId()) + "\",\"Input\":{\"type\":\"" + String(name()) + "\",\"button\":\"" + args + "\"}}";
    _node->announce(str);
    return "ButtonClicked behaviour " + _name + " with (" + args + ")";
  };
char * ButtonClicked::args() {return "<String buttonId>"; };
int ButtonPressed::start(String args) {
    //This is where you do your stuff for a simple behaviour
    String str = "{\"id\":\"" + String(_node->getId()) + "\",\"Input\":{\"type\":\"" + String(name()) + "\",\"button\":\"" + args + "\"}}";
    _node->announce(str);
    return "ButtonPressed behaviour " + _name + " with (" + args + ")";
  };
char * ButtonPressed::args() {return "<String buttonId>"; };
int ButtonTick::start(String args) {
    //This is where you do your stuff for a simple behaviour
    String str = "{\"id\":\"" + String(_node->getId()) + "\",\"Input\":{\"type\":\"" + String(name()) + "\",\"button\":\"" + args + "\"}}";
    _node->announce(str);
    return "ButtonTick behaviour " + _name + " with (" + args + ")";
  };
char * ButtonTick::args() {return "<String buttonId>"; };