Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,60 @@
|
||||
#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;
|
||||
}
|
||||
Reference in new issue
Block a user