MQTTSuite
Loading...
Searching...
No Matches
mqtt::mqttcli::lib::ConfigSession Class Reference

#include <ConfigSections.h>

Inheritance diagram for mqtt::mqttcli::lib::ConfigSession:
Collaboration diagram for mqtt::mqttcli::lib::ConfigSession:

Public Member Functions

 ConfigSession (utils::SubCommand *parent)
 ~ConfigSession () override
std::string getClientId () const
const ConfigSessionsetClientId (const std::string &clientId) const
uint8_t getQoS () const
const ConfigSessionsetQos (uint8_t qoS) const
bool getRetainSession () const
const ConfigSessionsetRetainSession (bool retainSession) const
uint16_t getKeepAlive () const
const ConfigSessionsetKeepAlive (uint16_t keepAlive) const
std::string getWillTopic () const
const ConfigSessionsetWillTopic (const std::string &willTopic) const
std::string getWillMessage () const
const ConfigSessionsetWillMessage (const std::string &willMessage) const
uint8_t getWillQoS () const
const ConfigSessionsettWillQoS (uint8_t willQoS) const
bool getWillRetain () const
const ConfigSessionsetWillRetain (bool willRetain) const
std::string getUsername () const
const ConfigSessionsettUsername (const std::string &username) const
std::string getPassword () const
const ConfigSessionsetPassword (const std::string &password) const

Static Public Attributes

static constexpr std::string_view NAME {"session"}
static constexpr std::string_view DESCRIPTION {"MQTT session behavior"}

Private Attributes

CLI::Option * clientIdOpt
CLI::Option * qoSOpt
CLI::Option * retainSessionOpt
CLI::Option * keepAliveOpt
CLI::Option * willTopicOpt
CLI::Option * willMessageOpt
CLI::Option * willQoSOpt
CLI::Option * willRetainOpt
CLI::Option * usernameOpt
CLI::Option * passwordOpt

Detailed Description

Definition at line 98 of file ConfigSections.h.

Constructor & Destructor Documentation

◆ ConfigSession()

mqtt::mqttcli::lib::ConfigSession::ConfigSession ( utils::SubCommand * parent)

Definition at line 123 of file ConfigSections.cpp.

124 : utils::SubCommand(parent, this, "Applications")
125 , clientIdOpt( //
126 setConfigurable(addOption("--client-id", "MQTT Client-ID", "string", CLI::TypeValidator<std::string>()), true))
127 , qoSOpt( //
128 setConfigurable(addOption("--qos", "Quality of service", "uint8_t", "0", CLI::Range(0, 2)), true))
129 , retainSessionOpt( //
130 setConfigurable(
131 addFlag("--retain-session{true},-r{true}", "Clean session", "bool", "false", CLI::IsMember({"true", "false"})), true)
132 ->needs(clientIdOpt))
133 , keepAliveOpt( //
134 setConfigurable(addOption("--keep-alive", "Quality of service", "uint16_t", "60", CLI::TypeValidator<uint16_t>()), true))
135 , willTopicOpt( //
136 setConfigurable(addOption("--will-topic", "MQTT will topic", "string", CLI::TypeValidator<std::string>()), true))
137 , willMessageOpt( //
138 setConfigurable(addOption("--will-message", "MQTT will message", "string", CLI::TypeValidator<std::string>()), true))
139 , willQoSOpt( //
140 setConfigurable(addOption("--will-qos", "MQTT will quality of service", "uint8_t", "0", CLI::TypeValidator<uint8_t>()), true))
141 , willRetainOpt( //
142 setConfigurable(addFlag("--will-retain{true}", "MQTT will message retain", "bool", "false", CLI::IsMember({"true", "false"})),
143 true))
144 , usernameOpt( //
145 setConfigurable(addOption("--username", "MQTT username", "string", CLI::TypeValidator<std::string>()), true))
146 , passwordOpt( //
147 setConfigurable(addOption("--password", "MQTT password", "string", CLI::TypeValidator<std::string>()), true)) {
148 }

