Loom 4 v4.5
Arduino library for Internet of Things Rapid Prototyping in environmental sensing
|
#include <Loom_MQTT.h>
Public Member Functions | |
Loom_MQTT (Manager &man, Client &internet_client, const char *broker_address, int broker_port, const char *database_name, const char *broker_user="", const char *broker_pass="", const char *projectServer="") | |
Loom_MQTT (Manager &man, Client &internet_client) | |
void | publish () |
void | publish (Loom_BatchSD &batchSD) |
void | setKeepAlive (int time) |
void | setMaxRetries (int retries) |
void | loadConfigFromJSON (char *json) |
![]() | |
Module (const char *modName) | |
void | setModuleName (const char *modName) |
virtual const char * | getModuleName () |
virtual void | printModuleName (const char *message) |
virtual void | initialize ()=0 |
virtual void | measure ()=0 |
virtual void | package ()=0 |
virtual void | power_up ()=0 |
virtual void | power_down ()=0 |
virtual void | display_data () |
Protected Member Functions | |
void | measure () override |
void | initialize () override |
void | power_up () override |
void | power_down () override |
void | package () override |
Additional Inherited Members | |
![]() | |
bool | moduleInitialized = true |
int | module_address = -1 |
Platform for logging data to MQTT for logging to a remote database
Loom_MQTT::Loom_MQTT | ( | Manager & | man, |
Client & | internet_client, | ||
const char * | broker_address, | ||
int | broker_port, | ||
const char * | database_name, | ||
const char * | broker_user = "" , |
||
const char * | broker_pass = "" , |
||
const char * | projectServer = "" |
||
) |
Construct a new MQTT interface
man | Reference to the manager |
internet_client | Reference to whatever connectivity platform is being used |
broker_address | Domain where the broker is being hosted |
broker_port | Port that the broker is listening on |
database_name | Name of the database that will be used by MongoDB |
Not Required:
broker_user | User name to log into the broker |
broker_pass | Password to log into the broker |
Loom_MQTT::Loom_MQTT | ( | Manager & | man, |
Client & | internet_client | ||
) |
Construct a new MQTT interface, expects credentials to be loaded from JSON
man | Reference to the manager |
|
inlineoverrideprotectedvirtual |
Implements Module.
void Loom_MQTT::loadConfigFromJSON | ( | char * | json | ) |
Load the MQTT credentials from a JSON string, used to pull credentials from a file
jsonString | JSON formatted string containing the login credentials, this is freed at the end |
|
inlineoverrideprotectedvirtual |
Implements Module.
|
inlineoverrideprotectedvirtual |
Implements Module.
|
inlineoverrideprotectedvirtual |
Implements Module.
|
inlineoverrideprotectedvirtual |
Implements Module.
void Loom_MQTT::publish | ( | ) |
Publish the current JSON data over MQTT
void Loom_MQTT::publish | ( | Loom_BatchSD & | batchSD | ) |
Publish the current JSON data as a batch
|
inline |
Length of time the broker should keep the connection open for default
time | Length of time in MILLISECONDS the connection will be kept open |
|
inline |
Set the maximum number of reconnection attempts to make before failing
retries | The number of retries we want to make |