File tree Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Original file line number Diff line number Diff line change @@ -78,3 +78,8 @@ GaugeBlock* AdafruitIO_Dashboard::addGaugeBlock(AdafruitIO_Feed *feed)
78
78
{
79
79
return new GaugeBlock (this , feed);
80
80
}
81
+
82
+ TextBlock* AdafruitIO_Dashboard::addTextBlock (AdafruitIO_Feed *feed)
83
+ {
84
+ return new TextBlock (this , feed);
85
+ }
Original file line number Diff line number Diff line change 18
18
#include " blocks/MomentaryBlock.h"
19
19
#include " blocks/SliderBlock.h"
20
20
#include " blocks/GaugeBlock.h"
21
+ #include " blocks/TextBlock.h"
21
22
22
23
// forward declaration
23
24
class AdafruitIO ;
@@ -38,6 +39,7 @@ class AdafruitIO_Dashboard {
38
39
MomentaryBlock* addMomentaryBlock (AdafruitIO_Feed *feed);
39
40
SliderBlock* addSliderBlock (AdafruitIO_Feed *feed);
40
41
GaugeBlock* addGaugeBlock (AdafruitIO_Feed *feed);
42
+ TextBlock* addTextBlock (AdafruitIO_Feed *feed);
41
43
42
44
private:
43
45
AdafruitIO *_io;
Original file line number Diff line number Diff line change
1
+ //
2
+ // Adafruit invests time and resources providing this open source code.
3
+ // Please support Adafruit and open source hardware by purchasing
4
+ // products from Adafruit!
5
+ //
6
+ // Copyright (c) 2015-2016 Adafruit Industries
7
+ // Authors: Tony DiCola, Todd Treece
8
+ // Licensed under the MIT license.
9
+ //
10
+ // All text above must be included in any redistribution.
11
+ //
12
+ #include " TextBlock.h"
13
+
14
+ TextBlock::TextBlock (AdafruitIO_Dashboard *d, AdafruitIO_Feed *f) : AdafruitIO_Block(d, f)
15
+ {
16
+ fontSize = " SMALL" ;
17
+ }
18
+
19
+ TextBlock::~TextBlock (){}
20
+
21
+ String TextBlock::properties ()
22
+ {
23
+ int s = 0 ;
24
+
25
+ if (fontSize == " SMALL" ) {
26
+ s = 12 ;
27
+ } else if (fontSize == " MEDIUM" ) {
28
+ s = 18 ;
29
+ } else {
30
+ s = 24 ;
31
+ }
32
+
33
+ String props = " {\" fontSize\" :\" " ;
34
+ props += s;
35
+ props += " \" }" ;
36
+
37
+ return props;
38
+ }
Original file line number Diff line number Diff line change
1
+ //
2
+ // Adafruit invests time and resources providing this open source code.
3
+ // Please support Adafruit and open source hardware by purchasing
4
+ // products from Adafruit!
5
+ //
6
+ // Copyright (c) 2015-2016 Adafruit Industries
7
+ // Authors: Tony DiCola, Todd Treece
8
+ // Licensed under the MIT license.
9
+ //
10
+ // All text above must be included in any redistribution.
11
+ //
12
+ #ifndef ADAFRUITIO_TEXTBLOCK_H
13
+ #define ADAFRUITIO_TEXTBLOCK_H
14
+
15
+ #include " AdafruitIO_Block.h"
16
+
17
+ class TextBlock : public AdafruitIO_Block {
18
+
19
+ public:
20
+ TextBlock (AdafruitIO_Dashboard *d, AdafruitIO_Feed *f);
21
+ ~TextBlock ();
22
+
23
+ const char *fontSize;
24
+
25
+ String properties ();
26
+
27
+ private:
28
+ const char *_visual_type = " text" ;
29
+
30
+ };
31
+
32
+ #endif // ADAFRUITIO_TEXTBLOCK_H
You can’t perform that action at this time.
0 commit comments