References clientIdOpt, qoSOpt, and retainSessionOpt.

◆ ~ConfigSession()

mqtt::mqttcli::lib::ConfigSession::~ConfigSession ( )
overridedefault

Member Function Documentation

◆ getClientId()

std::string mqtt::mqttcli::lib::ConfigSession::getClientId ( ) const

Definition at line 152 of file ConfigSections.cpp.

152 {
153 return clientIdOpt->as<std::string>();
154 }

References clientIdOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ getKeepAlive()

uint16_t mqtt::mqttcli::lib::ConfigSession::getKeepAlive ( ) const

Definition at line 182 of file ConfigSections.cpp.

182 {
183 return keepAliveOpt->as<uint16_t>();
184 }

References keepAliveOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ getPassword()

std::string mqtt::mqttcli::lib::ConfigSession::getPassword ( ) const

Definition at line 242 of file ConfigSections.cpp.

242 {
243 return passwordOpt->as<std::string>();
244 }

References passwordOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ getQoS()

uint8_t mqtt::mqttcli::lib::ConfigSession::getQoS ( ) const

Definition at line 162 of file ConfigSections.cpp.

162 {
163 return qoSOpt->as<uint8_t>();
164 }

References qoSOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ getRetainSession()

bool mqtt::mqttcli::lib::ConfigSession::getRetainSession ( ) const

Definition at line 172 of file ConfigSections.cpp.

172 {
173 return retainSessionOpt->as<bool>();
174 }

References retainSessionOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ getUsername()

std::string mqtt::mqttcli::lib::ConfigSession::getUsername ( ) const

Definition at line 232 of file ConfigSections.cpp.

232 {
233 return usernameOpt->as<std::string>();
234 }

References usernameOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ getWillMessage()

std::string mqtt::mqttcli::lib::ConfigSession::getWillMessage ( ) const

Definition at line 202 of file ConfigSections.cpp.

202 {
203 return willMessageOpt->as<std::string>();
204 }

References willMessageOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ getWillQoS()

uint8_t mqtt::mqttcli::lib::ConfigSession::getWillQoS ( ) const

Definition at line 212 of file ConfigSections.cpp.

212 {
213 return willQoSOpt->as<uint8_t>();
214 }

References willQoSOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ getWillRetain()

bool mqtt::mqttcli::lib::ConfigSession::getWillRetain ( ) const

Definition at line 222 of file ConfigSections.cpp.

222 {
223 return willRetainOpt->as<bool>();
224 }

References willRetainOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ getWillTopic()

std::string mqtt::mqttcli::lib::ConfigSession::getWillTopic ( ) const

Definition at line 192 of file ConfigSections.cpp.

192 {
193 return willTopicOpt->as<std::string>();
194 }

References willTopicOpt.

Referenced by mqtt::mqttcli::SocketContextFactory::create().

Here is the caller graph for this function:

◆ setClientId()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::setClientId ( const std::string & clientId) const

Definition at line 156 of file ConfigSections.cpp.

156 {
157 clientIdOpt->default_val(clientId)->clear();
158
159 return *this;
160 }

References clientIdOpt.

◆ setKeepAlive()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::setKeepAlive ( uint16_t keepAlive) const

Definition at line 186 of file ConfigSections.cpp.

186 {
187 keepAliveOpt->default_val(keepAlive)->clear();
188
189 return *this;
190 }

References keepAliveOpt.

◆ setPassword()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::setPassword ( const std::string & password) const

Definition at line 246 of file ConfigSections.cpp.

246 {
247 passwordOpt->default_val(password)->clear();
248
249 return *this;
250 }

References passwordOpt.

◆ setQos()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::setQos ( uint8_t qoS) const

Definition at line 166 of file ConfigSections.cpp.

