This commit is contained in:
2024-08-07 09:12:07 -04:00
parent ca445435a0
commit fdfadd5c7e
1021 changed files with 73601 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
#ifndef _CAPSERVER_MONITORTHREAD_HPP_
#define _CAPSERVER_MONITORTHREAD_HPP_
#ifndef _SOCKET_SOCKET_HPP_
#include <socket/socket.hpp>
#endif
#ifndef _THREAD_MESSAGETHREAD_HPP_
#include <thread/mthread.hpp>
#endif
class MonitorThread : private MessageThread
{
public:
MonitorThread();
virtual ~MonitorThread();
void startMonitor(const String &host,int port,DWORD timeout);
void stopMonitor(void);
private:
typedef enum MonitorThMsg{MsgMonitorStart,MsgMonitorStop};
enum{DefaultTimeout=1000,InitDelay=0}; // InitDelay=10000
DWORD threadCallback(ThreadMessage &threadMessage);
void handleMonitorStart(void);
void handleMonitorStop(void);
void message(const String &string);
void message(const String &string,int value);
void getHostAddress(void);
void getImage(void);
bool saveImage(Array<BYTE> &imageData);
ThreadCallback<MonitorThread> mCallback;
InternetAddress mInternetAddress;
Event mMonitorEvent;
bool mIsRunning;
String mHost;
int mPort;
DWORD mTimeout;
};
inline
void MonitorThread::message(const String &string)
{
::printf("%s\n",string.str());
}
inline
void MonitorThread::message(const String &string,int value)
{
::printf("%s=%d\n",string.str(),value);
}
#endif