FIX: fixed some issues with subscribung and unsubscribing from topics
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <WHISPER/whisper.hpp>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
/**
|
||||
* @brief namespace for all whisper-com related components
|
||||
@@ -30,7 +31,7 @@ namespace WHISPER
|
||||
this->derivedConnect();
|
||||
|
||||
receiveThread = std::thread(&WHISPER::whispercomm::receive,this);
|
||||
|
||||
this->setConnected(true);
|
||||
}
|
||||
|
||||
void whispercomm::disconnect()
|
||||
@@ -38,7 +39,7 @@ namespace WHISPER
|
||||
stopReceiveThread = true;
|
||||
if(receiveThread.joinable()) receiveThread.join();
|
||||
derivedDisconnect();
|
||||
|
||||
this->setConnected(false);
|
||||
}
|
||||
|
||||
void whispercomm::publish(std::string msg,std::string topic){
|
||||
@@ -70,7 +71,8 @@ namespace WHISPER
|
||||
}
|
||||
|
||||
void whispercomm::unsubscribe(std::string topic)
|
||||
{
|
||||
{
|
||||
|
||||
for (std::vector<std::string>::iterator it = subscribedTopics.begin(); it != subscribedTopics.end();it++)
|
||||
{
|
||||
if (*it == topic)
|
||||
@@ -105,5 +107,13 @@ namespace WHISPER
|
||||
}
|
||||
|
||||
|
||||
void whispercomm::setConnected(bool val){
|
||||
this->Connected = val;
|
||||
}
|
||||
|
||||
bool whispercomm::isConnected()
|
||||
{
|
||||
return this->Connected;
|
||||
}
|
||||
// Add datatypes here
|
||||
} // namespace WHISPER
|
||||
Reference in New Issue
Block a user