diff --git a/.gitignore b/.gitignore index cbccdcc..320176e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .cache build/ -compile_commands.json \ No newline at end of file +compile_commands.json +.vscode \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index 59e54f9..0000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**", - "${workspaceFolder}/libs/**" - ], - "defines": [], - "compilerPath": "/usr/bin/clang-13", - "cStandard": "c17", - "cppStandard": "c++14", - "intelliSenseMode": "linux-clang-x64", - "configurationProvider": "ms-vscode.cmake-tools" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 2beab5f..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "gdb", - "request": "launch", - "name": "Launch Program", - "target": "./SimControlApplication", - "cwd": "${workspaceRoot}/build", - "valuesFormatting": "parseText" - } - - ] -} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d841b0..8f7feee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,4 @@ + cmake_minimum_required (VERSION 3.1 FATAL_ERROR) project (SimControlApplication VERSION 0.1.0 LANGUAGES CXX C) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) diff --git a/cmake/Modules/defaultOptions.cmake b/cmake/Modules/defaultOptions.cmake index 87653ba..246ae48 100644 --- a/cmake/Modules/defaultOptions.cmake +++ b/cmake/Modules/defaultOptions.cmake @@ -3,6 +3,8 @@ find_package(Git) enable_testing() cxx_20() +# set(CMAKE_C_COMPILER "Clang-15") +set(CMAKE_CPP_COMPILER "Clang++-15") # build_docs(PROCESS_DOXYFILE DOXYFILE_PATH "docs/Doxyfile.in" ) add_code_coverage_all_targets(EXCLUDE ${PROJECT_SOURCE_DIR}/libs/* ${PROJECT_SOURCE_DIR}/test/*) diff --git a/include/SimControl/SimControl.hpp b/include/SimControl/SimControl.hpp index 3f37048..0535de8 100644 --- a/include/SimControl/SimControl.hpp +++ b/include/SimControl/SimControl.hpp @@ -82,7 +82,7 @@ class SimControl{ std::shared_ptr TCPClient_ = nullptr; std::shared_ptr ExternalTCPServer_ = nullptr; - + void getTrackListForEntity(std::string id, nlohmann::json &j); std::thread WebsocketThreadThread_; std::atomic stopWebsocketThreadThread_ = false; diff --git a/libs/SimCore b/libs/SimCore index 630e8c4..d345fd5 160000 --- a/libs/SimCore +++ b/libs/SimCore @@ -1 +1 @@ -Subproject commit 630e8c4d74b95a6dcab834b42d23798535760e40 +Subproject commit d345fd5bc3cd864593da3ef2eac5010047b08c47 diff --git a/src/SimControl/SimControl.cpp b/src/SimControl/SimControl.cpp index 59c63a0..d12ffa9 100644 --- a/src/SimControl/SimControl.cpp +++ b/src/SimControl/SimControl.cpp @@ -207,6 +207,17 @@ namespace SimControl { // response.merge_patch(Tracklist_->getJsonTRackList()); // LOG_S(INFO)<getTrackListForEntity(j["ID"].get(),response); + + websocket.send(response.dump()); + } + } }else if (j["Data"] == "Entity") { @@ -409,6 +420,38 @@ namespace SimControl { Tracklist_->deleteTrack(request["ID"]); } + void SimControl::getTrackListForEntity(std::string id,nlohmann::json &j) + { + + // LOG_S(INFO)<<"REQUEST: "<checkPodsHierarchy(); + std::string response; + auto info = PodController_->getPodsInfo(id); + if(info != nullptr) + { + LOG_S(INFO)<<"PODS Info: " <ToJson(); + DirectCommunication::DirectCommunicationClient client(std::stoi(CommandPort_),info->Ip); + SimCore::Control control(this->ID_,SimCore::ControlType::GET_TRACKLIST,"Tracklist"); + client.sendMessage(control.buildMessage().serialize()); + response = client.getLatestMessage(); + + client.disconnect(); + } + if (response != "NULL") + { + try + { + nlohmann::json tracks = nlohmann::json::parse(response); + j["Tracks"] = tracks; + + }catch (const std::exception e) { + LOG_S(ERROR)<< e.what(); + } + + } + } + + void SimControl::startWebApp() {