[DEV] remove STL

This commit is contained in:
Edouard DUPIN 2017-09-07 23:38:26 +02:00
parent b1b52cef16
commit dff27aed6d
24 changed files with 188 additions and 188 deletions

View File

@ -11,7 +11,7 @@
#include <zeus/zeus.hpp>
#include <echrono/Time.hpp>
#include <mutex>
#include <ethread/Mutex.hpp>
#include <ejson/ejson.hpp>
#include <etk/os/FSNode.hpp>
#include <sstream>
@ -24,7 +24,7 @@
#include <zeus/ProxyFile.hpp>
#include <zeus/zeus-Media.impl.hpp>
static std::mutex g_mutex;
static ethread::Mutex g_mutex;
static etk::String g_basePath;
static etk::String g_baseDBName = etk::String(SERVICE_NAME) + "-database.json";
@ -96,7 +96,7 @@ static void load_db() {
ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], etk::String _basePath) {
g_basePath = _basePath;
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
APPL_INFO("Load USER: " << g_basePath);
load_db();
APPL_INFO("new USER: [STOP]");
@ -104,7 +104,7 @@ ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], etk::String
}
ETK_EXPORT_API bool SERVICE_IO_uninit() {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
store_db();
APPL_INFO("delete USER [STOP]");
return true;

View File

@ -15,7 +15,7 @@ namespace appl {
class TcpServerInput {
private:
enet::TcpServer m_interface;
std::thread* m_thread;
ethread::Thread* m_thread;
bool m_threadRunning;
appl::GateWay* m_gateway;
public:
@ -32,7 +32,7 @@ namespace appl {
m_interface.link();
m_threadRunning = true;
APPL_INFO("Start waiting on " << _host << " " << _port);
m_thread = new std::thread([&](void *){ this->threadCallback();}, nullptr);
m_thread = new ethread::Thread([&](void *){ this->threadCallback();}, nullptr);
if (m_thread == nullptr) {
m_threadRunning = false;
APPL_ERROR("creating callback thread!");

View File

@ -15,13 +15,13 @@
#define GATEWAY_ENABLE_LAUNCHER
#ifdef GATEWAY_ENABLE_LAUNCHER
#include <mutex>
#include <ethread/Mutex.hpp>
#include <etk/os/FSNode.hpp>
#include <sstream>
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <thread>
#include <ethread/Thread.hpp>
#include <etk/stdTools.hpp>
#include <zeus/Object.hpp>
#include <zeus/Client.hpp>

View File

@ -7,13 +7,13 @@
#include <appl/debug.hpp>
#include <etk/etk.hpp>
#include <mutex>
#include <ethread/Mutex.hpp>
#include <etk/os/FSNode.hpp>
#include <sstream>
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <thread>
#include <ethread/Thread.hpp>
#include <etk/stdTools.hpp>
#include <zeus/Object.hpp>
#include <zeus/Client.hpp>

View File

@ -490,7 +490,7 @@ int appl::MediaDecoder::readFunc(uint8_t* _buf, int _bufSize) {
}
// Real Load of the data:
{
std::unique_lock<std::mutex> lock(m_remote->m_mutex);
std::unique_lock<ethread::Mutex> lock(m_remote->m_mutex);
memcpy(_buf, &m_remote->m_buffer[m_remote->m_bufferReadPosition], _bufSize);
m_remote->m_bufferReadPosition += _bufSize;
}
@ -499,7 +499,7 @@ int appl::MediaDecoder::readFunc(uint8_t* _buf, int _bufSize) {
}
int32_t appl::StreamBuffering::sizeReadable() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
for (auto &it : m_bufferFillSection) {
if ( m_bufferReadPosition >= it.first
&& m_bufferReadPosition < it.second) {
@ -561,7 +561,7 @@ bool appl::StreamBuffering::addDataCallback(const zeus::Raw& _data, int64_t _pos
std::this_thread::sleep_for(std::chrono::milliseconds(10));
#endif
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
bool find = false;
m_callInProgress = false;
// TODO : Check buffer size ...
@ -609,24 +609,24 @@ bool appl::StreamBuffering::addDataCallback(const zeus::Raw& _data, int64_t _pos
appl::StreamBuffering::StreamBuffering() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_callInProgress = false;
m_stopRequested = false;
m_mediaId = 0;
m_bufferReadPosition = 0;
}
void appl::StreamBuffering::stopStream() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_stopRequested = true;
}
void appl::StreamBuffering::startStream() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_stopRequested = false;
}
// TODO: Add requested section ...
void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
// check if enought data:
bool find = false;
if (m_callInProgress == true) {

View File

@ -60,7 +60,7 @@ namespace appl {
class StreamBuffering : public ememory::EnableSharedFromThis<StreamBuffering> {
public:
StreamBuffering();
std::mutex m_mutex; //!< local Lock Data protection
ethread::Mutex m_mutex; //!< local Lock Data protection
ememory::SharedPtr<appl::ClientProperty> m_property; //!< Remote interface that must get data
uint32_t m_mediaId; //!< remote media ID that need to get data
zeus::ProxyFile m_fileHandle; //!< Reference on the remote file
@ -73,11 +73,11 @@ namespace appl {
bool addDataCallback(const zeus::Raw& _data, int64_t _positionRequest);
void checkIfWeNeedMoreDataFromNetwork();
uint64_t getSize() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
return m_buffer.size();
}
etk::Vector<etk::Pair<uint32_t,uint32_t>> getDownloadPart() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
return m_bufferFillSection;
}
int32_t sizeReadable();

View File

@ -70,7 +70,7 @@ void appl::widget::ListViewer::searchElements(etk::String _filter) {
void appl::ElementProperty::loadData() {
// Check progression status:
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_metadataUpdated != appl::statusLoadingData::noData) {
return;
}
@ -83,7 +83,7 @@ void appl::ElementProperty::loadData() {
futMedia.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get media error: " << tmpProperty->m_id);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_title = "[ERROR] can not get media informations <br/>" + _error + ": " + _help;
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
}
@ -95,7 +95,7 @@ void appl::ElementProperty::loadData() {
if (_media.exist() == false) {
APPL_ERROR("get media error");
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_title = "[ERROR] can not get media informations (2)";
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
}
@ -105,7 +105,7 @@ void appl::ElementProperty::loadData() {
_media.getMetadata("title")
.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -116,12 +116,12 @@ void appl::ElementProperty::loadData() {
.andThen([=](etk::String _value) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get title: " << _value);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_title = _value;
}
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -132,7 +132,7 @@ void appl::ElementProperty::loadData() {
_media.getMetadata("series-name")
.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -143,12 +143,12 @@ void appl::ElementProperty::loadData() {
.andThen([=](etk::String _value) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get serie: " << _value);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_serie = _value;
}
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -159,7 +159,7 @@ void appl::ElementProperty::loadData() {
_media.getMetadata("saison")
.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -170,12 +170,12 @@ void appl::ElementProperty::loadData() {
.andThen([=](etk::String _value) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get saison: " << _value);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_saison = _value;
}
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -186,7 +186,7 @@ void appl::ElementProperty::loadData() {
_media.getMetadata("episode")
.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -197,12 +197,12 @@ void appl::ElementProperty::loadData() {
.andThen([=](etk::String _value) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get episode: " << _value);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_episode = _value;
}
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -214,7 +214,7 @@ void appl::ElementProperty::loadData() {
.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
APPL_INFO("Get remot error : " << _error << " " << _help);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -225,12 +225,12 @@ void appl::ElementProperty::loadData() {
.andThen([=](etk::String _value) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get description: " << _value);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_description = _value;
}
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -241,7 +241,7 @@ void appl::ElementProperty::loadData() {
_media.getMetadata("production-methode")
.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -252,12 +252,12 @@ void appl::ElementProperty::loadData() {
.andThen([=](etk::String _value) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get production-methode: " << _value);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_productMethode = _value;
}
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -268,7 +268,7 @@ void appl::ElementProperty::loadData() {
_media.getMetadata("type")
.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -279,12 +279,12 @@ void appl::ElementProperty::loadData() {
.andThen([=](etk::String _value) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get type: " << _value);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_type = _value;
}
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -295,7 +295,7 @@ void appl::ElementProperty::loadData() {
_media.getMineType()
.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -306,7 +306,7 @@ void appl::ElementProperty::loadData() {
.andThen([=](etk::String _value) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get mine-type: " << _value);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_mineType = _value;
if (etk::start_with(tmpProperty->m_mineType, "video") == true) {
// TODO : Optimise this ...
@ -318,7 +318,7 @@ void appl::ElementProperty::loadData() {
}
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -336,7 +336,7 @@ void appl::ElementProperty::loadData() {
std::this_thread::sleep_for(std::chrono::milliseconds(400));
etk::String serie;
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
serie = tmpProperty->m_serie;
}
if (serie != "") {
@ -345,7 +345,7 @@ void appl::ElementProperty::loadData() {
APPL_INFO(" [" << tmpProperty->m_id << "] get cover Group error: " << serie << ": " << _help);
{
m_widget->markToRedraw();
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -361,14 +361,14 @@ void appl::ElementProperty::loadData() {
etk::String mineType = mineTypeFut.wait().get();
APPL_INFO(" [" << tmpProperty->m_id << "] get cover Group on: " << serie << " mineType '" << mineType << "'");
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_thumb = egami::load(mineType, bufferData);
tmpProperty->m_thumbPresent = true;
}
APPL_WARNING("Get the Thumb ... " << tmpProperty->m_title << " ==> " << tmpProperty->m_thumb);
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -378,7 +378,7 @@ void appl::ElementProperty::loadData() {
});
} else {
m_widget->markToRedraw();
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -394,14 +394,14 @@ void appl::ElementProperty::loadData() {
etk::String mineType = mineTypeFut.wait().get();
APPL_INFO(" [" << tmpProperty->m_id << "] get cover on: " << tmpProperty->m_id << " mineType '" << mineType << "'");
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_thumb = egami::load(mineType, bufferData);
tmpProperty->m_thumbPresent = true;
}
APPL_WARNING("Get the Thumb ... " << tmpProperty->m_title << " ==> " << tmpProperty->m_thumb);
m_widget->markToRedraw();
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_nbElementLoaded++;
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
@ -412,13 +412,13 @@ void appl::ElementProperty::loadData() {
}
bool appl::ElementProperty::LoadDataEnded() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
return m_metadataUpdated == appl::statusLoadingData::done;
}
void appl::ElementPropertyGroup::loadData() {
// Check progression status:
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_metadataUpdated != appl::statusLoadingData::noData) {
return;
}
@ -430,7 +430,7 @@ void appl::ElementPropertyGroup::loadData() {
futMedia.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
APPL_INFO(" [" << tmpProperty->m_id << "] get cover error on group: " << tmpProperty->m_title << ": " << _help);
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
}
m_widget->markToRedraw();
@ -444,7 +444,7 @@ void appl::ElementPropertyGroup::loadData() {
etk::String mineType = mineTypeFut.wait().get();
APPL_INFO(" [" << tmpProperty->m_id << "] get cover on group: " << tmpProperty->m_title << " mineType '" << mineType << "'");
{
std::unique_lock<std::mutex> lock(tmpProperty->m_mutex);
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
tmpProperty->m_thumb = egami::load(mineType, bufferData);
tmpProperty->m_thumbPresent = true;
}
@ -456,7 +456,7 @@ void appl::ElementPropertyGroup::loadData() {
}
bool appl::ElementPropertyGroup::LoadDataEnded() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
return m_metadataUpdated == appl::statusLoadingData::done;
}
@ -775,7 +775,7 @@ void appl::ElementDisplayed::generateDisplay(vec2 _startPos, vec2 _size) {
if (m_property->LoadDataEnded() == false) {
textToDisplay += "<br/><i>Loading in progress</i> ... " + etk::toString(m_property->m_nbElementLoaded) + "/8";
} else {
std::unique_lock<std::mutex> lock(m_property->m_mutex);
std::unique_lock<ethread::Mutex> lock(m_property->m_mutex);
//m_text.setClipping(drawClippingPos, drawClippingSize);
textToDisplay = "<b>" + m_property->m_title + "</b><br/>";
bool newLine = false;
@ -821,7 +821,7 @@ void appl::ElementDisplayed::generateDisplay(vec2 _startPos, vec2 _size) {
haveThumb = false;
m_image.setSource("DATA:Home.svg", 128);
} else {
std::unique_lock<std::mutex> lock(m_property->m_mutex);
std::unique_lock<ethread::Mutex> lock(m_property->m_mutex);
if (m_property->m_thumbPresent == true) {
haveThumb = true;
m_image.setSource(m_property->m_thumb);
@ -847,7 +847,7 @@ void appl::ElementDisplayed::generateDisplay(vec2 _startPos, vec2 _size) {
if (m_propertyGroup->LoadDataEnded() == false) {
haveThumb = false;
} else {
std::unique_lock<std::mutex> lock(m_propertyGroup->m_mutex);
std::unique_lock<ethread::Mutex> lock(m_propertyGroup->m_mutex);
if (m_propertyGroup->m_thumbPresent == true) {
haveThumb = true;
m_image.setSource(m_propertyGroup->m_thumb);

View File

@ -41,7 +41,7 @@ namespace appl {
uint32_t m_nbElementLoaded; //!< this cont the number of lement loaded to set tle media full loaded
public:
bool LoadDataEnded();
std::mutex m_mutex;
ethread::Mutex m_mutex;
uint64_t m_id; //!< Remote Id of the Media
egami::Image m_thumb; //!< simple image describing the element
@ -77,7 +77,7 @@ namespace appl {
public:
bool LoadDataEnded();
public:
std::mutex m_mutex;
ethread::Mutex m_mutex;
uint64_t m_id; //!< Remote Id of the Media
etk::String m_title; //!< Title of the Group
etk::String m_filter; //!< element to add in the filter

View File

@ -66,7 +66,7 @@ namespace appl {
class TcpServerInput {
private:
enet::TcpServer m_interface;
std::thread* m_thread;
ethread::Thread* m_thread;
bool m_threadRunning;
appl::Router* m_router;
bool m_service;
@ -84,7 +84,7 @@ namespace appl {
m_interface.setPort(_port);
m_interface.link();
m_threadRunning = true;
m_thread = new std::thread([&](void *){ this->threadCallback();}, nullptr);
m_thread = new ethread::Thread([&](void *){ this->threadCallback();}, nullptr);
if (m_thread == nullptr) {
m_threadRunning = false;
ZEUS_ERROR("creating callback thread!");

View File

@ -11,7 +11,7 @@
#include <zeus/zeus.hpp>
#include <echrono/Time.hpp>
#include <mutex>
#include <ethread/Mutex.hpp>
#include <ejson/ejson.hpp>
#include <etk/os/FSNode.hpp>
#include <sstream>
@ -24,7 +24,7 @@
#include <zeus/File.hpp>
#include <zeus/ProxyFile.hpp>
static std::mutex g_mutex;
static ethread::Mutex g_mutex;
static etk::String g_basePath;
static etk::String g_baseDBName = etk::String(SERVICE_NAME) + "-database.json";
class FileProperty {
@ -78,13 +78,13 @@ namespace appl {
}
public:
uint32_t mediaIdCount() override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
return m_listFile.size();
}
etk::Vector<uint32_t> mediaIdGetRange(uint32_t _start, uint32_t _stop) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
etk::Vector<uint32_t> out;
for (size_t iii=_start; iii<m_listFile.size() && iii<_stop; ++iii) {
@ -94,7 +94,7 @@ namespace appl {
}
// Return a File Data (might be a picture .tiff/.png/.jpg)
ememory::SharedPtr<zeus::File> mediaGet(uint32_t _mediaId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
//Check if the file exist:
bool find = false;
@ -112,7 +112,7 @@ namespace appl {
return zeus::File::create(g_basePath + property.m_fileName + "." + zeus::getExtention(property.m_mineType), "", property.m_mineType);
}
uint32_t mediaAdd(zeus::ProxyFile _dataFile) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
uint64_t id = createUniqueID();
@ -151,7 +151,7 @@ namespace appl {
return id;
}
void mediaRemove(uint32_t _mediaId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
//Check if the file exist:
bool find = false;
@ -229,7 +229,7 @@ namespace appl {
throw std::invalid_argument("Wrong Album ID ...");
}
uint32_t albumCreate(etk::String _albumName) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
for (auto &it : m_listAlbum) {
if (it.m_name == _albumName) {
@ -245,7 +245,7 @@ namespace appl {
void albumRemove(uint32_t _albumId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
for (auto it = m_listAlbum.begin();
it != m_listAlbum.end();
@ -259,7 +259,7 @@ namespace appl {
throw std::invalid_argument("Wrong Album ID ...");
}
etk::Vector<uint32_t> albumGetList() override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
etk::Vector<uint32_t> out;
for (auto &it : m_listAlbum) {
out.pushBack(it.m_id);
@ -267,7 +267,7 @@ namespace appl {
return out;
}
etk::String albumNameGet(uint32_t _albumId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
return it.m_name;
@ -277,7 +277,7 @@ namespace appl {
return "";
}
void albumNameSet(uint32_t _albumId, etk::String _albumName) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
it.m_name = _albumName;
@ -287,7 +287,7 @@ namespace appl {
throw std::invalid_argument("Wrong Album ID ...");
}
etk::String albumDescriptionGet(uint32_t _albumId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
return it.m_description;
@ -297,7 +297,7 @@ namespace appl {
return "";
}
void albumDescriptionSet(uint32_t _albumId, etk::String _desc) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
it.m_description = _desc;
@ -307,7 +307,7 @@ namespace appl {
throw std::invalid_argument("Wrong Album ID ...");
}
void albumMediaAdd(uint32_t _albumId, uint32_t _mediaId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
for (auto &elem : it.m_listMedia) {
@ -323,7 +323,7 @@ namespace appl {
throw std::invalid_argument("Wrong Album ID ...");
}
void albumMediaRemove(uint32_t _albumId, uint32_t _mediaId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
for (auto elem = it.m_listMedia.begin();
@ -342,7 +342,7 @@ namespace appl {
throw std::invalid_argument("Wrong Album ID ...");
}
uint32_t albumMediaCount(uint32_t _albumId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
return it.m_listMedia.size();
@ -352,7 +352,7 @@ namespace appl {
return 0;
}
etk::Vector<uint32_t> albumMediaIdGet(uint32_t _albumId, uint32_t _start, uint32_t _stop) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
etk::Vector<uint32_t> out;
@ -368,7 +368,7 @@ namespace appl {
throw std::invalid_argument("Wrong Album ID ...");
}
void albumParentSet(uint32_t _albumId, uint32_t _albumParentId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
it.m_parentId = _albumParentId;
@ -378,7 +378,7 @@ namespace appl {
throw std::invalid_argument("Wrong Album ID ...");
}
void albumParentRemove(uint32_t _albumId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
it.m_parentId = 0;
@ -388,7 +388,7 @@ namespace appl {
throw std::invalid_argument("Wrong Album ID ...");
}
uint32_t albumParentGet(uint32_t _albumId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listAlbum) {
if (it.m_id == _albumId) {
return it.m_parentId;
@ -493,7 +493,7 @@ static void load_db() {
ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], etk::String _basePath) {
g_basePath = _basePath;
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
APPL_WARNING("Load USER: " << g_basePath);
load_db();
APPL_WARNING("new USER: [STOP]");
@ -501,7 +501,7 @@ ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], etk::String
}
ETK_EXPORT_API bool SERVICE_IO_uninit() {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
store_db();
APPL_WARNING("delete USER [STOP]");
return true;

View File

@ -9,7 +9,7 @@
#include <etk/etk.hpp>
#include <zeus/zeus.hpp>
#include <mutex>
#include <ethread/Mutex.hpp>
#include <ejson/ejson.hpp>
#include <etk/stdTools.hpp>
@ -18,7 +18,7 @@
#include <zeus/service/registerUser.hpp>
#include <zeus/ProxyClientProperty.hpp>
static std::mutex g_mutex;
static ethread::Mutex g_mutex;
static etk::String g_basePath;
static etk::String g_baseDBName = etk::String(SERVICE_NAME) + "-database.json";
static ejson::Document g_database;
@ -54,7 +54,7 @@ namespace appl {
// TODO: check if basished ...
/*
if (m_client.getName().get() != "") {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
etk::Vector<etk::String> out;
ejson::Object clients = g_database["client"].toObject();
if (clients.exist() == false) {
@ -83,7 +83,7 @@ namespace appl {
return out;
}
bool checkTocken(etk::String _clientName, etk::String _tocken) {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
APPL_INFO("Check TOCKEN for : '" << _clientName << "' tocken='" << _clientName << "'");
ejson::Object clients = g_database["client"].toObject();
if (clients.exist() == false) {
@ -108,7 +108,7 @@ namespace appl {
return false;
}
bool checkAuth(etk::String _password) {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
APPL_INFO("Check AUTH for : '" << _password << "'");
etk::String pass = g_database["password"].toString().get();
if (pass == "") {
@ -121,7 +121,7 @@ namespace appl {
return false;
}
etk::Vector<etk::String> filterClientServices(etk::String _clientName, etk::Vector<etk::String> _currentList) {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
APPL_INFO("Filter services : '" << _clientName << "' " << _currentList);
// When connected to our session ==> we have no control access ...
if (_clientName == m_userName) {
@ -137,7 +137,7 @@ namespace appl {
ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], etk::String _basePath) {
g_basePath = _basePath;
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
APPL_WARNING("Load USER: " << g_basePath);
bool ret = g_database.load(g_basePath + g_baseDBName);
if (ret == false) {
@ -147,7 +147,7 @@ ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], etk::String
}
ETK_EXPORT_API bool SERVICE_IO_uninit() {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
APPL_DEBUG("Store User Info:");
bool ret = g_database.storeSafe(g_basePath + g_baseDBName);
if (ret == false) {

View File

@ -11,7 +11,7 @@
#include <zeus/zeus.hpp>
#include <echrono/Time.hpp>
#include <mutex>
#include <ethread/Mutex.hpp>
#include <ejson/ejson.hpp>
#include <etk/os/FSNode.hpp>
#include <sstream>
@ -25,7 +25,7 @@
#include <zeus/ProxyFile.hpp>
#include <zeus/zeus-Media.impl.hpp>
static std::mutex g_mutex;
static ethread::Mutex g_mutex;
static etk::String g_basePath;
static etk::String g_basePathCover;
static etk::String g_basePathCoverGroup;
@ -130,13 +130,13 @@ namespace appl {
}
public:
uint32_t count() override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
return m_listFile.size();
}
etk::Vector<uint32_t> getIds(uint32_t _start, uint32_t _stop) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
etk::Vector<uint32_t> out;
for (size_t iii=_start; iii<m_listFile.size() && iii<_stop; ++iii) {
@ -148,7 +148,7 @@ namespace appl {
return out;
}
uint32_t getId(etk::String _sha512) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
uint32_t out;
for (size_t iii=0; iii<m_listFile.size(); ++iii) {
@ -164,7 +164,7 @@ namespace appl {
// Return a File Data (might be a video .tiff/.png/.jpg)
ememory::SharedPtr<zeus::Media> get(uint32_t _mediaId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
ememory::SharedPtr<zeus::MediaImpl> property;
for (auto &it : m_listFile) {
@ -185,7 +185,7 @@ namespace appl {
uint64_t id = 0;
uint64_t importId = 0;
{
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
id = createUniqueID();
importId = createUniqueImportID();
@ -197,7 +197,7 @@ namespace appl {
futRemoteSha512.wait();
etk::String sha512StringRemote = futRemoteSha512.get();
{
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listFile) {
if (it == nullptr) {
continue;
@ -221,7 +221,7 @@ namespace appl {
throw std::runtime_error("file size == 0");
}
if (zeus::getExtention(futType.get()) != "") {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
etk::FSNodeMove(tmpFileName, g_basePath + sha512String + "." + zeus::getExtention(futType.get()));
ememory::SharedPtr<zeus::MediaImpl> property = ememory::makeShared<zeus::MediaImpl>(id, sha512String + "." + zeus::getExtention(futType.get()), g_basePath);
property->setMetadata("sha512", sha512String);
@ -230,7 +230,7 @@ namespace appl {
m_listFile.pushBack(property);
g_needToStore = true;
} else {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
etk::FSNodeMove(tmpFileName, g_basePath + sha512String);
ememory::SharedPtr<zeus::MediaImpl> property = ememory::makeShared<zeus::MediaImpl>(id, sha512String, g_basePath);
property->setMetadata("sha512", sha512String);
@ -242,7 +242,7 @@ namespace appl {
return id;
}
void remove(uint32_t _mediaId) override {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
// TODO : Check right ...
//Check if the file exist:
bool find = false;
@ -354,7 +354,7 @@ namespace appl {
}
APPL_DEBUG("check : " << _sqlLikeRequest);
etk::Vector<etk::Vector<etk::String>> listAndParsed = interpreteSQLRequest(_sqlLikeRequest);
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listFile) {
if (it == nullptr) {
continue;
@ -375,7 +375,7 @@ namespace appl {
throw std::invalid_argument("empty request");
}
etk::Vector<etk::Vector<etk::String>> listAndParsed = interpreteSQLRequest(_sqlLikeRequest);
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
for (auto &it : m_listFile) {
if (it == nullptr) {
continue;
@ -416,7 +416,7 @@ namespace appl {
void internalSetCover(const etk::String& _baseName, zeus::ActionNotification<etk::String>& _notifs, zeus::ProxyFile _cover, etk::String _mediaString) {
uint64_t importId = 0;
{
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
importId = createUniqueImportID();
}
auto futType = _cover.getMineType();
@ -432,11 +432,11 @@ namespace appl {
throw std::runtime_error("file size > 1Mo");
}
if (futType.get() == "image/png") {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
etk::FSNodeRemove(_baseName + _mediaString + ".jpg");
etk::FSNodeMove(tmpFileName, _baseName + _mediaString + ".png");
} else if (futType.get() == "image/jpeg") {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
etk::FSNodeRemove(_baseName + _mediaString + ".png");
etk::FSNodeMove(tmpFileName, _baseName + _mediaString + ".jpg");
} else {
@ -510,7 +510,7 @@ ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], etk::String
g_basePath = _basePath;
g_basePathCover = _basePath + "/AAAASDGDFGQN4352SCVdfgBSXDFGFCVQDSGFQSfd_cover/";
g_basePathCoverGroup = _basePath + "/AAAASDGDFGQN4352SCVdfgBSXDFGFCVQDSGFQSfd_cover_group/";
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
APPL_WARNING("Load USER: " << g_basePath);
load_db();
APPL_WARNING("new USER: [STOP]");
@ -518,7 +518,7 @@ ETK_EXPORT_API bool SERVICE_IO_init(int _argc, const char *_argv[], etk::String
}
ETK_EXPORT_API bool SERVICE_IO_uninit() {
std::unique_lock<std::mutex> lock(g_mutex);
std::unique_lock<ethread::Mutex> lock(g_mutex);
store_db();
APPL_WARNING("delete USER [STOP]");
return true;

View File

@ -97,7 +97,7 @@ namespace zeus {
*/
zeus::ObjectRemote getService(const etk::String& _serviceName);
using factoryService = std::function<void(uint32_t, ememory::SharedPtr<zeus::WebServer>& _iface, uint32_t _destination)>; //!< call this function anser to the caller the requested Object
using factoryService = etk::Function<void(uint32_t, ememory::SharedPtr<zeus::WebServer>& _iface, uint32_t _destination)>; //!< call this function anser to the caller the requested Object
etk::Map<etk::String,factoryService> m_listServicesAvaillable; //!< list of all factory availlable (to create new services)
/**

View File

@ -91,7 +91,7 @@ namespace zeus {
zeus::FutureBase::waitUntil(_endTime);
return *this;
}
using ObserverFut = std::function<bool(zeus::Future<ZEUS_RETURN, ZEUS_EVENT>)>; //!< Define an Observer: function pointer for the local specific Future
using ObserverFut = etk::Function<bool(zeus::Future<ZEUS_RETURN, ZEUS_EVENT>)>; //!< Define an Observer: function pointer for the local specific Future
/**
* @brief Attach callback on all return type of value
* @param[in] _callback Handle on the function to call in all case
@ -108,7 +108,7 @@ 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 (return value)
*/
Future<ZEUS_RETURN, ZEUS_EVENT>& andThen(std::function<bool(const ZEUS_RETURN&)> _callback) {
Future<ZEUS_RETURN, ZEUS_EVENT>& andThen(etk::Function<bool(const ZEUS_RETURN&)> _callback) {
zeus::FutureBase::andThen(
[=](zeus::FutureBase _fut) {
zeus::Future<ZEUS_RETURN> tmp(_fut);
@ -121,7 +121,7 @@ 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 (return value)
*/
Future<ZEUS_RETURN, ZEUS_EVENT>& andThen(std::function<bool(ZEUS_RETURN)> _callback) {
Future<ZEUS_RETURN, ZEUS_EVENT>& andThen(etk::Function<bool(ZEUS_RETURN)> _callback) {
zeus::FutureBase::andThen(
[=](zeus::FutureBase _fut) {
return _callback(etk::move(zeus::Future<ZEUS_RETURN, ZEUS_EVENT>(_fut).get()));
@ -145,7 +145,7 @@ namespace zeus {
* @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 (with error parameter (ERROR type, Help string)
*/
Future<ZEUS_RETURN, ZEUS_EVENT>& andElse(std::function<bool(const etk::String&, const etk::String&)> _callback) {
Future<ZEUS_RETURN, ZEUS_EVENT>& andElse(etk::Function<bool(const etk::String&, const etk::String&)> _callback) {
zeus::FutureBase::andElse(
[=](zeus::FutureBase _fut) {
return _callback(_fut.getErrorType(), _fut.getErrorHelp());
@ -170,8 +170,8 @@ namespace zeus {
* @brief Attach callback on activity of the action / signal
* @param[in] _callback Handle on the function to call in progress information
*/
//template<typename = std::enable_if<std::is_void<ZEUS_EVENT>::value, false>>
Future<ZEUS_RETURN, ZEUS_EVENT>& onSignal(std::function<void(const ZEUS_EVENT&)> _callback) {
//template<typename = etk::EnableIf<etk::IsVoid<ZEUS_EVENT>::value, false>>
Future<ZEUS_RETURN, ZEUS_EVENT>& onSignal(etk::Function<void(const ZEUS_EVENT&)> _callback) {
zeus::FutureBase::onEvent(
[=](ememory::SharedPtr<zeus::message::Event> _msg) {
if (_msg == nullptr) {
@ -186,8 +186,8 @@ namespace zeus {
* @brief Attach callback on activity of the action / signal
* @param[in] _callback Handle on the function to call in progress information
*/
//template<typename = std::enable_if<std::is_void<ZEUS_EVENT>::value, false>>
Future<ZEUS_RETURN, ZEUS_EVENT>& onSignal(std::function<void(ZEUS_EVENT)> _callback) {
//template<typename = etk::EnableIf<etk::IsVoid<ZEUS_EVENT>::value, false>>
Future<ZEUS_RETURN, ZEUS_EVENT>& onSignal(etk::Function<void(ZEUS_EVENT)> _callback) {
zeus::FutureBase::onEvent(
[=](ememory::SharedPtr<zeus::message::Event> _msg) {
if (_msg == nullptr) {
@ -270,7 +270,7 @@ namespace zeus {
zeus::FutureBase::waitUntil(_endTime);
return *this;
}
using ObserverFut = std::function<bool(zeus::Future<void, ZEUS_EVENT>)>; //!< Define an Observer: function pointer for the local specific Future
using ObserverFut = etk::Function<bool(zeus::Future<void, ZEUS_EVENT>)>; //!< Define an Observer: function pointer for the local specific Future
/**
* @brief Attach callback on all return type of value
* @param[in] _callback Handle on the function to call in all case
@ -299,7 +299,7 @@ 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 (void parameter)
*/
Future<void, ZEUS_EVENT>& andThen(std::function<bool()> _callback) {
Future<void, ZEUS_EVENT>& andThen(etk::Function<bool()> _callback) {
zeus::FutureBase::andThen(
[=](zeus::FutureBase _fut) {
return _callback();
@ -323,7 +323,7 @@ namespace zeus {
* @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 (with error parameter (ERROR type, Help string)
*/
Future<void, ZEUS_EVENT>& andElse(std::function<bool(const etk::String&, const etk::String&)> _callback) {
Future<void, ZEUS_EVENT>& andElse(etk::Function<bool(const etk::String&, const etk::String&)> _callback) {
zeus::FutureBase::andElse(
[=](zeus::FutureBase _fut) {
return _callback(_fut.getErrorType(), _fut.getErrorHelp());
@ -335,8 +335,8 @@ namespace zeus {
* @brief Attach callback on activity of the action / signal
* @param[in] _callback Handle on the function to call in progress information
*/
//template<typename = std::enable_if<std::is_void<ZEUS_EVENT>::value, false>>
Future<void, ZEUS_EVENT>& onSignal(std::function<void(const ZEUS_EVENT&)> _callback) {
//template<typename = etk::EnableIf<etk::IsVoid<ZEUS_EVENT>::value, false>>
Future<void, ZEUS_EVENT>& onSignal(etk::Function<void(const ZEUS_EVENT&)> _callback) {
zeus::FutureBase::onEvent(
[=](ememory::SharedPtr<zeus::message::Event> _msg) {
if (_msg == nullptr) {
@ -351,8 +351,8 @@ namespace zeus {
* @brief Attach callback on activity of the action / signal
* @param[in] _callback Handle on the function to call in progress information
*/
//template<typename = std::enable_if<std::is_void<ZEUS_EVENT>::value, false>>
Future<void, ZEUS_EVENT>& onSignal(std::function<void(ZEUS_EVENT)> _callback) {
//template<typename = etk::EnableIf<etk::IsVoid<ZEUS_EVENT>::value, false>>
Future<void, ZEUS_EVENT>& onSignal(etk::Function<void(ZEUS_EVENT)> _callback) {
zeus::FutureBase::onEvent(
[=](ememory::SharedPtr<zeus::message::Event> _msg) {
if (_msg == nullptr) {

View File

@ -50,7 +50,7 @@ void zeus::Promise::setAction() {
void zeus::Promise::andAll(zeus::Promise::Observer _callback) {
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_callbackThen = _callback;
m_callbackElse = _callback;
}
@ -58,12 +58,12 @@ void zeus::Promise::andAll(zeus::Promise::Observer _callback) {
return;
}
if (hasError() == false) {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_callbackThen != nullptr) {
m_callbackThen(zeus::FutureBase(sharedFromThis()));
}
} else {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_callbackElse != nullptr) {
m_callbackElse(zeus::FutureBase(sharedFromThis()));
}
@ -72,7 +72,7 @@ void zeus::Promise::andAll(zeus::Promise::Observer _callback) {
void zeus::Promise::andThen(zeus::Promise::Observer _callback) {
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_callbackThen = _callback;
}
if (isFinished() == false) {
@ -81,7 +81,7 @@ void zeus::Promise::andThen(zeus::Promise::Observer _callback) {
if (hasError() == true) {
return;
}
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_callbackThen == nullptr) {
return;
}
@ -90,7 +90,7 @@ void zeus::Promise::andThen(zeus::Promise::Observer _callback) {
void zeus::Promise::andElse(zeus::Promise::Observer _callback) {
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_callbackElse = _callback;
}
if (isFinished() == false) {
@ -99,7 +99,7 @@ void zeus::Promise::andElse(zeus::Promise::Observer _callback) {
if (hasError() == false) {
return;
}
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_callbackElse == nullptr) {
return;
}
@ -107,7 +107,7 @@ void zeus::Promise::andElse(zeus::Promise::Observer _callback) {
}
void zeus::Promise::onEvent(zeus::Promise::ObserverEvent _callback) {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_isAction == false) {
ZEUS_ERROR("Request a Event calback on a simple function call");
}
@ -118,22 +118,22 @@ echrono::Duration zeus::Promise::getTransmitionTime() const {
if (isFinished() == false) {
return echrono::nanoseconds(0);
}
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
return m_receiveTime - m_sendTime;
}
bool zeus::Promise::setMessage(ememory::SharedPtr<zeus::Message> _value) {
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_receiveTime = echrono::Steady::now();
}
if (_value->getType() == zeus::message::type::event) {
ObserverEvent callback;
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
callback = m_callbackEvent;
}
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
// notification of a progresion ...
if (callback != nullptr) {
if (_value == nullptr) {
@ -141,7 +141,7 @@ bool zeus::Promise::setMessage(ememory::SharedPtr<zeus::Message> _value) {
}
callback(ememory::staticPointerCast<zeus::message::Event>(_value));
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_callbackEvent = etk::move(callback);
}
return false; // no error
@ -149,7 +149,7 @@ bool zeus::Promise::setMessage(ememory::SharedPtr<zeus::Message> _value) {
return false;
}
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_message = _value;
if (m_message == nullptr) {
return true;
@ -162,13 +162,13 @@ bool zeus::Promise::setMessage(ememory::SharedPtr<zeus::Message> _value) {
if (hasError() == false) {
Observer callback;
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
callback = etk::move(m_callbackThen);
}
if (callback != nullptr) {
bool ret = callback(zeus::FutureBase(sharedFromThis()));
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_callbackThen = etk::move(callback);
}
return ret;
@ -176,13 +176,13 @@ bool zeus::Promise::setMessage(ememory::SharedPtr<zeus::Message> _value) {
} else {
Observer callback;
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
callback = m_callbackElse;
}
if (callback != nullptr) {
bool ret = callback(zeus::FutureBase(sharedFromThis()));
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_callbackElse = etk::move(callback);
}
return ret;
@ -200,7 +200,7 @@ uint32_t zeus::Promise::getSource() const {
}
bool zeus::Promise::hasError() const {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_message == nullptr) {
return true;
}
@ -211,7 +211,7 @@ bool zeus::Promise::hasError() const {
}
etk::String zeus::Promise::getErrorType() const {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_message == nullptr) {
return "NULL_PTR";
}
@ -222,7 +222,7 @@ etk::String zeus::Promise::getErrorType() const {
}
etk::String zeus::Promise::getErrorHelp() const {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_message == nullptr) {
return "This is a nullptr future";
}
@ -234,7 +234,7 @@ etk::String zeus::Promise::getErrorHelp() const {
bool zeus::Promise::isFinished() const {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_message == nullptr) {
// in this case, we are waiting for an answer that the first packet is not arrived
return false;

View File

@ -21,10 +21,10 @@ namespace zeus {
*/
class Promise : public ememory::EnableSharedFromThis<zeus::Promise> {
public:
using Observer = std::function<bool(zeus::FutureBase)>; //!< Define an Observer: function pointer
using ObserverEvent = std::function<void(ememory::SharedPtr<zeus::message::Event>)>; //!< Define the observer on activity of the action (note that is a string, but it can contain json or other ...)
using Observer = etk::Function<bool(zeus::FutureBase)>; //!< Define an Observer: function pointer
using ObserverEvent = etk::Function<void(ememory::SharedPtr<zeus::message::Event>)>; //!< Define the observer on activity of the action (note that is a string, but it can contain json or other ...)
private:
mutable std::mutex m_mutex; //!< local prevention of multiple acess
mutable ethread::Mutex m_mutex; //!< local prevention of multiple acess
uint32_t m_transactionId; //!< waiting answer data
uint32_t m_source; //!< Source of the message.
ememory::SharedPtr<zeus::Message> m_message; //!< all buffer concatenate or last buffer if synchronous

View File

@ -109,12 +109,12 @@ void zeus::WebServer::setInterfaceName(const etk::String& _name) {
}
void zeus::WebServer::addWebObj(ememory::SharedPtr<zeus::WebObj> _obj) {
//std::unique_lock<std::mutex> lock(m_mutex);
//std::unique_lock<ethread::Mutex> lock(m_mutex);
m_listObject.pushBack(_obj);
}
void zeus::WebServer::addWebObjRemote(ememory::SharedPtr<zeus::ObjectRemoteBase> _obj) {
//std::unique_lock<std::mutex> lock(m_mutex);
//std::unique_lock<ethread::Mutex> lock(m_mutex);
m_listRemoteObject.pushBack(_obj);
}
@ -152,7 +152,7 @@ void zeus::WebServer::interfaceRemoved(etk::Vector<uint16_t> _list) {
}
}
for (int32_t iii=0; iii < _list.size(); ++iii) {
std::unique_lock<std::mutex> lock(m_pendingCallMutex);
std::unique_lock<ethread::Mutex> lock(m_pendingCallMutex);
auto it = m_pendingCall.begin();
while (it != m_pendingCall.end()) {
if (it->second.isValid() == false) {
@ -177,7 +177,7 @@ bool zeus::WebServer::isActive() const {
void zeus::WebServer::connect(bool _async){
ZEUS_DEBUG("connect [START]");
m_threadAsyncRunning = true;
m_threadAsync = new std::thread([&](void *){ this->threadAsyncCallback();}, nullptr);
m_threadAsync = new ethread::Thread([&](void *){ this->threadAsyncCallback();}, nullptr);
if (m_threadAsync == nullptr) {
m_threadAsyncRunning = false;
ZEUS_ERROR("creating async sender thread!");
@ -350,13 +350,13 @@ void zeus::WebServer::newMessage(ememory::SharedPtr<zeus::Message> _buffer) {
}
if ( _buffer->getPartFinish() == false
&& _buffer->getType() != zeus::message::type::data) {
//std::unique_lock<std::mutex> lock(m_mutex);
//std::unique_lock<ethread::Mutex> lock(m_mutex);
m_listPartialMessage.pushBack(_buffer);
return;
}
if (_buffer->getType() == zeus::message::type::data) {
// Add data in a previous buffer...
//std::unique_lock<std::mutex> lock(m_mutex);
//std::unique_lock<ethread::Mutex> lock(m_mutex);
auto it = m_listPartialMessage.begin();
while (it != m_listPartialMessage.end()) {
if (*it == nullptr) {
@ -391,7 +391,7 @@ void zeus::WebServer::newMessage(ememory::SharedPtr<zeus::Message> _buffer) {
if ( _buffer->getType() == zeus::message::type::answer
|| _buffer->getType() == zeus::message::type::data
|| _buffer->getType() == zeus::message::type::event) {
std::unique_lock<std::mutex> lock(m_pendingCallMutex);
std::unique_lock<ethread::Mutex> lock(m_pendingCallMutex);
auto it = m_pendingCall.begin();
while (it != m_pendingCall.end()) {
if (it->second.isValid() == false) {
@ -429,7 +429,7 @@ void zeus::WebServer::newMessage(ememory::SharedPtr<zeus::Message> _buffer) {
return;
}
}
//std::unique_lock<std::mutex> lock(m_mutex);
//std::unique_lock<ethread::Mutex> lock(m_mutex);
// call local map object on remote object
for (auto &it : m_listRemoteObject) {
ememory::SharedPtr<zeus::ObjectRemoteBase> tmp = it.lock();
@ -468,7 +468,7 @@ void zeus::WebServer::newMessage(ememory::SharedPtr<zeus::Message> _buffer) {
bool ret = fut.setMessage(_buffer);
if (ret == true) {
ZEUS_LOG_INPUT_OUTPUT(" ==> start LOCK");
std::unique_lock<std::mutex> lock(m_pendingCallMutex);
std::unique_lock<ethread::Mutex> lock(m_pendingCallMutex);
ZEUS_LOG_INPUT_OUTPUT(" ==> LOCK done");
auto it = m_pendingCall.begin();
while (it != m_pendingCall.end()) {
@ -493,7 +493,7 @@ void zeus::WebServer::newMessage(ememory::SharedPtr<zeus::Message> _buffer) {
}
void zeus::WebServer::listObjects() {
//std::unique_lock<std::mutex> lock(m_mutex);
//std::unique_lock<ethread::Mutex> lock(m_mutex);
if ( m_listObject.size() == 0
&& m_listRemoteObject.size() == 0) {
return;
@ -515,7 +515,7 @@ void zeus::WebServer::listObjects() {
}
void zeus::WebServer::cleanDeadObject() {
//std::unique_lock<std::mutex> lock(m_mutex);
//std::unique_lock<ethread::Mutex> lock(m_mutex);
if ( m_listObject.size() == 0
&& m_listRemoteObject.size() == 0) {
return;
@ -545,7 +545,7 @@ void zeus::WebServer::cleanDeadObject() {
}
bool zeus::WebServer::transferRemoteObjectOwnership(uint16_t _objectAddress, uint32_t _sourceAddress, uint32_t _destinataireAddress) {
//std::unique_lock<std::mutex> lock(m_mutex);
//std::unique_lock<ethread::Mutex> lock(m_mutex);
if ( m_listObject.size() == 0
&& m_listRemoteObject.size() == 0) {
return false;
@ -572,7 +572,7 @@ bool zeus::WebServer::transferRemoteObjectOwnership(uint16_t _objectAddress, uin
}
bool zeus::WebServer::removeObjectOwnership(uint16_t _objectAddress, uint32_t _sourceAddress) {
//std::unique_lock<std::mutex> lock(m_mutex);
//std::unique_lock<ethread::Mutex> lock(m_mutex);
if ( m_listObject.size() == 0
&& m_listRemoteObject.size() == 0) {
return false;
@ -601,7 +601,7 @@ bool zeus::WebServer::removeObjectOwnership(uint16_t _objectAddress, uint32_t _s
}
void zeus::WebServer::addAsync(zeus::WebServer::ActionAsync _elem) {
std::unique_lock<std::mutex> lock(m_threadAsyncMutex);
std::unique_lock<ethread::Mutex> lock(m_threadAsyncMutex);
m_threadAsyncList2.pushBack(_elem);
ZEUS_DEBUG("ADD element to send ... " << m_threadAsyncList2.size());
}
@ -613,7 +613,7 @@ void zeus::WebServer::threadAsyncCallback() {
while ( m_threadAsyncRunning == true
&& m_connection.isAlive() == true) {
if (m_threadAsyncList2.size() != 0) {
std::unique_lock<std::mutex> lock(m_threadAsyncMutex);
std::unique_lock<ethread::Mutex> lock(m_threadAsyncMutex);
for (auto &it : m_threadAsyncList2) {
m_threadAsyncList.pushBack(it);
}
@ -649,7 +649,7 @@ zeus::FutureBase zeus::WebServer::callBinary(ememory::SharedPtr<zeus::Message> _
}
zeus::FutureBase tmpFuture(_obj->getTransactionId());
{
std::unique_lock<std::mutex> lock(m_pendingCallMutex);
std::unique_lock<ethread::Mutex> lock(m_pendingCallMutex);
m_pendingCall.pushBack(etk::makePair(uint64_t(0), tmpFuture));
}
writeBinary(_obj);

View File

@ -9,7 +9,7 @@
#include <zeus/message/Event.hpp>
#include <zeus/message/Call.hpp>
#include <enet/WebSocket.hpp>
#include <thread>
#include <ethread/Thread.hpp>
#include <ememory/memory.hpp>
#include <zeus/AbstractFunction.hpp>
#include <zeus/FutureBase.hpp>
@ -109,7 +109,7 @@ namespace zeus {
*/
class WebServer : public ememory::EnableSharedFromThis<zeus::WebServer> {
protected:
std::mutex m_mutex; //!< main interface lock
ethread::Mutex m_mutex; //!< main interface lock
public:
etk::Vector<ememory::SharedPtr<zeus::WebObj>> m_actifObject; //!< List of all active object created and that remove is in progress ...
private:
@ -138,7 +138,7 @@ namespace zeus {
* @return a new single object ID
*/
uint16_t getNewObjectId() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
return m_localIdObjectIncrement++;
}
private:
@ -171,10 +171,10 @@ namespace zeus {
* @return Unique ID of the transmision
*/
uint16_t getId();
std::mutex m_pendingCallMutex; //!< local call of a pendinc call venctor update
ethread::Mutex m_pendingCallMutex; //!< local call of a pendinc call venctor update
etk::Vector<etk::Pair<uint64_t, zeus::FutureBase>> m_pendingCall; //!< List of pending call interface
public:
using Observer = std::function<void(ememory::SharedPtr<zeus::Message>)>; //!< Define an Observer: function pointer
using Observer = etk::Function<void(ememory::SharedPtr<zeus::Message>)>; //!< Define an Observer: function pointer
Observer m_observerElement; //!< Observer on a new message arriving
/**
* @brief Connect an function member on the signal with the shared_ptr object.
@ -188,7 +188,7 @@ namespace zeus {
};
}
public:
using ObserverRequestUri = std::function<bool(const etk::String&)>; //!< Define an Observer on the specific URI requested callback: function pointer (return true if the connection is accepted or not)
using ObserverRequestUri = etk::Function<bool(const etk::String&)>; //!< Define an Observer on the specific URI requested callback: function pointer (return true if the connection is accepted or not)
protected:
ObserverRequestUri m_observerRequestUri; //!< Observer on a requesting URI connection
public:
@ -299,9 +299,9 @@ namespace zeus {
return m_connection.getLastTimeSend();
}
private:
using ActionAsync = std::function<bool(WebServer* _interface)>; //!< type of the action for sending big data on the websocket
std::mutex m_threadAsyncMutex; //!< Mutex fot the thread to send async data
std::thread* m_threadAsync; //!< sending async data thread. TODO: Set it in a thread pool ...
using ActionAsync = etk::Function<bool(WebServer* _interface)>; //!< type of the action for sending big data on the websocket
ethread::Mutex m_threadAsyncMutex; //!< Mutex fot the thread to send async data
ethread::Thread* m_threadAsync; //!< sending async data thread. TODO: Set it in a thread pool ...
bool m_threadAsyncRunning; //!< Threa is running
etk::Vector<ActionAsync> m_threadAsyncList; //!< List of action to send (current)
etk::Vector<ActionAsync> m_threadAsyncList2; //!< list of action to send whenwurrent is sending in progress

View File

@ -40,7 +40,7 @@ void zeus::message::Answer::addError(const etk::String& _value, const etk::Strin
}
bool zeus::message::Answer::writeOn(enet::WebSocket& _interface) {
std::unique_lock<std::mutex> lock = _interface.getScopeLock();
std::unique_lock<ethread::Mutex> lock = _interface.getScopeLock();
zeus::Message::writeOn(_interface);
_interface.writeData((uint8_t*)m_errorType.c_str(), m_errorType.size() + 1);
if (m_errorType.size() != 0) {

View File

@ -35,7 +35,7 @@ void zeus::message::Call::setCall(const etk::String& _value) {
}
bool zeus::message::Call::writeOn(enet::WebSocket& _interface) {
std::unique_lock<std::mutex> lock = _interface.getScopeLock();
std::unique_lock<ethread::Mutex> lock = _interface.getScopeLock();
zeus::Message::writeOn(_interface);
_interface.writeData((uint8_t*)m_callName.c_str(), m_callName.size() + 1);
if (message::Parameter::writeOn(_interface) == false) {

View File

@ -37,7 +37,7 @@ void zeus::message::Data::setPartId(uint32_t _value) {
}
bool zeus::message::Data::writeOn(enet::WebSocket& _interface) {
std::unique_lock<std::mutex> lock = _interface.getScopeLock();
std::unique_lock<ethread::Mutex> lock = _interface.getScopeLock();
if (zeus::Message::writeOn(_interface) == false) {
return false;
}

View File

@ -18,7 +18,7 @@ void zeus::message::Event::generateDisplay(etk::Stream& _os) const {
}
bool zeus::message::Event::writeOn(enet::WebSocket& _interface) {
std::unique_lock<std::mutex> lock = _interface.getScopeLock();
std::unique_lock<ethread::Mutex> lock = _interface.getScopeLock();
zeus::Message::writeOn(_interface);
_interface.writeData((uint8_t*)(&m_uid), sizeof(m_uid));
if (message::Parameter::writeOn(_interface) == false) {

View File

@ -12,7 +12,7 @@
namespace zeus {
class WebServer;
// define basic async call element ...
using ActionAsyncClient = std::function<bool(WebServer* _interface, const uint32_t& _clientId, const uint32_t& _serviceId, uint64_t _transactionId, uint64_t _part)>;
using ActionAsyncClient = etk::Function<bool(WebServer* _interface, const uint32_t& _clientId, const uint32_t& _serviceId, uint64_t _transactionId, uint64_t _part)>;
}

View File

@ -17,9 +17,9 @@ namespace zeus {
etk::String m_basePath; //!< basic global path
etk::String m_fileName; //!< Name of the file
etk::Map<etk::String, etk::String> m_metadata; //!< all extra property
std::function<void(zeus::MediaImpl*, const etk::String& )> m_callback;
etk::Function<void(zeus::MediaImpl*, const etk::String& )> m_callback;
public:
void setCallbackMetadataChange(std::function<void(zeus::MediaImpl*, const etk::String& )> _callback) {
void setCallbackMetadataChange(etk::Function<void(zeus::MediaImpl*, const etk::String& )> _callback) {
m_callback = _callback;
}
public: