Restarted the production of the app

This commit is contained in:
Henry Winkel
2023-08-09 15:23:10 +02:00
parent b71f3b3bdf
commit 55ad5000dd
970 changed files with 453 additions and 79862 deletions

View File

@@ -1,7 +1,7 @@
#ifndef __SIMCONTROL__
#define __SIMCONTROL__
#include "CommService/Message.hpp"
#include "DirectCommunicationClient.hpp"
#include <iostream>
@@ -12,69 +12,24 @@
#include <mutex>
#include <queue>
#include <CommService/CommService.hpp>
namespace SimControl {
class SimControl : public std::enable_shared_from_this<SimControl> {
class SimControl{
public:
SimControl(const std::string &addr,const std::int16_t port):
// UDPInboundQueue_(std::make_shared<std::queue<std::string>>()),
// UDPOutboundQueue_(std::make_shared<std::queue<std::string>>()),
isMainThreadRunning_(false),
stopMainThread_(false),
isCommServiceThreadRunning_(false),
stopCommServiceThread_(false),
CommServiceThread(nullptr),
MainFunctionThread_(nullptr)
{
OutgoingMessageQueue_ = std::make_shared<ThreadsafeQueue<CommService::Message>>();
IncommingMessageQueue_ = nullptr;
}
void start();
void stop();
SimControl(const std::string &addr,const std::int16_t port);
private:
std::unique_ptr<std::thread> CommServiceThread = nullptr;
std::unique_ptr<std::thread> MainFunctionThread_ = nullptr;
std::shared_ptr<std::queue<std::string>> UDPInboundQueue_ = nullptr;
std::shared_ptr<std::queue<std::string>> UDPOutboundQueue_ = nullptr;
std::atomic<bool> isCommServiceThreadRunning_;
std::atomic<bool> stopCommServiceThread_;
std::atomic<bool> isMainThreadRunning_;
std::atomic<bool> stopMainThread_;
// std::mutex mutexInboundQueue_;
// std::mutex mutexOutboundQueue_;
///pointer to the commservice
std::unique_ptr<CommService::CommService> CommService_;
///threadsafe message queue from CommService
std::shared_ptr<ThreadsafeQueue<CommService::Message>> IncommingMessageQueue_;
std::shared_ptr<ThreadsafeQueue<CommService::Message>> OutgoingMessageQueue_;
void MainFunction_();
void startMainFunction_();
void stopMainFunction_();
void startCommService_();
void stopCommService_();
void CommServiceFunction_();
void MainFunction_();
std::shared_ptr<DirectCommunication::DirectCommunicationClient> TCPClient_;