#include "Streams.hpp" #include using namespace std; shared_ptr getHostStream() { static shared_ptr stream{ fopen("/dev/hidg0", "ab+"), [](FILE *f){ fclose(f); } }; if (!stream) clog << "Stream is unavailable" << endl; return stream; } shared_ptr getComHostStream() { static shared_ptr stream{ fopen("comhost.txt", "wb"), [](FILE *f){ clog << "Closing comhost stream" << endl; fclose(f); } }; if (!stream) clog << "Stream is unavailable" << endl; return stream; } shared_ptr getHostPacketStream() { static shared_ptr stream{ fopen("hostpackets.txt", "wb"), [](FILE *f){ clog << "Closing hostPackets stream" << endl; fclose(f); } }; if (!stream) clog << "Stream is unavailable" << endl; return stream; } shared_ptr getComDevStream() { static shared_ptr stream{ fopen("comdev.txt", "wb"), [](FILE *f){ clog << "Closing comdev stream" << endl; fclose(f); } }; if (!stream) clog << "Stream is unavailable" << endl; return stream; } shared_ptr getDevPacketStream() { static shared_ptr stream{ fopen("devpackets.txt", "wb"), [](FILE *f){ clog << "Closing devPackets stream" << endl; fclose(f); } }; if (!stream) clog << "Stream is unavailable" << endl; return stream; }