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

#include <ConfigSections.h>

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

Public Member Functions

 ConfigSession (utils::SubCommand *parent)
 ~ConfigSession () override
std::string getClientId () const
std::uint8_t getQoS () const
bool getRetainSession () const
std::uint16_t getKeepAlive () const
std::string getWillTopic () const
std::string getWillMessage () const
std::uint8_t getWillQoS () const
bool getWillRetain () const
std::string getUsername () const
std::string getPassword () const
std::string getSessionStore () 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
CLI::Option * sessionStoreOpt

Detailed Description

Definition at line 27 of file ConfigSections.h.

Constructor & Destructor Documentation

◆ ConfigSession()

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

Definition at line 16 of file ConfigSections.cpp.

17 : utils::SubCommand(parent, this, "MQTT session")
18 , clientIdOpt(setConfigurable(addOption("--client-id", "MQTT Client-ID", "string", CLI::TypeValidator<std::string>()), true))
19 , qoSOpt(setConfigurable(addOption("--qos", "Default subscription quality of service", "uint8_t", "0", CLI::Range(0, 2)), true))
20 , retainSessionOpt(setConfigurable(addFlag("--retain-session{true},-r{true}",
21 "Use a persistent MQTT session (sets clean_session=false)",
22 "bool",
23 "false",
24 CLI::IsMember({"true", "false"})),
25 true)
26 ->needs(clientIdOpt))
27 , keepAliveOpt(setConfigurable(
28 addOption("--keep-alive", "MQTT keep alive in seconds", "uint16_t", "60", CLI::TypeValidator<std::uint16_t>()), true))
29 , willTopicOpt(setConfigurable(addOption("--will-topic", "MQTT will topic", "string", CLI::TypeValidator<std::string>()), true))
31 setConfigurable(addOption("--will-message", "MQTT will message", "string", CLI::TypeValidator<std::string>()), true))
32 , willQoSOpt(setConfigurable(addOption("--will-qos", "MQTT will quality of service", "uint8_t", "0", CLI::Range(0, 2)), true))
33 , willRetainOpt(setConfigurable(
34 addFlag("--will-retain{true}", "MQTT will message retain", "bool", "false", CLI::IsMember({"true", "false"})), true))
35 , usernameOpt(setConfigurable(addOption("--username", "MQTT username", "string", CLI::TypeValidator<std::string>()), true))
36 , passwordOpt(setConfigurable(addOption("--password", "MQTT password", "string", CLI::TypeValidator<std::string>()), true))
37 , sessionStoreOpt(setConfigurable(
38 addOption("--session-store", "Path to persistent MQTT session store", "filename", !CLI::ExistingDirectory), true)) {
39 }

References clientIdOpt, qoSOpt, and retainSessionOpt.

◆ ~ConfigSession()

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

Member Function Documentation

◆ getClientId()

std::string mqtt::mqttstore::lib::ConfigSession::getClientId ( ) const
nodiscard

Definition at line 43 of file ConfigSections.cpp.

43 {
44 return clientIdOpt->as<std::string>();
45 }

References clientIdOpt.

◆ getKeepAlive()

std::uint16_t mqtt::mqttstore::lib::ConfigSession::getKeepAlive ( ) const
nodiscard

Definition at line 55 of file ConfigSections.cpp.

55 {
56 return keepAliveOpt->as<std::uint16_t>();
57 }

References keepAliveOpt.

◆ getPassword()

std::string mqtt::mqttstore::lib::ConfigSession::getPassword ( ) const
nodiscard

Definition at line 79 of file ConfigSections.cpp.

79 {
80 return passwordOpt->as<std::string>();
81 }

References passwordOpt.

◆ getQoS()

std::uint8_t mqtt::mqttstore::lib::ConfigSession::getQoS ( ) const
nodiscard

Definition at line 47 of file ConfigSections.cpp.

47 {
48 return qoSOpt->as<std::uint8_t>();
49 }

References qoSOpt.

◆ getRetainSession()

bool mqtt::mqttstore::lib::ConfigSession::getRetainSession ( ) const
nodiscard

Definition at line 51 of file ConfigSections.cpp.

51 {
52 return retainSessionOpt->as<bool>();
53 }

References retainSessionOpt.

◆ getSessionStore()

std::string mqtt::mqttstore::lib::ConfigSession::getSessionStore ( ) const
nodiscard

Definition at line 83 of file ConfigSections.cpp.

83 {
84 return sessionStoreOpt->as<std::string>();
85 }

References sessionStoreOpt.

◆ getUsername()

std::string mqtt::mqttstore::lib::ConfigSession::getUsername ( ) const
nodiscard

Definition at line 75 of file ConfigSections.cpp.

75 {
76 return usernameOpt->as<std::string>();
77 }

References usernameOpt.

◆ getWillMessage()

std::string mqtt::mqttstore::lib::ConfigSession::getWillMessage ( ) const
nodiscard

Definition at line 63 of file ConfigSections.cpp.

63 {
64 return willMessageOpt->as<std::string>();
65 }

References willMessageOpt.

◆ getWillQoS()

std::uint8_t mqtt::mqttstore::lib::ConfigSession::getWillQoS ( ) const
nodiscard

Definition at line 67 of file ConfigSections.cpp.

67 {
68 return willQoSOpt->as<std::uint8_t>();
69 }

References willQoSOpt.

◆ getWillRetain()

bool mqtt::mqttstore::lib::ConfigSession::getWillRetain ( ) const
nodiscard

Definition at line 71 of file ConfigSections.cpp.

71 {
72 return willRetainOpt->as<bool>();
73 }

References willRetainOpt.

◆ getWillTopic()

std::string mqtt::mqttstore::lib::ConfigSession::getWillTopic ( ) const
nodiscard

Definition at line 59 of file ConfigSections.cpp.

59 {
60 return willTopicOpt->as<std::string>();
61 }

References willTopicOpt.

Member Data Documentation

◆ clientIdOpt

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

Definition at line 48 of file ConfigSections.h.

Referenced by ConfigSession(), and getClientId().

◆ DESCRIPTION

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

Definition at line 30 of file ConfigSections.h.

30{"MQTT session behavior"};

◆ keepAliveOpt

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

Definition at line 51 of file ConfigSections.h.

Referenced by getKeepAlive().

◆ NAME

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

Definition at line 29 of file ConfigSections.h.

29{"session"};

◆ passwordOpt

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

Definition at line 57 of file ConfigSections.h.

Referenced by getPassword().

◆ qoSOpt

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

Definition at line 49 of file ConfigSections.h.

Referenced by ConfigSession(), and getQoS().

◆ retainSessionOpt

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

Definition at line 50 of file ConfigSections.h.

Referenced by ConfigSession(), and getRetainSession().

◆ sessionStoreOpt

CLI::Option* mqtt::mqttstore::lib::ConfigSession::sessionStoreOpt
private

Definition at line 58 of file ConfigSections.h.

Referenced by getSessionStore().

◆ usernameOpt

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

Definition at line 56 of file ConfigSections.h.

Referenced by getUsername().

◆ willMessageOpt

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

Definition at line 53 of file ConfigSections.h.

Referenced by getWillMessage().

◆ willQoSOpt

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

Definition at line 54 of file ConfigSections.h.

Referenced by getWillQoS().

◆ willRetainOpt

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

Definition at line 55 of file ConfigSections.h.

Referenced by getWillRetain().

◆ willTopicOpt

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

Definition at line 52 of file ConfigSections.h.

Referenced by getWillTopic().


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