@alteriom/painlessmesh 2.0.3 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +190 -0
- package/CONTRIBUTING.md +59 -11
- package/examples/alteriom/platformio.ini +4 -1
- package/examples/basic/platformio.ini +4 -1
- package/examples/sendToInternet/README.md +54 -2
- package/examples/sendToInternet/callmebot.h +139 -0
- package/examples/sendToInternet/sendToInternet.ino +117 -39
- package/keywords.txt +1 -0
- package/library.json +1 -1
- package/library.properties +1 -1
- package/package.json +1 -1
- package/src/AlteriomPainlessMesh.h +3 -3
- package/src/arduino/wifi.hpp +147 -81
- package/src/boost/asynctcp.hpp +1 -1
- package/src/painlessMeshSTA.cpp +38 -4
- package/src/painlessMeshSTA.h +18 -5
- package/src/painlessmesh/buffer.hpp +22 -17
- package/src/painlessmesh/gateway.hpp +420 -73
- package/src/painlessmesh/layout.hpp +16 -0
- package/src/painlessmesh/logger.hpp +1 -1
- package/src/painlessmesh/mesh.hpp +276 -116
- package/src/painlessmesh/message_queue.hpp +6 -6
- package/src/painlessmesh/metrics.hpp +1 -1
- package/src/painlessmesh/ota.hpp +1 -1
- package/src/painlessmesh/plugin.hpp +10 -7
- package/src/painlessmesh/protocol.hpp +10 -6
- package/src/painlessmesh/rtc.hpp +3 -3
- package/src/plugin/performance.hpp +5 -5
|
@@ -37,10 +37,10 @@ enum QueueState {
|
|
|
37
37
|
* Contains all metadata needed for reliable message delivery
|
|
38
38
|
*/
|
|
39
39
|
struct QueuedMessage {
|
|
40
|
-
uint32_t id;
|
|
41
|
-
MessagePriority priority; // Message priority level
|
|
42
|
-
uint32_t timestamp;
|
|
43
|
-
uint32_t attempts;
|
|
40
|
+
uint32_t id = 0; // Unique message ID
|
|
41
|
+
MessagePriority priority = PRIORITY_NORMAL; // Message priority level
|
|
42
|
+
uint32_t timestamp = 0; // When message was queued (millis)
|
|
43
|
+
uint32_t attempts = 0; // Number of send attempts
|
|
44
44
|
TSTRING payload; // Message content
|
|
45
45
|
TSTRING destination; // Cloud endpoint/topic (optional metadata)
|
|
46
46
|
|
|
@@ -298,8 +298,8 @@ public:
|
|
|
298
298
|
|
|
299
299
|
private:
|
|
300
300
|
std::vector<QueuedMessage> messages;
|
|
301
|
-
uint32_t maxQueueSize;
|
|
302
|
-
uint32_t nextMessageId;
|
|
301
|
+
uint32_t maxQueueSize = 1000;
|
|
302
|
+
uint32_t nextMessageId = 1;
|
|
303
303
|
QueueStats stats;
|
|
304
304
|
QueueState currentState = QUEUE_EMPTY;
|
|
305
305
|
queueStateChangedCallback_t stateChangedCallback;
|
package/src/painlessmesh/ota.hpp
CHANGED
|
@@ -39,10 +39,13 @@ namespace plugin {
|
|
|
39
39
|
|
|
40
40
|
class SinglePackage : public protocol::PackageInterface {
|
|
41
41
|
public:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
// `from` and `dest` are the application's to fill; a package built by
|
|
43
|
+
// the type constructor and sent before they are set addresses node 0,
|
|
44
|
+
// not whatever the stack held.
|
|
45
|
+
uint32_t from = 0;
|
|
46
|
+
uint32_t dest = 0;
|
|
47
|
+
router::Type routing = router::SINGLE;
|
|
48
|
+
int type = 0;
|
|
46
49
|
int noJsonFields = 4;
|
|
47
50
|
|
|
48
51
|
SinglePackage(int type) : routing(router::SINGLE), type(type) {}
|
|
@@ -65,9 +68,9 @@ class SinglePackage : public protocol::PackageInterface {
|
|
|
65
68
|
|
|
66
69
|
class BroadcastPackage : public protocol::PackageInterface {
|
|
67
70
|
public:
|
|
68
|
-
uint32_t from;
|
|
69
|
-
router::Type routing;
|
|
70
|
-
int type;
|
|
71
|
+
uint32_t from = 0;
|
|
72
|
+
router::Type routing = router::BROADCAST;
|
|
73
|
+
int type = 0;
|
|
71
74
|
int noJsonFields = 3;
|
|
72
75
|
|
|
73
76
|
BroadcastPackage(int type) : routing(router::BROADCAST), type(type) {}
|
|
@@ -75,6 +75,10 @@ constexpr uint8_t PRIORITY_LOW = 3;
|
|
|
75
75
|
|
|
76
76
|
class PackageInterface {
|
|
77
77
|
public:
|
|
78
|
+
// A base with virtual functions destroyed through a derived pointer needs
|
|
79
|
+
// this, and a package held in a shared_ptr is exactly that case (#469);
|
|
80
|
+
// clang refuses the build without it under -Werror.
|
|
81
|
+
virtual ~PackageInterface() = default;
|
|
78
82
|
virtual JsonObject addTo(JsonObject&& jsonObj) const = 0;
|
|
79
83
|
#if ARDUINOJSON_VERSION_MAJOR < 7
|
|
80
84
|
virtual size_t jsonObjectSize() const = 0;
|
|
@@ -89,8 +93,8 @@ class PackageInterface {
|
|
|
89
93
|
class Single : public PackageInterface {
|
|
90
94
|
public:
|
|
91
95
|
int type = SINGLE;
|
|
92
|
-
uint32_t from;
|
|
93
|
-
uint32_t dest;
|
|
96
|
+
uint32_t from = 0;
|
|
97
|
+
uint32_t dest = 0;
|
|
94
98
|
TSTRING msg = "";
|
|
95
99
|
// Non-zero when the sender requested a delivery acknowledgment. Only
|
|
96
100
|
// serialized when set, so plain sends carry zero overhead.
|
|
@@ -273,8 +277,8 @@ class NodeTree : public PackageInterface {
|
|
|
273
277
|
class NodeSyncRequest : public NodeTree {
|
|
274
278
|
public:
|
|
275
279
|
int type = NODE_SYNC_REQUEST;
|
|
276
|
-
uint32_t from;
|
|
277
|
-
uint32_t dest;
|
|
280
|
+
uint32_t from = 0;
|
|
281
|
+
uint32_t dest = 0;
|
|
278
282
|
|
|
279
283
|
NodeSyncRequest() {}
|
|
280
284
|
NodeSyncRequest(uint32_t fromID, uint32_t destID, std::list<NodeTree> subTree,
|
|
@@ -351,8 +355,8 @@ struct time_sync_msg_t {
|
|
|
351
355
|
class TimeSync : public PackageInterface {
|
|
352
356
|
public:
|
|
353
357
|
int type = TIME_SYNC;
|
|
354
|
-
uint32_t dest;
|
|
355
|
-
uint32_t from;
|
|
358
|
+
uint32_t dest = 0;
|
|
359
|
+
uint32_t from = 0;
|
|
356
360
|
time_sync_msg_t msg;
|
|
357
361
|
|
|
358
362
|
TimeSync() {}
|
package/src/painlessmesh/rtc.hpp
CHANGED
|
@@ -192,9 +192,9 @@ class RTCManager {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
private:
|
|
195
|
-
RTCInterface* rtcInterface;
|
|
196
|
-
bool rtcEnabled;
|
|
197
|
-
uint32_t lastSyncTime;
|
|
195
|
+
RTCInterface* rtcInterface = nullptr;
|
|
196
|
+
bool rtcEnabled = false;
|
|
197
|
+
uint32_t lastSyncTime = 0;
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
} // namespace rtc
|
|
@@ -53,10 +53,10 @@ class Stats {
|
|
|
53
53
|
|
|
54
54
|
class PerformancePackage : public plugin::BroadcastPackage {
|
|
55
55
|
public:
|
|
56
|
-
int id = 0;
|
|
57
|
-
int time; // Get an idea of the delay, by comparing it with nodetime
|
|
58
|
-
int stability; // stability of the sending node
|
|
59
|
-
int freeMemory; // memory of the sending node
|
|
56
|
+
int id = 0; // Can see if we missed values
|
|
57
|
+
int time = 0; // Get an idea of the delay, by comparing it with nodetime
|
|
58
|
+
int stability = 0; // stability of the sending node
|
|
59
|
+
int freeMemory = 0; // memory of the sending node
|
|
60
60
|
#ifdef ESP32
|
|
61
61
|
TSTRING hardware = "ESP32";
|
|
62
62
|
#else
|
|
@@ -93,7 +93,7 @@ class PerformancePackage : public plugin::BroadcastPackage {
|
|
|
93
93
|
/// Numbers to track for each node we receive PerformancePackages from
|
|
94
94
|
class Track {
|
|
95
95
|
public:
|
|
96
|
-
uint32_t nodeId;
|
|
96
|
+
uint32_t nodeId = 0;
|
|
97
97
|
TSTRING hardware;
|
|
98
98
|
uint32_t hits = 0;
|
|
99
99
|
uint32_t misses = 0;
|