Skip to content

Commit 1faae28

Browse files
author
brentru
committed
chart, slider, toggle doxy'd
1 parent 86acaf2 commit 1faae28

7 files changed

Lines changed: 219 additions & 26 deletions

File tree

src/blocks/ChartBlock.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
*/
1515
#include "ChartBlock.h"
1616

17+
/**************************************************************************/
18+
/*!
19+
@brief Creates a new Chart Block on an Adafruit IO Dashboard.
20+
@param d
21+
Adafruit IO Dashboard name.
22+
@param f
23+
Adafruit IO Feed to display on the chart.
24+
*/
25+
/**************************************************************************/
1726
ChartBlock::ChartBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
1827
: AdafruitIO_Block(d, f) {
1928
historyHours = 0;
@@ -25,6 +34,12 @@ ChartBlock::ChartBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
2534

2635
ChartBlock::~ChartBlock() {}
2736

37+
/**************************************************************************/
38+
/*!
39+
@brief Sets chart block properties.
40+
@return String containing properties of the chart block.
41+
*/
42+
/**************************************************************************/
2843
String ChartBlock::properties() {
2944

3045
String props = "{\"historyHours\":\"";

src/blocks/ChartBlock.h

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,52 @@ class ChartBlock : public AdafruitIO_Block {
2525

2626
const char *type() { return _visual_type; }
2727

28-
int historyHours;
29-
const char *xAxisLabel;
30-
const char *yAxisLabel;
31-
int yAxisMin;
32-
int yAxisMax;
28+
int historyHours; /*!< Amount of hours to store the chart's history for. */
29+
const char *xAxisLabel; /*!< Chart's x-axis label. */
30+
const char *yAxisLabel; /*!< Chart's y-axis label. */
31+
int yAxisMin; /*!< Chart's y-axis minimum. */
32+
int yAxisMax; /*!< Chart's y-axis maximum. */
3333

34-
int width = 6;
35-
int height = 4;
34+
int width = 6; /*!< Dashboard block width. */
35+
int height = 4; /*!< Dashboard block height. */
3636

3737
String properties();
3838

3939
protected:
40-
const char *_visual_type = "line_chart";
40+
const char *_visual_type = "line_chart"; /*!< Block type. */
4141

42+
/******************************************/
43+
/*!
44+
@brief Returns width of block.
45+
@return Block width.
46+
*/
47+
/******************************************/
4248
int _width() { return width; }
49+
50+
/******************************************/
51+
/*!
52+
@brief Returns height of block.
53+
@return Block height.
54+
*/
55+
/******************************************/
4356
int _height() { return height; }
57+
58+
/******************************************/
59+
/*!
60+
@brief Returns block's row location
61+
on an Adafruit IO dashboard.
62+
@return Adafruit IO dashboard row.
63+
*/
64+
/******************************************/
4465
int _row() { return row; }
66+
67+
/******************************************/
68+
/*!
69+
@brief Returns block's column location
70+
on an Adafruit IO dashboard.
71+
@return Adafruit IO dashboard column
72+
*/
73+
/******************************************/
4574
int _column() { return column; }
4675
};
4776

src/blocks/MomentaryBlock.h

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,58 @@ class MomentaryBlock : public AdafruitIO_Block {
2323
MomentaryBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f);
2424
~MomentaryBlock();
2525

26-
const char *text;
27-
const char *value;
28-
const char *release;
26+
const char *text; /*!< Text displayed by block. */
27+
const char *value; /*!< Value displayed by block. */
28+
const char *release; /*!< Release value text. */
2929

30-
int width = 2;
31-
int height = 2;
30+
int width = 2; /*!< Dashboard block width. */
31+
int height = 2; /*!< Dashboard block height. */
3232

3333
String properties();
34+
35+
/******************************************/
36+
/*!
37+
@brief Returns block type
38+
@return Block type.
39+
*/
40+
/******************************************/
3441
const char *type() { return _visual_type; }
3542

3643
protected:
37-
const char *_visual_type = "momentary_button";
44+
const char *_visual_type = "momentary_button"; /*!< Block type. */
3845

46+
/******************************************/
47+
/*!
48+
@brief Returns width of block.
49+
@return Block width.
50+
*/
51+
/******************************************/
3952
int _width() { return width; }
53+
54+
/******************************************/
55+
/*!
56+
@brief Returns height of block.
57+
@return Block height.
58+
*/
59+
/******************************************/
4060
int _height() { return height; }
61+
62+
/******************************************/
63+
/*!
64+
@brief Returns block's row location
65+
on an Adafruit IO dashboard.
66+
@return Adafruit IO dashboard row.
67+
*/
68+
/******************************************/
4169
int _row() { return row; }
70+
71+
/******************************************/
72+
/*!
73+
@brief Returns block's column location
74+
on an Adafruit IO dashboard.
75+
@return Adafruit IO dashboard column
76+
*/
77+
/******************************************/
4278
int _column() { return column; }
4379
};
4480

src/blocks/SliderBlock.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
*/
1515
#include "SliderBlock.h"
1616

17+
/**************************************************************************/
18+
/*!
19+
@brief Creates a new Slider Block on an Adafruit IO Dashboard.
20+
@param d
21+
Adafruit IO Dashboard name.
22+
@param f
23+
Adafruit IO Feed to display on the slider.
24+
*/
25+
/**************************************************************************/
1726
SliderBlock::SliderBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
1827
: AdafruitIO_Block(d, f) {
1928
min = 0;
@@ -24,6 +33,12 @@ SliderBlock::SliderBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
2433

2534
SliderBlock::~SliderBlock() {}
2635

36+
/**************************************************************************/
37+
/*!
38+
@brief Sets slider block properties.
39+
@return String containing properties of the slider block.
40+
*/
41+
/**************************************************************************/
2742
String SliderBlock::properties() {
2843
String props = "{\"min\":\"";
2944
props += min;

src/blocks/SliderBlock.h

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,71 @@
1717

1818
#include "AdafruitIO_Block.h"
1919

20+
/**************************************************************************/
21+
/*!
22+
@brief Class for interacting with the Adafruit IO Dashboard
23+
Slider Block.
24+
*/
25+
/**************************************************************************/
2026
class SliderBlock : public AdafruitIO_Block {
2127

2228
public:
2329
SliderBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f);
2430
~SliderBlock();
2531

26-
int min;
27-
int max;
28-
int step;
29-
const char *label;
32+
int min; /*!< Minimum slider data value. */
33+
int max; /*!< Maximum slider data value. */
34+
int step; /*!< Slider data step value. */
35+
const char *label; /*!< Slider title. */
3036

31-
int width = 4;
32-
int height = 2;
37+
int width = 4; /*!< Dashboard block width. */
38+
int height = 2; /*!< Dashboard block height. */
3339

3440
String properties();
41+
42+
/******************************************/
43+
/*!
44+
@brief Returns block type
45+
@return Block type.
46+
*/
47+
/******************************************/
3548
const char *type() { return _visual_type; }
3649

3750
protected:
38-
const char *_visual_type = "slider";
51+
const char *_visual_type = "slider"; /*!< Block type. */
3952

53+
/******************************************/
54+
/*!
55+
@brief Returns width of block.
56+
@return Block width.
57+
*/
58+
/******************************************/
4059
int _width() { return width; }
60+
61+
/******************************************/
62+
/*!
63+
@brief Returns height of block.
64+
@return Block height.
65+
*/
66+
/******************************************/
4167
int _height() { return height; }
68+
69+
/******************************************/
70+
/*!
71+
@brief Returns block's row location
72+
on an Adafruit IO dashboard.
73+
@return Adafruit IO dashboard row.
74+
*/
75+
/******************************************/
4276
int _row() { return row; }
77+
78+
/******************************************/
79+
/*!
80+
@brief Returns block's column location
81+
on an Adafruit IO dashboard.
82+
@return Adafruit IO dashboard column
83+
*/
84+
/******************************************/
4385
int _column() { return column; }
4486
};
4587

src/blocks/ToggleBlock.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
*/
1515
#include "ToggleBlock.h"
1616

17+
/**************************************************************************/
18+
/*!
19+
@brief Creates a new Toggle Block on an Adafruit IO Dashboard.
20+
@param d
21+
Adafruit IO Dashboard name.
22+
@param f
23+
Adafruit IO Feed to display on the toggle block.
24+
*/
25+
/**************************************************************************/
1726
ToggleBlock::ToggleBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
1827
: AdafruitIO_Block(d, f) {
1928
onText = "1";
@@ -22,6 +31,12 @@ ToggleBlock::ToggleBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
2231

2332
ToggleBlock::~ToggleBlock() {}
2433

34+
/**************************************************************************/
35+
/*!
36+
@brief Sets toggle block properties.
37+
@return String containing properties of the toggle block.
38+
*/
39+
/**************************************************************************/
2540
String ToggleBlock::properties() {
2641
String props = "{\"onText\":\"";
2742
props += onText;

src/blocks/ToggleBlock.h

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,68 @@
1717

1818
#include "AdafruitIO_Block.h"
1919

20+
/**************************************************************************/
21+
/*!
22+
@brief Class for creating an Adafruit IO Dashboard Toggle Block.
23+
*/
24+
/**************************************************************************/
2025
class ToggleBlock : public AdafruitIO_Block {
2126

2227
public:
2328
ToggleBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f);
2429
~ToggleBlock();
2530

26-
const char *onText;
27-
const char *offText;
31+
const char *onText; /*!< Text to display if the switch is in the on state. */
32+
const char *offText; /*!< Text to display if the switch is in the off state. */
2833

29-
int width = 4;
30-
int height = 2;
34+
int height = 2; /*!< Dashboard block height. */
35+
int width = 4; /*!< Dashboard block width. */
3136

3237
String properties();
38+
39+
/******************************************/
40+
/*!
41+
@brief Returns block type
42+
@return Block type.
43+
*/
44+
/******************************************/
3345
const char *type() { return _visual_type; }
3446

3547
protected:
36-
const char *_visual_type = "toggle_button";
48+
const char *_visual_type = "toggle_button"; /*!< Block type. */
3749

50+
/******************************************/
51+
/*!
52+
@brief Returns width of block.
53+
@return Block width.
54+
*/
55+
/******************************************/
3856
int _width() { return width; }
57+
58+
/******************************************/
59+
/*!
60+
@brief Returns height of block.
61+
@return Block height.
62+
*/
63+
/******************************************/
3964
int _height() { return height; }
65+
66+
/******************************************/
67+
/*!
68+
@brief Returns block's row location
69+
on an Adafruit IO dashboard.
70+
@return Adafruit IO dashboard row.
71+
*/
72+
/******************************************/
4073
int _row() { return row; }
74+
75+
/******************************************/
76+
/*!
77+
@brief Returns block's column location
78+
on an Adafruit IO dashboard.
79+
@return Adafruit IO dashboard column
80+
*/
81+
/******************************************/
4182
int _column() { return column; }
4283
};
4384

0 commit comments

Comments
 (0)