[DEV] continue removing STL
This commit is contained in:
parent
dff27aed6d
commit
c8a9290648
@ -122,7 +122,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
lastValue = _value;
|
||||
});
|
||||
while (lasNumberSend != lastValue) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
ethread::sleepMilliSeconds((50));
|
||||
}
|
||||
retCall.wait();
|
||||
APPL_INFO("END (receive " << lastValue << " signals");
|
||||
@ -130,7 +130,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
}
|
||||
int32_t iii=0;
|
||||
while (iii < 3) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
ethread::sleepMilliSeconds((500));
|
||||
APPL_INFO("Appl in waiting ... " << iii << "/3");
|
||||
iii++;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ namespace appl {
|
||||
}
|
||||
void doSomething(zeus::ActionNotification<int32_t>& _notifs, int32_t _value) override {
|
||||
for (int32_t iii=1; iii<=_value; ++iii) {
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
//ethread::sleepMilliSeconds((500));
|
||||
_notifs.emit(iii);
|
||||
}
|
||||
}
|
||||
@ -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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
store_db();
|
||||
APPL_INFO("delete USER [STOP]");
|
||||
return true;
|
||||
|
@ -52,7 +52,7 @@ bool progressCall(const etk::String& _value) {
|
||||
void progressCallback(const etk::String& _value) {
|
||||
APPL_PRINT("plop " << _value);
|
||||
}
|
||||
bool pushVideoFile(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<etk::String,etk::String> _basicKey = etk::Map<etk::String,std::string>()) {
|
||||
bool pushVideoFile(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<etk::String,etk::String> _basicKey = etk::Map<etk::String,etk::String>()) {
|
||||
etk::String extention;
|
||||
if ( _path.rfind('.') != etk::String::npos
|
||||
&& _path.rfind('.') != 0) {
|
||||
@ -309,7 +309,7 @@ bool pushVideoFile(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<
|
||||
return true;
|
||||
}
|
||||
|
||||
void installVideoPath(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<etk::String,etk::String> _basicKey = etk::Map<etk::String,std::string>()) {
|
||||
void installVideoPath(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<etk::String,etk::String> _basicKey = etk::Map<etk::String,etk::String>()) {
|
||||
etk::FSNode node(_path);
|
||||
APPL_INFO("Parse : '" << _path << "'");
|
||||
etk::Vector<etk::String> listSubPath = node.folderGetSub(true, false, "*");
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <zeus/zeus.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <elog/elog.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
#include <etk/stdTools.hpp>
|
||||
#include <zeus/ProxyFile.hpp>
|
||||
@ -52,7 +51,7 @@ void progressCallback(const etk::String& _value) {
|
||||
APPL_PRINT("plop " << _value);
|
||||
}
|
||||
#if 0
|
||||
bool pushVideoFile(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<etk::String,etk::String> _basicKey = etk::Map<etk::String,std::string>()) {
|
||||
bool pushVideoFile(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<etk::String,etk::String> _basicKey = etk::Map<etk::String,etk::String>()) {
|
||||
etk::String extention;
|
||||
if ( _path.rfind('.') != etk::String::npos
|
||||
&& _path.rfind('.') != 0) {
|
||||
@ -286,7 +285,7 @@ bool pushVideoFile(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<
|
||||
return true;
|
||||
}
|
||||
|
||||
void installVideoPath(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<etk::String,etk::String> _basicKey = etk::Map<etk::String,std::string>()) {
|
||||
void installVideoPath(zeus::service::ProxyVideo& _srv, etk::String _path, etk::Map<etk::String,etk::String> _basicKey = etk::Map<etk::String,etk::String>()) {
|
||||
etk::FSNode node(_path);
|
||||
APPL_INFO("Parse : '" << _path << "'");
|
||||
etk::Vector<etk::String> listSubPath = node.folderGetSub(true, false, "*");
|
||||
|
@ -58,7 +58,7 @@ namespace appl {
|
||||
if (data.getConnectionStatus() != enet::Tcp::status::link) {
|
||||
APPL_CRITICAL("New TCP connection (DEAD ....) ==> gateway is dead ...");
|
||||
// TODO: Check interaface: if (m_interface.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(300));
|
||||
ethread::sleepMilliSeconds((300));
|
||||
}
|
||||
APPL_VERBOSE("New connection");
|
||||
m_gateway->newDirectInterface(etk::move(data));
|
||||
|
@ -246,7 +246,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
bool routerAlive = true;
|
||||
#endif
|
||||
while (routerAlive == true) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
ethread::sleepMilliSeconds((100));
|
||||
basicGateway.cleanIO();
|
||||
routerAlive = basicGateway.checkIsAlive(echrono::seconds(routerDisconnectionDelay));
|
||||
if (routerAlive == false) {
|
||||
@ -304,7 +304,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
APPL_WARNING("Router is Dead or Timeout");
|
||||
} else {
|
||||
elog::flush();
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(1));
|
||||
APPL_INFO("gateway in waiting ... " << iii << "/inf");
|
||||
}
|
||||
iii++;
|
||||
|
@ -179,7 +179,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
for (auto &it: listElements) {
|
||||
it->peridic_call();
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(1));
|
||||
APPL_INFO("service in waiting ... " << iii << "/inf");
|
||||
iii++;
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ int appl::MediaDecoder::readFunc(uint8_t* _buf, int _bufSize) {
|
||||
}
|
||||
while(m_remote->sizeReadable() == 0) {
|
||||
APPL_WARNING(" -------- waiting data --------- ");// << m_remote->sizeReadable());
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
ethread::sleepMilliSeconds((50));
|
||||
if (m_stopRequested == true) {
|
||||
return 0;
|
||||
}
|
||||
@ -490,7 +490,7 @@ int appl::MediaDecoder::readFunc(uint8_t* _buf, int _bufSize) {
|
||||
}
|
||||
// Real Load of the data:
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_remote->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
for (auto &it : m_bufferFillSection) {
|
||||
if ( m_bufferReadPosition >= it.first
|
||||
&& m_bufferReadPosition < it.second) {
|
||||
@ -558,10 +558,10 @@ int64_t appl::MediaDecoder::seekFunc(int64_t _offset, int _whence) {
|
||||
|
||||
bool appl::StreamBuffering::addDataCallback(const zeus::Raw& _data, int64_t _positionRequest) {
|
||||
#ifdef DEBUG
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
ethread::sleepMilliSeconds((10));
|
||||
#endif
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
m_callInProgress = false;
|
||||
m_stopRequested = false;
|
||||
m_mediaId = 0;
|
||||
m_bufferReadPosition = 0;
|
||||
}
|
||||
void appl::StreamBuffering::stopStream() {
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
m_stopRequested = true;
|
||||
}
|
||||
void appl::StreamBuffering::startStream() {
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
m_stopRequested = false;
|
||||
}
|
||||
|
||||
// TODO: Add requested section ...
|
||||
void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
// check if enought data:
|
||||
bool find = false;
|
||||
if (m_callInProgress == true) {
|
||||
@ -875,7 +875,7 @@ bool appl::MediaDecoder::onThreadCall() {
|
||||
init();
|
||||
if (m_isInit == false) {
|
||||
// take some time to sleep the decoding ...
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(60/100));
|
||||
ethread::sleepMilliSeconds((60/100));
|
||||
return false;
|
||||
}
|
||||
if (m_seek >= echrono::Duration(0)) {
|
||||
@ -888,7 +888,7 @@ bool appl::MediaDecoder::onThreadCall() {
|
||||
// Need to wait at lease 1MB
|
||||
if (m_remote->sizeReadable() < APPL_BUFFER_SIZE_FOR_FFMPEG) {
|
||||
// take some time to sleep the decoding ...
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(60/100));
|
||||
ethread::sleepMilliSeconds((60/100));
|
||||
return false;
|
||||
}
|
||||
// check if we have space to decode data
|
||||
@ -898,7 +898,7 @@ bool appl::MediaDecoder::onThreadCall() {
|
||||
&& audioGetEmptySlot() == -1)
|
||||
) {
|
||||
// take some time to sleep the decoding ...
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(60/25));
|
||||
ethread::sleepMilliSeconds((60/25));
|
||||
return false;
|
||||
}
|
||||
APPL_VERBOSE("Work on decoding");
|
||||
|
@ -73,11 +73,11 @@ namespace appl {
|
||||
bool addDataCallback(const zeus::Raw& _data, int64_t _positionRequest);
|
||||
void checkIfWeNeedMoreDataFromNetwork();
|
||||
uint64_t getSize() {
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
return m_buffer.size();
|
||||
}
|
||||
etk::Vector<etk::Pair<uint32_t,uint32_t>> getDownloadPart() {
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
return m_bufferFillSection;
|
||||
}
|
||||
int32_t sizeReadable();
|
||||
|
@ -70,7 +70,7 @@ void appl::widget::ListViewer::searchElements(etk::String _filter) {
|
||||
void appl::ElementProperty::loadData() {
|
||||
// Check progression status:
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock lock(tmpProperty->m_mutex);
|
||||
tmpProperty->m_title = _value;
|
||||
}
|
||||
m_widget->markToRedraw();
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock lock(tmpProperty->m_mutex);
|
||||
tmpProperty->m_serie = _value;
|
||||
}
|
||||
m_widget->markToRedraw();
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock lock(tmpProperty->m_mutex);
|
||||
tmpProperty->m_saison = _value;
|
||||
}
|
||||
m_widget->markToRedraw();
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock lock(tmpProperty->m_mutex);
|
||||
tmpProperty->m_episode = _value;
|
||||
}
|
||||
m_widget->markToRedraw();
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock lock(tmpProperty->m_mutex);
|
||||
tmpProperty->m_description = _value;
|
||||
}
|
||||
m_widget->markToRedraw();
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock lock(tmpProperty->m_mutex);
|
||||
tmpProperty->m_productMethode = _value;
|
||||
}
|
||||
m_widget->markToRedraw();
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock lock(tmpProperty->m_mutex);
|
||||
tmpProperty->m_type = _value;
|
||||
}
|
||||
m_widget->markToRedraw();
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock lock(tmpProperty->m_mutex);
|
||||
tmpProperty->m_nbElementLoaded++;
|
||||
if (tmpProperty->m_nbElementLoaded >= nbCallOfMetaData) {
|
||||
tmpProperty->m_metadataUpdated = appl::statusLoadingData::done;
|
||||
@ -333,10 +333,10 @@ void appl::ElementProperty::loadData() {
|
||||
futMediaCover.andElse([=](const etk::String& _error, const etk::String& _help) mutable {
|
||||
APPL_INFO(" [" << tmpProperty->m_id << "] get cover error: " << tmpProperty->m_id << ": " << _help);
|
||||
// TODO : Remove this ...
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(400));
|
||||
ethread::sleepMilliSeconds((400));
|
||||
etk::String serie;
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
return m_metadataUpdated == appl::statusLoadingData::done;
|
||||
}
|
||||
void appl::ElementPropertyGroup::loadData() {
|
||||
// Check progression status:
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(tmpProperty->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_property->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_property->m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_propertyGroup->m_mutex);
|
||||
ethread::UniqueLock lock(m_propertyGroup->m_mutex);
|
||||
if (m_propertyGroup->m_thumbPresent == true) {
|
||||
haveThumb = true;
|
||||
m_image.setSource(m_propertyGroup->m_thumb);
|
||||
|
@ -67,7 +67,7 @@ void appl::widget::UpBar::onCallbackVolumeRequest(const float& _value) {
|
||||
APPL_DEBUG("volume change value=" << _value << " dB");
|
||||
APPL_DEBUG("===========================================================================");
|
||||
signalChange.emit(_value);
|
||||
etk::String display = etk::toString(int32_t(_value)) + "." + etk::toString(std::abs(int32_t(_value*10.0f)-int32_t(_value)*10));
|
||||
etk::String display = etk::toString(int32_t(_value)) + "." + etk::toString(etk::abs(int32_t(_value*10.0f)-int32_t(_value)*10));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-upbar-label", "value", display + " dB");
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ def configure(target, my_module):
|
||||
])
|
||||
my_module.add_flag('c++', [
|
||||
"-DPROJECT_NAME=\"\\\""+ my_module.get_name()+"\\\"\"",
|
||||
"-DAPPL_VERSION=\"\\\"" + tools.version_toString(my_module.get_version()) + "\\\"\"",
|
||||
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(my_module.get_version()) + "\\\"\"",
|
||||
"-Wno-deprecated-declarations"
|
||||
])
|
||||
my_module.copy_path('data/*')
|
||||
|
@ -174,11 +174,10 @@ bool appl::Router::userIsConnected(const etk::String& _userName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" {
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
ememory::SharedPtr<appl::GateWayInterface> appl::Router::get(const etk::String& _userName) {
|
||||
// TODO : Start USer only when needed, not get it all time started...
|
||||
@ -254,7 +253,7 @@ ememory::SharedPtr<appl::GateWayInterface> appl::Router::get(const etk::String&
|
||||
#endif
|
||||
int32_t nbCheckDelayMax = 24;
|
||||
while (nbCheckDelayMax-- > 0) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(25));
|
||||
ethread::sleepMilliSeconds((25));
|
||||
for (auto &it : m_GateWayList) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
|
@ -58,7 +58,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
APPL_INFO("==================================");
|
||||
basicRouter.start();
|
||||
while (true) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
ethread::sleepMilliSeconds((100));
|
||||
basicRouter.cleanIO();
|
||||
}
|
||||
basicRouter.stop();
|
||||
|
@ -42,7 +42,7 @@ def configure(target, my_module):
|
||||
])
|
||||
my_module.add_flag('c++', [
|
||||
"-DPROJECT_NAME=\"\\\""+my_module.get_name()+"\\\"\"",
|
||||
"-DAPPL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\"",
|
||||
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"",
|
||||
])
|
||||
my_module.copy_path('data/*')
|
||||
my_module.add_path(".")
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <ethread/Mutex.hpp>
|
||||
#include <ejson/ejson.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <sstream>
|
||||
|
||||
#include <etk/stdTools.hpp>
|
||||
|
||||
@ -78,13 +77,13 @@ namespace appl {
|
||||
}
|
||||
public:
|
||||
uint32_t mediaIdCount() override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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 +93,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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
// TODO : Check right ...
|
||||
//Check if the file exist:
|
||||
bool find = false;
|
||||
@ -112,7 +111,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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
// TODO : Check right ...
|
||||
uint64_t id = createUniqueID();
|
||||
|
||||
@ -151,7 +150,7 @@ namespace appl {
|
||||
return id;
|
||||
}
|
||||
void mediaRemove(uint32_t _mediaId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
// TODO : Check right ...
|
||||
//Check if the file exist:
|
||||
bool find = false;
|
||||
@ -229,7 +228,7 @@ namespace appl {
|
||||
throw std::invalid_argument("Wrong Album ID ...");
|
||||
}
|
||||
uint32_t albumCreate(etk::String _albumName) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
// TODO : Check right ...
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_name == _albumName) {
|
||||
@ -245,7 +244,7 @@ namespace appl {
|
||||
|
||||
|
||||
void albumRemove(uint32_t _albumId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
// TODO : Check right ...
|
||||
for (auto it = m_listAlbum.begin();
|
||||
it != m_listAlbum.end();
|
||||
@ -259,7 +258,7 @@ namespace appl {
|
||||
throw std::invalid_argument("Wrong Album ID ...");
|
||||
}
|
||||
etk::Vector<uint32_t> albumGetList() override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
etk::Vector<uint32_t> out;
|
||||
for (auto &it : m_listAlbum) {
|
||||
out.pushBack(it.m_id);
|
||||
@ -267,7 +266,7 @@ namespace appl {
|
||||
return out;
|
||||
}
|
||||
etk::String albumNameGet(uint32_t _albumId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
return it.m_name;
|
||||
@ -277,7 +276,7 @@ namespace appl {
|
||||
return "";
|
||||
}
|
||||
void albumNameSet(uint32_t _albumId, etk::String _albumName) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
it.m_name = _albumName;
|
||||
@ -287,7 +286,7 @@ namespace appl {
|
||||
throw std::invalid_argument("Wrong Album ID ...");
|
||||
}
|
||||
etk::String albumDescriptionGet(uint32_t _albumId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
return it.m_description;
|
||||
@ -297,7 +296,7 @@ namespace appl {
|
||||
return "";
|
||||
}
|
||||
void albumDescriptionSet(uint32_t _albumId, etk::String _desc) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
it.m_description = _desc;
|
||||
@ -307,7 +306,7 @@ namespace appl {
|
||||
throw std::invalid_argument("Wrong Album ID ...");
|
||||
}
|
||||
void albumMediaAdd(uint32_t _albumId, uint32_t _mediaId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
for (auto &elem : it.m_listMedia) {
|
||||
@ -323,7 +322,7 @@ namespace appl {
|
||||
throw std::invalid_argument("Wrong Album ID ...");
|
||||
}
|
||||
void albumMediaRemove(uint32_t _albumId, uint32_t _mediaId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
for (auto elem = it.m_listMedia.begin();
|
||||
@ -342,7 +341,7 @@ namespace appl {
|
||||
throw std::invalid_argument("Wrong Album ID ...");
|
||||
}
|
||||
uint32_t albumMediaCount(uint32_t _albumId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
return it.m_listMedia.size();
|
||||
@ -352,7 +351,7 @@ namespace appl {
|
||||
return 0;
|
||||
}
|
||||
etk::Vector<uint32_t> albumMediaIdGet(uint32_t _albumId, uint32_t _start, uint32_t _stop) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
etk::Vector<uint32_t> out;
|
||||
@ -368,7 +367,7 @@ namespace appl {
|
||||
throw std::invalid_argument("Wrong Album ID ...");
|
||||
}
|
||||
void albumParentSet(uint32_t _albumId, uint32_t _albumParentId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
it.m_parentId = _albumParentId;
|
||||
@ -378,7 +377,7 @@ namespace appl {
|
||||
throw std::invalid_argument("Wrong Album ID ...");
|
||||
}
|
||||
void albumParentRemove(uint32_t _albumId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
it.m_parentId = 0;
|
||||
@ -388,7 +387,7 @@ namespace appl {
|
||||
throw std::invalid_argument("Wrong Album ID ...");
|
||||
}
|
||||
uint32_t albumParentGet(uint32_t _albumId) override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
for (auto &it : m_listAlbum) {
|
||||
if (it.m_id == _albumId) {
|
||||
return it.m_parentId;
|
||||
@ -493,7 +492,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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
APPL_WARNING("Load USER: " << g_basePath);
|
||||
load_db();
|
||||
APPL_WARNING("new USER: [STOP]");
|
||||
@ -501,7 +500,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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
store_db();
|
||||
APPL_WARNING("delete USER [STOP]");
|
||||
return true;
|
||||
|
@ -54,7 +54,7 @@ namespace appl {
|
||||
// TODO: check if basished ...
|
||||
/*
|
||||
if (m_client.getName().get() != "") {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
APPL_DEBUG("Store User Info:");
|
||||
bool ret = g_database.storeSafe(g_basePath + g_baseDBName);
|
||||
if (ret == false) {
|
||||
|
@ -130,13 +130,13 @@ namespace appl {
|
||||
}
|
||||
public:
|
||||
uint32_t count() override {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
etk::FSNodeRemove(_baseName + _mediaString + ".jpg");
|
||||
etk::FSNodeMove(tmpFileName, _baseName + _mediaString + ".png");
|
||||
} else if (futType.get() == "image/jpeg") {
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(g_mutex);
|
||||
ethread::UniqueLock lock(g_mutex);
|
||||
store_db();
|
||||
APPL_WARNING("delete USER [STOP]");
|
||||
return true;
|
||||
|
@ -29,7 +29,7 @@ void zeus::FutureGroup::waitUntil(echrono::Steady _endTime) const {
|
||||
allIsFinished = false;
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(echrono::milliseconds(10));
|
||||
ethread::sleepMilliSeconds(echrono::milliseconds(10));
|
||||
}
|
||||
if (allIsFinished == false) {
|
||||
ZEUS_WARNING("Group Wait timeout ...");
|
||||
|
@ -50,7 +50,7 @@ void zeus::Promise::setAction() {
|
||||
|
||||
void zeus::Promise::andAll(zeus::Promise::Observer _callback) {
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
if (m_callbackThen != nullptr) {
|
||||
m_callbackThen(zeus::FutureBase(sharedFromThis()));
|
||||
}
|
||||
} else {
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
return m_receiveTime - m_sendTime;
|
||||
}
|
||||
|
||||
bool zeus::Promise::setMessage(ememory::SharedPtr<zeus::Message> _value) {
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
m_receiveTime = echrono::Steady::now();
|
||||
}
|
||||
if (_value->getType() == zeus::message::type::event) {
|
||||
ObserverEvent callback;
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
callback = m_callbackEvent;
|
||||
}
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
callback = etk::move(m_callbackThen);
|
||||
}
|
||||
if (callback != nullptr) {
|
||||
bool ret = callback(zeus::FutureBase(sharedFromThis()));
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
callback = m_callbackElse;
|
||||
}
|
||||
if (callback != nullptr) {
|
||||
bool ret = callback(zeus::FutureBase(sharedFromThis()));
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock 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;
|
||||
@ -245,7 +245,7 @@ bool zeus::Promise::isFinished() const {
|
||||
void zeus::Promise::wait() const {
|
||||
while (isFinished() == false) {
|
||||
// TODO : Do it better ... like messaging/mutex_locked ...
|
||||
std::this_thread::sleep_for(echrono::milliseconds(10));
|
||||
ethread::sleepMilliSeconds(echrono::milliseconds(10));
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ void zeus::Promise::waitFor(echrono::Duration _delta) const {
|
||||
while ( echrono::Steady::now() - start < _delta
|
||||
&& isFinished() == false) {
|
||||
// TODO : Do it better ... like messaging/mutex_locked ...
|
||||
std::this_thread::sleep_for(echrono::milliseconds(10));
|
||||
ethread::sleepMilliSeconds(echrono::milliseconds(10));
|
||||
}
|
||||
if (isFinished() == false) {
|
||||
ZEUS_WARNING("Wait timeout ... " << _delta);
|
||||
@ -266,7 +266,7 @@ void zeus::Promise::waitUntil(echrono::Steady _endTime) const {
|
||||
while ( echrono::Steady::now() < _endTime
|
||||
&& isFinished() == false) {
|
||||
// TODO : Do it better ... like messaging/mutex_locked ...
|
||||
std::this_thread::sleep_for(echrono::milliseconds(10));
|
||||
ethread::sleepMilliSeconds(echrono::milliseconds(10));
|
||||
}
|
||||
if (isFinished() == false) {
|
||||
ZEUS_WARNING("Wait timeout ..." << _endTime);
|
||||
|
@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <etk/types.hpp>
|
||||
#include <functional>
|
||||
#include <etk/Function.hpp>
|
||||
#include <zeus/message/Message.hpp>
|
||||
#include <zeus/message/Event.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
|
@ -97,7 +97,7 @@ zeus::WebServer::~WebServer() {
|
||||
ZEUS_INFO("stop thread pool ...");
|
||||
m_processingPool.stop();
|
||||
ZEUS_INFO("stop thread pool (done)");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); // TODO : Remove this ...
|
||||
ethread::sleepMilliSeconds((100)); // TODO : Remove this ...
|
||||
ZEUS_INFO("stop thread join ...");
|
||||
m_processingPool.join();
|
||||
ZEUS_INFO("stop thread join (done)");
|
||||
@ -109,12 +109,12 @@ void zeus::WebServer::setInterfaceName(const etk::String& _name) {
|
||||
}
|
||||
|
||||
void zeus::WebServer::addWebObj(ememory::SharedPtr<zeus::WebObj> _obj) {
|
||||
//std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
//ethread::UniqueLock lock(m_mutex);
|
||||
m_listObject.pushBack(_obj);
|
||||
}
|
||||
|
||||
void zeus::WebServer::addWebObjRemote(ememory::SharedPtr<zeus::ObjectRemoteBase> _obj) {
|
||||
//std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
//ethread::UniqueLock 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<ethread::Mutex> lock(m_pendingCallMutex);
|
||||
ethread::UniqueLock lock(m_pendingCallMutex);
|
||||
auto it = m_pendingCall.begin();
|
||||
while (it != m_pendingCall.end()) {
|
||||
if (it->second.isValid() == false) {
|
||||
@ -186,7 +186,7 @@ void zeus::WebServer::connect(bool _async){
|
||||
while ( _async == false
|
||||
&& m_threadAsyncRunning == true
|
||||
&& m_connection.isAlive() != true) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
ethread::sleepMilliSeconds((50));
|
||||
}
|
||||
//ethread::setPriority(*m_receiveThread, -6);
|
||||
if (_async == true) {
|
||||
@ -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<ethread::Mutex> lock(m_mutex);
|
||||
//ethread::UniqueLock lock(m_mutex);
|
||||
m_listPartialMessage.pushBack(_buffer);
|
||||
return;
|
||||
}
|
||||
if (_buffer->getType() == zeus::message::type::data) {
|
||||
// Add data in a previous buffer...
|
||||
//std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
//ethread::UniqueLock 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<ethread::Mutex> lock(m_pendingCallMutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
//ethread::UniqueLock 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<ethread::Mutex> lock(m_pendingCallMutex);
|
||||
ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
//ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
//ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
//ethread::UniqueLock 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<ethread::Mutex> lock(m_mutex);
|
||||
//ethread::UniqueLock 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<ethread::Mutex> lock(m_threadAsyncMutex);
|
||||
ethread::UniqueLock lock(m_threadAsyncMutex);
|
||||
m_threadAsyncList2.pushBack(_elem);
|
||||
ZEUS_DEBUG("ADD element to send ... " << m_threadAsyncList2.size());
|
||||
}
|
||||
@ -613,14 +613,14 @@ void zeus::WebServer::threadAsyncCallback() {
|
||||
while ( m_threadAsyncRunning == true
|
||||
&& m_connection.isAlive() == true) {
|
||||
if (m_threadAsyncList2.size() != 0) {
|
||||
std::unique_lock<ethread::Mutex> lock(m_threadAsyncMutex);
|
||||
ethread::UniqueLock lock(m_threadAsyncMutex);
|
||||
for (auto &it : m_threadAsyncList2) {
|
||||
m_threadAsyncList.pushBack(it);
|
||||
}
|
||||
m_threadAsyncList2.clear();
|
||||
}
|
||||
if (m_threadAsyncList.size() == 0) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
ethread::sleepMilliSeconds((10));
|
||||
continue;
|
||||
}
|
||||
auto it = m_threadAsyncList.begin();
|
||||
@ -649,7 +649,7 @@ zeus::FutureBase zeus::WebServer::callBinary(ememory::SharedPtr<zeus::Message> _
|
||||
}
|
||||
zeus::FutureBase tmpFuture(_obj->getTransactionId());
|
||||
{
|
||||
std::unique_lock<ethread::Mutex> lock(m_pendingCallMutex);
|
||||
ethread::UniqueLock lock(m_pendingCallMutex);
|
||||
m_pendingCall.pushBack(etk::makePair(uint64_t(0), tmpFuture));
|
||||
}
|
||||
writeBinary(_obj);
|
||||
|
@ -64,7 +64,7 @@ namespace zeus {
|
||||
_ARGS&&... _args) {
|
||||
_obj->addParameter<ZEUS_TYPE>(_param);
|
||||
_paramId++;
|
||||
createParam(_paramId, _obj, std::forward<_ARGS>(_args)...);
|
||||
createParam(_paramId, _obj, etk::forward<_ARGS>(_args)...);
|
||||
}
|
||||
/**
|
||||
* @brief Template specialization in 'const char*' to add a parameter of a function in recursive form
|
||||
@ -78,7 +78,7 @@ namespace zeus {
|
||||
ememory::SharedPtr<zeus::message::Call> _obj,
|
||||
const char* _param,
|
||||
_ARGS&&... _args) {
|
||||
createParam(_paramId, _obj, etk::String(_param), std::forward<_ARGS>(_args)...);
|
||||
createParam(_paramId, _obj, etk::String(_param), etk::forward<_ARGS>(_args)...);
|
||||
}
|
||||
/**
|
||||
* @brieftemplate to create a ZEUS CALL message with all the parameter in arguments
|
||||
@ -101,7 +101,7 @@ namespace zeus {
|
||||
if (callElem == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
createParam(0, callElem, std::forward<_ARGS>(_args)...);
|
||||
createParam(0, callElem, etk::forward<_ARGS>(_args)...);
|
||||
return callElem;
|
||||
}
|
||||
/**
|
||||
@ -138,7 +138,7 @@ namespace zeus {
|
||||
* @return a new single object ID
|
||||
*/
|
||||
uint16_t getNewObjectId() {
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
return m_localIdObjectIncrement++;
|
||||
}
|
||||
private:
|
||||
@ -336,7 +336,7 @@ namespace zeus {
|
||||
template<class... _ARGS>
|
||||
zeus::FutureBase call(const uint32_t& _source, const uint32_t& _destination, const etk::String& _functionName, _ARGS&&... _args) {
|
||||
uint16_t id = getId();
|
||||
ememory::SharedPtr<zeus::message::Call> callElem = zeus::createCall(sharedFromThis(), id, _source, _destination, _functionName, std::forward<_ARGS>(_args)...);
|
||||
ememory::SharedPtr<zeus::message::Call> callElem = zeus::createCall(sharedFromThis(), id, _source, _destination, _functionName, etk::forward<_ARGS>(_args)...);
|
||||
return callBinary(callElem);
|
||||
}
|
||||
public: // Events ...
|
||||
|
@ -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<ethread::Mutex> lock = _interface.getScopeLock();
|
||||
ethread::UniqueLock lock = _interface.getScopeLock();
|
||||
zeus::Message::writeOn(_interface);
|
||||
_interface.writeData((uint8_t*)m_errorType.c_str(), m_errorType.size() + 1);
|
||||
if (m_errorType.size() != 0) {
|
||||
|
@ -35,7 +35,7 @@ void zeus::message::Call::setCall(const etk::String& _value) {
|
||||
}
|
||||
|
||||
bool zeus::message::Call::writeOn(enet::WebSocket& _interface) {
|
||||
std::unique_lock<ethread::Mutex> lock = _interface.getScopeLock();
|
||||
ethread::UniqueLock 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) {
|
||||
|
@ -37,7 +37,7 @@ void zeus::message::Data::setPartId(uint32_t _value) {
|
||||
}
|
||||
|
||||
bool zeus::message::Data::writeOn(enet::WebSocket& _interface) {
|
||||
std::unique_lock<ethread::Mutex> lock = _interface.getScopeLock();
|
||||
ethread::UniqueLock lock = _interface.getScopeLock();
|
||||
if (zeus::Message::writeOn(_interface) == false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ void zeus::message::Event::generateDisplay(etk::Stream& _os) const {
|
||||
}
|
||||
|
||||
bool zeus::message::Event::writeOn(enet::WebSocket& _interface) {
|
||||
std::unique_lock<ethread::Mutex> lock = _interface.getScopeLock();
|
||||
ethread::UniqueLock lock = _interface.getScopeLock();
|
||||
zeus::Message::writeOn(_interface);
|
||||
_interface.writeData((uint8_t*)(&m_uid), sizeof(m_uid));
|
||||
if (message::Parameter::writeOn(_interface) == false) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user