|
ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
|
Logic for interfacing with the Dirtviz API. More...
#include <dirtviz/include/dirtviz.hpp>
Public Member Functions | |
| Dirtviz (void) | |
| Construct a new Dirtviz object. | |
| Dirtviz (const char *url) | |
| Default constructor. | |
| ~Dirtviz () | |
| Frees all memory. | |
| void | SetUrl (const char *url) |
| Set new URL string. | |
| unsigned int | Check () |
| Health check for API endpoint. | |
| unsigned int | SendMeasurement (const uint8_t *meas, size_t meas_len) |
| Send serialized measurement to the API. | |
| HttpClient | GetResponse () |
| Get the response from the server. | |
Logic for interfacing with the Dirtviz API.
Assumes that WiFi interface is connected to the network. Uses http to read http requests. Requests are formatted ad-hoc.
Examples:
HTTP interface for Dirtviz API
Definition at line 43 of file dirtviz.hpp.
| Dirtviz::Dirtviz | ( | void | ) |
Construct a new Dirtviz object.
Definition at line 27 of file dirtviz.cpp.
|
explicit |
Default constructor.
Allows for setting of URL on initialization.
| url | API URL |
Definition at line 29 of file dirtviz.cpp.
References SetUrl().
| Dirtviz::~Dirtviz | ( | ) |
Frees all memory.
Definition at line 31 of file dirtviz.cpp.
| unsigned int Dirtviz::Check | ( | ) |
Health check for API endpoint.
Definition at line 40 of file dirtviz.cpp.
References g_user_agent.
| HttpClient Dirtviz::GetResponse | ( | ) |
Get the response from the server.
Definition at line 106 of file dirtviz.cpp.
References g_resp_timeout.
Referenced by loop().
| unsigned int Dirtviz::SendMeasurement | ( | const uint8_t * | meas, |
| size_t | meas_len | ||
| ) |
Send serialized measurement to the API.
| meas | Pointer to serialized measurement data |
| meas_len | Number of bytes in meas |
Definition at line 64 of file dirtviz.cpp.
References buffer, and g_user_agent.
Referenced by loop().
| void Dirtviz::SetUrl | ( | const char * | url | ) |
Set new URL string.
| new_url | New API URL |
Definition at line 33 of file dirtviz.cpp.
Referenced by Dirtviz().