File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,3 +78,8 @@ GaugeBlock* AdafruitIO_Dashboard::addGaugeBlock(AdafruitIO_Feed *feed)
7878{
7979 return new GaugeBlock (this , feed);
8080}
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 1818#include " blocks/MomentaryBlock.h"
1919#include " blocks/SliderBlock.h"
2020#include " blocks/GaugeBlock.h"
21+ #include " blocks/TextBlock.h"
2122
2223// forward declaration
2324class AdafruitIO ;
@@ -38,6 +39,7 @@ class AdafruitIO_Dashboard {
3839 MomentaryBlock* addMomentaryBlock (AdafruitIO_Feed *feed);
3940 SliderBlock* addSliderBlock (AdafruitIO_Feed *feed);
4041 GaugeBlock* addGaugeBlock (AdafruitIO_Feed *feed);
42+ TextBlock* addTextBlock (AdafruitIO_Feed *feed);
4143
4244 private:
4345 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