#ifndef PLAINCONNECTION_H #define PLAINCONNECTION_H #ifdef _WIN32 #include #include #include "win32shim.h" #else #include #include #include "sys/socket.h" #include #endif #include #include #include #include #include "Packet.h" #include "Utils.h" typedef std::function timeoutCallback; namespace cspot { class PlainConnection { public: PlainConnection(); ~PlainConnection(); /** * @brief Connect to the given AP address * * @param apAddress The AP url to connect to */ void connect(const std::string& apAddress); void close(); timeoutCallback timeoutHandler; std::vector sendPrefixPacket(const std::vector& prefix, const std::vector& data); std::vector recvPacket(); void readBlock(const uint8_t* dst, size_t size); size_t writeBlock(const std::vector& data); private: int apSock; }; } // namespace cspot #endif