Initial
This commit is contained in:
50
CapServer/MonitorThread.hpp
Normal file
50
CapServer/MonitorThread.hpp
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user