Base class for UART Device Drivers.
More...
#include <ws_uart_drv.h>
|
| ws_uart_drv (HardwareSerial *hwSerial, int32_t interval) |
| Initializes a UART device driver. More...
|
|
bool | isReady () |
| Checks if the UART device is ready to be polled at its time interval. More...
|
|
void | setPrvPollTime (unsigned long curTime) |
| Sets the last time a UART device driver was polled. More...
|
|
const char * | getDriverID () |
| Gets the UART device's unique identifier. More...
|
|
void | setDriverID (const char *id) |
| Sets the UART driver's identifer. More...
|
|
virtual void | set_mqtt_client (Adafruit_MQTT *AMQTT, const char *mqtt_topic) |
| Provides the UART device driver with an instance of the application's MQTT configuration. More...
|
|
virtual bool | begin () |
| Initializes the UART device driver. More...
|
|
virtual bool | read_data () |
| Checks if the UART device's data is ready. More...
|
|
void | packUARTResponse (wippersnapper_signal_v1_UARTResponse *msgUARTResponse, int event_index, wippersnapper_i2c_v1_SensorType sensor_type, float sensor_value) |
| Packs the UART device's data into a UARTResponse message. More...
|
|
virtual void | send_data () |
| Reads the UART device's data then packs and sends it to IO.
|
|
|
const char * | uartTopic = nullptr |
| UART device's MQTT topic.
|
|
Adafruit_MQTT * | mqttClient = nullptr |
| Pointer to MQTT client object.
|
|
unsigned long | pollingInterval |
| UART device's polling interval, in milliseconds.
|
|
Base class for UART Device Drivers.
◆ ws_uart_drv()
ws_uart_drv::ws_uart_drv |
( |
HardwareSerial * |
hwSerial, |
|
|
int32_t |
interval |
|
) |
| |
|
inline |
Initializes a UART device driver.
- Parameters
-
hwSerial | Pointer to an instance of a HardwareSerial object. |
interval | How often the UART device will be polled, in milliseconds. |
◆ isReady()
bool ws_uart_drv::isReady |
( |
| ) |
|
|
inline |
Checks if the UART device is ready to be polled at its time interval.
- Returns
- True if the UART device is ready to be polled, False otherwise.
◆ setPrvPollTime()
void ws_uart_drv::setPrvPollTime |
( |
unsigned long |
curTime | ) |
|
|
inline |
Sets the last time a UART device driver was polled.
- Parameters
-
curTime | The current time, in milliseconds. |
◆ getDriverID()
const char* ws_uart_drv::getDriverID |
( |
| ) |
|
|
inline |
Gets the UART device's unique identifier.
- Returns
- The UART device's unique identifier.
◆ setDriverID()
void ws_uart_drv::setDriverID |
( |
const char * |
id | ) |
|
|
inline |
Sets the UART driver's identifer.
- Parameters
-
id | The UART device's unique identifier. |
◆ set_mqtt_client()
virtual void ws_uart_drv::set_mqtt_client |
( |
Adafruit_MQTT * |
AMQTT, |
|
|
const char * |
mqtt_topic |
|
) |
| |
|
inlinevirtual |
Provides the UART device driver with an instance of the application's MQTT configuration.
- Parameters
-
AMQTT | Pointer to an Adafruit_MQTT object. |
mqtt_topic | UART topic string, generated by adafruit MQTT |
◆ begin()
virtual bool ws_uart_drv::begin |
( |
| ) |
|
|
inlinevirtual |
Initializes the UART device driver.
- Returns
- True if UART device driver initialized successfully, False otherwise.
Reimplemented in ws_uart_drv_pm25aqi.
◆ read_data()
virtual bool ws_uart_drv::read_data |
( |
| ) |
|
|
inlinevirtual |
Checks if the UART device's data is ready.
- Returns
- True if data is available, False otherwise.
Reimplemented in ws_uart_drv_pm25aqi.
◆ packUARTResponse()
void ws_uart_drv::packUARTResponse |
( |
wippersnapper_signal_v1_UARTResponse * |
msgUARTResponse, |
|
|
int |
event_index, |
|
|
wippersnapper_i2c_v1_SensorType |
sensor_type, |
|
|
float |
sensor_value |
|
) |
| |
|
inline |
Packs the UART device's data into a UARTResponse message.
- Parameters
-
msgUARTResponse | Pointer to a UARTResponse message. |
event_index | Index of the UART device's event. |
sensor_type | Type of sensor data. |
sensor_value | Sensor data value. |
The documentation for this class was generated from the following file: