LoomPublishPlat class

Abstract internet publishing module, implementing google sheets and mongodb functionality.

All actuator modules inherit from this class.

Base classes

class LoomModule
Abstract root of Loom component modules inheritance hierarchy.

Derived classes

class Loom_GoogleSheets
Module taking in and translating JSON into data understood by the Google Sheets script API.
class Loom_MaxPub
Module taking in and translating JSON into data understood by the Google Sheets script API.

Protected variables

LoomInternetPlat* m_internet
Pointer to internet platform to use to publish.
LoomModule::Type internet_type
Type of internet platform used to publish.

CONSTRUCTORS / DESTRUCTOR

LoomPublishPlat(LoomManager* manager, const char* module_name, const LoomModule::Type module_type, const LoomModule::Type internet_type)
Constructor.
~LoomPublishPlat() defaulted virtual
Destructor.
void second_stage_ctor() override
Grab the internet platform specified by the ctor parameters.

OPERATION

void package(JsonObject json) override
No package necessary for publishing platforms.
auto publish(const JsonObject json) -> bool
Publish data.
auto publish_batch() -> uint8_t
Publish all the packets stored in the batch.
auto publish() -> bool
Version of log for use with LoomManager.

Function documentation

LoomPublishPlat::LoomPublishPlat(LoomManager* manager, const char* module_name, const LoomModule::Type module_type, const LoomModule::Type internet_type)

Constructor.

Parameters
manager
module_name in String | <"Internet-Plat"> | null | Publish platform module name
module_type in Type of the module (provided by derived classes)
internet_type in Set(LoomModule::Type) | <7001> | {7001("Ethernet"), 7002("WiFi"), 7003("LTE")} | Code of the desired internet platform.

void LoomPublishPlat::package(JsonObject json) override

No package necessary for publishing platforms.

Implement with empty body.

bool LoomPublishPlat::publish(const JsonObject json)

Publish data.

Parameters
json in JSON object to publish. MUST be formatted as { "contents" : [ { "module": "module_name", "data" : {...} }, ... ], "timestamp"(optional) : {...} }
Returns Whether or not the publish succeded

uint8_t LoomPublishPlat::publish_batch()

Publish all the packets stored in the batch.

Returns Whether or not the publishes succeded or not

bool LoomPublishPlat::publish()

Version of log for use with LoomManager.

Returns True if success

Accesses Json from LoomManager

bool LoomPublishPlat::send_to_internet(const JsonObject json, LoomInternetPlat* plat) pure virtual protected

Send JSON to the internet, assumes that a valid internet plat was found and can be used.

Parameters
json in Json object to send
plat in Internet platform to send on
Returns True if success

Variable documentation

LoomModule::Type LoomPublishPlat::internet_type protected

Type of internet platform used to publish.

Needed because finding the module for m_internet happens in second_stage_ctor(), rather than the regular constructor.