|
AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
|
Gateway Acknowledgment Package for delivery confirmations. More...
#include <gateway.hpp>


Public Member Functions | |
| GatewayAckPackage () | |
| Default constructor. | |
| GatewayAckPackage (JsonObject jsonObj) | |
| Construct from JSON object. | |
| JsonObject | addTo (JsonObject &&jsonObj) const |
| Serialize to JSON object. | |
| size_t | jsonObjectSize () const |
| Calculate JSON object size for ArduinoJson v6. | |
Public Member Functions inherited from painlessmesh::plugin::SinglePackage | |
| SinglePackage (int type) | |
| SinglePackage (JsonObject jsonObj) | |
| JsonObject | addTo (JsonObject &&jsonObj) const |
Public Member Functions inherited from painlessmesh::protocol::PackageInterface | |
| virtual | ~PackageInterface ()=default |
Public Attributes | |
| uint32_t | messageId = 0 |
| Original message ID being acknowledged. | |
| uint32_t | originNode = 0 |
| Original sender node ID. | |
| bool | success = false |
| Delivery success status. | |
| uint16_t | httpStatus = 0 |
| HTTP response code (if applicable) | |
| TSTRING | error = "" |
| Error message (if failed) | |
| uint32_t | timestamp = 0 |
| Acknowledgment timestamp. | |
| TSTRING | response = "" |
| The start of the response body, summarized to one line. | |
| int8_t | retryable = -1 |
| Whether the origin node may resend the identical request. | |
| uint32_t | retryAfterMs = 0 |
| How long the server asked to wait before a retry, in milliseconds. | |
Public Attributes inherited from painlessmesh::plugin::SinglePackage | |
| uint32_t | from = 0 |
| uint32_t | dest = 0 |
| router::Type | routing = router::SINGLE |
| int | type = 0 |
| int | noJsonFields = 4 |
Static Public Attributes | |
| static constexpr int | numPackageFields = 9 |
| Number of additional JSON fields in this package. | |
Gateway Acknowledgment Package for delivery confirmations.
This package is sent from the gateway back to the origin node to confirm delivery status of a GatewayDataPackage. It provides feedback on whether the data was successfully delivered to the Internet destination.
The GatewayAckPackage structure has an estimated memory footprint of:
For ESP8266 with ~80KB RAM, this represents <0.3% of available memory. For ESP32 with ~320KB RAM, this represents <0.1% of available memory.
Example usage:
Type ID: 621 (GATEWAY_ACK) Base class: SinglePackage (routed back to origin node)
|
inline |
Default constructor.
Creates a GatewayAckPackage with type ID 621 (GATEWAY_ACK).
|
inline |
Construct from JSON object.
Deserializes a GatewayAckPackage from a JSON object. Compatible with ArduinoJson v6 and v7.
| jsonObj | JSON object containing package data |
|
inlinevirtual |
Serialize to JSON object.
Adds all package fields to the provided JSON object.
| jsonObj | JSON object to add fields to |
Implements painlessmesh::protocol::PackageInterface.
|
inlinevirtual |
Calculate JSON object size for ArduinoJson v6.
Used for buffer allocation when serializing.
Implements painlessmesh::protocol::PackageInterface.
| TSTRING painlessmesh::gateway::GatewayAckPackage::error = "" |
Error message (if failed)
A human-readable error message describing why delivery failed. Empty string if success is true.
| uint16_t painlessmesh::gateway::GatewayAckPackage::httpStatus = 0 |
HTTP response code (if applicable)
The HTTP status code received from the Internet destination. Examples: 200 (OK), 404 (Not Found), 500 (Server Error). Set to 0 if not applicable (e.g., connection failure).
| uint32_t painlessmesh::gateway::GatewayAckPackage::messageId = 0 |
Original message ID being acknowledged.
The messageId from the GatewayDataPackage that this acknowledgment corresponds to. Used for correlation at the origin node.
|
staticconstexpr |
Number of additional JSON fields in this package.
Used for jsonObjectSize() calculation in ArduinoJson v6. Count: msgId, origin, success, http, err, ts, resp, retry, retryAfter = 9
| uint32_t painlessmesh::gateway::GatewayAckPackage::originNode = 0 |
Original sender node ID.
The node ID that originally sent the GatewayDataPackage. Used for routing and correlation.
| TSTRING painlessmesh::gateway::GatewayAckPackage::response = "" |
The start of the response body, summarized to one line.
Carried on success as well as failure, because whether a reply means what the application wanted is the application's decision, not the library's. Empty when no body was read. JSON key "resp", omitted when empty.
| int8_t painlessmesh::gateway::GatewayAckPackage::retryable = -1 |
Whether the origin node may resend the identical request.
1 when the request cannot have reached the server or the server asked to be retried, 0 when a resend could deliver it twice. -1 when the gateway did not say – one that predates the field – and the origin node falls back to its own reading of the status. JSON key "retry", omitted at -1.
| uint32_t painlessmesh::gateway::GatewayAckPackage::retryAfterMs = 0 |
How long the server asked to wait before a retry, in milliseconds.
From a Retry-After header on a 429 or 503. JSON key "retryAfter", omitted when 0.
| bool painlessmesh::gateway::GatewayAckPackage::success = false |
Delivery success status.
True if the message was successfully delivered to the Internet destination, false otherwise.
| uint32_t painlessmesh::gateway::GatewayAckPackage::timestamp = 0 |
Acknowledgment timestamp.
Mesh time when the acknowledgment was created. Can be used to calculate round-trip time.