zeus/tools/system-gateway/appl/ServiceInterface.h

37 lines
930 B
C
Raw Normal View History

/** @file
* @author Edouard DUPIN
* @copyright 2016, Edouard DUPIN, all right reserved
* @license APACHE v2.0 (see license file)
*/
#pragma once
2016-06-23 22:08:11 +02:00
#include <zeus/WebServer.h>
#include <ememory/memory.h>
2016-06-23 22:08:11 +02:00
namespace appl {
class GateWay;
2016-06-23 22:08:11 +02:00
class ClientInterface;
class ServiceInterface {
friend class appl::ClientInterface;
private:
2016-06-23 22:08:11 +02:00
appl::GateWay* m_gatewayInterface;
zeus::WebServer m_interfaceClient;
std::string m_name;
public:
2016-06-23 22:08:11 +02:00
ServiceInterface(enet::Tcp _connection, appl::GateWay* _gatewayInterface);
virtual ~ServiceInterface();
2016-05-23 21:18:37 +02:00
void start();
void stop();
2016-07-19 22:31:27 +02:00
void onServiceData(ememory::SharedPtr<zeus::Buffer> _value);
public:
2016-07-19 22:31:27 +02:00
void SendData(uint64_t _userSessionId, ememory::SharedPtr<zeus::Buffer> _data);
const std::string& getName() {
return m_name;
}
bool isAlive();
protected:
void answerProtocolError(uint32_t _transactionId, const std::string& _errorHelp);
};
}