166 {
167 qoSOpt->default_val(qoS)->clear();
168
169 return *this;
170 }

References qoSOpt.

◆ setRetainSession()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::setRetainSession ( bool retainSession) const

Definition at line 176 of file ConfigSections.cpp.

176 {
177 retainSessionOpt->default_val(retainSession)->clear();
178
179 return *this;
180 }

References retainSessionOpt.

◆ settUsername()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::settUsername ( const std::string & username) const

Definition at line 236 of file ConfigSections.cpp.

236 {
237 usernameOpt->default_val(username)->clear();
238
239 return *this;
240 }

References usernameOpt.

◆ settWillQoS()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::settWillQoS ( uint8_t willQoS) const

Definition at line 216 of file ConfigSections.cpp.

216 {
217 willQoSOpt->default_val(willQoS)->clear();
218
219 return *this;
220 }

References willQoSOpt.

◆ setWillMessage()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::setWillMessage ( const std::string & willMessage) const

Definition at line 206 of file ConfigSections.cpp.

206 {
207 willMessageOpt->default_val(willMessage)->clear();
208
209 return *this;
210 }

References willMessageOpt.

◆ setWillRetain()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::setWillRetain ( bool willRetain) const

Definition at line 226 of file ConfigSections.cpp.

226 {
227 willRetainOpt->default_val(willRetain)->clear();
228
229 return *this;
230 }

References willRetainOpt.

◆ setWillTopic()

const ConfigSession & mqtt::mqttcli::lib::ConfigSession::setWillTopic ( const std::string & willTopic) const

Definition at line 196 of file ConfigSections.cpp.

196 {
197 willTopicOpt->default_val(willTopic)->clear();
198
199 return *this;
200 }

References willTopicOpt.

Member Data Documentation

◆ clientIdOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::clientIdOpt
private

Definition at line 148 of file ConfigSections.h.

Referenced by ConfigSession(), getClientId(), and setClientId().

◆ DESCRIPTION

std::string_view mqtt::mqttcli::lib::ConfigSession::DESCRIPTION {"MQTT session behavior"}
staticconstexpr

Definition at line 101 of file ConfigSections.h.

101{"MQTT session behavior"};

◆ keepAliveOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::keepAliveOpt
private

Definition at line 151 of file ConfigSections.h.

Referenced by getKeepAlive(), and setKeepAlive().

◆ NAME

std::string_view mqtt::mqttcli::lib::ConfigSession::NAME {"session"}
staticconstexpr

Definition at line 100 of file ConfigSections.h.

100{"session"};

◆ passwordOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::passwordOpt
private

Definition at line 157 of file ConfigSections.h.

Referenced by getPassword(), and setPassword().

◆ qoSOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::qoSOpt
private

Definition at line 149 of file ConfigSections.h.

Referenced by ConfigSession(), getQoS(), and setQos().

◆ retainSessionOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::retainSessionOpt
private

Definition at line 150 of file ConfigSections.h.

Referenced by ConfigSession(), getRetainSession(), and setRetainSession().

◆ usernameOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::usernameOpt
private

Definition at line 156 of file ConfigSections.h.

Referenced by getUsername(), and settUsername().

◆ willMessageOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::willMessageOpt
private

Definition at line 153 of file ConfigSections.h.

Referenced by getWillMessage(), and setWillMessage().

◆ willQoSOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::willQoSOpt
private

Definition at line 154 of file ConfigSections.h.

Referenced by getWillQoS(), and settWillQoS().

◆ willRetainOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::willRetainOpt
private

Definition at line 155 of file ConfigSections.h.

Referenced by getWillRetain(), and setWillRetain().

◆ willTopicOpt

CLI::Option* mqtt::mqttcli::lib::ConfigSession::willTopicOpt
private

Definition at line 152 of file ConfigSections.h.

Referenced by getWillTopic(), and setWillTopic().


The documentation for this class was generated from the following files: