[DEV] better integration of test base and actions/signals
This commit is contained in:
parent
309c106962
commit
4801cb8306
@ -259,6 +259,7 @@ class FunctionDefinition:
|
||||
out += elem["name"] + " "
|
||||
if elem["brief"] != "":
|
||||
out += elem["brief"] + " "
|
||||
out += "\n"
|
||||
if self.is_action == True:
|
||||
out += space + " * @note: This is an action ==> it can notify of the progression of the call\n"
|
||||
if self.return_brief != "":
|
||||
|
@ -15,303 +15,12 @@
|
||||
|
||||
|
||||
#include <etk/stdTools.hpp>
|
||||
#include <zeus/service/ProxyUser.hpp>
|
||||
#include <zeus/service/ProxyPicture.hpp>
|
||||
#include <zeus/service/ProxyVideo.hpp>
|
||||
#include <zeus/test/ProxyService1.hpp>
|
||||
#include <zeus/ProxyFile.hpp>
|
||||
#include <zeus/ObjectRemote.hpp>
|
||||
#include <echrono/Steady.hpp>
|
||||
#include <zeus/FutureGroup.hpp>
|
||||
|
||||
void installPath(zeus::service::ProxyPicture& _srv, std::string _path, uint32_t _albumID) {
|
||||
etk::FSNode node(_path);
|
||||
APPL_INFO("Parse : '" << _path << "'");
|
||||
std::vector<std::string> listSubPath = node.folderGetSub(true, false, "*");
|
||||
for (auto &itPath : listSubPath) {
|
||||
APPL_INFO("Create Album : '" << itPath << "'");
|
||||
std::string albumName = etk::split(itPath, '/').back();
|
||||
uint32_t albumId = _srv.albumCreate(albumName).wait().get();
|
||||
_srv.albumDescriptionSet(albumId, itPath).wait();
|
||||
if (_albumID != 0) {
|
||||
_srv.albumParentSet(albumId, _albumID).wait();
|
||||
}
|
||||
installPath(_srv, itPath, albumId);
|
||||
}
|
||||
|
||||
std::vector<std::string> listSubFile = node.folderGetSub(false, true, "*");
|
||||
for (auto &itFile : listSubFile) {
|
||||
APPL_INFO("Add media : '" << itFile << "' in " << _albumID);
|
||||
std::string extention = etk::tolower(std::string(itFile.begin()+itFile.size() -3, itFile.end()));
|
||||
if ( extention == "jpg"
|
||||
|| extention == "png"
|
||||
|| extention == "gif"
|
||||
|| extention == "bmp"
|
||||
|| extention == "avi"
|
||||
|| extention == "ogg"
|
||||
|| extention == "mp3"
|
||||
|| extention == "mkv"
|
||||
|| extention == "mka"
|
||||
|| extention == "tga"
|
||||
|| extention == "mp2"
|
||||
|| extention == "mov") {
|
||||
uint32_t mediaId = _srv.mediaAdd(zeus::File::create(itFile)).wait().get();
|
||||
if (mediaId == 0) {
|
||||
APPL_ERROR("Get media ID = 0 With no error");
|
||||
}
|
||||
if (_albumID != 0) {
|
||||
APPL_INFO("Add media '" << mediaId << "'in ALbum: " << _albumID);
|
||||
_srv.albumMediaAdd(_albumID, mediaId).wait();
|
||||
}
|
||||
} else {
|
||||
APPL_ERROR("Sot send file : " << itFile << " Not manage extention...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static std::string extractAndRemove(const std::string& _inputValue, const char _startMark, const char _stopMark, std::vector<std::string>& _values) {
|
||||
_values.clear();
|
||||
std::string out;
|
||||
bool inside=false;
|
||||
std::string insideData;
|
||||
for (auto &it : _inputValue) {
|
||||
if ( inside == false
|
||||
&& it == _startMark) {
|
||||
inside = true;
|
||||
} else if ( inside == true
|
||||
&& it == _stopMark) {
|
||||
inside = false;
|
||||
_values.push_back(insideData);
|
||||
insideData.clear();
|
||||
} else if (inside == true) {
|
||||
insideData += it;
|
||||
} else {
|
||||
out += it;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
void installVideoPath(zeus::service::ProxyVideo& _srv, std::string _path, std::map<std::string,std::string> _basicKey = std::map<std::string,std::string>()) {
|
||||
etk::FSNode node(_path);
|
||||
APPL_INFO("Parse : '" << _path << "'");
|
||||
std::vector<std::string> listSubPath = node.folderGetSub(true, false, "*");
|
||||
for (auto &itPath : listSubPath) {
|
||||
std::map<std::string,std::string> basicKeyTmp = _basicKey;
|
||||
APPL_INFO("Add Sub path: '" << itPath << "'");
|
||||
std::string lastPathName = etk::split(itPath, '/').back();
|
||||
if (basicKeyTmp.size() == 0) {
|
||||
APPL_INFO("find '" << lastPathName << "' " << basicKeyTmp.size());
|
||||
if (lastPathName == "films") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("type", "film"));
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("production-methode", "picture"));
|
||||
} else if (lastPathName == "films-annimation") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("type", "film"));
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("production-methode", "draw"));
|
||||
} else if (lastPathName == "tv-show") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("type", "tv-show"));
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("production-methode", "picture"));
|
||||
} else if (lastPathName == "anim") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("type", "tv-show"));
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("production-methode", "draw"));
|
||||
} else if (lastPathName == "courses") { // short films
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("type", "courses"));
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("production-methode", "picture")); // TODO : Check "draw"
|
||||
} else if (lastPathName == "theater") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("type", "theater"));
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("production-methode", "picture"));
|
||||
} else if (lastPathName == "one-man-show") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("type", "one-man show"));
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("production-methode", "picture"));
|
||||
}
|
||||
} else {
|
||||
APPL_INFO("find '" << lastPathName << "' " << basicKeyTmp.size());
|
||||
if (lastPathName == "saison_01") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "1"));
|
||||
} else if (lastPathName == "saison_02") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "2"));
|
||||
} else if (lastPathName == "saison_03") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "3"));
|
||||
} else if (lastPathName == "saison_04") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "4"));
|
||||
} else if (lastPathName == "saison_05") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "5"));
|
||||
} else if (lastPathName == "saison_06") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "6"));
|
||||
} else if (lastPathName == "saison_07") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "7"));
|
||||
} else if (lastPathName == "saison_08") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "8"));
|
||||
} else if (lastPathName == "saison_09") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "9"));
|
||||
} else if (lastPathName == "saison_10") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "10"));
|
||||
} else if (lastPathName == "saison_11") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "11"));
|
||||
} else if (lastPathName == "saison_12") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "12"));
|
||||
} else if (lastPathName == "saison_13") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "13"));
|
||||
} else if (lastPathName == "saison_14") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "14"));
|
||||
} else if (lastPathName == "saison_15") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "15"));
|
||||
} else if (lastPathName == "saison_16") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "16"));
|
||||
} else if (lastPathName == "saison_17") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "17"));
|
||||
} else if (lastPathName == "saison_18") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "18"));
|
||||
} else if (lastPathName == "saison_19") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "19"));
|
||||
} else if (lastPathName == "saison_20") {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", "20"));
|
||||
} else {
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("series-name", lastPathName));
|
||||
}
|
||||
}
|
||||
installVideoPath(_srv, itPath, basicKeyTmp);
|
||||
}
|
||||
// Add files :
|
||||
std::vector<std::string> listSubFile = node.folderGetSub(false, true, "*");
|
||||
for (auto &itFile : listSubFile) {
|
||||
std::map<std::string,std::string> basicKeyTmp = _basicKey;
|
||||
APPL_INFO("Add media : '" << itFile << "'");
|
||||
std::string extention = etk::tolower(std::string(itFile.begin()+itFile.size() -3, itFile.end()));
|
||||
if ( extention == "avi"
|
||||
|| extention == "mkv"
|
||||
|| extention == "mov"
|
||||
|| extention == "mp4") {
|
||||
|
||||
uint32_t mediaId = _srv.mediaAdd(zeus::File::create(itFile)).waitFor(echrono::seconds(20000)).get();
|
||||
if (mediaId == 0) {
|
||||
APPL_ERROR("Get media ID = 0 With no error");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Parse file name:
|
||||
std::string fileName = etk::split(itFile, '/').back();
|
||||
APPL_INFO("Find fileName : '" << fileName << "'");
|
||||
// Remove Date (XXXX)
|
||||
std::vector<std::string> dates;
|
||||
fileName = extractAndRemove(fileName, '(', ')', dates);
|
||||
if (dates.size() > 1) {
|
||||
APPL_INFO(" '" << fileName << "'");
|
||||
APPL_ERROR("Parse Date error : () : " << dates);
|
||||
} else if (dates.size() == 1) {
|
||||
APPL_INFO(" '" << fileName << "'");
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("date", dates[0]));
|
||||
}
|
||||
// Remove the actors [XXX YYY][EEE TTT]...
|
||||
std::vector<std::string> acthors;
|
||||
fileName = extractAndRemove(fileName, '[', ']', acthors);
|
||||
if (acthors.size() > 0) {
|
||||
APPL_INFO(" '" << fileName << "'");
|
||||
std::string actorList;
|
||||
for (auto &itActor : acthors) {
|
||||
if (actorList != "") {
|
||||
actorList += ";";
|
||||
}
|
||||
actorList += itActor;
|
||||
}
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("acthors", actorList));
|
||||
}
|
||||
|
||||
// remove extention
|
||||
fileName = std::string(fileName.begin(), fileName.begin() + fileName.size() - 4);
|
||||
|
||||
std::vector<std::string> listElementBase = etk::split(fileName, '-');
|
||||
|
||||
std::vector<std::string> listElement;
|
||||
std::string tmpStartString;
|
||||
for (size_t iii=0; iii<listElementBase.size(); ++iii) {
|
||||
if ( listElementBase[iii][0] != 's'
|
||||
&& listElementBase[iii][0] != 'e') {
|
||||
if (tmpStartString != "") {
|
||||
tmpStartString += '-';
|
||||
}
|
||||
tmpStartString += listElementBase[iii];
|
||||
} else {
|
||||
listElement.push_back(tmpStartString);
|
||||
tmpStartString = "";
|
||||
for (/* nothing to do */; iii<listElementBase.size(); ++iii) {
|
||||
listElement.push_back(listElementBase[iii]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (tmpStartString != "") {
|
||||
listElement.push_back(tmpStartString);
|
||||
}
|
||||
if (listElement.size() == 1) {
|
||||
// nothing to do , it might be a film ...
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("title", etk::to_string(listElement[0])));
|
||||
} else {
|
||||
/*
|
||||
for (auto &itt : listElement) {
|
||||
APPL_INFO(" " << itt);
|
||||
}
|
||||
*/
|
||||
if ( listElement.size() > 3
|
||||
&& listElement[1][0] == 's'
|
||||
&& listElement[2][0] == 'e') {
|
||||
// internal formalisme ...
|
||||
int32_t saison = -1;
|
||||
int32_t episode = -1;
|
||||
std::string seriesName = listElement[0];
|
||||
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("series-name", etk::to_string(seriesName)));
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("title", etk::to_string(listElement[3])));
|
||||
if (std::string(&listElement[1][1]) == "XX") {
|
||||
// saison unknow ... ==> nothing to do ...
|
||||
} else {
|
||||
saison = etk::string_to_int32_t(&listElement[1][1]);
|
||||
}
|
||||
if (std::string(&listElement[2][1]) == "XX") {
|
||||
// episode unknow ... ==> nothing to do ...
|
||||
} else {
|
||||
episode = etk::string_to_int32_t(&listElement[2][1]);
|
||||
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("episode", etk::to_string(episode)));
|
||||
}
|
||||
APPL_INFO("Find a internal mode series: :");
|
||||
APPL_INFO(" origin : '" << fileName << "'");
|
||||
std::string saisonPrint = "XX";
|
||||
std::string episodePrint = "XX";
|
||||
if (saison < 0) {
|
||||
// nothing to do
|
||||
} else if(saison < 10) {
|
||||
saisonPrint = "0" + etk::to_string(saison);
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", etk::to_string(saison)));
|
||||
} else {
|
||||
saisonPrint = etk::to_string(saison);
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("saison", etk::to_string(saison)));
|
||||
}
|
||||
if (episode < 0) {
|
||||
// nothing to do
|
||||
} else if(episode < 10) {
|
||||
episodePrint = "0" + etk::to_string(episode);
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("episode", etk::to_string(episode)));
|
||||
} else {
|
||||
episodePrint = etk::to_string(episode);
|
||||
basicKeyTmp.insert(std::pair<std::string,std::string>("episode", etk::to_string(episode)));
|
||||
}
|
||||
APPL_INFO(" recontituated: '" << seriesName << "-s" << saisonPrint << "-e" << episodePrint << "-" << listElement[3] << "'");
|
||||
}
|
||||
}
|
||||
|
||||
// send all meta data:
|
||||
zeus::FutureGroup group;
|
||||
for (auto &itKey : basicKeyTmp) {
|
||||
group.add(_srv.mediaMetadataSetKey(mediaId, itKey.first, itKey.second));
|
||||
}
|
||||
group.wait();
|
||||
|
||||
} else {
|
||||
APPL_ERROR("Sot send file : " << itFile << " Not manage extention...");
|
||||
}
|
||||
}
|
||||
}
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
elog::init(_argc, _argv);
|
||||
@ -329,7 +38,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
} else if (etk::start_with(data, "--from=") == true) {
|
||||
fromUser = &data[7];
|
||||
} else if (etk::start_with(data, "--to=") == true) {
|
||||
toUser = &data[7];
|
||||
toUser = &data[5];
|
||||
} else if (etk::start_with(data, "--pass=") == true) {
|
||||
pass = &data[7];
|
||||
} else if (etk::start_with(data, "--tocken=") == true) {
|
||||
@ -390,154 +99,12 @@ int main(int _argc, const char *_argv[]) {
|
||||
for (auto &it: retServiceList.get()) {
|
||||
APPL_INFO(" - " << it);
|
||||
}
|
||||
/*
|
||||
zeus::ServiceRemote localService = client1.getService("serviceTest1");
|
||||
if (localService.exist() == true) {
|
||||
double retCall = localService.call_d("mul", 13.1, 2.0);
|
||||
APPL_INFO("serviceTest1.mul = " << retCall);
|
||||
zeus::test::ProxyService1 srv = client1.getService("service1");
|
||||
if (srv.exist() == true) {
|
||||
auto retCall = srv.getU32(11);
|
||||
retCall.wait();
|
||||
APPL_INFO("value = " << retCall.get());
|
||||
}
|
||||
*/
|
||||
|
||||
if ( client1.waitForService("user") == true
|
||||
&& false) {
|
||||
|
||||
APPL_INFO(" ----------------------------------");
|
||||
APPL_INFO(" -- Get service system-user");
|
||||
APPL_INFO(" ----------------------------------");
|
||||
zeus::service::ProxyUser remoteServiceUser;
|
||||
remoteServiceUser = client1.getService("user");
|
||||
if (remoteServiceUser.exist() == true) {
|
||||
zeus::Future<std::vector<std::string>> retCall = remoteServiceUser.clientGroupsGet("clientTest1#atria-soft.com");
|
||||
retCall.wait();
|
||||
APPL_INFO("system-user.getGroups() = " << retCall.get());
|
||||
// system DOC
|
||||
zeus::Future<std::string> retDesc = remoteServiceUser.sys.getDescription();
|
||||
zeus::Future<std::string> retVersion = remoteServiceUser.sys.getVersion();
|
||||
zeus::Future<std::string> retType = remoteServiceUser.sys.getType();
|
||||
zeus::Future<std::vector<std::string>> retMaintainer = remoteServiceUser.sys.getAuthors();
|
||||
retDesc.wait();
|
||||
retVersion.wait();
|
||||
retType.wait();
|
||||
retMaintainer.wait();
|
||||
APPL_INFO("Service: system-user");
|
||||
APPL_INFO(" version : " << retVersion.get());
|
||||
APPL_INFO(" type : " << retType.get());
|
||||
APPL_INFO(" maintainer: " << retMaintainer.get().size());
|
||||
for (auto &it : retMaintainer.get()) {
|
||||
APPL_INFO(" - " << it);
|
||||
}
|
||||
APPL_INFO(" description:");
|
||||
APPL_INFO(" " << retDesc.get());
|
||||
APPL_INFO(" Function List:");
|
||||
zeus::Future<std::vector<std::string>> retFuctions = remoteServiceUser.sys.getFunctions().wait();
|
||||
for (auto it : retFuctions.get()) {
|
||||
echrono::Steady start = echrono::Steady::now();
|
||||
zeus::Future<std::string> retFunctionPrototype = remoteServiceUser.sys.getFunctionPrototype(it);
|
||||
zeus::Future<std::string> retFunctionHelp = remoteServiceUser.sys.getFunctionDescription(it);
|
||||
retFunctionPrototype.wait();
|
||||
retFunctionHelp.wait();
|
||||
echrono::Steady stop = echrono::Steady::now();
|
||||
APPL_INFO(" - " << retFunctionPrototype.get());
|
||||
APPL_INFO(" " << retFunctionHelp.get());
|
||||
APPL_INFO(" IO1=" << int64_t(retFunctionPrototype.getTransmitionTime().count()/1000)/1000.0 << " ms");
|
||||
APPL_INFO(" IO2=" << int64_t(retFunctionHelp.getTransmitionTime().count()/1000)/1000.0 << " ms");
|
||||
APPL_INFO(" IO*=" << (stop-start));
|
||||
}
|
||||
}
|
||||
}
|
||||
APPL_INFO(" ----------------------------------");
|
||||
APPL_INFO(" -- Get service picture");
|
||||
APPL_INFO(" ----------------------------------");
|
||||
if ( client1.waitForService("picture") == true
|
||||
&& false) {
|
||||
zeus::service::ProxyPicture remoteServicePicture = client1.getService("picture");
|
||||
if (remoteServicePicture.exist() == true) {
|
||||
// Send a full path:
|
||||
installPath(remoteServicePicture, "testPhoto", 0);
|
||||
} else {
|
||||
APPL_ERROR("Can not get service Picture ...");
|
||||
}
|
||||
}
|
||||
if ( client1.waitForService("picture") == true
|
||||
&& false) {
|
||||
zeus::service::ProxyPicture remoteServicePicture = client1.getService("picture");
|
||||
if (remoteServicePicture.exist() == true) {
|
||||
zeus::Future<std::vector<uint32_t>> retCall = remoteServicePicture.albumGetList().wait();
|
||||
if (retCall.hasError() == true) {
|
||||
APPL_INFO(" Get an error when getting list of albums ...");
|
||||
} else {
|
||||
APPL_INFO(" album list: ");
|
||||
for (auto &it : retCall.get()) {
|
||||
std::string name = remoteServicePicture.albumNameGet(it).wait().get();
|
||||
std::string desc = remoteServicePicture.albumDescriptionGet(it).wait().get();
|
||||
uint32_t retCount = remoteServicePicture.albumMediaCount(it).wait().get();
|
||||
uint32_t parentId = remoteServicePicture.albumParentGet(it).wait().get();
|
||||
|
||||
if (retCount != 0) {
|
||||
APPL_INFO(" - [" << it << "] '" << name << "' DESC=" << desc);
|
||||
if (parentId != 0) {
|
||||
APPL_INFO(" PARENT : " << parentId);
|
||||
}
|
||||
APPL_INFO(" " << retCount << " Medias");
|
||||
std::vector<uint32_t> retListImage = remoteServicePicture.albumMediaIdGet(it, 0, retCount).wait().get();
|
||||
for (auto &it3 : retListImage) {
|
||||
APPL_INFO(" - " << it3);
|
||||
}
|
||||
} else {
|
||||
APPL_INFO(" - " << it);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
echrono::Steady start = echrono::Steady::now();
|
||||
//ememory::SharedPtr<zeus::File> tmp = zeus::File::create("./tmpResult.bmp");
|
||||
ememory::SharedPtr<zeus::File> tmp = zeus::File::create("./testImage.png");
|
||||
//ememory::SharedPtr<zeus::File> tmp = zeus::File::create("./test_log.txt");
|
||||
int32_t size = tmp->getSize();
|
||||
auto retSendImage = remoteServicePicture.mediaAdd(tmp).wait();
|
||||
if (retSendImage.hasError() == true) {
|
||||
APPL_ERROR(" get an error while sending the File : '" << retSendImage.getErrorType() << "' help=" << retSendImage.getErrorHelp() );
|
||||
} else {
|
||||
echrono::Steady stop = echrono::Steady::now();
|
||||
APPL_WARNING(" IO*=" << (stop-start) << " " << retSendImage.get());
|
||||
double megaParSec = double(size)/(double((stop-start).count())/1000000000.0);
|
||||
APPL_WARNING(" speed=" << int64_t(megaParSec/1024.0)/1024.0 << " Mo/s");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
APPL_INFO(" ----------------------------------");
|
||||
APPL_INFO(" -- Get service video (send DATA) ");
|
||||
APPL_INFO(" ----------------------------------");
|
||||
if ( client1.waitForService("video") == true
|
||||
&& true) {
|
||||
zeus::service::ProxyVideo remoteServiceVideo = client1.getService("video");
|
||||
// remove all media (for test)
|
||||
if (remoteServiceVideo.exist() == true) {
|
||||
uint32_t count = remoteServiceVideo.mediaIdCount().wait().get();
|
||||
std::vector<uint32_t> list = remoteServiceVideo.mediaIdGet(0,count).wait().get();
|
||||
zeus::FutureGroup groupWait;
|
||||
for (auto& it : list) {
|
||||
APPL_INFO("remove ELEMENT : " << it);
|
||||
groupWait.add(remoteServiceVideo.mediaRemove(it));
|
||||
}
|
||||
groupWait.waitFor(echrono::seconds(2000));
|
||||
}
|
||||
|
||||
// Update path:
|
||||
if (remoteServiceVideo.exist() == true) {
|
||||
// Send a full path:
|
||||
installVideoPath(remoteServiceVideo, "testVideo");
|
||||
} else {
|
||||
APPL_ERROR("Can not get service Picture ...");
|
||||
}
|
||||
// List all data:
|
||||
if (remoteServiceVideo.exist() == true) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int32_t iii=0;
|
||||
while (iii < 3) {
|
||||
|
@ -28,9 +28,7 @@ def configure(target, my_module):
|
||||
my_module.add_path(".")
|
||||
my_module.add_depend([
|
||||
'zeus',
|
||||
'zeus-service-user',
|
||||
'zeus-service-picture',
|
||||
'zeus-service-video'
|
||||
'zeus-test-service1',
|
||||
])
|
||||
my_module.add_src_file([
|
||||
'appl/debug.cpp',
|
||||
|
@ -7,6 +7,6 @@
|
||||
#include <appl/debug.hpp>
|
||||
|
||||
int32_t appl::getLogId() {
|
||||
static int32_t g_val = elog::registerInstance("zeus-test-service1");
|
||||
static int32_t g_val = elog::registerInstance("test-service1");
|
||||
return g_val;
|
||||
}
|
||||
|
@ -17,13 +17,12 @@ namespace appl {
|
||||
#define APPL_CRITICAL(data) APPL_BASE(1, data)
|
||||
#define APPL_ERROR(data) APPL_BASE(2, data)
|
||||
#define APPL_WARNING(data) APPL_BASE(3, data)
|
||||
#define APPL_INFO(data) APPL_BASE(4, data)
|
||||
#ifdef DEBUG
|
||||
#define APPL_INFO(data) APPL_BASE(4, data)
|
||||
#define APPL_DEBUG(data) APPL_BASE(5, data)
|
||||
#define APPL_VERBOSE(data) APPL_BASE(6, data)
|
||||
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
|
||||
#else
|
||||
#define APPL_INFO(data) do { } while(false)
|
||||
#define APPL_DEBUG(data) do { } while(false)
|
||||
#define APPL_VERBOSE(data) do { } while(false)
|
||||
#define APPL_TODO(data) do { } while(false)
|
||||
|
@ -1,118 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <appl/debug.hpp>
|
||||
#include <zeus/Service.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <zeus/zeus.hpp>
|
||||
|
||||
|
||||
#include <etk/stdTools.hpp>
|
||||
namespace appl {
|
||||
class User {
|
||||
public:
|
||||
User() {
|
||||
APPL_WARNING("new USER");
|
||||
}
|
||||
~User() {
|
||||
APPL_WARNING("delete USER");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class UserManager {
|
||||
private:
|
||||
std::map<std::string, ememory::SharedPtr<appl::User>> m_listLoaded;
|
||||
public:
|
||||
UserManager() {
|
||||
|
||||
}
|
||||
ememory::SharedPtr<appl::User> getUser(const std::string& _userName) {
|
||||
// TODO : Lock ...
|
||||
auto it = m_listLoaded.find(_userName);
|
||||
if (it != m_listLoaded.end()) {
|
||||
// User already loaded:
|
||||
return it->second;
|
||||
}
|
||||
// load New User:
|
||||
ememory::SharedPtr<appl::User> tmp(new appl::User);
|
||||
m_listLoaded.insert(std::make_pair(_userName, tmp));
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
class Calculator {
|
||||
public:
|
||||
Calculator() {
|
||||
APPL_WARNING("New Calculator ...");
|
||||
}
|
||||
~Calculator() {
|
||||
APPL_WARNING("delete Calculator ...");
|
||||
}
|
||||
private:
|
||||
ememory::SharedPtr<appl::User> m_user;
|
||||
private:
|
||||
ememory::SharedPtr<zeus::ClientProperty> m_client;
|
||||
public:
|
||||
double mul(double _val1, double _val2) {
|
||||
return _val1*_val2;
|
||||
}
|
||||
public:
|
||||
Calculator(ememory::SharedPtr<appl::User> _user, ememory::SharedPtr<zeus::ClientProperty> _client) :
|
||||
m_user(_user),
|
||||
m_client(_client) {
|
||||
//advertise("mul", &appl::Service1::mul, "simple multiplication to test double IO");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
zeus::init(_argc, _argv);
|
||||
ememory::SharedPtr<appl::UserManager> userMng = ememory::makeShared<appl::UserManager>();
|
||||
zeus::ServiceType<appl::Calculator, appl::UserManager> serviceInterface(userMng);
|
||||
serviceInterface.setDescription("Calculator interface");
|
||||
serviceInterface.setVersion("0.1.1");
|
||||
serviceInterface.addAuthor("Heero Yui", "yui.heero@gmail.com");
|
||||
zeus::AbstractFunction* func = serviceInterface.advertise("mul", &appl::Calculator::mul);
|
||||
if (func != nullptr) {
|
||||
func->setDescription("simple multiplication to test double IO");
|
||||
func->addParam("val1", "First Parameter To multiply");
|
||||
func->addParam("val2", "Second Parameter To multiply");
|
||||
}
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
if (etk::start_with(data, "--ip=") == true) {
|
||||
serviceInterface.propertyIp.set(std::string(&data[5]));
|
||||
} else if (etk::start_with(data, "--port=") == true) {
|
||||
serviceInterface.propertyPort.set(etk::string_to_uint16_t(std::string(&data[7])));
|
||||
} else if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
APPL_PRINT(etk::getApplicationName() << " - help : ");
|
||||
APPL_PRINT(" " << _argv[0] << " [options]");
|
||||
APPL_PRINT(" --ip=XXX Server connection IP (default: 1.7.0.0.1)");
|
||||
APPL_PRINT(" --port=XXX Server connection PORT (default: 1983)");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
APPL_INFO("==================================");
|
||||
APPL_INFO("== ZEUS test service1 start ==");
|
||||
APPL_INFO("==================================");
|
||||
serviceInterface.propertyNameService.set("serviceTest1");
|
||||
serviceInterface.connect();
|
||||
int32_t iii=0;
|
||||
while (true) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
serviceInterface.pingIsAlive();
|
||||
APPL_INFO("service in waiting ... " << iii << "/inf");
|
||||
iii++;
|
||||
}
|
||||
serviceInterface.disconnect();
|
||||
APPL_INFO("==================================");
|
||||
APPL_INFO("== ZEUS test service1 stop ==");
|
||||
APPL_INFO("==================================");
|
||||
return 0;
|
||||
}
|
121
test/service1/appl/main-test-service1.cpp
Normal file
121
test/service1/appl/main-test-service1.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <appl/debug.hpp>
|
||||
#include <zeus/Object.hpp>
|
||||
#include <zeus/File.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <zeus/zeus.hpp>
|
||||
#include <echrono/Time.hpp>
|
||||
|
||||
#include <mutex>
|
||||
#include <ejson/ejson.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <sstream>
|
||||
|
||||
#include <etk/stdTools.hpp>
|
||||
|
||||
#include <zeus/test/Service1.hpp>
|
||||
#include <zeus/test/registerService1.hpp>
|
||||
#include <zeus/File.hpp>
|
||||
#include <zeus/ProxyFile.hpp>
|
||||
#include <zeus/zeus-Media.impl.hpp>
|
||||
|
||||
static std::mutex g_mutex;
|
||||
static std::string g_basePath;
|
||||
static std::string g_baseDBName = std::string(SERVICE_NAME) + "-database.json";
|
||||
|
||||
static std::vector<ememory::SharedPtr<zeus::MediaImpl>> m_listFile;
|
||||
|
||||
static uint64_t m_lastMaxId = 0;
|
||||
static bool g_needToStore = false;
|
||||
|
||||
static uint64_t createUniqueID() {
|
||||
m_lastMaxId++;
|
||||
return m_lastMaxId;
|
||||
}
|
||||
namespace appl {
|
||||
class TestService1 : public zeus::test::Service1 {
|
||||
private:
|
||||
std::string m_userName;
|
||||
public:
|
||||
TestService1(uint16_t _clientId) {
|
||||
APPL_VERBOSE("New TestService1 ... for user: " << _clientId);
|
||||
}
|
||||
~TestService1() {
|
||||
APPL_VERBOSE("delete TestService1 ...");
|
||||
}
|
||||
public:
|
||||
uint32_t getU32(uint32_t _value) override {
|
||||
return _value*2;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> getVU32(std::vector<uint32_t> _value) override {
|
||||
for (auto &it: _value) {
|
||||
it *= 2;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
std::string getString(std::string _value) override {
|
||||
return "get:'" + _value + "'";
|
||||
}
|
||||
void getVoid() override {
|
||||
// nothing to do ...;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static void store_db() {
|
||||
APPL_INFO("Store database [START]");
|
||||
ejson::Document database;
|
||||
ejson::Array listFilesArray;
|
||||
database.add("baseValue", ejson::String("plop"));
|
||||
bool retGenerate = database.storeSafe(g_basePath + g_baseDBName);
|
||||
APPL_INFO("Store database [STOP] : " << (g_basePath + g_baseDBName) << " ret = " << retGenerate);
|
||||
g_needToStore = false;
|
||||
}
|
||||
|
||||
static void load_db() {
|
||||
ejson::Document database;
|
||||
bool ret = database.load(g_basePath + g_baseDBName);
|
||||
if (ret == false) {
|
||||
APPL_WARNING(" ==> LOAD error");
|
||||
}
|
||||
g_needToStore = false;
|
||||
}
|
||||
|
||||
ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], std::string _basePath) {
|
||||
g_basePath = _basePath;
|
||||
std::unique_lock<std::mutex> lock(g_mutex);
|
||||
APPL_INFO("Load USER: " << g_basePath);
|
||||
load_db();
|
||||
APPL_INFO("new USER: [STOP]");
|
||||
return true;
|
||||
}
|
||||
|
||||
ETK_EXPORT_API bool SERVICE_IO_uninit() {
|
||||
std::unique_lock<std::mutex> lock(g_mutex);
|
||||
store_db();
|
||||
APPL_INFO("delete USER [STOP]");
|
||||
return true;
|
||||
}
|
||||
|
||||
ETK_EXPORT_API void SERVICE_IO_peridic_call() {
|
||||
if (g_needToStore == false) {
|
||||
return;
|
||||
}
|
||||
// try lock mutex:
|
||||
if (g_mutex.try_lock() == false) {
|
||||
return;
|
||||
}
|
||||
store_db();
|
||||
g_mutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
ZEUS_TEST_SERVICE1_DECLARE(appl::TestService1);
|
||||
|
20
test/service1/appl/zeus-test-service1.srv.zeus.idl
Normal file
20
test/service1/appl/zeus-test-service1.srv.zeus.idl
Normal file
@ -0,0 +1,20 @@
|
||||
#elem-brief: picture interface management
|
||||
#elem-version: 1.0
|
||||
#elem-type:PICTURE
|
||||
#elem-author:Heero Yui<yui.heero@gmail.com
|
||||
|
||||
|
||||
#brief:Title of the fucntion
|
||||
#param:parameterName:description of the parameter
|
||||
#return:Return description of the function
|
||||
uint32 getU32(uint32)
|
||||
|
||||
|
||||
vector:uint32 getVU32(vector:uint32)
|
||||
|
||||
|
||||
string getString(string)
|
||||
|
||||
|
||||
void getVoid()
|
||||
|
36
test/service1/lutin_zeus-test-package.py
Normal file
36
test/service1/lutin_zeus-test-package.py
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.debug as debug
|
||||
import lutin.tools as tools
|
||||
|
||||
|
||||
def get_type():
|
||||
return "PACKAGE"
|
||||
|
||||
def get_desc():
|
||||
return "ZEUS package group to set it usable"
|
||||
|
||||
def get_licence():
|
||||
return "MPL-2"
|
||||
|
||||
def get_compagny_type():
|
||||
return "com"
|
||||
|
||||
def get_compagny_name():
|
||||
return "atria-soft"
|
||||
|
||||
def get_maintainer():
|
||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||
|
||||
def configure(target, my_module):
|
||||
my_module.add_depend([
|
||||
'zeus-router',
|
||||
'zeus-gateway',
|
||||
'zeus-test-service1-impl',
|
||||
'zeus-service-user-impl',
|
||||
'zeus-launcher',
|
||||
'zeus-test-client',
|
||||
])
|
||||
return True
|
||||
|
||||
|
||||
|
43
test/service1/lutin_zeus-test-service1-impl.py
Normal file
43
test/service1/lutin_zeus-test-service1-impl.py
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.debug as debug
|
||||
import lutin.tools as tools
|
||||
|
||||
|
||||
def get_type():
|
||||
return "LIBRARY_DYNAMIC"
|
||||
#return "BINARY"
|
||||
|
||||
def get_sub_type():
|
||||
return "TOOLS"
|
||||
|
||||
def get_desc():
|
||||
return "ZEUS test service1"
|
||||
|
||||
def get_licence():
|
||||
return "MPL-2"
|
||||
|
||||
def get_compagny_type():
|
||||
return "com"
|
||||
|
||||
def get_compagny_name():
|
||||
return "atria-soft"
|
||||
|
||||
def get_maintainer():
|
||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||
|
||||
def configure(target, my_module):
|
||||
my_module.add_path(".")
|
||||
my_module.add_depend([
|
||||
'zeus',
|
||||
'ejson',
|
||||
'zeus-test-service1'
|
||||
])
|
||||
my_module.add_src_file([
|
||||
'appl/debug.cpp',
|
||||
'appl/main-test-service1.cpp'
|
||||
])
|
||||
my_module.add_flag('c++', "-DSERVICE_NAME=\"\\\"test-service1\\\"\"")
|
||||
return True
|
||||
|
||||
|
||||
|
@ -1,16 +1,18 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.debug as debug
|
||||
import lutin.tools as tools
|
||||
import lutin.macro as macro
|
||||
|
||||
|
||||
def get_type():
|
||||
return "BINARY"
|
||||
return "LIBRARY"
|
||||
#return "BINARY"
|
||||
|
||||
def get_sub_type():
|
||||
return "TOOLS"
|
||||
|
||||
def get_desc():
|
||||
return "ZEUS test service"
|
||||
return "ZEUS test service1"
|
||||
|
||||
def get_licence():
|
||||
return "MPL-2"
|
||||
@ -25,12 +27,14 @@ def get_maintainer():
|
||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||
|
||||
def configure(target, my_module):
|
||||
my_module.add_path(".")
|
||||
my_module.add_depend(['zeus'])
|
||||
my_module.add_src_file([
|
||||
'appl/debug.cpp',
|
||||
'appl/main-test-service.cpp'
|
||||
my_module.add_depend([
|
||||
'zeus'
|
||||
])
|
||||
|
||||
zeus_macro = macro.load_macro('zeus')
|
||||
zeus_macro.parse_object_idl(my_module, 'appl/zeus-test-service1.srv.zeus.idl')
|
||||
|
||||
my_module.add_flag('c++', "-DSERVICE_NAME=\"\\\"test-service1\\\"\"")
|
||||
return True
|
||||
|
||||
|
||||
|
@ -261,7 +261,7 @@ void appl::GateWay::cleanIO() {
|
||||
// send the message the interface has been removed
|
||||
zeus::WebServer* iface = it->getInterface();
|
||||
uint16_t id = it->getId();
|
||||
iface->event(ZEUS_ID_GATEWAY, uint32_t(id)<<16, "removeInterface", tmpIDToRemove);
|
||||
iface->call(ZEUS_ID_GATEWAY, uint32_t(id)<<16, "removeInterface", tmpIDToRemove);
|
||||
APPL_WARNING("Send it to :" << id << " " << tmpIDToRemove);
|
||||
}
|
||||
}
|
||||
|
@ -69,18 +69,6 @@ void appl::IOInterface::receive(ememory::SharedPtr<zeus::Message> _value) {
|
||||
// Check if we are the destinated Of this message
|
||||
if ( _value->getDestinationId() == ZEUS_ID_GATEWAY
|
||||
&& _value->getDestinationObjectId() == ZEUS_ID_GATEWAY_OBJECT) {
|
||||
if (_value->getType() == zeus::message::type::event) {
|
||||
ememory::SharedPtr<zeus::message::Event> eventObj = ememory::staticPointerCast<zeus::message::Event>(_value);
|
||||
std::string event = eventObj->getCall();
|
||||
if (event == "removeRouterClient") {
|
||||
// TODO : Broadcast that an IO is remoed ...
|
||||
m_state = appl::clientState::unconnect;
|
||||
} else {
|
||||
APPL_ERROR("Protocol error ==>missing 'call'");
|
||||
answerProtocolError(transactionId, "missing parameter: 'event' ... ");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_value->getType() != zeus::message::type::call) {
|
||||
APPL_ERROR("Protocol error ==>missing 'call'");
|
||||
answerProtocolError(transactionId, "missing parameter: 'call' / wrong type 'call'");
|
||||
@ -88,6 +76,10 @@ void appl::IOInterface::receive(ememory::SharedPtr<zeus::Message> _value) {
|
||||
}
|
||||
ememory::SharedPtr<zeus::message::Call> callObj = ememory::staticPointerCast<zeus::message::Call>(_value);
|
||||
std::string callFunction = callObj->getCall();
|
||||
if (callFunction == "removeRouterClient") {
|
||||
// TODO : Broadcast that an IO is remoed ...
|
||||
m_state = appl::clientState::unconnect;
|
||||
}
|
||||
switch (m_state) {
|
||||
case appl::clientState::disconnect:
|
||||
case appl::clientState::unconnect:
|
||||
|
@ -397,11 +397,10 @@ void appl::MediaDecoder::init(ememory::SharedPtr<ClientProperty> _property, uint
|
||||
m_remote->m_fileHandle = _proxy;
|
||||
APPL_WARNING("We have handle");
|
||||
m_remote->m_fileHandle.getSize().andThen(
|
||||
[=](const uint64_t& _value) mutable {
|
||||
[=](uint64_t _value) {
|
||||
APPL_WARNING("Receive FileSize to index property");
|
||||
uint64_t sizeOfBuffer = _value;
|
||||
APPL_WARNING("pppllloooppp " << sizeOfBuffer);
|
||||
m_remote->m_buffer.resize(sizeOfBuffer, 0);
|
||||
APPL_WARNING("pppllloooppp " << _value);
|
||||
m_remote->m_buffer.resize(_value, 0);
|
||||
APPL_WARNING("pppllloooppp");
|
||||
m_remote->checkIfWeNeedMoreDataFromNetwork();
|
||||
APPL_WARNING("pppppplllllloooooopppppp");
|
||||
@ -638,7 +637,7 @@ void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
|
||||
APPL_DEBUG("Request DATA : " << m_bufferReadPosition << " size=" << sizeRequest);
|
||||
auto futData = m_fileHandle.getPart(m_bufferReadPosition, m_bufferReadPosition+sizeRequest);
|
||||
auto localShared = ememory::dynamicPointerCast<appl::StreamBuffering>(sharedFromThis());
|
||||
futData.andThen([=](const zeus::Raw& _value) mutable {
|
||||
futData.andThen([=](zeus::Raw _value) mutable {
|
||||
return localShared->addDataCallback(_value, m_bufferReadPosition);
|
||||
});
|
||||
m_callInProgress = true;
|
||||
@ -660,7 +659,7 @@ void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
|
||||
APPL_DEBUG("Request DATA : " << m_bufferReadPosition << " size=" << sizeRequest);
|
||||
auto futData = m_fileHandle.getPart(m_bufferReadPosition, m_bufferReadPosition + sizeRequest);
|
||||
auto localShared = ememory::dynamicPointerCast<appl::StreamBuffering>(sharedFromThis());
|
||||
futData.andThen([=](const zeus::Raw& _value) mutable {
|
||||
futData.andThen([=](zeus::Raw _value) mutable {
|
||||
return localShared->addDataCallback(_value, m_bufferReadPosition);
|
||||
});
|
||||
m_callInProgress = true;
|
||||
|
@ -89,7 +89,7 @@ void appl::ElementProperty::loadData() {
|
||||
m_widget->markToRedraw();
|
||||
return true;
|
||||
});
|
||||
futMedia.andThen([=](const zeus::ProxyMedia& _media) mutable {
|
||||
futMedia.andThen([=](zeus::ProxyMedia _media) mutable {
|
||||
APPL_INFO(" [" << tmpProperty->m_id << "] get media: " << tmpProperty->m_id);
|
||||
if (_media.exist() == false) {
|
||||
APPL_ERROR("get media error");
|
||||
@ -113,7 +113,7 @@ void appl::ElementProperty::loadData() {
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.andThen([=](const std::string& _value) mutable {
|
||||
.andThen([=](std::string _value) mutable {
|
||||
APPL_INFO(" [" << tmpProperty->m_id << "] get title: " << _value);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
|
||||
@ -140,7 +140,7 @@ void appl::ElementProperty::loadData() {
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.andThen([=](const std::string& _value) mutable {
|
||||
.andThen([=](std::string _value) mutable {
|
||||
APPL_ERROR(" [" << tmpProperty->m_id << "] get serie: " << _value);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
|
||||
@ -167,7 +167,7 @@ void appl::ElementProperty::loadData() {
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.andThen([=](const std::string& _value) mutable {
|
||||
.andThen([=](std::string _value) mutable {
|
||||
APPL_INFO(" [" << tmpProperty->m_id << "] get saison: " << _value);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
|
||||
@ -194,7 +194,7 @@ void appl::ElementProperty::loadData() {
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.andThen([=](const std::string& _value) mutable {
|
||||
.andThen([=](std::string _value) mutable {
|
||||
APPL_INFO(" [" << tmpProperty->m_id << "] get episode: " << _value);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
|
||||
@ -221,7 +221,7 @@ void appl::ElementProperty::loadData() {
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.andThen([=](const std::string& _value) mutable {
|
||||
.andThen([=](std::string _value) mutable {
|
||||
APPL_INFO(" [" << tmpProperty->m_id << "] get description: " << _value);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
|
||||
@ -248,7 +248,7 @@ void appl::ElementProperty::loadData() {
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.andThen([=](const std::string& _value) mutable {
|
||||
.andThen([=](std::string _value) mutable {
|
||||
APPL_INFO(" [" << tmpProperty->m_id << "] get production-methode: " << _value);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
|
||||
@ -275,7 +275,7 @@ void appl::ElementProperty::loadData() {
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.andThen([=](const std::string& _value) mutable {
|
||||
.andThen([=](std::string _value) mutable {
|
||||
APPL_INFO(" [" << tmpProperty->m_id << "] get type: " << _value);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
|
||||
@ -302,7 +302,7 @@ void appl::ElementProperty::loadData() {
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.andThen([=](const std::string& _value) mutable {
|
||||
.andThen([=](std::string _value) mutable {
|
||||
APPL_INFO(" [" << tmpProperty->m_id << "] get mine-type: " << _value);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
|
||||
|
@ -95,7 +95,7 @@ void appl::GateWayInterface::rmClient(ememory::SharedPtr<appl::ClientInterface>
|
||||
++it;
|
||||
}
|
||||
}
|
||||
m_interfaceClient.event(uint32_t(id)<<16, ZEUS_ID_GATEWAY, "removeRouterClient", id);
|
||||
m_interfaceClient.call(uint32_t(id)<<16, ZEUS_ID_GATEWAY, "removeRouterClient", id);
|
||||
}
|
||||
|
||||
void appl::GateWayInterface::onServiceData(ememory::SharedPtr<zeus::Message> _value) {
|
||||
|
@ -79,13 +79,8 @@ namespace zeus {
|
||||
* @brief Attach callback on a specific return action (SUCESS)
|
||||
* @param[in] _callback Handle on the function to call in case of sucess on the call
|
||||
*/
|
||||
Future<ZEUS_RETURN>& andThen(ObserverFut _callback) {
|
||||
zeus::FutureBase::andThen(
|
||||
[=](zeus::FutureBase _fut) {
|
||||
return _callback(zeus::Future<ZEUS_RETURN>(_fut));
|
||||
});
|
||||
return *this;
|
||||
}
|
||||
/*
|
||||
note : this is anbigous ???
|
||||
Future<ZEUS_RETURN>& andThen(std::function<bool(const ZEUS_RETURN&)> _callback) {
|
||||
zeus::FutureBase::andThen(
|
||||
[=](zeus::FutureBase _fut) {
|
||||
@ -94,6 +89,7 @@ namespace zeus {
|
||||
});
|
||||
return *this;
|
||||
}
|
||||
*/
|
||||
Future<ZEUS_RETURN>& andThen(std::function<bool(ZEUS_RETURN)> _callback) {
|
||||
zeus::FutureBase::andThen(
|
||||
[=](zeus::FutureBase _fut) {
|
||||
@ -101,6 +97,14 @@ namespace zeus {
|
||||
});
|
||||
return *this;
|
||||
}
|
||||
/*
|
||||
Future<ZEUS_RETURN>& andThen(ObserverFut _callback) {
|
||||
zeus::FutureBase::andThen(
|
||||
[=](zeus::FutureBase _fut) {
|
||||
return _callback(zeus::Future<ZEUS_RETURN>(_fut));
|
||||
});
|
||||
return *this;
|
||||
}*/
|
||||
/**
|
||||
* @brief Attach callback on a specific return action (ERROR)
|
||||
* @param[in] _callback Handle on the function to call in case of error on the call
|
||||
|
Loading…
x
Reference in New Issue
Block a user