Skip to content

Commit ce7d5ed

Browse files
committed
🎨 Add doxygen across new v2 classes
1 parent e513533 commit ce7d5ed

File tree

10 files changed

+631
-217
lines changed

10 files changed

+631
-217
lines changed

Doxyfile

Lines changed: 543 additions & 206 deletions
Large diffs are not rendered by default.

src/Wippersnapper_V2.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,17 @@ void Wippersnapper_V2::haltErrorV2(String error,
828828
}
829829
}
830830

831+
/**************************************************************************/
832+
/*!
833+
@brief Publishes a signal message to the broker.
834+
@param which_payload
835+
The type of signal payload to publish.
836+
@param payload
837+
The payload to publish.
838+
@returns True if the signal message published successfully,
839+
False otherwise.
840+
*/
841+
/**************************************************************************/
831842
bool Wippersnapper_V2::PublishSignal(pb_size_t which_payload, void *payload) {
832843
size_t szMessageBuf;
833844
wippersnapper_signal_DeviceToBroker MsgSignal =

src/Wippersnapper_V2.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class Wippersnapper_V2 {
244244
#ifdef ARDUINO_ARCH_ESP32
245245
ws_ledc *_ledcV2 = nullptr; ///< Pointer to LEDC object
246246
#endif
247-
bool got_checkin_response;
247+
bool got_checkin_response; ///< True if a checkin response was received, False otherwise.
248248

249249
private:
250250
void _initV2();
@@ -261,8 +261,7 @@ class Wippersnapper_V2 {
261261
Adafruit_MQTT_Subscribe *_subscribeThrottle;
262262

263263
protected:
264-
// TODO: Do we need this?
265-
ws_status_t _statusV2 = WS_IDLE;
264+
ws_status_t _statusV2 = WS_IDLE; ///< Wippersnapper status
266265

267266
uint32_t _last_mqtt_connectV2 = 0; /*!< Previous time when client connected to
268267
Adafruit IO, in milliseconds. */

src/components/checkin/model.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
#define WS_CHECKIN_MODEL_H
1717
#include "Wippersnapper_V2.h"
1818

19+
/**************************************************************************/
20+
/*!
21+
@brief Provides an interface for creating, encoding, and parsing
22+
messages from checkin.proto.
23+
*/
24+
/**************************************************************************/
1925
class CheckinModel {
2026
public:
2127
CheckinModel();

src/components/digitalIO/controller.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ struct DigitalIOPin {
3232

3333
class DigitalIOModel; // Forward declaration
3434
class DigitalIOHardware; // Forward declaration
35+
36+
/**************************************************************************/
37+
/*!
38+
@brief Routes messages using the digitalio.proto API to the
39+
appropriate hardware and model classes, controls and tracks
40+
the state of the hardware's digital I/O pins.
41+
*/
42+
/**************************************************************************/
3543
class DigitalIOController {
3644
public:
3745
DigitalIOController();

src/components/digitalIO/hardware.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
#define WS_DIGITALIO_HARDWARE_H
1717
#include "Wippersnapper_V2.h"
1818

19+
/**************************************************************************/
20+
/*!
21+
@brief Interface for interacting with hardware's digital I/O pin API.
22+
*/
23+
/**************************************************************************/
1924
class DigitalIOHardware {
2025
public:
2126
DigitalIOHardware();
@@ -26,7 +31,6 @@ class DigitalIOHardware {
2631
bool GetValue(uint8_t pin_name);
2732
void deinit(uint8_t pin_name);
2833
bool IsStatusLEDPin(uint8_t pin_name);
29-
3034
private:
3135
};
3236
#endif // WS_DIGITALIO_HARDWARE_H

src/components/digitalIO/model.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
#define WS_DIGITALIO_MODEL_H
1717
#include "Wippersnapper_V2.h"
1818

19+
/**************************************************************************/
20+
/*!
21+
@brief Provides an interface for creating, encoding, and parsing
22+
messages from digitalio.proto.
23+
*/
24+
/**************************************************************************/
1925
class DigitalIOModel {
2026
public:
2127
DigitalIOModel();
@@ -39,7 +45,6 @@ class DigitalIOModel {
3945
wippersnapper_digitalio_DigitalIOEvent *GetDigitalIOEventMsg() {
4046
return &_msg_dio_event;
4147
}
42-
4348
private:
4449
wippersnapper_digitalio_DigitalIOAdd _msg_dio_add;
4550
wippersnapper_digitalio_DigitalIORemove _msg_dio_remove;

src/components/sensor/model.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
#include "Wippersnapper_V2.h"
1818
#include "protos/sensor.pb.h"
1919

20+
/**************************************************************************/
21+
/*!
22+
@brief Provides an interface for creating, encoding, and parsing
23+
messages from sensor.proto.
24+
*/
25+
/**************************************************************************/
2026
class SensorModel {
2127
public:
2228
SensorModel();

src/ws_manager.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#include "ws_manager.h"
22

3+
/**************************************************************************/
4+
/*!
5+
@brief Constructor for Wippersnapper_Manager
6+
*/
7+
/**************************************************************************/
38
Wippersnapper_Manager::Wippersnapper_Manager() : ws_instance(nullptr) {}
49

10+
/**************************************************************************/
11+
/*!
12+
@brief Destructor for Wippersnapper_Manager
13+
*/
14+
/**************************************************************************/
515
Wippersnapper_Manager::~Wippersnapper_Manager() {
616
if (ws_instance) {
717
delete ws_instance;
@@ -11,6 +21,11 @@ Wippersnapper_Manager::~Wippersnapper_Manager() {
1121
}
1222
}
1323

24+
/**************************************************************************/
25+
/*!
26+
@brief Performs the connect() function in Wippersnapper*.cpp
27+
*/
28+
/**************************************************************************/
1429
void Wippersnapper_Manager::connect() {
1530
if (_api_version == 2) {
1631
WS_DEBUG_PRINTLN("api v2 instance::connect()");
@@ -23,6 +38,11 @@ void Wippersnapper_Manager::connect() {
2338
}
2439
}
2540

41+
/**************************************************************************/
42+
/*!
43+
@brief Performs the provision() function in Wippersnapper*.cpp
44+
*/
45+
/**************************************************************************/
2646
void Wippersnapper_Manager::provision() {
2747
if (_api_version == 2) {
2848
WS_DEBUG_PRINTLN("api v2 instance::provision()");
@@ -35,6 +55,13 @@ void Wippersnapper_Manager::provision() {
3555
}
3656
}
3757

58+
/**************************************************************************/
59+
/*!
60+
@brief Checks the API version by reading the state of a pin
61+
@param pinNum
62+
The pin number to read
63+
*/
64+
/**************************************************************************/
3865
void Wippersnapper_Manager::checkAPIVersion(int pinNum) {
3966
// Check if pin D12 is high
4067
pinMode(pinNum, INPUT_PULLUP);
@@ -50,6 +77,11 @@ void Wippersnapper_Manager::checkAPIVersion(int pinNum) {
5077
}
5178
}
5279

80+
/**************************************************************************/
81+
/*!
82+
@brief Performs the run() function in Wippersnapper*.cpp
83+
*/
84+
/**************************************************************************/
5385
void Wippersnapper_Manager::run() {
5486
if (_api_version == 2) {
5587
ws_instance_v2->runV2();

src/ws_manager.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,30 @@ typedef Wippersnapper_ESP32 Wippersnapper_WiFi;
66
#include "network_interfaces/Wippersnapper_ESP32_V2.h"
77
typedef Wippersnapper_ESP32V2 Wippersnapper_WiFiV2;
88

9+
/****************************************************************************/
10+
/*!
11+
@brief Helper class to manage the WipperSnapper API versions dynamically
12+
at runtime.
13+
*/
14+
/****************************************************************************/
915
class Wippersnapper_Manager {
1016
public:
1117
Wippersnapper_Manager();
1218
~Wippersnapper_Manager();
1319

14-
// API version check
20+
// API version checks
1521
void checkAPIVersion(int pinNum);
1622
int getAPIVersion() { return _api_version; }
23+
24+
// High-level functions (called from demo sketch ino)
1725
void provision();
1826
void connect();
1927
void run();
2028

2129
protected:
22-
// Wippersnapper *ws_instance;
23-
Wippersnapper_WiFi *ws_instance;
24-
Wippersnapper_WiFiV2 *ws_instance_v2;
25-
30+
Wippersnapper_WiFi *ws_instance; ///< Instance of Wippersnapper API v1
31+
Wippersnapper_WiFiV2 *ws_instance_v2; ///< Instance of Wippersnapper API v2
2632
private:
2733
int _api_version;
2834
};
29-
#endif // WIPPERSNAPPER_MANAGER_H
35+
#endif // WIPPERSNAPPER_MANAGER_H

0 commit comments

Comments
 (0)