Skip to content

Commit 85a2bbf

Browse files
author
brentru
committed
add stream block
1 parent 1faae28 commit 85a2bbf

3 files changed

Lines changed: 74 additions & 8 deletions

File tree

src/blocks/MomentaryBlock.cpp

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

17+
/**************************************************************************/
18+
/*!
19+
@brief Creates a new Momentary 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 momentary.
24+
*/
25+
/**************************************************************************/
1726
MomentaryBlock::MomentaryBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
1827
: AdafruitIO_Block(d, f) {
1928
text = "RESET";
@@ -23,6 +32,12 @@ MomentaryBlock::MomentaryBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
2332

2433
MomentaryBlock::~MomentaryBlock() {}
2534

35+
/**************************************************************************/
36+
/*!
37+
@brief Sets momentary block properties.
38+
@return String containing properties of the momentary block.
39+
*/
40+
/**************************************************************************/
2641
String MomentaryBlock::properties() {
2742
String props = "{\"text\":\"";
2843
props += text;

src/blocks/StreamBlock.cpp

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

17+
/**************************************************************************/
18+
/*!
19+
@brief Creates a new Stream 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 stream block.
24+
*/
25+
/**************************************************************************/
1726
StreamBlock::StreamBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
1827
: AdafruitIO_Block(d, f) {
1928
fontSize = "small";
@@ -25,6 +34,12 @@ StreamBlock::StreamBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f)
2534

2635
StreamBlock::~StreamBlock() {}
2736

37+
/**************************************************************************/
38+
/*!
39+
@brief Sets stream block properties.
40+
@return String containing properties of the stream block.
41+
*/
42+
/**************************************************************************/
2843
String StreamBlock::properties() {
2944
int s = 0;
3045

src/blocks/StreamBlock.h

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,60 @@ class StreamBlock : public AdafruitIO_Block {
2323
StreamBlock(AdafruitIO_Dashboard *d, AdafruitIO_Feed *f);
2424
~StreamBlock();
2525

26-
const char *fontSize;
27-
const char *fontColor;
28-
bool showErrors;
29-
bool showTimestamp;
30-
bool showName;
26+
const char *fontSize; /*!< Block's text font size. */
27+
const char *fontColor; /*!< Block's text font color. */
28+
bool showErrors; /*!< Display Adafruit IO errors .*/
29+
bool showTimestamp; /*!< Display timestamp metadata. */
30+
bool showName; /*!< Display value name.. */
3131

32-
int width = 6;
33-
int height = 4;
32+
int width = 6; /*!< Dashboard block width. */
33+
int height = 4; /*!< Dashboard block height. */
3434

3535
String properties();
36+
37+
/******************************************/
38+
/*!
39+
@brief Returns block type
40+
@return Block type.
41+
*/
42+
/******************************************/
3643
const char *type() { return _visual_type; }
3744

3845
protected:
39-
const char *_visual_type = "stream";
46+
const char *_visual_type = "stream"; /*!< Block type. */
4047

48+
/******************************************/
49+
/*!
50+
@brief Returns width of block.
51+
@return Block width.
52+
*/
53+
/******************************************/
4154
int _width() { return width; }
55+
56+
/******************************************/
57+
/*!
58+
@brief Returns height of block.
59+
@return Block height.
60+
*/
61+
/******************************************/
4262
int _height() { return height; }
63+
64+
/******************************************/
65+
/*!
66+
@brief Returns block's row location
67+
on an Adafruit IO dashboard.
68+
@return Adafruit IO dashboard row.
69+
*/
70+
/******************************************/
4371
int _row() { return row; }
72+
73+
/******************************************/
74+
/*!
75+
@brief Returns block's column location
76+
on an Adafruit IO dashboard.
77+
@return Adafruit IO dashboard column
78+
*/
79+
/******************************************/
4480
int _column() { return column; }
4581
};
4682

0 commit comments

Comments
 (0)