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- //
1+ /* !
2+ * @file AdafruitIO_Block.cpp
3+ *
4+ * This is part of the Adafruit IO library for the Arduino platform.
5+ *
6+ * Adafruit invests time and resources providing this open source code,
7+ * please support Adafruit and open-source hardware by purchasing
8+ * products from Adafruit!
9+ *
10+ * Written by Tony DiCola, Todd Treece for Adafruit Industries
11+ *
12+ * BSD license, all text here must be included in any redistribution.
13+ *
14+ */
1215#include " AdafruitIO_Block.h"
1316#include " AdafruitIO.h"
1417#include " AdafruitIO_Dashboard.h"
1518
19+ /* *************************************************************************/
20+ /* !
21+ @brief Creates a new Block on an Adafruit IO Dashboard.
22+ @param d
23+ Adafruit IO Dashboard name.
24+ @param f
25+ Adafruit IO Feed to display on the block.
26+ */
27+ /* *************************************************************************/
1628AdafruitIO_Block::AdafruitIO_Block (AdafruitIO_Dashboard *d,
1729 AdafruitIO_Feed *f) {
1830 _dashboard = d;
@@ -21,11 +33,24 @@ AdafruitIO_Block::AdafruitIO_Block(AdafruitIO_Dashboard *d,
2133
2234AdafruitIO_Block::~AdafruitIO_Block () {}
2335
36+ /* *************************************************************************/
37+ /* !
38+ @brief Sets block properties.
39+ @return String containing block's properties.
40+ */
41+ /* *************************************************************************/
2442String AdafruitIO_Block::properties () {
2543 String props = " {}" ;
2644 return props;
2745}
2846
47+ /* *************************************************************************/
48+ /* !
49+ @brief Sets block dimensions, provided block size (width, height)
50+ and block location on dashboard (row, column).
51+ @return String containing block's dimensions.
52+ */
53+ /* *************************************************************************/
2954String AdafruitIO_Block::dimensions () {
3055 String dim = " \" ,\" size_x\" :\" " ;
3156 dim += _width ();
@@ -45,8 +70,20 @@ String AdafruitIO_Block::dimensions() {
4570 return dim;
4671}
4772
73+ /* *************************************************************************/
74+ /* !
75+ @brief Returns type of Adafruit IO Block.
76+ @return Block type
77+ */
78+ /* *************************************************************************/
4879const char *AdafruitIO_Block::type () { return _visual_type; }
4980
81+ /* *************************************************************************/
82+ /* !
83+ @brief Creates a new block on an Adafruit IO dashboard.
84+ @return True if successful, False otherwise.
85+ */
86+ /* *************************************************************************/
5087bool AdafruitIO_Block::save () {
5188 HttpClient *http = _dashboard->io ()->_http ;
5289
0 commit comments