-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverinteractor.h
More file actions
49 lines (37 loc) · 1.19 KB
/
Copy pathserverinteractor.h
File metadata and controls
49 lines (37 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef SERVERINTERACTOR_H
#define SERVERINTERACTOR_H
#include <boost/asio.hpp>
#include <string>
#include "deviceconfigurationstore.h"
#include "statechangelistener.h"
#include "udpserver.h"
class MessageHandler;
class ServerPresenter
{
public:
virtual void PresentServerState(std::string ServerState) = 0;
};
class ServerConfigurationStore
{
public:
virtual void StoreServerConfiguration(const DeviceConfiguration& Configuration) = 0;
virtual DeviceConfiguration GetServerConfiguration() = 0;
};
class ServerInteractor : public StateChangeListener<UdpServerState>
{
public:
ServerInteractor(ServerPresenter& Presenter,
ServerConfigurationStore& Store);
~ServerInteractor();
void InitFromStore(boost::asio::io_service& IOService, MessageHandler& MessageHandler);
void StartServer(const DeviceConfiguration& Configuration,
boost::asio::io_service& IOService,
MessageHandler& MessageHandler);
void StopServer();
void OnStateChange() override;
private:
UdpServer* m_ServerDevice = nullptr;
ServerPresenter& m_Presenter;
ServerConfigurationStore& m_ConfigurationStore;
};
#endif // SERVERINTERACTOR_H