Skip to content

Commit

Permalink
Changed mqtt default prefic to mqtt://
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Feb 10, 2025
1 parent 0120aff commit 0effede
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
22 changes: 16 additions & 6 deletions src/vscp/common/vscp-client-mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ vscpClientMqtt::vscpClientMqtt(void)
m_bindInterface = ""; // No bind interface
m_mosq = nullptr; // No mosquitto connection
m_bRun = true; // Run to the Hills...
m_host = "localhost"; // tcp://localhost:1883
m_host = "localhost"; // mqtt://localhost:1883
m_port = 1883; // Default port
m_clientid = ""; // No client id set
m_username = ""; // No username set
Expand Down Expand Up @@ -790,6 +790,16 @@ vscpClientMqtt::initFromJson(const std::string &config)
m_bTLS = true;
spdlog::debug("VSCP MQTT CLIENT: json mqtt init: Secure connection {}.", m_host);
}
else if (0 == m_host.find("mqtt://")) {
m_host = m_host.substr(7);
m_bTLS = false;
spdlog::debug("VSCP MQTT CLIENT: json mqtt init: Unsecure connection {}.", m_host);
}
else if (0 == m_host.find("mqtts://")) {
m_host = m_host.substr(8);
m_bTLS = true;
spdlog::debug("VSCP MQTT CLIENT: json mqtt init: Secure connection {}.", m_host);
}

// Get port
size_t pos;
Expand Down Expand Up @@ -1455,7 +1465,7 @@ vscpClientMqtt::initFromJson(const std::string &config)
//

void
vscpClientMqtt::writeEventDefaultsFromTopic(vscpEvent &ex, const char *pTopic)
vscpClientMqtt::writeEventDefaultsFromTopic(vscpEventEx &ex, const char *pTopic)
{
// If standard topic format is used, that is
// vscp/<vscp-guid>/<vscp-class>/<vscp-type>/index/zone/subzone
Expand Down Expand Up @@ -1576,7 +1586,7 @@ vscpClientMqtt::handleMessage(const struct mosquitto_message *pmsg)
return false;
}

writeEventDefaultsFromTopic(ex, pMsg->topic);
writeEventDefaultsFromTopic(ex, pmsg->topic);

// If callback is defined send event
if (isCallbackEvActive()) {
Expand Down Expand Up @@ -1624,7 +1634,7 @@ vscpClientMqtt::handleMessage(const struct mosquitto_message *pmsg)
return false;
}

writeEventDefaultsFromTopic(ex, pMsg->topic);
writeEventDefaultsFromTopic(ex, pmsg->topic);

// If callback is defined send event
if (isCallbackEvActive()) {
Expand Down Expand Up @@ -1672,7 +1682,7 @@ vscpClientMqtt::handleMessage(const struct mosquitto_message *pmsg)
return false;
}

writeEventDefaultsFromTopic(ex, pMsg->topic);
writeEventDefaultsFromTopic(ex, pmsg->topic);

// If callback is defined send event
if (isCallbackEvActive()) {
Expand Down Expand Up @@ -1722,7 +1732,7 @@ vscpClientMqtt::handleMessage(const struct mosquitto_message *pmsg)
return false;
}

writeEventDefaultsFromTopic(ex, pMsg->topic);
writeEventDefaultsFromTopic(ex, pmsg->topic);

// If callback is defined send event
if (isCallbackEvActive()) {
Expand Down
2 changes: 1 addition & 1 deletion src/vscp/common/vscp-client-mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class vscpClientMqtt : public CVscpClient {
vscp/<vscp-guid>/<vscp-class>/<vscp-type>/index/zone/subzone
and instructed to do so we can find the GUID, class and type from the topic
*/
void writeEventDefaultsFromTopic(vscpEvent &ex, const char *pTopic);
void writeEventDefaultsFromTopic(vscpEventEx &ex, const char *pTopic);

/*!
Handle incoming message
Expand Down
2 changes: 1 addition & 1 deletion third_party/mongoose
Submodule mongoose updated 380 files
2 changes: 1 addition & 1 deletion third_party/nlohmann
Submodule nlohmann updated 757 files
2 changes: 1 addition & 1 deletion third_party/spdlog
Submodule spdlog updated 42 files
+12 −2 .github/workflows/macos.yml
+139 −122 CMakeLists.txt
+3 −0 README.md
+3 −0 example/example.cpp
+2 −2 include/spdlog/cfg/env.h
+1 −6 include/spdlog/common.h
+2 −1 include/spdlog/details/file_helper-inl.h
+12 −0 include/spdlog/details/os-inl.h
+4 −0 include/spdlog/details/os.h
+1 −1 include/spdlog/fmt/bin_to_hex.h
+20 −28 include/spdlog/fmt/bundled/args.h
+1,768 −1,884 include/spdlog/fmt/bundled/base.h
+376 −470 include/spdlog/fmt/bundled/chrono.h
+20 −22 include/spdlog/fmt/bundled/color.h
+46 −24 include/spdlog/fmt/bundled/compile.h
+65 −44 include/spdlog/fmt/bundled/format-inl.h
+1,091 −1,284 include/spdlog/fmt/bundled/format.h
+0 −2 include/spdlog/fmt/bundled/locale.h
+43 −55 include/spdlog/fmt/bundled/os.h
+43 −88 include/spdlog/fmt/bundled/ostream.h
+107 −130 include/spdlog/fmt/bundled/printf.h
+98 −130 include/spdlog/fmt/bundled/ranges.h
+74 −47 include/spdlog/fmt/bundled/std.h
+97 −46 include/spdlog/fmt/bundled/xchar.h
+12 −6 include/spdlog/sinks/ansicolor_sink-inl.h
+4 −3 include/spdlog/sinks/ansicolor_sink.h
+6 −0 include/spdlog/sinks/basic_file_sink-inl.h
+1 −0 include/spdlog/sinks/basic_file_sink.h
+1 −1 include/spdlog/sinks/null_sink.h
+6 −0 include/spdlog/sinks/rotating_file_sink-inl.h
+1 −0 include/spdlog/sinks/rotating_file_sink.h
+5 −4 include/spdlog/sinks/stdout_sinks-inl.h
+7 −0 include/spdlog/tweakme.h
+1 −1 include/spdlog/version.h
+5 −1 src/bundled_fmtlib_format.cpp
+2 −5 tests/CMakeLists.txt
+9 −0 tests/test_cfg.cpp
+2 −1 tests/test_custom_callbacks.cpp
+3 −5 tests/test_daily_logger.cpp
+40 −0 tests/test_file_logging.cpp
+35 −0 tests/test_misc.cpp
+2 −1 tests/test_sink.h

0 comments on commit 0effede

Please sign in to comment.