Initial commit
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#ifndef VSTARCAM_FINDER_H
|
||||
#define VSTARCAM_FINDER_H
|
||||
|
||||
#include <asio.hpp>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
|
||||
namespace VStarCam {
|
||||
|
||||
class Finder
|
||||
{
|
||||
public:
|
||||
explicit Finder(const std::string& ipAddress);
|
||||
~Finder();
|
||||
|
||||
int GetPort(const std::string& ipAddress);
|
||||
|
||||
private:
|
||||
bool Timeout() const;
|
||||
bool PortFound();
|
||||
void ProcessMessage(const std::string& message);
|
||||
std::string GetString(std::string::const_iterator& it) const;
|
||||
void Advance(std::string::const_iterator& it) const;
|
||||
std::string StringToHex(const std::string& input) const;
|
||||
|
||||
private:
|
||||
asio::system_timer::time_point m_startTime;
|
||||
asio::system_timer::duration m_timeout;
|
||||
|
||||
mutable std::mutex m_mutex;
|
||||
std::condition_variable m_condition;
|
||||
|
||||
std::string m_sourceAddress;
|
||||
std::string m_targetAddress;
|
||||
|
||||
int m_sourcePort;
|
||||
int m_targetPort;
|
||||
|
||||
int m_port;
|
||||
};
|
||||
|
||||
} // namespace VStarCam
|
||||
|
||||
#endif // UTIL_VSTARCAMFINDER_H
|
||||
Reference in New Issue
Block a user