Merge commit '80dc1ab0436dc1514a381871e051516bc4e18081'

This commit is contained in:
Henry Winkel
2022-09-15 11:15:23 +02:00
6 changed files with 34 additions and 50 deletions

View File

@@ -1,18 +1,13 @@
#ifndef __PAYLOADS_JOIN__
#define __PAYLOADS_JOIN__
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
/**
* @file
* @brief main header file for the BC::Payloads::HotPlugJoin payload
* @author Dominik Meyer <dmeyer@hsu-hh.de>
* @date 2019-02-03
* @copyright 2019 no yet defined
* @brief main header file for the Join payload
* @author Henry Winkel
* @date 15.09.2022
* @copyright
*/
#include <CommService/transmittable.hpp>
#include <cstdint>

View File

@@ -1,7 +1,13 @@
#ifndef __PAYLOADS_LEAVE__
#define __PAYLOADS_LEAVE__
/**
* @file
* @brief main header file for the Leave payload
* @author Henry Winkel
* @date 15.09.2022
* @copyright
*/
#include <CommService/transmittable.hpp>
#include <cstdint>
#include <vector>

View File

@@ -1,18 +1,11 @@
#ifndef __PAYLOADS_PING__
#define __PAYLOADS_PING__
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
/**
* @file
* @brief main header file for the BC::Payloads::Ping payload
* @author Dominik Meyer <dmeyer@hsu-hh.de>
* @date 2019-02-06
* @copyright 2019 no yet defined
* @brief main header file for the BPing payload
* @author Henry Winkel
* @date 15.09.2022
* @copyright
*/
#include <CommService/transmittable.hpp>
#include <cstdint>

View File

@@ -1,18 +1,12 @@
#ifndef __LIBBC_BC_PAYLOADS_PONG_HPP__
#define __LIBBC_BC_PAYLOADS_PONG_HPP__
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
/**
* @file
* @brief main header file for the BC::Payloads::Pong payload
* @author Dominik Meyer <dmeyer@hsu-hh.de>
* @date 2019-02-06
* @copyright 2019 no yet defined
* @brief main header file for the Pong payload
* @author Henry Winkel
* @date 15.09.2022
* @copyright
*/
#include <CommService/transmittable.hpp>
#include <cstdint>

View File

@@ -94,27 +94,29 @@ namespace CommService {
}
receiveThread = std::thread(&CommService::receiveThreadFunc,this);
receiveThread = std::thread(&CommService::receiveThreadFunc,this);
Message m;
m.topic = messageTopic::JOIN;
m.sourceID = deviceID_;
Message m;
m.topic = messageTopic::JOIN;
m.sourceID = deviceID_;
// wait until service is really connected
while(!connected)
{
// wait until service is really connected
while(!connected)
{
}
LOG_S(INFO)<< "connected";
}
LOG_S(INFO)<< "connected";
// publish the hotplug join message
publish(m);
// publish the hotplug join message
publish(m);
}
void CommService::disconnect(){
close(inetSocket);
LOG_S(INFO)<< "socket closed";
receiveThread.join();
connected = false;
}
@@ -376,14 +378,11 @@ namespace CommService {
void CommService::stop(){
stopReceiveThread = true;
while (receiving == false) {
}
LOG_S(INFO)<<"receive thread stoped";
LOG_S(INFO)<<"receive thread stoped ";
Message m;
m.topic = messageTopic::LEAVE;
LOG_S(INFO) << "own device = "<<deviceID_;
m.sourceID = deviceID_;
publish(m);
@@ -397,9 +396,6 @@ namespace CommService {
}
CommService::~CommService(){
if (connected == true) {
disconnect();
}
}
};