16namespace std {
class thread; }
32 void setServiceIP(
const std::string& _ip) { m_servicesIpAddress = _ip; }
34 const std::string&
lastError(
void)
const {
return m_lastError; }
36 void setSiteID(
const std::string& _siteID) { m_siteID = _siteID; }
37 const std::string&
siteID(
void)
const {
return m_siteID; }
59 struct RequestedService {
62 unsigned int startAttempt;
64 struct InitializingService {
66 RequestedService startInfo;
67 int initializeAttempt;
70 void runThreads(
void);
72 void serviceStartFailed(RequestedService _info);
73 void sendInitializeMessage(InitializingService _info);
74 void serviceInitializeFailed(InitializingService _info);
76 std::vector<Service *> * sessionServices(
const SessionInformation& _sessionInformation);
80 void workerServiceStarter(
void);
81 void workerServiceInitializer(
void);
82 void workerHealthCheck(
void);
83 void workerServiceStopper(
void);
85 std::string m_servicesIpAddress;
86 std::string m_lastError;
89 bool m_isShuttingDown;
91 std::thread * m_threadServiceStarter;
92 std::thread * m_threadServiceInitializer;
93 std::thread * m_threadHealthCheck;
94 std::thread * m_threadServiceStopper;
96 std::map<SessionInformation, std::vector<Service *> *> m_services;
97 std::mutex m_mutexServices;
99 std::list<RequestedService> m_requestedServices;
100 std::mutex m_mutexRequestedServices;
102 std::list<InitializingService> m_initializingServices;
103 std::mutex m_mutexInitializingServices;
105 std::list<Service *> m_stoppingServices;
106 std::mutex m_mutexStoppingServices;
const char const char const char * _sessionID
Definition dllmain.cpp:62
const char * _serviceURL
Definition dllmain.cpp:93
Definition ServiceManager.h:18
void sessionClosed(const std::string &_sessionID)
Definition ServiceManager.cpp:226
const std::string & siteID(void) const
Definition ServiceManager.h:37
void serviceDisconnected(const std::string &_sessionID, const ServiceInformation &_info, const std::string &_serviceURL)
Definition ServiceManager.cpp:276
void setServiceIP(const std::string &_ip)
Definition ServiceManager.h:32
const std::string & lastError(void) const
Definition ServiceManager.h:34
bool requestStartService(const SessionInformation &_sessionInformation, const ServiceInformation &_serviceInformation)
Will attempt to start a new service.
Definition ServiceManager.cpp:125
virtual ~ServiceManager()
Definition ServiceManager.cpp:24
void setSiteID(const std::string &_siteID)
Definition ServiceManager.h:36
ServiceManager()
Definition ServiceManager.cpp:17
bool requestStartRelayService(const SessionInformation &_sessionInformation, std::string &_websocketUrl, std::string &_relayServiceURL)
Definition ServiceManager.cpp:148
void addToJsonObject(ot::JsonValue &_object, ot::JsonAllocator &_allocator)
Add the object contents to the provided JSON object.
Definition ServiceManager.cpp:28
void GetSessionInformation(ot::JsonArray &sessionInfo, ot::JsonAllocator &allocator)
Definition ServiceManager.cpp:614
JSON Array value.
Definition JSON.h:116
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30