The class represents a standalone device Smarwi. It allows to communicate with the actual device via MQTT client and thus control it.
More...
#include <VektivaSmarwi.h>
|
void | publishModifyStateCommand (const ModuleID &moduleID, double value, MqttClient::Ptr mqttClient) |
| Function checks if module id and it's value is valid and if so, publishes a command to change state of Smarwi. More...
|
|
void | confirmStateModification (MqttClient::Ptr mqttClient) |
| After command to modify state was published, this function waits until the message with correct status is received. More...
|
|
void | setupLogger (Poco::Logger *logger=0) const |
|
Poco::Logger & | logger () const |
|
| Loggable (const ClassInfo &info) |
|
| Loggable (const std::type_info &info) |
|
|
static std::string | buildTopicRegex (const std::string &remoteId, const std::string &macAddress, const std::string &lastSegment) |
|
static Poco::Logger & | forMethod (const char *name) |
|
static Poco::Logger & | forClass (const ClassInfo &info) |
|
static Poco::Logger & | forClass (const std::type_info &info) |
|
template<typename T > |
static Poco::Logger & | forInstance (const T *i) |
|
static void | configureSimple (Poco::Logger &logger, const std::string &level) |
|
static void | logException (Poco::Logger &logger, const Poco::Message::Priority priority, const Poco::Exception &e, const char *file, size_t line) |
|
The class represents a standalone device Smarwi. It allows to communicate with the actual device via MQTT client and thus control it.
Called internally when constructing the instance. Creates DeviceID based on Mac address of device.
- Returns
- DeviceID - DeviceID created out of MAC address provided
MqttMessage VektivaSmarwi::buildMqttMessage |
( |
const std::string & |
remoteId, |
|
|
const std::string & |
macAddress, |
|
|
const std::string & |
command |
|
) |
| |
|
static |
Constructs an MQTT message with the topic "ion/<remoteId>/%<macAddress>/cmd" and message specified in the command parameter.
- Parameters
-
remoteId | - remoteId of the user, can be found in Smarwi settings |
macAddress | - mac address of Smarwi |
command | - command to send to Smarwi |
- Returns
- MqttMessage on success
string VektivaSmarwi::buildTopicRegex |
( |
const std::string & |
remoteId, |
|
|
const std::string & |
macAddress, |
|
|
const std::string & |
lastSegment |
|
) |
| |
|
staticprotected |
Builds simple topic regex to validate the incoming message' topic.
- Returns
- regex in string
void VektivaSmarwi::confirmStateModification |
( |
MqttClient::Ptr |
mqttClient | ) |
|
|
protected |
After command to modify state was published, this function waits until the message with correct status is received.
- Parameters
-
mqttClient | - client ptr which will receive message |
Creates Smarwi sensor data to send to registered exporters.
- Parameters
-
smarwiStatus | - status of Smarwi status |
- Returns
- SensorData - sensor data created out of SmarWiStatus
Parses Smarwi's status response to an object which is returned if parsing is successful.
- Parameters
-
rcvmsg | MQTT message received from Smarwi after status request |
- Returns
- VektivaSmarwiStatus object representation of SmarWi status message
void VektivaSmarwi::publishModifyStateCommand |
( |
const ModuleID & |
moduleID, |
|
|
double |
value, |
|
|
MqttClient::Ptr |
mqttClient |
|
) |
| |
|
protected |
Function checks if module id and it's value is valid and if so, publishes a command to change state of Smarwi.
- Parameters
-
moduleID | - ID of the module |
value | - intended value |
mqttClient | - client ptr which will publish the message |
void VektivaSmarwi::requestModifyState |
( |
const ModuleID & |
moduleID, |
|
|
double |
value, |
|
|
MqttClient::Ptr |
mqttClient |
|
) |
| |
Attempts to change status of the device.
- Parameters
-
moduleID | - what module to change |
value | - to what value to change to |
mqttClient | - which MQTT client to use |
The documentation for this class was generated from the following files:
- /var/lib/jenkins/workspace/beeeon-gateway-master/src/vektiva/VektivaSmarwi.h
- /var/lib/jenkins/workspace/beeeon-gateway-master/src/vektiva/VektivaSmarwi.cpp