Skip to content
Snippets Groups Projects
Commit 8d9b9148 authored by Matthew's avatar Matthew
Browse files

sweep for missing ; and unmoved constructors

parent a8ba5728
No related branches found
No related tags found
3 merge requests!4Joe merge,!3Doxygen Documentation,!2Docs
...@@ -68,6 +68,10 @@ char * ButtonPressed::args() ...@@ -68,6 +68,10 @@ char * ButtonPressed::args()
return "<String buttonId>"; return "<String buttonId>";
}; };
ButtonTick::ButtonTick(VizBlocks* node, String name = "ButtonTick") :
Behaviour(name), _node(node)
{ }
int ButtonTick::start(String args) int ButtonTick::start(String args)
{ {
//This is where you do your stuff for a simple behaviour //This is where you do your stuff for a simple behaviour
......
...@@ -14,10 +14,10 @@ class ButtonPressed : public Behaviour ...@@ -14,10 +14,10 @@ class ButtonPressed : public Behaviour
VizBlocks* _node; VizBlocks* _node;
public: public:
ButtonPressed(VizBlocks* node, String name = "ButtonPressed") ButtonPressed(VizBlocks* node, String name = "ButtonPressed");
char* args(); char* args();
String start(String args); String start(String args);
} };
class ButtonReleased : public Behaviour class ButtonReleased : public Behaviour
{ {
...@@ -30,8 +30,8 @@ class ButtonReleased : public Behaviour ...@@ -30,8 +30,8 @@ class ButtonReleased : public Behaviour
public: public:
ButtonReleased(VizBlocks* node, String name = "ButtonReleased"); ButtonReleased(VizBlocks* node, String name = "ButtonReleased");
char* args() char* args();
String start(String args) String start(String args);
}; };
class ButtonClicked : public Behaviour class ButtonClicked : public Behaviour
...@@ -45,7 +45,7 @@ class ButtonClicked : public Behaviour ...@@ -45,7 +45,7 @@ class ButtonClicked : public Behaviour
public: public:
ButtonClicked(VizBlocks* node, String name = "ButtonClicked"); ButtonClicked(VizBlocks* node, String name = "ButtonClicked");
char* args() char* args();
String start(String args); String start(String args);
}; };
...@@ -59,26 +59,16 @@ class ButtonHeld : public Behaviour ...@@ -59,26 +59,16 @@ class ButtonHeld : public Behaviour
VizBlocks* _node; VizBlocks* _node;
public: public:
ButtonHeld(VizBlocks* node, String name = "ButtonHeld") ButtonHeld(VizBlocks* node, String name = "ButtonHeld");
/** /**
@brief What does this do? @brief What does this do?
*/ */
char* args() char* args();
{
return "<String buttonId>";
};
/** /**
@brief What does this do? @brief What does this do?
*/ */
String start(String args) String 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 + ")";
}
}; };
class ButtonTick : public Behaviour class ButtonTick : public Behaviour
...@@ -91,17 +81,12 @@ class ButtonTick : public Behaviour ...@@ -91,17 +81,12 @@ class ButtonTick : public Behaviour
VizBlocks* _node; VizBlocks* _node;
public: public:
ButtonTick(VizBlocks* node, String name = "ButtonTick") : ButtonTick(VizBlocks* node, String name = "ButtonTick");
Behaviour(name), _node(node)
{ }
/** /**
@brief What does this do? @brief What does this do?
*/ */
char* args() char* args();
{
return "<String buttonId>";
};
String start(String args); String start(String args);
}; };
......
SendCapabilities::SendCapabilities(VizBlocks* node, String name = "SendCapabilities") :
Behaviour(name), _node(node)
{ }
int SendCapabilities::start(String args) int SendCapabilities::start(String args)
{ {
//This is where you do your stuff for a simple behaviour //This is where you do your stuff for a simple behaviour
...@@ -31,6 +35,12 @@ int PingServer::start(String args) ...@@ -31,6 +35,12 @@ int PingServer::start(String args)
return "Pinging server"; return "Pinging server";
}; };
Link:: Link(VizBlocks* node, String name = "Link") : Behaviour(name), _node(node)
{
_background = true;
}
void Link::update() void Link::update()
{ {
if (millis() > (_t+_timeoutInterval)) if (millis() > (_t+_timeoutInterval))
......
...@@ -15,20 +15,11 @@ class SendCapabilities : public Behaviour ...@@ -15,20 +15,11 @@ class SendCapabilities : public Behaviour
VizBlocks* _node; VizBlocks* _node;
public: public:
SendCapabilities(VizBlocks* node, String name = "SendCapabilities") : SendCapabilities(VizBlocks* node, String name = "SendCapabilities");
Behaviour(name), _node(node)
{ }
/** /**
@brief What does this do? @brief What does this do?
*/ */
String start(String args) String start(String args);
{
//This is where you do your stuff for a simple behaviour
_node->announce_capabilities();
return "SendCapabilities behaviour " + _name;
}
}; };
...@@ -46,59 +37,21 @@ class Link : public Behaviour ...@@ -46,59 +37,21 @@ class Link : public Behaviour
unsigned long _t = 0; unsigned long _t = 0;
public: public:
Link(VizBlocks* node, String name = "Link") : Behaviour(name), _node(node) Link(VizBlocks* node, String name = "Link");
{ /**
_background = true;
}
/**
@brief What does this do? @brief What does this do?
*/ */
char* args() char* args();
{
return "<String peerId>";
};
/** /**
@brief What does this do? @brief What does this do?
*/ */
String start(String args) String start(String args);
{
_running = true;
if (args == name() || args.indexOf(" ")>0)
{
return "Invalid args (" + args + ") in behaviour " + name();
}
_t = millis();
if (args == _peerId)
{
return "Link ping from (" + _peerId + ")";
}
_peerId = args;
String str = "{\"id\":\"" + String(_node->getId()) + "\",\"Link\":{\"peerId\":\"" + _peerId + "\"}}";
_node->announce(str);
return "New link with (" + _peerId + ")";
}
/** /**
@brief What does this do? @brief What does this do?
*/ */
void update() void update();
{
if (millis() > (_t+_timeoutInterval))
{
String str = "{\"id\":\"" + String(_node->getId()) + "\",\"Unlink\":{\"peerId\":\"" + _peerId + "\"}}";
_node->announce(str);
_peerId = "";
_running = false;
}
}
}; };
......
...@@ -32,7 +32,7 @@ public: ...@@ -32,7 +32,7 @@ public:
/** /**
@brief What does this do? @brief What does this do?
*/ */
String start(String args) String start(String args);
}; };
...@@ -48,9 +48,7 @@ class BreathingLEDs : public Behaviour ...@@ -48,9 +48,7 @@ class BreathingLEDs : public Behaviour
int _direction = 1; int _direction = 1;
public: public:
BreathingLEDs(Adafruit_NeoPixel* strip, String name = "BreathingLEDs", uint32_t hue=0, uint32_t sat=0) : BreathingLEDs(Adafruit_NeoPixel* strip, String name = "BreathingLEDs", uint32_t hue=0, uint32_t sat=0);
Behaviour(name), _strip(strip), _hue(hue * 255), _sat(sat)
{ }
char* args(); char* args();
/** /**
@brief What does this do? @brief What does this do?
......
...@@ -43,10 +43,7 @@ class NameDictionary ...@@ -43,10 +43,7 @@ class NameDictionary
int _arraySize; int _arraySize;
public: public:
NameDictionary() NameDictionary();
{
_arraySize = sizeof(data) / sizeof(keyValuePair);
};
/** /**
@brief What does this do? @brief What does this do?
*/ */
......
...@@ -19,9 +19,7 @@ class PotentiometerUpdated : public Behaviour ...@@ -19,9 +19,7 @@ class PotentiometerUpdated : public Behaviour
VizBlocks* _node; VizBlocks* _node;
public: public:
PotentiometerUpdated(VizBlocks* node, String name = "PotentiometerUpdated") : PotentiometerUpdated(VizBlocks* node, String name = "PotentiometerUpdated");
Behaviour(name), _node(node)
{ }
/** /**
@brief What does this do? @brief What does this do?
*/ */
......
...@@ -82,15 +82,8 @@ public: ...@@ -82,15 +82,8 @@ public:
//Public Functions: //Public Functions:
RotaryEncoder(int pinA, int pinB, int id = 99) : _pinA(pinA), _pinB(pinB), _id(id) RotaryEncoder(int pinA, int pinB, int id = 99);
{
pinMode(_pinA, INPUT_PULLUP);
pinMode(_pinB, INPUT_PULLUP);
_previousTimer = millis();
_setState(digitalRead(_pinA), digitalRead(_pinB));
setPosition(0);
}
/** /**
@brief What does this do? @brief What does this do?
*/ */
......
...@@ -19,7 +19,7 @@ class RotaryEncoderUpdated : public Behaviour ...@@ -19,7 +19,7 @@ class RotaryEncoderUpdated : public Behaviour
VizBlocks* _node; VizBlocks* _node;
public: public:
RotaryEncoderUpdated(VizBlocks* node, String name = "RotaryEncoderUpdated") RotaryEncoderUpdated(VizBlocks* node, String name = "RotaryEncoderUpdated");
/** /**
@brief What does this do? @brief What does this do?
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment