DreamHostPublisher class
The DreamHostPublisher subclass of dataPublisher is for publishing data to the Stroud Center's now-deprecated DreamHost based live sensor data system.
- Reference
- Detailed Descriptions
Base classes
- class dataPublisher
- The dataPublisher class is a virtual class used by other publishers to distribute data online.
Constructors, destructors, conversion operators
- DreamHostPublisher()
- Construct a new DreamHost Publisher object with no members set.
- DreamHostPublisher(Logger& baseLogger, int sendEveryX = 1) explicit
- Construct a new DreamHost Publisher object.
- DreamHostPublisher(Logger& baseLogger, Client* inClient, int sendEveryX = 1)
- Construct a new DreamHost Publisher object.
- DreamHostPublisher(Logger& baseLogger, const char* dhUrl, int sendEveryX = 1)
- Construct a new DreamHost Publisher object.
- DreamHostPublisher(Logger& baseLogger, Client* inClient, const char* dhUrl, int sendEveryX = 1)
- Construct a new DreamHost Publisher object.
- ~DreamHostPublisher() virtual
- Destroy the DreamHost Publisher object.
Public functions
- String getEndpoint(void) -> String override
- Get the destination for published data - generally the host name of the data receiver.
- void setDreamHostPortalRX(const char* dhUrl)
- Set the url of the DreamHost data receiver.
- void begin(Logger& baseLogger, Client* inClient, const char* dhUrl)
- Begin the publisher - linking it to the client and logger.
- void begin(Logger& baseLogger, const char* dhUrl)
- Begin the publisher - linking it to the logger but not attaching a client.
- int16_t publishData(Client* outClient) -> int16_t override
- Utilizes an attached modem to make a TCP connection to the DreamHost URL and then stream out a get request over that connection.
Portions of the GET request to DreamHost
- static const char* dreamhostHost protected
- The host name.
- static const int dreamhostPort protected
- The host port.
- static const char* loggerTag protected
- The Stroud logger number.
- static const char* timestampTagDH protected
- The timestamp.
Function documentation
DreamHostPublisher:: DreamHostPublisher(Logger& baseLogger,
int sendEveryX = 1) explicit
Construct a new DreamHost Publisher object.
Parameters | |
---|---|
baseLogger | The logger supplying the data to be published |
sendEveryX | Interval (in units of the logging interval) between attempted data transmissions. NOTE: not implemented by this publisher! |
DreamHostPublisher:: DreamHostPublisher(Logger& baseLogger,
Client* inClient,
int sendEveryX = 1)
Construct a new DreamHost Publisher object.
Parameters | |
---|---|
baseLogger | The logger supplying the data to be published |
inClient | An Arduino client instance to use to print data to. Allows the use of any type of client and multiple clients tied to a single TinyGSM modem instance |
sendEveryX | Interval (in units of the logging interval) between attempted data transmissions. NOTE: not implemented by this publisher! |
DreamHostPublisher:: DreamHostPublisher(Logger& baseLogger,
const char* dhUrl,
int sendEveryX = 1)
Construct a new DreamHost Publisher object.
Parameters | |
---|---|
baseLogger | The logger supplying the data to be published |
dhUrl | The URL for sending data to DreamHost |
sendEveryX | Interval (in units of the logging interval) between attempted data transmissions. NOTE: not implemented by this publisher! |
DreamHostPublisher:: DreamHostPublisher(Logger& baseLogger,
Client* inClient,
const char* dhUrl,
int sendEveryX = 1)
Construct a new DreamHost Publisher object.
Parameters | |
---|---|
baseLogger | The logger supplying the data to be published |
inClient | An Arduino client instance to use to print data to. Allows the use of any type of client and multiple clients tied to a single TinyGSM modem instance |
dhUrl | The URL for sending data to DreamHost |
sendEveryX | Interval (in units of the logging interval) between attempted data transmissions. NOTE: not implemented by this publisher! |
String DreamHostPublisher:: getEndpoint(void) override
Get the destination for published data - generally the host name of the data receiver.
Returns | String The URL or HOST to receive published data |
---|
void DreamHostPublisher:: setDreamHostPortalRX(const char* dhUrl)
Set the url of the DreamHost data receiver.
Parameters | |
---|---|
dhUrl | The URL for sending data to DreamHost |
void DreamHostPublisher:: begin(Logger& baseLogger,
Client* inClient,
const char* dhUrl)
Begin the publisher - linking it to the client and logger.
Parameters | |
---|---|
baseLogger | The logger supplying the data to be published |
inClient | An Arduino client instance to use to print data to. Allows the use of any type of client and multiple clients tied to a single TinyGSM modem instance |
dhUrl | The URL for sending data to DreamHost |
This can be used as an alternative to adding the logger and client in the constructor.
void DreamHostPublisher:: begin(Logger& baseLogger,
const char* dhUrl)
Begin the publisher - linking it to the logger but not attaching a client.
Parameters | |
---|---|
baseLogger | The logger supplying the data to be published |
dhUrl | The URL for sending data to DreamHost |
This can be used as an alternative to adding the logger and client in the constructor.
int16_t DreamHostPublisher:: publishData(Client* outClient) override
Utilizes an attached modem to make a TCP connection to the DreamHost URL and then stream out a get request over that connection.
Parameters | |
---|---|
outClient | An Arduino client instance to use to print data to. Allows the use of any type of client and multiple clients tied to a single TinyGSM modem instance |
Returns | int16_t The http status code of the response. |
This depends on an internet connection already having been made and a client being available.