mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 12:24:57 +00:00
removed mqtt check
This commit is contained in:
@@ -17,7 +17,6 @@ void parseMQTT(std::string message);
|
|||||||
void CapnSend();
|
void CapnSend();
|
||||||
void reconnectKobuki();
|
void reconnectKobuki();
|
||||||
void monitorKobukiConnection();
|
void monitorKobukiConnection();
|
||||||
void monitorMQTTConnection();
|
|
||||||
// ip, clientID, username, password
|
// ip, clientID, username, password
|
||||||
MqttClient client("ws://145.92.224.21/ws/", "KobukiRPI", "rpi",
|
MqttClient client("ws://145.92.224.21/ws/", "KobukiRPI", "rpi",
|
||||||
"rpiwachtwoordofzo"); // create a client object
|
"rpiwachtwoordofzo"); // create a client object
|
||||||
@@ -34,8 +33,6 @@ void setup() {
|
|||||||
client.subscribe("home/commands");
|
client.subscribe("home/commands");
|
||||||
|
|
||||||
std::thread monitorThread(monitorKobukiConnection);
|
std::thread monitorThread(monitorKobukiConnection);
|
||||||
std::thread mqttMonitorThread(monitorMQTTConnection);
|
|
||||||
mqttMonitorThread.detach();
|
|
||||||
monitorThread.detach();
|
monitorThread.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,17 +80,6 @@ void monitorKobukiConnection() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void monitorMQTTConnection() {
|
|
||||||
while (true) {
|
|
||||||
if (!client.isConnected()) { // Controleer of de client nog verbonden is
|
|
||||||
std::cerr << "MQTT verbinding verloren. Probeer opnieuw te verbinden..." << std::endl;
|
|
||||||
client.connect();
|
|
||||||
client.subscribe("home/commands");
|
|
||||||
}
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(5)); // Controleer iedere 5 seconden
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string readMQTT() {
|
std::string readMQTT() {
|
||||||
static std::string lastMessage;
|
static std::string lastMessage;
|
||||||
|
Reference in New Issue
Block a user