diff --git a/main.cpp b/main.cpp index 98e0fce..209f2d3 100644 --- a/main.cpp +++ b/main.cpp @@ -2,10 +2,11 @@ #include #include #include +#include "lfr_state_machine.h" int main(void) { - std::cout << "hello central" << std::endl; + std::cout << "started central" << std::endl; const int thresholdBinary = 140; const int videoHeight = 720; @@ -14,6 +15,11 @@ int main(void) std::mutex mutex; + // Init State Machine; + std::cout << "create State Machine" << std::endl; + LFR_StateMachine stateMachine(); + + // Init LFR Autonomous mode std::cout << "create lfr" << std::endl; LFR lfr(videoHeight, videoWidth, thresholdBinary, gaussKernelSize, [&](std::exception const &ex) { @@ -22,9 +28,11 @@ int main(void) return false; }); + // Init UART Communication std::cout << "create uart" << std::endl; LFR_UART uartCommunicator; + // Init Socket Communication std::cout << "create socket" << std::endl; LFR_Socket socket([&](std::exception const &ex) { @@ -33,5 +41,25 @@ int main(void) return false; }); + // Connect String parser to socket + socket.addListener([&](LFR_Socket::LFR_Telegram telegram) + { + std::unique_lock lock(mutex); + std::cout << telegram; + }, &mutex); + socket.startLoop(); + + + //Start the permanent loop + char input; + std::cout << "fress q to quit" << std::endl; + std::cin >> input; + std::cout << "cinned" << std::endl; + while (input != 'q') + { + std::cin >> input; + std::cout << "cinned" << std::endl; + } + std::cout << "Exiting central" << std::endl; return 0; } \ No newline at end of file