Skip to content
Snippets Groups Projects
ButtonBehaviours.cpp 2.48 KiB
Newer Older
ButtonHeld::ButtonHeld : Behaviour(name), _node(node){ }

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>";
};
ButtonReleased::ButtonReleased(VizBlocks* node, String name = "ButtonReleased") :
        Behaviour(name), _node(node){
}

Matthew's avatar
Matthew committed
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>";
};

ButtonClicked::ButtonClicked(VizBlocks* node, String name = "ButtonClicked") :
  Behaviour(name), _node(node){ }

Matthew's avatar
Matthew committed
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>";
};

ButtonPressed::ButtonPressed(VizBlocks* node, String name = "ButtonPressed") :
        Behaviour(name), _node(node){
}
Matthew's avatar
Matthew committed
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>";
};
Matthew's avatar
Matthew committed
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>";
};