ADD: added path to get Tracklist from entity
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.cache
|
||||
build/
|
||||
compile_commands.json
|
||||
compile_commands.json
|
||||
.vscode
|
||||
18
.vscode/c_cpp_properties.json
vendored
18
.vscode/c_cpp_properties.json
vendored
@@ -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
|
||||
}
|
||||
17
.vscode/launch.json
vendored
17
.vscode/launch.json
vendored
@@ -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"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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/*)
|
||||
|
||||
@@ -82,7 +82,7 @@ class SimControl{
|
||||
std::shared_ptr<DirectCommunication::DirectCommunicationClient> TCPClient_ = nullptr;
|
||||
std::shared_ptr<DirectCommunication::DirectCommunicationServer> ExternalTCPServer_ = nullptr;
|
||||
|
||||
|
||||
void getTrackListForEntity(std::string id, nlohmann::json &j);
|
||||
|
||||
std::thread WebsocketThreadThread_;
|
||||
std::atomic<bool> stopWebsocketThreadThread_ = false;
|
||||
|
||||
Submodule libs/SimCore updated: 630e8c4d74...d345fd5bc3
@@ -207,6 +207,17 @@ namespace SimControl {
|
||||
// response.merge_patch(Tracklist_->getJsonTRackList());
|
||||
// LOG_S(INFO)<<response;
|
||||
websocket.send(response.dump());
|
||||
}else if(j["Type"] == "EntityTrackList")
|
||||
{
|
||||
|
||||
if(j.contains("ID"))
|
||||
{
|
||||
nlohmann::json response;
|
||||
this->getTrackListForEntity(j["ID"].get<std::string>(),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: "<<request;
|
||||
PodController_->checkPodsHierarchy();
|
||||
std::string response;
|
||||
auto info = PodController_->getPodsInfo(id);
|
||||
if(info != nullptr)
|
||||
{
|
||||
LOG_S(INFO)<<"PODS Info: " <<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()
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user