75 lines
1.6 KiB
C
75 lines
1.6 KiB
C
|
#ifndef OBSERVERCLIENTMODEL_H
|
||
|
#define OBSERVERCLIENTMODEL_H
|
||
|
|
||
|
#include <QObject>
|
||
|
|
||
|
#include "UserInfo.h"
|
||
|
#include "misc.h"
|
||
|
#include "ClientSocket.h"
|
||
|
#include "customtimer.h"
|
||
|
|
||
|
|
||
|
class MainWindow;
|
||
|
|
||
|
class TObserverClientModel : public QObject
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
explicit TObserverClientModel(QObject *parent = 0);
|
||
|
|
||
|
MainWindow* MainWindowPtr;
|
||
|
|
||
|
boost::shared_ptr<TClientSocket> ClientSocket;
|
||
|
|
||
|
boost::asio::io_service IoService;
|
||
|
|
||
|
boost::thread IoServiceThread;
|
||
|
|
||
|
boost::mutex UpdatingMapMutex;
|
||
|
|
||
|
std::vector<TUserInfo> UserInfoArr;
|
||
|
std::vector<TUserInfo> AlarmUserInfoArr;
|
||
|
|
||
|
CustomTimer Timer;
|
||
|
|
||
|
int MapType;
|
||
|
|
||
|
void Start(std::string address, std::string port);
|
||
|
void Finish();
|
||
|
|
||
|
void OnSocketClosed();
|
||
|
|
||
|
void RestartHeartbeatTimer();
|
||
|
void RestartMapHeartbeatTimer();
|
||
|
|
||
|
void OnConnectButtonPressed();
|
||
|
|
||
|
|
||
|
|
||
|
void OnUpdateInfoButtonPressed();
|
||
|
|
||
|
void OnChangeMapTypeButtonPressed();
|
||
|
|
||
|
void OnHeartbeat(const boost::system::error_code& e);
|
||
|
void OnMapHeartbeat(const boost::system::error_code& e);
|
||
|
|
||
|
void OnUpdateMapTimer();
|
||
|
void OnReceiveMapUpdate(std::vector<TUserInfo> userInfoArr);
|
||
|
void OnReceiveAlarmMapUpdate(std::vector<TUserInfo> userInfoArr);
|
||
|
|
||
|
void OnChatSendClick();
|
||
|
|
||
|
void OnReceiveChatMessage(TUserInfo userInfo, std::string msg);
|
||
|
|
||
|
|
||
|
boost::shared_ptr<boost::asio::deadline_timer> HeartbeatTimer;
|
||
|
boost::shared_ptr<boost::asio::deadline_timer> MapHeartbeatTimer;
|
||
|
|
||
|
//signals:
|
||
|
|
||
|
//public slots:
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif // OBSERVERCLIENTMODEL_H
|