///////////////////////////////////////////////////////////////////////////////// // // nwthread.h is part of TestModbus-Client. // ///////////////////////////////////////////////////////////////////////////////// #ifndef _NWTHREAD_H_ #define _NWTHREAD_H_ #include #include #include #include #include enum { NWT_nothing, NWT_connect, NWT_running, NWT_error, NWT_close }; class NetworkThread { private: GMutex mutex; GThread *thread; int state; int req_fc; // 0 .. is no request int req_offset; int req_size; int req_timeout; // timeout[ms] struct timeval req_time; std::string host, port; void SetState(int s); void ClientSendStatustext(char* txt); public: NetworkThread(); ~NetworkThread(); void Lock(); void UnLock(); int Connect(std::string dest_host, std::string dest_port); int Disconnect(); int GetState(); int SendRequest(); void Thread(); }; #endif