Commit 62748966 authored by Sébastien Blin's avatar Sébastien Blin Committed by Kateryna Kostiuk
Browse files

lrc: add the possibility to know if daemon is connected

Change-Id: I1e4e4d9a48a393b91cc62353ce6c0153810881ce
parent 0b305a14
......@@ -56,6 +56,20 @@ public:
*/
DataTransferModel& getDataTransferModel() const;
/**
* Inform the daemon that the connectivity changed
*/
void connectivityChanged() const;
/**
* Test connection with daemon
*/
static bool isConnected();
/**
* Can communicate with the daemon via dbus
*/
static bool dbusIsValid();
private:
std::unique_ptr<LrcPimpl> lrcPimpl_;
};
......
/****************************************************************************
* Copyright (C) 2017-2018 Savoir-faire Linux *
* Copyright (C) 2017-2018 Savoir-faire Linux *
* Author : Nicolas Jäger <nicolas.jager@savoirfairelinux.com> *
* Author : Sébastien Blin <sebastien.blin@savoirfairelinux.com> *
* *
......@@ -24,6 +24,7 @@
#include "api/behaviorcontroller.h"
#include "database.h"
#include "callbackshandler.h"
#include "dbus/configurationmanager.h"
#include "dbus/instancemanager.h"
namespace lrc
......@@ -75,6 +76,32 @@ Lrc::getDataTransferModel() const
return *lrcPimpl_->dataTransferModel;
}
void
Lrc::connectivityChanged() const
{
ConfigurationManager::instance().connectivityChanged();
}
bool
Lrc::isConnected()
{
#ifdef ENABLE_LIBWRAP
return true;
#else
return ConfigurationManager::instance().connection().isConnected();
#endif
}
bool
Lrc::dbusIsValid()
{
#ifdef ENABLE_LIBWRAP
return true;
#else
return ConfigurationManager::instance().isValid();
#endif
}
LrcPimpl::LrcPimpl(Lrc& linked)
: linked(linked)
, behaviorController(std::make_unique<BehaviorController>())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment