Skip to content

Commit

Permalink
Merge branch 'master' into ds/feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dennispelle authored Sep 21, 2023
2 parents 5122e7c + 2beb5bc commit 845c9d8
Show file tree
Hide file tree
Showing 5 changed files with 633 additions and 589 deletions.
2 changes: 1 addition & 1 deletion ai_omniscope-v2-communication_sw
8 changes: 4 additions & 4 deletions src/create_training_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static void selected_vcds_data(nlohmann::json const &config,
nlohmann::json &metadata, std::string &inputvin,
std::string &mileage, std::string &comment,
std::string &api_message, bool &upload_success) {
ImGui::Text(load_json<std::string>(language, "explanation", "upload", "vcds")
ImGui::TextUnformatted(load_json<std::string>(language, "explanation", "upload", "vcds")
.c_str());
static ImGui::FileBrowser fileBrowser;
static bool first_job = true;
Expand Down Expand Up @@ -153,11 +153,11 @@ static void selected_vcds_data(nlohmann::json const &config,
ImGui::EndChild();
}

void selected_battery_measurement(
inline void selected_battery_measurement(
nlohmann::json const &config, nlohmann::json const &language,
nlohmann::json &metadata, std::string &inputvin, std::string &mileage,
std::string &comment, std::string &api_message, bool &upload_success) {
ImGui::Text(
ImGui::TextUnformatted(
load_json<std::string>(language, "explanation", "upload", "battery")
.c_str());
static ImGui::FileBrowser fileBrowser;
Expand Down Expand Up @@ -333,7 +333,7 @@ static void selected_compression_data(
ImGui::EndChild();
}

void popup_create_training_data_select(nlohmann::json const &config,
inline void popup_create_training_data_select(nlohmann::json const &config,
nlohmann::json const &language,
bool &upload_success) {

Expand Down
122 changes: 61 additions & 61 deletions src/get_from_github.hpp
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
#pragma once
#include "jasonhandler.hpp"

#include <curl/curl.h>
#include <fmt/format.h>
#include <fstream>
#include <iostream>

bool downloadFileFromGitHub(const std::string &githubUrl,
const std::string &localPath) {
// Initialisieren Sie die libcurl-Bibliothek
CURL *curl = curl_easy_init();
inline bool downloadFileFromGitHub(std::string const& githubUrl, std::string const& localPath) {
// Initialisieren Sie die libcurl-Bibliothek
CURL* curl = curl_easy_init();

if (curl) {
// Setzen Sie die URL
curl_easy_setopt(curl, CURLOPT_URL, githubUrl.c_str());
if(curl) {
// Setzen Sie die URL
curl_easy_setopt(curl, CURLOPT_URL, githubUrl.c_str());

// Setzen Sie die Schreibfunktion, um die heruntergeladene Datei zu
// speichern
FILE *file = fopen(localPath.c_str(), "wb");
// Setzen Sie die Schreibfunktion, um die heruntergeladene Datei zu
// speichern
FILE* file = fopen(localPath.c_str(), "wb");

if (file) {
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
if(file) {
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);

// Führen Sie die Anfrage aus
CURLcode res = curl_easy_perform(curl);
// Führen Sie die Anfrage aus
CURLcode res = curl_easy_perform(curl);

// Überprüfen Sie den Anfragestatus
if (res != CURLE_OK) {
fmt::print("Fehler beim Herunterladen der Datei: ");
fclose(file);
curl_easy_cleanup(curl);
return false;
}
// Überprüfen Sie den Anfragestatus
if(res != CURLE_OK) {
fmt::print("Fehler beim Herunterladen der Datei: ");
fclose(file);
curl_easy_cleanup(curl);
return false;
}

// Datei schließen
fclose(file);
// Datei schließen
fclose(file);

// Rückgabe von true bei erfolgreichem Download
curl_easy_cleanup(curl);
return true;
} else {
fmt::print("Fehler beim Öffnen der lokalen Datei zum Schreiben.");
// Rückgabe von true bei erfolgreichem Download
curl_easy_cleanup(curl);
return true;
} else {
fmt::print("Fehler beim Öffnen der lokalen Datei zum Schreiben.");

curl_easy_cleanup(curl);
return false;
curl_easy_cleanup(curl);
return false;
}
}
}

// Rückgabe von false bei einem Fehler
return false;
// Rückgabe von false bei einem Fehler
return false;
}

bool update_config_from_github() {
inline bool update_config_from_github() {
std::filesystem::create_directories("config");

std::filesystem::create_directories("config");
const std::string config_url
= "https://raw.githubusercontent.com/skunkforce/"
"omniview/master/config/config.json";
fmt::print("download config file from: {} \n\r", config_url);
bool downloaded_config = downloadFileFromGitHub(config_url, "config/config.json");

if(downloaded_config) {
fmt::print("download succeeded\n\r");
} else {
fmt::print("download failed\n\r");
}
return downloaded_config;
}
inline bool update_language_from_github() {
std::filesystem::create_directories("languages");

const std::string config_url = "https://raw.githubusercontent.com/skunkforce/"
"omniview/master/config/config.json";
fmt::print("download config file from: {} \n\r", config_url);
bool downloaded_config =
downloadFileFromGitHub(config_url, "config/config.json");
const std::string lang_url
= "https://raw.githubusercontent.com/skunkforce/"
"omniview/master/languages/Deutsch.json";
fmt::print("download language file from: {} \n\r", lang_url);
bool downloaded_langfiles = downloadFileFromGitHub(lang_url, "languages/Deutsch.json");

if (downloaded_config) {
fmt::print("download succeeded\n\r");
} else {
fmt::print("download failed\n\r");
}
if(downloaded_langfiles) {
fmt::print("download succeeded\n\r");
} else {
fmt::print("download failed\n\r");
}
return downloaded_langfiles;
}
bool update_language_from_github() {

std::filesystem::create_directories("languages");

const std::string lang_url = "https://raw.githubusercontent.com/skunkforce/"
"omniview/master/languages/Deutsch.json";
fmt::print("download language file from: {} \n\r", lang_url);
bool downloaded_langfiles =
downloadFileFromGitHub(lang_url, "languages/Deutsch.json");

if (downloaded_langfiles) {
fmt::print("download succeeded\n\r");
} else {
fmt::print("download failed\n\r");
}
}
Loading

0 comments on commit 845c9d8

Please sign in to comment.