[DEV] remove remote object and transfer ownership ...
This commit is contained in:
parent
0efb75039b
commit
d439fb5bc2
@ -459,7 +459,7 @@ class ServiceDefinition:
|
||||
out += " }\n"
|
||||
out += " \n"
|
||||
out += " template<>\n"
|
||||
out += " void Parameter::addParameter<ememory::SharedPtr<" + class_name + ">>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const ememory::SharedPtr<" + class_name + ">& _value) {\n"
|
||||
out += " void Parameter::addParameter<ememory::SharedPtr<" + class_name + ">>(uint16_t _paramId, const ememory::SharedPtr<" + class_name + ">& _value) {\n"
|
||||
out += " std::vector<uint8_t> data;\n"
|
||||
"""
|
||||
out += " addType(data, createType<" + class_name + ">());\n"
|
||||
@ -470,14 +470,13 @@ class ServiceDefinition:
|
||||
out += " data.resize(data.size()+4);\n"
|
||||
out += " uint32_t fullId = 0;\n"
|
||||
# convert the object in a real System Object ....
|
||||
out += " if (_iface != nullptr) {\n"
|
||||
out += " ememory::SharedPtr<zeus::WebServer> _iface2 = _iface;\n"
|
||||
out += " uint16_t id = _iface2->getAddress();\n"
|
||||
out += " uint16_t idObj = _iface2->getNewObjectId();\n"
|
||||
out += " ememory::SharedPtr<zeus::ObjectType<" + class_name + ">> obj = ememory::makeShared<zeus::ObjectType<" + class_name + ">>(_iface, idObj, _value);\n"
|
||||
|
||||
out += " if (m_iface != nullptr) {\n"
|
||||
out += " uint16_t id = m_iface->getAddress();\n"
|
||||
out += " uint16_t idObj = m_iface->getNewObjectId();\n"
|
||||
out += " ememory::SharedPtr<zeus::ObjectType<" + class_name + ">> obj = ememory::makeShared<zeus::ObjectType<" + class_name + ">>(m_iface, idObj, _value);\n"
|
||||
out += " " + namespace + "register" + self.name[-1] + "(*obj);\n"
|
||||
out += " _iface2->addWebObj(obj);\n"
|
||||
out += " obj->addRemote(getDestination());\n"
|
||||
out += " m_iface->addWebObj(obj);\n"
|
||||
out += " ZEUS_INFO(\"Create object ID : \" << idObj);\n"
|
||||
out += " fullId = (uint32_t(id)<<16)+idObj;\n"
|
||||
out += " }\n"
|
||||
@ -487,9 +486,9 @@ class ServiceDefinition:
|
||||
out += " }\n"
|
||||
out += " \n"
|
||||
out += " template<>\n"
|
||||
out += " " + class_name_proxy + " Parameter::getParameter<" + class_name_proxy + ">(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {\n"
|
||||
out += " " + class_name_proxy + " Parameter::getParameter<" + class_name_proxy + ">(int32_t _id) const {\n"
|
||||
out += " ememory::SharedPtr<zeus::ObjectRemoteBase> out;\n"
|
||||
out += " out = zeus::message::Parameter::getParameter<ememory::SharedPtr<zeus::ObjectRemoteBase>>(_iface, _id);\n"
|
||||
out += " out = zeus::message::Parameter::getParameter<ememory::SharedPtr<zeus::ObjectRemoteBase>>(_id);\n"
|
||||
out += " return zeus::ObjectRemote(out);\n"
|
||||
out += " }\n"
|
||||
out += " }\n"
|
||||
|
@ -94,6 +94,7 @@ def configure(target, my_module):
|
||||
'zeus/Raw.cpp',
|
||||
'zeus/Client.cpp',
|
||||
'zeus/RemoteProcessCall.cpp',
|
||||
'zeus/WebObj.cpp',
|
||||
'zeus/WebServer.cpp',
|
||||
'zeus/mineType.cpp',
|
||||
])
|
||||
|
@ -198,6 +198,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
double megaParSec = double(size)/(double((stop-start).count())/1000000000.0);
|
||||
APPL_WARNING(" speed=" << int64_t(megaParSec/1024.0)/1024.0 << " Mo/s");
|
||||
#endif
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
}
|
||||
}
|
||||
int32_t iii=0;
|
||||
|
@ -256,7 +256,7 @@ void appl::GateWay::cleanIO() {
|
||||
zeus::WebServer* iface = it->getInterface();
|
||||
uint16_t id = it->getId();
|
||||
iface->event(ZEUS_ID_GATEWAY, uint32_t(id)<<16, "removeInterface", tmpIDToRemove);
|
||||
APPL_WARNING("Send it to :" << id);
|
||||
APPL_WARNING("Send it to :" << id << " " << tmpIDToRemove);
|
||||
}
|
||||
}
|
||||
// Simply display All active objkect in all interfaces:
|
||||
|
@ -156,6 +156,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
while(m_client.isAlive() == true) {
|
||||
m_client.pingIsAlive();
|
||||
m_client.displayConnectedObject();
|
||||
m_client.cleanDeadObject();
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
APPL_INFO("service in waiting ... " << iii << "/inf");
|
||||
iii++;
|
||||
|
@ -50,7 +50,7 @@ namespace appl {
|
||||
}
|
||||
*/
|
||||
PictureService(uint16_t _clientId) {
|
||||
APPL_WARNING("New PictureService ... for user: ");
|
||||
APPL_WARNING("New PictureService ... for user: " << _clientId);
|
||||
}
|
||||
~PictureService() {
|
||||
APPL_WARNING("delete PictureService ...");
|
||||
@ -193,15 +193,6 @@ namespace appl {
|
||||
// TODO : Check right ...
|
||||
uint64_t id = createFileID();
|
||||
APPL_ERROR("New ID : " << id);
|
||||
/*
|
||||
auto fut = _dataFile.getPart(0, 6400);
|
||||
fut.andThen([](zeus::FutureBase _data){
|
||||
zeus::Future<zeus::Raw> data(_data);
|
||||
zeus::Raw ppp = data.get();
|
||||
APPL_ERROR("Get data In andThen " << ppp.size());
|
||||
return true;
|
||||
});
|
||||
*/
|
||||
auto futType = _dataFile.getMineType();
|
||||
auto futName = _dataFile.getName();
|
||||
auto futSize = _dataFile.getSize();
|
||||
@ -360,16 +351,4 @@ ETK_EXPORT_API bool SERVICE_IO_uninit() {
|
||||
|
||||
|
||||
ZEUS_SERVICE_PICTURE_DECLARE(appl::PictureService);
|
||||
/*
|
||||
ETK_EXPORT_API zeus::Object* SERVICE_IO_instanciate(zeus::Client* _client, uint16_t _objectId, uint16_t _clientId) { \
|
||||
return zeus::service::createPicture<appl::PictureService>(_client, _objectId, _clientId); \
|
||||
}
|
||||
*/
|
||||
/*
|
||||
ETK_EXPORT_API zeus::Object* SERVICE_IO_instanciate(zeus::Client* _client, uint16_t _objectId, uint16_t _clientId) { \
|
||||
return zeus::service::createPicture<appl::PictureService>(_client, _objectId, _clientId, \
|
||||
[](uint16_t _clientId){ \
|
||||
return ememory::makeShared<appl::PictureService>(_clientId); \
|
||||
}); \
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -32,10 +32,10 @@ namespace zeus {
|
||||
// clang generate a basic warning:
|
||||
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
||||
int32_t idParam = 0;
|
||||
ret = (*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(_interfaceClient, idParam++)...);
|
||||
ret = (*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
||||
} else {
|
||||
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
||||
ret = (*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(_interfaceClient, idParam--)...);
|
||||
ret = (*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
||||
}
|
||||
if (_interfaceClient == nullptr) {
|
||||
ZEUS_ERROR("Nullptr for _interfaceWeb");
|
||||
@ -65,10 +65,10 @@ namespace zeus {
|
||||
// clang generate a basic warning:
|
||||
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
||||
int32_t idParam = 0;
|
||||
(*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(_interfaceClient, idParam++)...);
|
||||
(*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
||||
} else {
|
||||
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
||||
(*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(_interfaceClient, idParam--)...);
|
||||
(*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
||||
}
|
||||
if (_interfaceClient == nullptr) {
|
||||
ZEUS_ERROR("Nullptr for _interfaceWeb");
|
||||
|
@ -27,10 +27,10 @@ namespace zeus {
|
||||
// clang generate a basic warning:
|
||||
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
||||
int32_t idParam = 0;
|
||||
ret = _func(_obj->getParameter<ZEUS_TYPES>(_interfaceClient, idParam++)...);
|
||||
ret = _func(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
||||
} else {
|
||||
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
||||
ret = _func(_obj->getParameter<ZEUS_TYPES>(_interfaceClient, idParam--)...);
|
||||
ret = _func(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
||||
}
|
||||
if (_interfaceClient == nullptr) {
|
||||
ZEUS_ERROR("Nullptr for _interfaceWeb");
|
||||
@ -58,10 +58,10 @@ namespace zeus {
|
||||
// clang generate a basic warning:
|
||||
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
||||
int32_t idParam = 0;
|
||||
_func(_obj->getParameter<ZEUS_TYPES>(_interfaceClient, idParam++)...);
|
||||
_func(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
||||
} else {
|
||||
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
||||
_func(_obj->getParameter<ZEUS_TYPES>(_interfaceClient, idParam--)...);
|
||||
_func(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
||||
}
|
||||
if (_interfaceClient == nullptr) {
|
||||
ZEUS_ERROR("Nullptr for _interfaceWeb");
|
||||
|
@ -63,11 +63,6 @@ void zeus::Client::onClientData(ememory::SharedPtr<zeus::Message> _value) {
|
||||
if (_value->getType() == zeus::message::type::call) {
|
||||
ememory::SharedPtr<zeus::message::Call> callObj = ememory::staticPointerCast<zeus::message::Call>(_value);
|
||||
std::string callFunction = callObj->getCall();
|
||||
if ( callFunction != "link"
|
||||
&& callFunction != "unlink") {
|
||||
answerProtocolError(transactionId, "interact with client, musty only call: link/unlink");
|
||||
return;
|
||||
}
|
||||
if (callFunction == "link") {
|
||||
// link with a specific service:
|
||||
std::string serviceName = callObj->getParameter<std::string>(0);
|
||||
@ -94,18 +89,46 @@ void zeus::Client::onClientData(ememory::SharedPtr<zeus::Message> _value) {
|
||||
}
|
||||
}
|
||||
m_interfaceWeb->answerError(transactionId, _value->getDestination(), _value->getSource(), "UNKNOW-SERVICE");
|
||||
return;
|
||||
} else if (callFunction == "unlink") {
|
||||
uint32_t objectAddress = callObj->getParameter<uint32_t>(0);
|
||||
if ((objectAddress>> 16) != m_interfaceWeb->getAddress()) {
|
||||
m_interfaceWeb->answerError(transactionId, _value->getDestination(), _value->getSource(), "REMOVE-OWNERSHIP-WRONG-INTERFACE");
|
||||
return;
|
||||
}
|
||||
bool ret = m_interfaceWeb->remoteObjectOwnership(objectAddress&0xFFFF, _value->getSource());
|
||||
if (ret == true) {
|
||||
m_interfaceWeb->answerVoid(transactionId, _value->getDestination(), _value->getSource());
|
||||
return;
|
||||
}
|
||||
m_interfaceWeb->answerError(transactionId, _value->getDestination(), _value->getSource(), "REMOVE-OWNERSHIP-ERROR");
|
||||
return;
|
||||
} else if (callFunction == "movelink") {
|
||||
uint32_t objectAddress = callObj->getParameter<uint32_t>(0);
|
||||
uint32_t destinataireAddress = callObj->getParameter<uint32_t>(1);
|
||||
if ((objectAddress>> 16) != m_interfaceWeb->getAddress()) {
|
||||
m_interfaceWeb->answerError(transactionId, _value->getDestination(), _value->getSource(), "TRANSFER-OWNERSHIP-WRONG-INTERFACE");
|
||||
return;
|
||||
}
|
||||
bool ret = m_interfaceWeb->transferRemoteObjectOwnership(objectAddress&0xFFFF, _value->getSource(), destinataireAddress);
|
||||
if (ret == true) {
|
||||
m_interfaceWeb->answerVoid(transactionId, _value->getDestination(), _value->getSource());
|
||||
return;
|
||||
}
|
||||
m_interfaceWeb->answerError(transactionId, _value->getDestination(), _value->getSource(), "TRANSFER-OWNERSHIP-ERROR");
|
||||
return;
|
||||
}
|
||||
answerProtocolError(transactionId, "interact with client, musty only call: link/unlink/movelink");
|
||||
return;
|
||||
} else if (_value->getType() == zeus::message::type::event) {
|
||||
ememory::SharedPtr<zeus::message::Event> eventObj = ememory::staticPointerCast<zeus::message::Event>(_value);
|
||||
std::string callFunction = eventObj->getCall();
|
||||
if (callFunction != "removeInterface") {
|
||||
answerProtocolError(transactionId, "interact with client, musty only call: removeInterface");
|
||||
return;
|
||||
}
|
||||
if (callFunction == "removeInterface") {
|
||||
ZEUS_VERBOSE("Remove Object : " << eventObj);
|
||||
m_interfaceWeb->interfaceRemoved(eventObj->getParameter<std::vector<uint16_t>>(0));
|
||||
return;
|
||||
}
|
||||
answerProtocolError(transactionId, "interact with client, musty only call: removeInterface");
|
||||
return;
|
||||
}
|
||||
m_interfaceWeb->answerError(transactionId, _value->getDestination(), _value->getSource(), "UNKNOW-ACTION");
|
||||
@ -312,3 +335,11 @@ void zeus::Client::displayConnectedObject() {
|
||||
m_interfaceWeb->listObjects();
|
||||
}
|
||||
|
||||
|
||||
void zeus::Client::cleanDeadObject() {
|
||||
if (m_interfaceWeb== nullptr) {
|
||||
return;
|
||||
}
|
||||
m_interfaceWeb->cleanDeadObject();
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,10 @@ namespace zeus {
|
||||
* @brief Display all connected object remote and local ...
|
||||
*/
|
||||
void displayConnectedObject();
|
||||
/**
|
||||
* @brief Display all connected object remote and local ...
|
||||
*/
|
||||
void cleanDeadObject();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -20,27 +20,21 @@ zeus::ObjectRemoteBase::ObjectRemoteBase(const ememory::SharedPtr<zeus::WebServe
|
||||
|
||||
void zeus::ObjectRemoteBase::display() {
|
||||
ZEUS_INFO(" - [" << m_id << "/" << m_objectId << "] => [" << (m_remoteAddress>>16) << "/" << (m_remoteAddress&0xFFFF) << "]");
|
||||
for (auto &it : m_listRemoteConnected) {
|
||||
ZEUS_INFO(" * [" << (it>>16) << "/" << (it&0xFFFF) << "]");
|
||||
}
|
||||
}
|
||||
|
||||
zeus::ObjectRemoteBase::~ObjectRemoteBase() {
|
||||
ZEUS_INFO("[" << m_id << "/" << m_objectId << "] DESTROY => to remote [" << (m_remoteAddress>>16) << "/" << (m_remoteAddress&0xFFFF) << "]");
|
||||
if (m_isLinked == true) {
|
||||
uint32_t tmpLocalService = m_remoteAddress;
|
||||
// little hack : Call the service manager with the service ID=0 ...
|
||||
m_remoteAddress = 0;
|
||||
zeus::Future<bool> ret = m_interfaceWeb->call(getFullId(), m_remoteAddress, "unlink", tmpLocalService);
|
||||
zeus::Future<bool> ret = m_interfaceWeb->call(getFullId(), m_remoteAddress&0xFFFF0000, "unlink", m_remoteAddress);
|
||||
ret.wait();
|
||||
if (ret.hasError() == true) {
|
||||
ZEUS_WARNING("Can not unlink with the service id: '" << tmpLocalService << "' ==> link error");
|
||||
m_remoteAddress = tmpLocalService;
|
||||
ZEUS_WARNING("Can not unlink with the service id: '" << m_remoteAddress << "' ==> link error");
|
||||
return;
|
||||
}
|
||||
if (ret.get() == true) {
|
||||
m_isLinked = false;
|
||||
} else {
|
||||
ZEUS_ERROR("Can not unlink with this service ....");
|
||||
m_remoteAddress = tmpLocalService;
|
||||
}
|
||||
m_isLinked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,6 @@ zeus::RemoteProcessCall::RemoteProcessCall(const ememory::SharedPtr<zeus::WebSer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void zeus::RemoteProcessCall::setDescription(const std::string& _desc) {
|
||||
m_description = _desc;
|
||||
}
|
||||
|
86
zeus/WebObj.cpp
Normal file
86
zeus/WebObj.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <zeus/WebObj.hpp>
|
||||
#include <zeus/debug.hpp>
|
||||
|
||||
zeus::WebObj::WebObj(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _id, uint16_t _objectId) :
|
||||
m_interfaceWeb(_iface),
|
||||
m_id(_id),
|
||||
m_objectId(_objectId) {
|
||||
ZEUS_INFO("[" << m_id << "/" << m_objectId << "] Create");
|
||||
}
|
||||
|
||||
zeus::WebObj::~WebObj() {
|
||||
ZEUS_INFO("[" << m_id << "/" << m_objectId << "] Delete");
|
||||
}
|
||||
|
||||
uint16_t zeus::WebObj::getInterfaceId() {
|
||||
return m_id;
|
||||
}
|
||||
|
||||
uint16_t zeus::WebObj::getObjectId() {
|
||||
return m_objectId;
|
||||
}
|
||||
|
||||
uint32_t zeus::WebObj::getFullId() {
|
||||
return (uint32_t(m_id) << 16 ) + m_objectId;
|
||||
}
|
||||
|
||||
void zeus::WebObj::receive(ememory::SharedPtr<zeus::Message> _value) {
|
||||
ZEUS_ERROR("Receive a message ==> not implemented magaging ..." << _value);
|
||||
}
|
||||
|
||||
void zeus::WebObj::display() {
|
||||
ZEUS_INFO(" - [" << m_id << "/" << m_objectId << "]");
|
||||
for (auto &it : m_listRemoteConnected) {
|
||||
ZEUS_INFO(" * [" << (it>>16) << "/" << (it&0xFFFF) << "]");
|
||||
}
|
||||
}
|
||||
|
||||
void zeus::WebObj::addRemote(uint32_t _id) {
|
||||
m_listRemoteConnected.push_back(_id);
|
||||
}
|
||||
|
||||
|
||||
bool zeus::WebObj::removeOwnership(uint32_t _id) {
|
||||
for (auto it = m_listRemoteConnected.begin();
|
||||
it != m_listRemoteConnected.end();
|
||||
) {
|
||||
if (*it == _id) {
|
||||
it = m_listRemoteConnected.erase(it);
|
||||
return true;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void zeus::WebObj::rmRemoteInterface(uint16_t _id) {
|
||||
for (auto it = m_listRemoteConnected.begin();
|
||||
it != m_listRemoteConnected.end();
|
||||
) {
|
||||
if ((*it>>16) == _id) {
|
||||
it = m_listRemoteConnected.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool zeus::WebObj::transferOwnership(uint32_t _sourceAddress, uint32_t _destinataireAddress) {
|
||||
for (auto &it : m_listRemoteConnected) {
|
||||
if (it == _sourceAddress) {
|
||||
it = _destinataireAddress;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool zeus::WebObj::haveRemoteConnected() const {
|
||||
return m_listRemoteConnected.size() != 0;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
//#include <zeus/WebServer.hpp>
|
||||
#include <etk/types.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <zeus/message/Message.hpp>
|
||||
|
||||
namespace zeus {
|
||||
class WebServer;
|
||||
@ -16,28 +17,20 @@ namespace zeus {
|
||||
ememory::SharedPtr<zeus::WebServer> m_interfaceWeb;
|
||||
uint16_t m_id;
|
||||
uint16_t m_objectId;
|
||||
std::vector<uint32_t> m_listRemoteConnected;
|
||||
public:
|
||||
WebObj(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _id, uint16_t _objectId) :
|
||||
m_interfaceWeb(_iface),
|
||||
m_id(_id),
|
||||
m_objectId(_objectId) {
|
||||
ZEUS_INFO("[" << m_id << "/" << m_objectId << "] Create");
|
||||
}
|
||||
virtual ~WebObj() {
|
||||
ZEUS_INFO("[" << m_id << "/" << m_objectId << "] Delete");
|
||||
}
|
||||
uint32_t getInterfaceId() {
|
||||
return m_id;
|
||||
}
|
||||
uint32_t getFullId() {
|
||||
return (uint32_t(m_id) << 16 ) + m_objectId;
|
||||
}
|
||||
virtual void receive(ememory::SharedPtr<zeus::Message> _value) {
|
||||
ZEUS_ERROR("Receive a message ==> not implemented magaging ..." << _value);
|
||||
}
|
||||
virtual void display() {
|
||||
ZEUS_INFO(" - [" << m_id << "/" << m_objectId << "]");
|
||||
}
|
||||
WebObj(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _id, uint16_t _objectId);
|
||||
virtual ~WebObj();
|
||||
uint16_t getInterfaceId();
|
||||
uint16_t getObjectId();
|
||||
uint32_t getFullId();
|
||||
virtual void receive(ememory::SharedPtr<zeus::Message> _value);
|
||||
virtual void display();
|
||||
void addRemote(uint32_t _id);
|
||||
bool removeOwnership(uint32_t _id);
|
||||
void rmRemoteInterface(uint16_t _id);
|
||||
bool haveRemoteConnected() const;
|
||||
bool transferOwnership(uint32_t _sourceAddress, uint32_t _destinataireAddress);
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -33,7 +33,8 @@ ememory::SharedPtr<zeus::message::Call> zeus::createBaseCall(bool _isEvent,
|
||||
return obj;
|
||||
}
|
||||
|
||||
void zeus::createParam(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _paramId, ememory::SharedPtr<zeus::message::Call> _obj) {
|
||||
void zeus::createParam(int32_t _paramId,
|
||||
ememory::SharedPtr<zeus::message::Call> _obj) {
|
||||
// Finish recursive parse ...
|
||||
}
|
||||
|
||||
@ -110,8 +111,9 @@ void zeus::WebServer::addWebObjRemote(ememory::SharedPtr<zeus::ObjectRemoteBase>
|
||||
}
|
||||
|
||||
void zeus::WebServer::interfaceRemoved(std::vector<uint16_t> _list) {
|
||||
ZEUS_WARNING("Remove interface : " << _list);
|
||||
for (int32_t iii=0; iii < _list.size(); ++iii) {
|
||||
// Call local object
|
||||
// Call All remote Object object
|
||||
for (auto it=m_listRemoteObject.begin();
|
||||
it != m_listRemoteObject.end();
|
||||
/* no increment */) {
|
||||
@ -128,6 +130,19 @@ void zeus::WebServer::interfaceRemoved(std::vector<uint16_t> _list) {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
for (int32_t iii=0; iii < _list.size(); ++iii) {
|
||||
// Call All remote Object object
|
||||
for (auto it=m_listObject.begin();
|
||||
it != m_listObject.end();
|
||||
/* no increment */) {
|
||||
if (*it == nullptr) {
|
||||
it = m_listObject.erase(it);
|
||||
continue;
|
||||
}
|
||||
(*it)->rmRemoteInterface(_list[iii]);
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -457,6 +472,87 @@ void zeus::WebServer::listObjects() {
|
||||
}
|
||||
}
|
||||
|
||||
void zeus::WebServer::cleanDeadObject() {
|
||||
if ( m_listObject.size() == 0
|
||||
&& m_listRemoteObject.size() == 0) {
|
||||
return;
|
||||
}
|
||||
for (auto it=m_listObject.begin();
|
||||
it!=m_listObject.end();
|
||||
/* no auto increment*/) {
|
||||
if (*it == nullptr) {
|
||||
it = m_listObject.erase(it);
|
||||
continue;
|
||||
}
|
||||
if ((*it)->haveRemoteConnected() == false) {
|
||||
it = m_listObject.erase(it);
|
||||
continue;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
for (auto it=m_listRemoteObject.begin();
|
||||
it!=m_listRemoteObject.end();
|
||||
/* no auto increment*/) {
|
||||
if (it->expired() == true) {
|
||||
it = m_listRemoteObject.erase(it);
|
||||
continue;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
bool zeus::WebServer::transferRemoteObjectOwnership(uint16_t _objectAddress, uint32_t _sourceAddress, uint32_t _destinataireAddress) {
|
||||
if ( m_listObject.size() == 0
|
||||
&& m_listRemoteObject.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
for (auto &it : m_listObject) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->getObjectId() == _objectAddress) {
|
||||
return it->transferOwnership(_sourceAddress, _destinataireAddress);
|
||||
}
|
||||
}
|
||||
for (auto &it : m_listRemoteObject) {
|
||||
ememory::SharedPtr<zeus::ObjectRemoteBase> tmp = it.lock();
|
||||
if (tmp == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (tmp->getObjectId() == _objectAddress) {
|
||||
ZEUS_ERROR("return a remote Object is not permited ... ==> link directly to the original elements");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool zeus::WebServer::remoteObjectOwnership(uint16_t _objectAddress, uint32_t _sourceAddress) {
|
||||
if ( m_listObject.size() == 0
|
||||
&& m_listRemoteObject.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
for (auto &it : m_listObject) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->getObjectId() == _objectAddress) {
|
||||
return it->removeOwnership(_sourceAddress);
|
||||
}
|
||||
}
|
||||
for (auto &it : m_listRemoteObject) {
|
||||
ememory::SharedPtr<zeus::ObjectRemoteBase> tmp = it.lock();
|
||||
if (tmp == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (tmp->getObjectId() == _objectAddress) {
|
||||
ZEUS_ERROR("return a remote Object is not permited ... ==> link directly to the original elements");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void zeus::WebServer::addAsync(zeus::WebServer::ActionAsync _elem) {
|
||||
std::unique_lock<std::mutex> lock(m_threadAsyncMutex);
|
||||
m_threadAsyncList2.push_back(_elem);
|
||||
|
@ -44,8 +44,7 @@ namespace zeus {
|
||||
* @param[in]
|
||||
* @return
|
||||
*/
|
||||
void createParam(const ememory::SharedPtr<zeus::WebServer>& _iface,
|
||||
int32_t _paramId,
|
||||
void createParam(int32_t _paramId,
|
||||
ememory::SharedPtr<zeus::message::Call> _obj);
|
||||
|
||||
/**
|
||||
@ -54,14 +53,13 @@ namespace zeus {
|
||||
* @return
|
||||
*/
|
||||
template<class ZEUS_TYPE, class... _ARGS>
|
||||
void createParam(const ememory::SharedPtr<zeus::WebServer>& _iface,
|
||||
int32_t _paramId,
|
||||
void createParam(int32_t _paramId,
|
||||
ememory::SharedPtr<zeus::message::Call> _obj,
|
||||
const ZEUS_TYPE& _param,
|
||||
_ARGS&&... _args) {
|
||||
_obj->addParameter<ZEUS_TYPE>(_iface, _param);
|
||||
_obj->addParameter<ZEUS_TYPE>(_param);
|
||||
_paramId++;
|
||||
createParam(_iface, _paramId, _obj, std::forward<_ARGS>(_args)...);
|
||||
createParam(_paramId, _obj, std::forward<_ARGS>(_args)...);
|
||||
}
|
||||
/**
|
||||
* @brief
|
||||
@ -70,12 +68,11 @@ namespace zeus {
|
||||
*/
|
||||
// convert const char in std::string ...
|
||||
template<class... _ARGS>
|
||||
void createParam(const ememory::SharedPtr<zeus::WebServer>& _iface,
|
||||
int32_t _paramId,
|
||||
void createParam(int32_t _paramId,
|
||||
ememory::SharedPtr<zeus::message::Call> _obj,
|
||||
const char* _param,
|
||||
_ARGS&&... _args) {
|
||||
createParam(_iface, _paramId, _obj, std::string(_param), std::forward<_ARGS>(_args)...);
|
||||
createParam(_paramId, _obj, std::string(_param), std::forward<_ARGS>(_args)...);
|
||||
}
|
||||
/**
|
||||
* @brief
|
||||
@ -83,12 +80,18 @@ namespace zeus {
|
||||
* @return
|
||||
*/
|
||||
template<class... _ARGS>
|
||||
ememory::SharedPtr<zeus::message::Call> createCall(bool _isEvent, const ememory::SharedPtr<zeus::WebServer>& _iface, uint64_t _transactionId, const uint32_t& _source, const uint32_t& _destination, const std::string& _functionName, _ARGS&&... _args) {
|
||||
ememory::SharedPtr<zeus::message::Call> createCall(bool _isEvent,
|
||||
const ememory::SharedPtr<zeus::WebServer>& _iface,
|
||||
uint64_t _transactionId,
|
||||
const uint32_t& _source,
|
||||
const uint32_t& _destination,
|
||||
const std::string& _functionName,
|
||||
_ARGS&&... _args) {
|
||||
ememory::SharedPtr<zeus::message::Call> callElem = createBaseCall(_isEvent, _iface, _transactionId, _source, _destination, _functionName);
|
||||
if (callElem == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
createParam(_iface, 0, callElem, std::forward<_ARGS>(_args)...);
|
||||
createParam(0, callElem, std::forward<_ARGS>(_args)...);
|
||||
return callElem;
|
||||
}
|
||||
/**
|
||||
@ -119,6 +122,7 @@ namespace zeus {
|
||||
public:
|
||||
void addWebObj(ememory::SharedPtr<zeus::WebObj> _obj);
|
||||
void addWebObjRemote(ememory::SharedPtr<zeus::ObjectRemoteBase> _obj);
|
||||
void cleanDeadObject();
|
||||
/**
|
||||
* @brief Set the list of interface that has been removed ...
|
||||
*/
|
||||
@ -334,7 +338,7 @@ namespace zeus {
|
||||
answer->setTransactionId(_clientTransactionId);
|
||||
answer->setSource(_source);
|
||||
answer->setDestination(_destination);
|
||||
answer->addAnswer(sharedFromThis(), _value);
|
||||
answer->addAnswer(_value);
|
||||
writeBinary(answer);
|
||||
}
|
||||
/**
|
||||
@ -354,6 +358,8 @@ namespace zeus {
|
||||
public:
|
||||
// for debug only:
|
||||
void listObjects();
|
||||
bool transferRemoteObjectOwnership(uint16_t _objectAddress, uint32_t _sourceAddress, uint32_t _destinataireAddress);
|
||||
bool remoteObjectOwnership(uint16_t _objectAddress, uint32_t _sourceAddress);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,8 @@ namespace zeus {
|
||||
* @param[in] _value Value to add
|
||||
*/
|
||||
template<class ZEUS_TYPE_DATA>
|
||||
void addAnswer(const ememory::SharedPtr<zeus::WebServer>& _iface, const ZEUS_TYPE_DATA& _value) {
|
||||
addParameter(_iface, _value);
|
||||
void addAnswer(const ZEUS_TYPE_DATA& _value) {
|
||||
addParameter(_value);
|
||||
}
|
||||
/**
|
||||
* @brief get the answer value
|
||||
@ -54,7 +54,7 @@ namespace zeus {
|
||||
*/
|
||||
template<class ZEUS_TYPE_DATA>
|
||||
ZEUS_TYPE_DATA getAnswer() const {
|
||||
return getParameter<ZEUS_TYPE_DATA>(m_iface, 0);
|
||||
return getParameter<ZEUS_TYPE_DATA>(0);
|
||||
}
|
||||
/**
|
||||
* @brief Ann an error on the message answer
|
||||
|
@ -25,16 +25,7 @@ namespace zeus {
|
||||
* @return Converted type of the parameter (or empty value)
|
||||
*/
|
||||
template<class ZEUS_TYPE_DATA>
|
||||
ZEUS_TYPE_DATA getParameter(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const;
|
||||
/**
|
||||
* @brief Template to get a parameter with a specific type
|
||||
* @param[in] _id Number of the parameter
|
||||
* @return Converted type of the parameter (or empty value)
|
||||
*/
|
||||
template<class ZEUS_TYPE_DATA>
|
||||
ZEUS_TYPE_DATA getParameter(int32_t _id) const {
|
||||
return getParameter<ZEUS_TYPE_DATA>(m_iface, _id);
|
||||
}
|
||||
ZEUS_TYPE_DATA getParameter(int32_t _id) const;
|
||||
/**
|
||||
* @brief Get the type of a parameter.
|
||||
* @param[in] _id Number of the parameter
|
||||
@ -81,11 +72,12 @@ namespace zeus {
|
||||
* @param[in] _value Value to add in parameter
|
||||
*/
|
||||
template<class ZEUS_TYPE_DATA>
|
||||
void addParameter(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const ZEUS_TYPE_DATA& _value);
|
||||
void addParameter(uint16_t _paramId,
|
||||
const ZEUS_TYPE_DATA& _value);
|
||||
public:
|
||||
template<class ZEUS_TYPE_DATA>
|
||||
void addParameter(const ememory::SharedPtr<zeus::WebServer>& _iface, const ZEUS_TYPE_DATA& _value) {
|
||||
addParameter(_iface, m_parameter.size(), _value);
|
||||
void addParameter(const ZEUS_TYPE_DATA& _value) {
|
||||
addParameter(m_parameter.size(), _value);
|
||||
}
|
||||
void parameterAppendMessageData(ememory::SharedPtr<zeus::message::Data> _obj);
|
||||
};
|
||||
|
@ -45,7 +45,7 @@ void zeus::message::Parameter::addParameterEmptyVector() {
|
||||
namespace zeus {
|
||||
namespace message {
|
||||
template<>
|
||||
void Parameter::addParameter<std::string>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::string& _value) {
|
||||
void Parameter::addParameter<std::string>(uint16_t _paramId, const std::string& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::string>());
|
||||
int32_t currentOffset = data.size();
|
||||
@ -54,7 +54,7 @@ namespace zeus {
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<std::string>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<std::string>& _value) {
|
||||
void Parameter::addParameter<std::vector<std::string>>(uint16_t _paramId, const std::vector<std::string>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<std::string>>());
|
||||
// count all datas:
|
||||
@ -77,7 +77,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<bool>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<bool>& _value) {
|
||||
void Parameter::addParameter<std::vector<bool>>(uint16_t _paramId, const std::vector<bool>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<bool>>());
|
||||
// add size:
|
||||
@ -96,124 +96,125 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<int8_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<int8_t>& _value) {
|
||||
void Parameter::addParameter<std::vector<int8_t>>(uint16_t _paramId, const std::vector<int8_t>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<int8_t>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
data.resize(data.size()+sizeof(int8_t)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(int8_t)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<int16_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<int16_t>& _value) {
|
||||
void Parameter::addParameter<std::vector<int16_t>>(uint16_t _paramId, const std::vector<int16_t>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<int16_t>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
data.resize(data.size()+sizeof(int16_t)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(int16_t)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<int32_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<int32_t>& _value) {
|
||||
void Parameter::addParameter<std::vector<int32_t>>(uint16_t _paramId, const std::vector<int32_t>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<int32_t>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
data.resize(data.size()+sizeof(int32_t)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(int32_t)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<int64_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<int64_t>& _value) {
|
||||
void Parameter::addParameter<std::vector<int64_t>>(uint16_t _paramId, const std::vector<int64_t>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<int64_t>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
data.resize(data.size()+sizeof(int64_t)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(int64_t)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<uint8_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<uint8_t>& _value) {
|
||||
void Parameter::addParameter<std::vector<uint8_t>>(uint16_t _paramId, const std::vector<uint8_t>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<uint8_t>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
data.resize(data.size()+sizeof(uint8_t)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(uint8_t)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<uint16_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<uint16_t>& _value) {
|
||||
void Parameter::addParameter<std::vector<uint16_t>>(uint16_t _paramId, const std::vector<uint16_t>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<uint16_t>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
ZEUS_INFO("add " << _value.size() << " elements");
|
||||
data.resize(data.size()+sizeof(uint16_t)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(uint16_t)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<uint32_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<uint32_t>& _value) {
|
||||
void Parameter::addParameter<std::vector<uint32_t>>(uint16_t _paramId, const std::vector<uint32_t>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<uint32_t>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
data.resize(data.size()+sizeof(uint32_t)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(uint32_t)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<uint64_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<uint64_t>& _value) {
|
||||
void Parameter::addParameter<std::vector<uint64_t>>(uint16_t _paramId, const std::vector<uint64_t>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<uint64_t>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
data.resize(data.size()+sizeof(uint64_t)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(uint64_t)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<float>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<float>& _value) {
|
||||
void Parameter::addParameter<std::vector<float>>(uint16_t _paramId, const std::vector<float>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<float>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
data.resize(data.size()+sizeof(float)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(float)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
|
||||
template<>
|
||||
void Parameter::addParameter<std::vector<double>>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const std::vector<double>& _value) {
|
||||
void Parameter::addParameter<std::vector<double>>(uint16_t _paramId, const std::vector<double>& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<std::vector<double>>());
|
||||
// add size:
|
||||
int32_t currentOffset = data.size();
|
||||
data.resize(data.size()+_value.size());
|
||||
data.resize(data.size()+sizeof(double)*_value.size());
|
||||
memcpy(&data[currentOffset], &_value[0], sizeof(double)*_value.size());
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
|
||||
template<>
|
||||
void Parameter::addParameter<int8_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const int8_t& _value) {
|
||||
void Parameter::addParameter<int8_t>(uint16_t _paramId, const int8_t& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<int8_t>());
|
||||
data.push_back(uint8_t(_value));
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<uint8_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const uint8_t& _value) {
|
||||
void Parameter::addParameter<uint8_t>(uint16_t _paramId, const uint8_t& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<uint8_t>());
|
||||
data.push_back(_value);
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<int16_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const int16_t& _value) {
|
||||
void Parameter::addParameter<int16_t>(uint16_t _paramId, const int16_t& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<int16_t>());
|
||||
int32_t currentOffset = data.size();
|
||||
@ -222,7 +223,7 @@ namespace zeus {
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<uint16_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const uint16_t& _value) {
|
||||
void Parameter::addParameter<uint16_t>(uint16_t _paramId, const uint16_t& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<uint16_t>());
|
||||
int32_t currentOffset = data.size();
|
||||
@ -231,7 +232,7 @@ namespace zeus {
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<int32_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const int32_t& _value) {
|
||||
void Parameter::addParameter<int32_t>(uint16_t _paramId, const int32_t& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<int32_t>());
|
||||
int32_t currentOffset = data.size();
|
||||
@ -240,7 +241,7 @@ namespace zeus {
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<uint32_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const uint32_t& _value) {
|
||||
void Parameter::addParameter<uint32_t>(uint16_t _paramId, const uint32_t& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<uint32_t>());
|
||||
int32_t currentOffset = data.size();
|
||||
@ -249,7 +250,7 @@ namespace zeus {
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<int64_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const int64_t& _value) {
|
||||
void Parameter::addParameter<int64_t>(uint16_t _paramId, const int64_t& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<int64_t>());
|
||||
int32_t currentOffset = data.size();
|
||||
@ -258,7 +259,7 @@ namespace zeus {
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<uint64_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const uint64_t& _value) {
|
||||
void Parameter::addParameter<uint64_t>(uint16_t _paramId, const uint64_t& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<uint64_t>());
|
||||
int32_t currentOffset = data.size();
|
||||
@ -269,12 +270,12 @@ namespace zeus {
|
||||
#if defined(__TARGET_OS__MacOs) \
|
||||
|| defined(__TARGET_OS__IOs)
|
||||
template<>
|
||||
void Parameter::addParameter<size_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const size_t& _value) {
|
||||
void Parameter::addParameter<size_t>(uint16_t _paramId, const size_t& _value) {
|
||||
addParameter(_paramId, uint64_t(_value));
|
||||
}
|
||||
#endif
|
||||
template<>
|
||||
void Parameter::addParameter<float>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const float& _value) {
|
||||
void Parameter::addParameter<float>(uint16_t _paramId, const float& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<float>());
|
||||
int32_t currentOffset = data.size();
|
||||
@ -283,7 +284,7 @@ namespace zeus {
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<double>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const double& _value) {
|
||||
void Parameter::addParameter<double>(uint16_t _paramId, const double& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<double>());
|
||||
int32_t currentOffset = data.size();
|
||||
@ -292,7 +293,7 @@ namespace zeus {
|
||||
m_parameter.push_back(std::make_pair(2,data));
|
||||
}
|
||||
template<>
|
||||
void Parameter::addParameter<bool>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const bool& _value) {
|
||||
void Parameter::addParameter<bool>(uint16_t _paramId, const bool& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<bool>());
|
||||
if (_value == true) {
|
||||
@ -347,7 +348,7 @@ namespace zeus {
|
||||
}
|
||||
};
|
||||
template<>
|
||||
void Parameter::addParameter<zeus::Raw>(const ememory::SharedPtr<zeus::WebServer>& _iface, uint16_t _paramId, const zeus::Raw& _value) {
|
||||
void Parameter::addParameter<zeus::Raw>(uint16_t _paramId, const zeus::Raw& _value) {
|
||||
std::vector<uint8_t> data;
|
||||
addType(data, createType<zeus::Raw>());
|
||||
// set mine type in string:
|
||||
|
@ -15,7 +15,7 @@
|
||||
namespace zeus {
|
||||
namespace message {
|
||||
template<>
|
||||
bool Parameter::getParameter<bool>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
bool Parameter::getParameter<bool>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -32,7 +32,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::string Parameter::getParameter<std::string>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::string Parameter::getParameter<std::string>(int32_t _id) const {
|
||||
std::string out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -44,7 +44,7 @@ namespace zeus {
|
||||
|
||||
|
||||
template<>
|
||||
uint8_t Parameter::getParameter<uint8_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
uint8_t Parameter::getParameter<uint8_t>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -84,7 +84,7 @@ namespace zeus {
|
||||
return 0;
|
||||
}
|
||||
template<>
|
||||
uint16_t Parameter::getParameter<uint16_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
uint16_t Parameter::getParameter<uint16_t>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -125,7 +125,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
uint32_t Parameter::getParameter<uint32_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
uint32_t Parameter::getParameter<uint32_t>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -166,7 +166,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
uint64_t Parameter::getParameter<uint64_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
uint64_t Parameter::getParameter<uint64_t>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -209,12 +209,12 @@ namespace zeus {
|
||||
#if defined(__TARGET_OS__MacOs) \
|
||||
|| defined(__TARGET_OS__IOs)
|
||||
template<>
|
||||
size_t Parameter::getParameter<size_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
size_t Parameter::getParameter<size_t>(int32_t _id) const {
|
||||
return getParameter<uint64_t>(_id);
|
||||
}
|
||||
#endif
|
||||
template<>
|
||||
int8_t Parameter::getParameter<int8_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
int8_t Parameter::getParameter<int8_t>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -255,7 +255,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
int16_t Parameter::getParameter<int16_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
int16_t Parameter::getParameter<int16_t>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -296,7 +296,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
int32_t Parameter::getParameter<int32_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
int32_t Parameter::getParameter<int32_t>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -337,7 +337,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
int64_t Parameter::getParameter<int64_t>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
int64_t Parameter::getParameter<int64_t>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -378,7 +378,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
float Parameter::getParameter<float>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
float Parameter::getParameter<float>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -418,7 +418,7 @@ namespace zeus {
|
||||
return 0.0f;
|
||||
}
|
||||
template<>
|
||||
double Parameter::getParameter<double>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
double Parameter::getParameter<double>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -482,7 +482,7 @@ namespace zeus {
|
||||
|
||||
|
||||
template<>
|
||||
std::vector<uint8_t> Parameter::getParameter<std::vector<uint8_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<uint8_t> Parameter::getParameter<std::vector<uint8_t>>(int32_t _id) const {
|
||||
std::vector<uint8_t> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -493,7 +493,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<uint8_t>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(uint8_t);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(uint8_t));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(uint8_t));
|
||||
return out;
|
||||
} else if (createType<std::vector<uint16_t>>() == type) {
|
||||
const uint16_t* tmp = reinterpret_cast<const uint16_t*>(pointer);
|
||||
@ -572,7 +572,7 @@ namespace zeus {
|
||||
return out;
|
||||
}
|
||||
template<>
|
||||
std::vector<uint16_t> Parameter::getParameter<std::vector<uint16_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<uint16_t> Parameter::getParameter<std::vector<uint16_t>>(int32_t _id) const {
|
||||
std::vector<uint16_t> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -591,7 +591,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<uint16_t>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(uint16_t);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(uint16_t));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(uint16_t));
|
||||
return out;
|
||||
} else if (createType<std::vector<uint32_t>>() == type) {
|
||||
const uint32_t* tmp = reinterpret_cast<const uint32_t*>(pointer);
|
||||
@ -663,7 +663,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<uint32_t> Parameter::getParameter<std::vector<uint32_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<uint32_t> Parameter::getParameter<std::vector<uint32_t>>(int32_t _id) const {
|
||||
std::vector<uint32_t> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -690,7 +690,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<uint32_t>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(uint32_t);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(uint32_t));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(uint32_t));
|
||||
return out;
|
||||
} else if (createType<std::vector<uint64_t>>() == type) {
|
||||
const uint64_t* tmp = reinterpret_cast<const uint64_t*>(pointer);
|
||||
@ -754,7 +754,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<uint64_t> Parameter::getParameter<std::vector<uint64_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<uint64_t> Parameter::getParameter<std::vector<uint64_t>>(int32_t _id) const {
|
||||
std::vector<uint64_t> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -789,7 +789,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<uint64_t>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(uint64_t);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(uint64_t));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(uint64_t));
|
||||
return out;
|
||||
} else if (createType<std::vector<int8_t>>() == type) {
|
||||
const int8_t* tmp = reinterpret_cast<const int8_t*>(pointer);
|
||||
@ -845,7 +845,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<int8_t> Parameter::getParameter<std::vector<int8_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<int8_t> Parameter::getParameter<std::vector<int8_t>>(int32_t _id) const {
|
||||
std::vector<int8_t> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -888,7 +888,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<int8_t>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(int8_t);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(int8_t));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(int8_t));
|
||||
return out;
|
||||
} else if (createType<std::vector<int16_t>>() == type) {
|
||||
const int16_t* tmp = reinterpret_cast<const int16_t*>(pointer);
|
||||
@ -936,7 +936,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<int16_t> Parameter::getParameter<std::vector<int16_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<int16_t> Parameter::getParameter<std::vector<int16_t>>(int32_t _id) const {
|
||||
std::vector<int16_t> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -987,7 +987,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<int16_t>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(int16_t);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(int16_t));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(int16_t));
|
||||
return out;
|
||||
} else if (createType<std::vector<int32_t>>() == type) {
|
||||
const int32_t* tmp = reinterpret_cast<const int32_t*>(pointer);
|
||||
@ -1027,7 +1027,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<int32_t> Parameter::getParameter<std::vector<int32_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<int32_t> Parameter::getParameter<std::vector<int32_t>>(int32_t _id) const {
|
||||
std::vector<int32_t> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -1086,7 +1086,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<int32_t>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(int32_t);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(int32_t));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(int32_t));
|
||||
return out;
|
||||
} else if (createType<std::vector<int64_t>>() == type) {
|
||||
const int64_t* tmp = reinterpret_cast<const int64_t*>(pointer);
|
||||
@ -1118,7 +1118,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<int64_t> Parameter::getParameter<std::vector<int64_t>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<int64_t> Parameter::getParameter<std::vector<int64_t>>(int32_t _id) const {
|
||||
std::vector<int64_t> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -1185,7 +1185,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<int64_t>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(int64_t);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(int64_t));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(int64_t));
|
||||
return out;
|
||||
} else if (createType<std::vector<float>>() == type) {
|
||||
const float* tmp = reinterpret_cast<const float*>(pointer);
|
||||
@ -1209,7 +1209,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<float> Parameter::getParameter<std::vector<float>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<float> Parameter::getParameter<std::vector<float>>(int32_t _id) const {
|
||||
std::vector<float> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -1284,7 +1284,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<float>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(float);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(float));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(float));
|
||||
return out;
|
||||
} else if (createType<std::vector<double>>() == type) {
|
||||
const double* tmp = reinterpret_cast<const double*>(pointer);
|
||||
@ -1300,7 +1300,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<double> Parameter::getParameter<std::vector<double>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<double> Parameter::getParameter<std::vector<double>>(int32_t _id) const {
|
||||
std::vector<double> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -1383,7 +1383,7 @@ namespace zeus {
|
||||
} else if (createType<std::vector<double>>() == type) {
|
||||
int32_t nbElement = dataSize / sizeof(double);
|
||||
out.resize(nbElement);
|
||||
memcpy(&out, pointer, nbElement * sizeof(double));
|
||||
memcpy(&out[0], pointer, nbElement * sizeof(double));
|
||||
return out;
|
||||
}
|
||||
ZEUS_ERROR("Can not get type from '" << type << "'");
|
||||
@ -1391,7 +1391,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<bool> Parameter::getParameter<std::vector<bool>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<bool> Parameter::getParameter<std::vector<bool>>(int32_t _id) const {
|
||||
std::vector<bool> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -1413,7 +1413,7 @@ namespace zeus {
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<std::string> Parameter::getParameter<std::vector<std::string>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
std::vector<std::string> Parameter::getParameter<std::vector<std::string>>(int32_t _id) const {
|
||||
std::vector<std::string> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -1437,7 +1437,7 @@ namespace zeus {
|
||||
return out;
|
||||
}
|
||||
template<>
|
||||
zeus::Raw Parameter::getParameter<zeus::Raw>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
zeus::Raw Parameter::getParameter<zeus::Raw>(int32_t _id) const {
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
uint32_t dataSize = getParameterSize(_id);
|
||||
@ -1452,7 +1452,7 @@ namespace zeus {
|
||||
return zeus::Raw();
|
||||
}
|
||||
template<>
|
||||
ememory::SharedPtr<zeus::ObjectRemoteBase> Parameter::getParameter<ememory::SharedPtr<zeus::ObjectRemoteBase>>(const ememory::SharedPtr<zeus::WebServer>& _iface, int32_t _id) const {
|
||||
ememory::SharedPtr<zeus::ObjectRemoteBase> Parameter::getParameter<ememory::SharedPtr<zeus::ObjectRemoteBase>>(int32_t _id) const {
|
||||
ememory::SharedPtr<zeus::ObjectRemoteBase> out;
|
||||
zeus::message::ParamType type = getParameterType(_id);
|
||||
const uint8_t* pointer = getParameterPointer(_id);
|
||||
@ -1463,17 +1463,18 @@ namespace zeus {
|
||||
ZEUS_VERBOSE("Get type : " << type.getName());
|
||||
ZEUS_VERBOSE("Get id : " << getSourceId() << "/" << getSourceObjectId());
|
||||
const uint32_t* tmp = reinterpret_cast<const uint32_t*>(pointer);
|
||||
uint32_t serviceAddress = *tmp;
|
||||
uint32_t objectAdress = *tmp;
|
||||
ZEUS_VERBOSE("Get id : " << (*tmp>>16) << "/" << (*tmp&0xFFFF));
|
||||
|
||||
// get new local ID:
|
||||
|
||||
if (_iface != nullptr) {
|
||||
ememory::SharedPtr<zeus::WebServer> _iface2 = _iface;
|
||||
uint16_t id = _iface2->getAddress();
|
||||
uint16_t idObj = _iface2->getNewObjectId();
|
||||
out = ememory::makeShared<zeus::ObjectRemoteBase>(_iface, id, idObj, serviceAddress, type.getName());
|
||||
_iface2->addWebObjRemote(out);
|
||||
ememory::SharedPtr<zeus::WebServer> iface = m_iface;
|
||||
if (iface != nullptr) {
|
||||
uint16_t id = iface->getAddress();
|
||||
uint16_t idObj = iface->getNewObjectId();
|
||||
// Sent to the interface the change of links from the curent interface to the real object remote ... (the client interface can control that the user calle r is athorised to do it ...
|
||||
iface->call((uint32_t(id)<<16), objectAdress&0xFFFF0000, "movelink", objectAdress, (uint32_t(id)<<16)+idObj);
|
||||
out = ememory::makeShared<zeus::ObjectRemoteBase>(iface, id, idObj, objectAdress, type.getName());
|
||||
iface->addWebObjRemote(out);
|
||||
} else {
|
||||
ZEUS_ERROR("missing interface to crate object: '" << type << "'");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user