2024-02-29 11:36:24 +01:00
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QByteArray>
|
|
|
|
|
|
|
|
#include "message_handler.h"
|
2024-03-19 09:12:46 +01:00
|
|
|
#include <DeviceController/interfaces.h>"
|
2024-02-29 11:36:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
//#include <unistd.h>
|
|
|
|
//#include <errno.h>
|
|
|
|
|
|
|
|
#ifdef PTU5
|
|
|
|
#define SERIAL_PORT "ttymxc2"
|
|
|
|
#else
|
|
|
|
#define SERIAL_PORT "ttyUSB0"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
QByteArray const value = qgetenv("LC_ALL");
|
|
|
|
if (value != "C") {
|
|
|
|
qputenv("LC_ALL", "C");
|
|
|
|
}
|
|
|
|
// qputenv("XDG_RUNTIME_DIR", "/var/run/user/0");
|
|
|
|
|
|
|
|
openlog("ATB-DL-JSON", LOG_PERROR | LOG_PID | LOG_CONS, LOG_USER);
|
|
|
|
|
|
|
|
QCoreApplication a(argc, argv);
|
|
|
|
QCoreApplication::setApplicationName("ATBDownloadDCJsonFiles");
|
|
|
|
QCoreApplication::setApplicationVersion(APP_VERSION);
|
|
|
|
|
|
|
|
if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling
|
|
|
|
atbInstallMessageHandler(atbDebugOutput);
|
|
|
|
setDebugLevel(LOG_NOTICE);
|
|
|
|
}
|
|
|
|
|
2024-03-19 09:19:52 +01:00
|
|
|
// int r = std::system("ls -l /proc/[0-9]*/fd/* 2>/dev/null | grep /dev/ttymxc2 > /tmp/slave-or-master.txt");
|
2024-02-29 11:36:24 +01:00
|
|
|
// lrwx------ 1 root root 64 Oct 31 14:55 /proc/884/fd/18 -> /dev/ttymxc2
|
|
|
|
|
|
|
|
//std::ifstream ifs("/tmp/slave-or-master.txt");
|
|
|
|
|
|
|
|
//if (ifs.is_open()) {
|
|
|
|
// std::string line;
|
|
|
|
// if (std::getline(ifs, line)) {
|
|
|
|
// if (line.size() > 0) {
|
|
|
|
// std::cout << "SLAVE " << line << std::endl;
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// }
|
|
|
|
|
|
|
|
// ifs.close();
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
return a.exec();
|
|
|
|
}
|