Files
qt5-legatus-legacy/Lts/Proxies/TrainingAreaBase/Plugins/UAS/Test/test4_2.cpp
T
2026-08-13 18:33:10 +02:00

61 lines
1.2 KiB
C++
Executable File

#include <iostream>
#include <thread>
#include <dlfcn.h> // TODO: no UAS for windoof
#include <TmsIfAdapter/tms_if_adapter.h>
using GetFn = void *(*)();
int main(int , char *[])
{
std::cout << "App started ..." << std::endl;
void *handle = dlopen("libTmsIfAdapter.so", RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
if (handle == nullptr)
{
std::cerr << "no libTmsIfAdapter.so :( => " << dlerror() << std::endl;
return 1;
}
auto get = reinterpret_cast<GetFn>(dlsym(handle, "get"));
if (get == nullptr)
{
std::cerr << "no 'get' in libTmsIfAdapter.so :( => " << dlerror() << std::endl;
return 1;
}
UAS::TmsIfAdapter *adapter = reinterpret_cast<UAS::TmsIfAdapter *>(get());
// adapter->test();
std::cout << "Now waiting ..." << std::endl;
// keep app running:
while(true){std::this_thread::sleep_for(std::chrono::milliseconds(500));}
std::this_thread::sleep_for(std::chrono::milliseconds(500));
// std::string blub;
// std::cin >> blub;
std::cout << "Stopping ..." << std::endl;
// UAS::TmsIfAdapter::stop();
std::cout << "Stopped ..." << std::endl;
// std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::cout << "Exit ..." << std::endl;
return 0;
}