Rename internal logging functions for clarity
I still got them mixed up all the time... Low, Medium, High it is!
This commit is contained in:
parent
72adec94e1
commit
31c709435b
7 changed files with 114 additions and 112 deletions
|
@ -34,8 +34,8 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chargeFile) logE("Battery charge file: " + chargeFile->fileName());
|
if(chargeFile) logL("Battery charge file: " + chargeFile->fileName());
|
||||||
else logE("Battery charge file: not found!");
|
else logL("Battery charge file: not found!");
|
||||||
|
|
||||||
// Number: battery/charging current, e.g. -1450000 (-145mA)
|
// Number: battery/charging current, e.g. -1450000 (-145mA)
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -49,8 +49,8 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentFile) logE("Charging/discharging current file: " + currentFile->fileName());
|
if(currentFile) logL("Charging/discharging current file: " + currentFile->fileName());
|
||||||
else logE("Charging/discharging current file: not found!");
|
else logL("Charging/discharging current file: not found!");
|
||||||
|
|
||||||
// String: charging, discharging, full, empty, unknown (others?)
|
// String: charging, discharging, full, empty, unknown (others?)
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -64,8 +64,8 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stateFile) logE("Status file: " + stateFile->fileName());
|
if(stateFile) logL("Status file: " + stateFile->fileName());
|
||||||
else logE("Status file: not found!");
|
else logL("Status file: not found!");
|
||||||
|
|
||||||
// Number: 0 or 1
|
// Number: 0 or 1
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -79,8 +79,8 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chargerConnectedFile) logE("Charger status file: " + chargerConnectedFile->fileName());
|
if(chargerConnectedFile) logL("Charger status file: " + chargerConnectedFile->fileName());
|
||||||
else logE("Charger status file: not found!");
|
else logL("Charger status file: not found!");
|
||||||
|
|
||||||
// Number: temperature
|
// Number: temperature
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -94,8 +94,8 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(temperatureFile) logE("Battery temperature file: " + temperatureFile->fileName());
|
if(temperatureFile) logL("Battery temperature file: " + temperatureFile->fileName());
|
||||||
else logE("Battery temperature file: not found!");
|
else logL("Battery temperature file: not found!");
|
||||||
|
|
||||||
// String: health state
|
// String: health state
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -108,8 +108,8 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(healthFile) logE("Battery health file: " + healthFile->fileName());
|
if(healthFile) logL("Battery health file: " + healthFile->fileName());
|
||||||
else logE("Battery health file: not found!");
|
else logL("Battery health file: not found!");
|
||||||
|
|
||||||
// Charger control file
|
// Charger control file
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -133,21 +133,21 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
|
||||||
|
|
||||||
// If we found a usable file, check that it is writable
|
// If we found a usable file, check that it is writable
|
||||||
if(chargingEnabledFile) {
|
if(chargingEnabledFile) {
|
||||||
logE("Charger control file: " + chargingEnabledFile->fileName());
|
logL("Charger control file: " + chargingEnabledFile->fileName());
|
||||||
if(chargingEnabledFile->open(QIODevice::WriteOnly)) {
|
if(chargingEnabledFile->open(QIODevice::WriteOnly)) {
|
||||||
chargingEnabledFile->close();
|
chargingEnabledFile->close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logE("Charger control file is not writable - feature disabled");
|
logL("Charger control file is not writable - feature disabled");
|
||||||
delete chargingEnabledFile;
|
delete chargingEnabledFile;
|
||||||
chargingEnabledFile = Q_NULLPTR;
|
chargingEnabledFile = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!QSysInfo::machineHostName().contains("SailfishEmul")) {
|
else if(!QSysInfo::machineHostName().contains("SailfishEmul")) {
|
||||||
logE("Charger control file not found!");
|
logL("Charger control file not found!");
|
||||||
logE("Please contact the developer with your device model!");
|
logL("Please contact the developer with your device model!");
|
||||||
}
|
}
|
||||||
else logE("Charger control file: not found!");
|
else logL("Charger control file: not found!");
|
||||||
|
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
|
@ -161,28 +161,31 @@ void Battery::updateData()
|
||||||
if(nextCharge != charge) {
|
if(nextCharge != charge) {
|
||||||
charge = nextCharge;
|
charge = nextCharge;
|
||||||
emit chargeChanged(charge);
|
emit chargeChanged(charge);
|
||||||
logV(QString("Battery: %1%").arg(charge));
|
logM(QString("Battery: %1%").arg(charge));
|
||||||
}
|
}
|
||||||
chargeFile->close();
|
chargeFile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chargerConnectedFile && chargerConnectedFile->open(QIODevice::ReadOnly)) {
|
if(chargerConnectedFile && chargerConnectedFile->open(QIODevice::ReadOnly)) {
|
||||||
nextChargerConnected = chargerConnectedFile->readLine().trimmed().toInt();
|
nextChargerConnected = chargerConnectedFile->readLine().trimmed().toInt();
|
||||||
if(nextChargerConnected != chargerConnected) {
|
if(nextChargerConnected != chargerConnected) {
|
||||||
chargerConnected = nextChargerConnected;
|
chargerConnected = nextChargerConnected;
|
||||||
emit chargerConnectedChanged(chargerConnected);
|
emit chargerConnectedChanged(chargerConnected);
|
||||||
logV(QString("Charger: %1").arg(chargerConnected ? "connected" : "disconnected"));
|
logM(QString("Charger: %1").arg(chargerConnected ? "connected" : "disconnected"));
|
||||||
}
|
}
|
||||||
chargerConnectedFile->close();
|
chargerConnectedFile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stateFile && stateFile->open(QIODevice::ReadOnly)) {
|
if(stateFile && stateFile->open(QIODevice::ReadOnly)) {
|
||||||
nextState = (QString(stateFile->readLine().trimmed().toLower()));
|
nextState = (QString(stateFile->readLine().trimmed().toLower()));
|
||||||
if(nextState != state) {
|
if(nextState != state) {
|
||||||
state = nextState;
|
state = nextState;
|
||||||
emit stateChanged(state);
|
emit stateChanged(state);
|
||||||
logV("State: " + state);
|
logM("State: " + state);
|
||||||
}
|
}
|
||||||
stateFile->close();
|
stateFile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentFile && currentFile->open(QIODevice::ReadOnly)) {
|
if(currentFile && currentFile->open(QIODevice::ReadOnly)) {
|
||||||
nextCurrent = currentFile->readLine().trimmed().toInt();
|
nextCurrent = currentFile->readLine().trimmed().toInt();
|
||||||
if(nextCurrent != current) {
|
if(nextCurrent != current) {
|
||||||
|
@ -192,23 +195,23 @@ void Battery::updateData()
|
||||||
}
|
}
|
||||||
currentFile->close();
|
currentFile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(healthFile && healthFile->open(QIODevice::ReadOnly)) {
|
if(healthFile && healthFile->open(QIODevice::ReadOnly)) {
|
||||||
nextHealth = (QString(healthFile->readLine().trimmed().toLower()));
|
nextHealth = (QString(healthFile->readLine().trimmed().toLower()));
|
||||||
if(nextHealth != health) {
|
if(nextHealth != health) {
|
||||||
health = nextHealth;
|
health = nextHealth;
|
||||||
emit healthChanged(health);
|
emit healthChanged(health);
|
||||||
logV("Health: " + health);
|
logM("Health: " + health);
|
||||||
}
|
}
|
||||||
healthFile->close();
|
healthFile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(temperatureFile && temperatureFile->open(QIODevice::ReadOnly)) {
|
if(temperatureFile && temperatureFile->open(QIODevice::ReadOnly)) {
|
||||||
nextTemperature = temperatureFile->readLine().trimmed().toInt();
|
nextTemperature = temperatureFile->readLine().trimmed().toInt();
|
||||||
if(nextTemperature != temperature) {
|
if(nextTemperature != temperature) {
|
||||||
temperature = nextTemperature;
|
temperature = nextTemperature;
|
||||||
emit temperatureChanged(temperature);
|
emit temperatureChanged(temperature);
|
||||||
// TODO: factor might be different depending on device
|
logH(QString("Temperature: %1°C").arg(temperature / 10));
|
||||||
// X10 has degrees * 10
|
|
||||||
logD(QString("Temperature: %1°C").arg(temperature / 10));
|
|
||||||
}
|
}
|
||||||
temperatureFile->close();
|
temperatureFile->close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ int main(int argc, char *argv[])
|
||||||
else if(!strcmp(argv[i],"--help")) {
|
else if(!strcmp(argv[i],"--help")) {
|
||||||
printf("%s %s\n", APP_NAME, APP_VERSION);
|
printf("%s %s\n", APP_NAME, APP_VERSION);
|
||||||
printf("Usage:\n");
|
printf("Usage:\n");
|
||||||
printf(" --verbose Enable informational messages\n");
|
printf(" --verbose Set log level to medium)\n");
|
||||||
printf(" --debug Enable informational and debugging messages\n");
|
printf(" --debug Set log level to high\n");
|
||||||
printf(" --help Print version string and exit\n");
|
printf(" --help Print version string and exit\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ Settings::Settings(Logger *newLogger, QObject *parent) : QObject(parent)
|
||||||
|
|
||||||
logger = newLogger;
|
logger = newLogger;
|
||||||
|
|
||||||
logV("Using " + mySettings->fileName());
|
logM("Using " + mySettings->fileName());
|
||||||
|
|
||||||
// Read in the values
|
// Read in the values
|
||||||
loadInteger(sLowAlert, lowAlert, 5, 99);
|
loadInteger(sLowAlert, lowAlert, 5, 99);
|
||||||
|
@ -60,7 +60,7 @@ Settings::Settings(Logger *newLogger, QObject *parent) : QObject(parent)
|
||||||
Settings::~Settings()
|
Settings::~Settings()
|
||||||
{
|
{
|
||||||
mySettings->sync();
|
mySettings->sync();
|
||||||
logV(QString("Settings saved: %1").arg(mySettings->status() == QSettings::NoError));
|
logM(QString("Settings saved: %1").arg(mySettings->status() == QSettings::NoError));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters condensed.
|
// Getters condensed.
|
||||||
|
@ -176,33 +176,33 @@ bool Settings::loadInteger(const char *key, int &currValue, const int min, const
|
||||||
int newValue = mySettings->value(key, currValue).toInt();
|
int newValue = mySettings->value(key, currValue).toInt();
|
||||||
newValue = (newValue <= min ? min : (newValue >= max ? max : newValue));
|
newValue = (newValue <= min ? min : (newValue >= max ? max : newValue));
|
||||||
if(currValue == newValue) {
|
if(currValue == newValue) {
|
||||||
logD(QString("Load: %1 %2 (unchanged)").arg(key).arg(currValue));
|
logH(QString("Load: %1 %2 (unchanged)").arg(key).arg(currValue));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
currValue = newValue;
|
currValue = newValue;
|
||||||
logV(QString("Load: %1 %2").arg(key).arg(currValue));
|
logM(QString("Load: %1 %2").arg(key).arg(currValue));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::loadString(const char *key, QString & currValue) {
|
bool Settings::loadString(const char *key, QString & currValue) {
|
||||||
QString newValue = mySettings->value(key, currValue).toString();
|
QString newValue = mySettings->value(key, currValue).toString();
|
||||||
if(currValue == newValue) {
|
if(currValue == newValue) {
|
||||||
logD(QString("Load: %1 %2 (unchanged)").arg(key).arg(currValue));
|
logH(QString("Load: %1 %2 (unchanged)").arg(key).arg(currValue));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
currValue = newValue;
|
currValue = newValue;
|
||||||
logV(QString("Load: %1 %2").arg(key).arg(currValue));
|
logM(QString("Load: %1 %2").arg(key).arg(currValue));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::saveInteger(const char* key, const int &newValue, int &currValue) {
|
bool Settings::saveInteger(const char* key, const int &newValue, int &currValue) {
|
||||||
if(currValue == newValue) {
|
if(currValue == newValue) {
|
||||||
logD(QString("Save: %1 %2 (unchanged)").arg(key).arg(currValue));
|
logH(QString("Save: %1 %2 (unchanged)").arg(key).arg(currValue));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
currValue = newValue;
|
currValue = newValue;
|
||||||
mySettings->setValue(key, QByteArray::number(newValue));
|
mySettings->setValue(key, QByteArray::number(newValue));
|
||||||
logV(QString("Save: %1 %2").arg(key).arg(newValue));
|
logM(QString("Save: %1 %2").arg(key).arg(newValue));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +212,6 @@ bool Settings::saveString(const char* key, const QString &newValue, QString &cur
|
||||||
}
|
}
|
||||||
currValue = newValue;
|
currValue = newValue;
|
||||||
mySettings->setValue(key, QString(newValue).replace("\"", "\\\"").toUtf8());
|
mySettings->setValue(key, QString(newValue).replace("\"", "\\\"").toUtf8());
|
||||||
logV(QString("Save: %1 %2").arg(key).arg(newValue));
|
logM(QString("Save: %1 %2").arg(key).arg(newValue));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
|
||||||
int logLevel = settings->getLogLevel();
|
int logLevel = settings->getLogLevel();
|
||||||
logger->debug = (logLevel == 2);
|
logger->debug = (logLevel == 2);
|
||||||
logger->verbose = (logLevel > 1);
|
logger->verbose = (logLevel > 1);
|
||||||
logE(QString("Log level set to %1").arg((logLevel == 0 ? "low" : (logLevel == 1 ? "medium" : "high"))));
|
logL(QString("Log level set to %1").arg((logLevel == 0 ? "low" : (logLevel == 1 ? "medium" : "high"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
chargeNotification = new MyNotification(this);
|
chargeNotification = new MyNotification(this);
|
||||||
|
@ -45,8 +45,8 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chargeFile) logE("Battery charge file: " + chargeFile->fileName());
|
if(chargeFile) logL("Battery charge file: " + chargeFile->fileName());
|
||||||
else logE("Battery charge file: not found!");
|
else logL("Battery charge file: not found!");
|
||||||
|
|
||||||
// Charging/discharging current in microamps, e.g. -1450000 (-145mA)
|
// Charging/discharging current in microamps, e.g. -1450000 (-145mA)
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -60,8 +60,8 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentFile) logE("Charging/discharging current file: " + currentFile->fileName());
|
if(currentFile) logL("Charging/discharging current file: " + currentFile->fileName());
|
||||||
else logE("Charging/discharging current file: not found!");
|
else logL("Charging/discharging current file: not found!");
|
||||||
|
|
||||||
// Battery/charging status: charging, discharging, full, empty, unknown (others?)
|
// Battery/charging status: charging, discharging, full, empty, unknown (others?)
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -75,8 +75,8 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stateFile) logE("Status file: " + stateFile->fileName());
|
if(stateFile) logL("Status file: " + stateFile->fileName());
|
||||||
else logE("Status file: not found!");
|
else logL("Status file: not found!");
|
||||||
|
|
||||||
// Charger connected, bool (number): 0 or 1
|
// Charger connected, bool (number): 0 or 1
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -90,8 +90,8 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chargerConnectedFile) logE("Charger status file: " + chargerConnectedFile->fileName());
|
if(chargerConnectedFile) logL("Charger status file: " + chargerConnectedFile->fileName());
|
||||||
else logE("Charger status file: not found!");
|
else logL("Charger status file: not found!");
|
||||||
|
|
||||||
// Number: temperature
|
// Number: temperature
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -105,8 +105,8 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(temperatureFile) logE("Battery temperature file: " + temperatureFile->fileName());
|
if(temperatureFile) logL("Battery temperature file: " + temperatureFile->fileName());
|
||||||
else logE("Battery temperature file: not found!");
|
else logL("Battery temperature file: not found!");
|
||||||
|
|
||||||
// String: health state
|
// String: health state
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -119,8 +119,8 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(healthFile) logE("Battery health file: " + healthFile->fileName());
|
if(healthFile) logL("Battery health file: " + healthFile->fileName());
|
||||||
else logE("Battery health file: not found!");
|
else logL("Battery health file: not found!");
|
||||||
|
|
||||||
// Charger control file
|
// Charger control file
|
||||||
filenames.clear();
|
filenames.clear();
|
||||||
|
@ -144,21 +144,21 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
|
||||||
|
|
||||||
// If we found a usable file, check that it is writable
|
// If we found a usable file, check that it is writable
|
||||||
if(chargingEnabledFile) {
|
if(chargingEnabledFile) {
|
||||||
logE("Charger control file: " + chargingEnabledFile->fileName());
|
logL("Charger control file: " + chargingEnabledFile->fileName());
|
||||||
if(chargingEnabledFile->open(QIODevice::WriteOnly)) {
|
if(chargingEnabledFile->open(QIODevice::WriteOnly)) {
|
||||||
chargingEnabledFile->close();
|
chargingEnabledFile->close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logE("Charger control file is not writable - feature disabled");
|
logL("Charger control file is not writable - feature disabled");
|
||||||
delete chargingEnabledFile;
|
delete chargingEnabledFile;
|
||||||
chargingEnabledFile = Q_NULLPTR;
|
chargingEnabledFile = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!QSysInfo::machineHostName().contains("SailfishEmul")) {
|
else if(!QSysInfo::machineHostName().contains("SailfishEmul")) {
|
||||||
logE("Charger control file not found!");
|
logL("Charger control file not found!");
|
||||||
logE("Please contact the developer with your device model!");
|
logL("Please contact the developer with your device model!");
|
||||||
}
|
}
|
||||||
else logE("Charger control file: not found!");
|
else logL("Charger control file: not found!");
|
||||||
|
|
||||||
connect(settings, SIGNAL(resetTimers()), this, SLOT(resetTimers()));
|
connect(settings, SIGNAL(resetTimers()), this, SLOT(resetTimers()));
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ void Battery::updateData()
|
||||||
nextCharge = chargeFile->readLine().trimmed().toInt();
|
nextCharge = chargeFile->readLine().trimmed().toInt();
|
||||||
if(nextCharge != charge) {
|
if(nextCharge != charge) {
|
||||||
charge = nextCharge;
|
charge = nextCharge;
|
||||||
logV(QString("Battery: %1%").arg(charge));
|
logM(QString("Battery: %1%").arg(charge));
|
||||||
}
|
}
|
||||||
chargeFile->close();
|
chargeFile->close();
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ void Battery::updateData()
|
||||||
nextChargerConnected = chargerConnectedFile->readLine().trimmed().toInt();
|
nextChargerConnected = chargerConnectedFile->readLine().trimmed().toInt();
|
||||||
if(nextChargerConnected != chargerConnected) {
|
if(nextChargerConnected != chargerConnected) {
|
||||||
chargerConnected = nextChargerConnected;
|
chargerConnected = nextChargerConnected;
|
||||||
logV(QString("Charger: %1").arg(chargerConnected ? "connected" : "disconnected"));
|
logM(QString("Charger: %1").arg(chargerConnected ? "connected" : "disconnected"));
|
||||||
}
|
}
|
||||||
chargerConnectedFile->close();
|
chargerConnectedFile->close();
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ void Battery::updateData()
|
||||||
nextState = (QString(stateFile->readLine().trimmed().toLower()));
|
nextState = (QString(stateFile->readLine().trimmed().toLower()));
|
||||||
if(nextState != state) {
|
if(nextState != state) {
|
||||||
state = nextState;
|
state = nextState;
|
||||||
logV("State: " + state);
|
logM("State: " + state);
|
||||||
|
|
||||||
// Hide/show notification right away
|
// Hide/show notification right away
|
||||||
resetTimers();
|
resetTimers();
|
||||||
|
@ -248,7 +248,7 @@ void Battery::updateData()
|
||||||
nextTemperature = temperatureFile->readLine().trimmed().toInt();
|
nextTemperature = temperatureFile->readLine().trimmed().toInt();
|
||||||
if(nextTemperature != temperature) {
|
if(nextTemperature != temperature) {
|
||||||
if((nextTemperature / 10) != (temperature / 10)) {
|
if((nextTemperature / 10) != (temperature / 10)) {
|
||||||
logV(QString("Temperature: %1°C").arg(nextTemperature / 10));
|
logM(QString("Temperature: %1°C").arg(nextTemperature / 10));
|
||||||
}
|
}
|
||||||
temperature = nextTemperature;
|
temperature = nextTemperature;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ void Battery::updateData()
|
||||||
nextHealth = (QString(healthFile->readLine().trimmed().toLower()));
|
nextHealth = (QString(healthFile->readLine().trimmed().toLower()));
|
||||||
if(nextHealth != health) {
|
if(nextHealth != health) {
|
||||||
health = nextHealth;
|
health = nextHealth;
|
||||||
logV("Health: " + health);
|
logM("Health: " + health);
|
||||||
|
|
||||||
// Hide/show notification right away
|
// Hide/show notification right away
|
||||||
resetTimers();
|
resetTimers();
|
||||||
|
@ -269,11 +269,11 @@ void Battery::updateData()
|
||||||
|
|
||||||
if(chargingEnabledFile && settings->getLimitEnabled()) {
|
if(chargingEnabledFile && settings->getLimitEnabled()) {
|
||||||
if(chargingEnabled && charge >= settings->getHighLimit()) {
|
if(chargingEnabled && charge >= settings->getHighLimit()) {
|
||||||
logD("Disabling charging...");
|
logM("Disabling charging...");
|
||||||
setChargingEnabled(false);
|
setChargingEnabled(false);
|
||||||
}
|
}
|
||||||
else if(!chargingEnabled && charge <= settings->getLowLimit()) {
|
else if(!chargingEnabled && charge <= settings->getLowLimit()) {
|
||||||
logD("Enabling charging...");
|
logM("Enabling charging...");
|
||||||
setChargingEnabled(true);
|
setChargingEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,57 +287,57 @@ void Battery::resetTimers() {
|
||||||
|
|
||||||
if(settings->getHighNotificationsInterval() > 0) {
|
if(settings->getHighNotificationsInterval() > 0) {
|
||||||
highNotifyTimer->setWakeupFrequency(frequencies[settings->getHighNotificationsInterval()]);
|
highNotifyTimer->setWakeupFrequency(frequencies[settings->getHighNotificationsInterval()]);
|
||||||
logD(QString("High notifications frequency %1 => %2 seconds")
|
logH(QString("High notifications frequency %1 => %2 seconds")
|
||||||
.arg(settings->getHighNotificationsInterval())
|
.arg(settings->getHighNotificationsInterval())
|
||||||
.arg(static_cast<int>(frequencies[settings->getHighNotificationsInterval()])));
|
.arg(static_cast<int>(frequencies[settings->getHighNotificationsInterval()])));
|
||||||
logD("Starting high battery timer");
|
logH("Starting high battery timer");
|
||||||
highNotifyTimer->wait();
|
highNotifyTimer->wait();
|
||||||
showHighNotification();
|
showHighNotification();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logD("High battery timer not started");
|
logH("High battery timer not started");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(settings->getLowNotificationsInterval() > 0) {
|
if(settings->getLowNotificationsInterval() > 0) {
|
||||||
lowNotifyTimer->setWakeupFrequency(frequencies[settings->getLowNotificationsInterval()]);
|
lowNotifyTimer->setWakeupFrequency(frequencies[settings->getLowNotificationsInterval()]);
|
||||||
logD(QString("Low notifications frequency %1 => %2 seconds")
|
logH(QString("Low notifications frequency %1 => %2 seconds")
|
||||||
.arg(settings->getLowNotificationsInterval())
|
.arg(settings->getLowNotificationsInterval())
|
||||||
.arg(static_cast<int>(frequencies[settings->getLowNotificationsInterval()])));
|
.arg(static_cast<int>(frequencies[settings->getLowNotificationsInterval()])));
|
||||||
logD("Start low battery timer");
|
logH("Start low battery timer");
|
||||||
lowNotifyTimer->wait();
|
lowNotifyTimer->wait();
|
||||||
showLowNotification();
|
showLowNotification();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logD("Low battery timer not started");
|
logH("Low battery timer not started");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(settings->getHealthNotificationsInterval() > 0) {
|
if(settings->getHealthNotificationsInterval() > 0) {
|
||||||
healthNotifyTimer->setWakeupFrequency(frequencies[settings->getHealthNotificationsInterval()]);
|
healthNotifyTimer->setWakeupFrequency(frequencies[settings->getHealthNotificationsInterval()]);
|
||||||
logD(QString("Health notifications frequency %1 => %2 seconds")
|
logH(QString("Health notifications frequency %1 => %2 seconds")
|
||||||
.arg(settings->getHealthNotificationsInterval())
|
.arg(settings->getHealthNotificationsInterval())
|
||||||
.arg(static_cast<int>(frequencies[settings->getHealthNotificationsInterval()])));
|
.arg(static_cast<int>(frequencies[settings->getHealthNotificationsInterval()])));
|
||||||
logD("Start health timer");
|
logH("Start health timer");
|
||||||
healthNotifyTimer->wait();
|
healthNotifyTimer->wait();
|
||||||
showHealthNotification();
|
showHealthNotification();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logD("Health timer not started");
|
logH("Health timer not started");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::showHighNotification() {
|
void Battery::showHighNotification() {
|
||||||
if(settings->getHighNotificationsInterval() > 0 && (charge >= settings->getHighAlert() && state != "discharging")
|
if(settings->getHighNotificationsInterval() > 0 && (charge >= settings->getHighAlert() && state != "discharging")
|
||||||
&& !(charge == 100 && state == "idle")) {
|
&& !(charge == 100 && state == "idle")) {
|
||||||
logV(QString("Notification: %1").arg(settings->getNotificationTitle().arg(charge)));
|
logH(QString("Notification: %1").arg(settings->getNotificationTitle().arg(charge)));
|
||||||
chargeNotification->send(settings->getNotificationTitle().arg(charge), settings->getNotificationHighText(), settings->getHighAlertFile());
|
chargeNotification->send(settings->getNotificationTitle().arg(charge), settings->getNotificationHighText(), settings->getHighAlertFile());
|
||||||
unclosedChargeNotification = true;
|
unclosedChargeNotification = true;
|
||||||
if(settings->getHighNotificationsInterval() == 50) {
|
if(settings->getHighNotificationsInterval() == 50) {
|
||||||
logD("Stop high battery timer");
|
logH("Stop high battery timer");
|
||||||
highNotifyTimer->stop();
|
highNotifyTimer->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(unclosedChargeNotification && charge > settings->getLowAlert()) {
|
else if(unclosedChargeNotification && charge > settings->getLowAlert()) {
|
||||||
logD("Close high battery notification");
|
logH("Close high battery notification");
|
||||||
chargeNotification->close();
|
chargeNotification->close();
|
||||||
unclosedChargeNotification = true;
|
unclosedChargeNotification = true;
|
||||||
}
|
}
|
||||||
|
@ -345,16 +345,16 @@ void Battery::showHighNotification() {
|
||||||
|
|
||||||
void Battery::showLowNotification() {
|
void Battery::showLowNotification() {
|
||||||
if(settings->getLowNotificationsInterval() > 0 && charge <= settings->getLowAlert() && state != "charging") {
|
if(settings->getLowNotificationsInterval() > 0 && charge <= settings->getLowAlert() && state != "charging") {
|
||||||
logV(QString("Notification: %1").arg(settings->getNotificationTitle().arg(charge)));
|
logH(QString("Notification: %1").arg(settings->getNotificationTitle().arg(charge)));
|
||||||
chargeNotification->send(settings->getNotificationTitle().arg(charge), settings->getNotificationLowText(), settings->getLowAlertFile());
|
chargeNotification->send(settings->getNotificationTitle().arg(charge), settings->getNotificationLowText(), settings->getLowAlertFile());
|
||||||
unclosedChargeNotification = true;
|
unclosedChargeNotification = true;
|
||||||
if(settings->getLowNotificationsInterval() == 50) {
|
if(settings->getLowNotificationsInterval() == 50) {
|
||||||
logD("Stop low battery timer");
|
logH("Stop low battery timer");
|
||||||
lowNotifyTimer->stop();
|
lowNotifyTimer->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(unclosedChargeNotification && charge < settings->getHighAlert()) {
|
else if(unclosedChargeNotification && charge < settings->getHighAlert()) {
|
||||||
logD("Close low battery notification");
|
logH("Close low battery notification");
|
||||||
chargeNotification->close();
|
chargeNotification->close();
|
||||||
unclosedChargeNotification = true;
|
unclosedChargeNotification = true;
|
||||||
}
|
}
|
||||||
|
@ -392,16 +392,16 @@ void Battery::showHealthNotification() {
|
||||||
} else if (HealthState[health] == HealthThresh["crit"]) {
|
} else if (HealthState[health] == HealthThresh["crit"]) {
|
||||||
notificationText = settings->getNotificationHealthCritText();
|
notificationText = settings->getNotificationHealthCritText();
|
||||||
}
|
}
|
||||||
logD(QString("Notification: %1").arg(settings->getNotificationHealthTitle().arg(titleArgs)));
|
logH(QString("Notification: %1").arg(settings->getNotificationHealthTitle().arg(titleArgs)));
|
||||||
healthNotification->send(settings->getNotificationHealthTitle().arg(titleArgs), notificationText, settings->getHealthAlertFile());
|
healthNotification->send(settings->getNotificationHealthTitle().arg(titleArgs), notificationText, settings->getHealthAlertFile());
|
||||||
unclosedHealthNotification = true;
|
unclosedHealthNotification = true;
|
||||||
if(settings->getHealthNotificationsInterval() == 50) {
|
if(settings->getHealthNotificationsInterval() == 50) {
|
||||||
logD("Stop health timer");
|
logH("Stop health timer");
|
||||||
healthNotifyTimer->stop();
|
healthNotifyTimer->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(unclosedHealthNotification && (HealthState[health] == HealthThresh["ok"] || HealthState[health] < settings->getHealthAlert())) {
|
else if(unclosedHealthNotification && (HealthState[health] == HealthThresh["ok"] || HealthState[health] < settings->getHealthAlert())) {
|
||||||
logD("Close health notification");
|
logH("Close health notification");
|
||||||
healthNotification->close();
|
healthNotification->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,19 +425,19 @@ bool Battery::setChargingEnabled(const bool isEnabled) {
|
||||||
success = true;
|
success = true;
|
||||||
|
|
||||||
if(isEnabled) {
|
if(isEnabled) {
|
||||||
logV("Charging resumed");
|
logM("Charging resumed");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logV("Charging paused");
|
logM("Charging paused");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logE("Could not write new charger state");
|
logL("Could not write new charger state");
|
||||||
}
|
}
|
||||||
chargingEnabledFile->close();
|
chargingEnabledFile->close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logE("Could not open charger control file");
|
logL("Could not open charger control file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
|
@ -448,28 +448,27 @@ bool Battery::getChargerConnected() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::shutdown() {
|
void Battery::shutdown() {
|
||||||
logV("Shutting down...");
|
logM("Shutting down...");
|
||||||
chargeNotification->close();
|
chargeNotification->close();
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
if(updateTimer) {
|
if(updateTimer) {
|
||||||
updateTimer->stop();
|
updateTimer->stop();
|
||||||
logD("Update timer stopped");
|
logH("Update timer stopped");
|
||||||
}
|
}
|
||||||
if(highNotifyTimer) {
|
if(highNotifyTimer) {
|
||||||
highNotifyTimer->stop();
|
highNotifyTimer->stop();
|
||||||
logD("High battery notification stopped");
|
logH("High battery notification stopped");
|
||||||
}
|
}
|
||||||
if(lowNotifyTimer) {
|
if(lowNotifyTimer) {
|
||||||
lowNotifyTimer->stop();
|
lowNotifyTimer->stop();
|
||||||
logD("Low battery notification stopped");
|
logH("Low battery notification stopped");
|
||||||
}
|
}
|
||||||
if(healthNotifyTimer) {
|
if(healthNotifyTimer) {
|
||||||
healthNotifyTimer->stop();
|
healthNotifyTimer->stop();
|
||||||
logD("Health notification stopped");
|
logH("Health notification stopped");
|
||||||
}
|
}
|
||||||
// ENABLE/DISABLE CHARGING
|
|
||||||
if(!setChargingEnabled(true) && !QSysInfo::machineHostName().contains("SailfishEmul")) {
|
if(!setChargingEnabled(true) && !QSysInfo::machineHostName().contains("SailfishEmul")) {
|
||||||
logE("ERROR! Could not restore charger status! Your device "
|
logL("ERROR! Could not restore charger status! Your device "
|
||||||
"may not charge until reboot! If that doesn't help, "
|
"may not charge until reboot! If that doesn't help, "
|
||||||
"uninstall Battery Buddy and reboot your device.");
|
"uninstall Battery Buddy and reboot your device.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ int main(int argc, char** argv)
|
||||||
else if(!strcmp(argv[i],"--help")) {
|
else if(!strcmp(argv[i],"--help")) {
|
||||||
printf("%s %s\n", APP_NAME, APP_VERSION);
|
printf("%s %s\n", APP_NAME, APP_VERSION);
|
||||||
printf("Usage:\n");
|
printf("Usage:\n");
|
||||||
printf(" --verbose Enable informational messages\n");
|
printf(" --verbose Set log level to medium)\n");
|
||||||
printf(" --debug Enable informational and debugging messages\n");
|
printf(" --debug Set log level to high\n");
|
||||||
printf(" --help Print version string and exit\n");
|
printf(" --help Print version string and exit\n");
|
||||||
printf(" --logfile Write log to a file. Implies --verbose\n\n");
|
printf(" --logfile Write log to a file. Implies --verbose\n\n");
|
||||||
printf("Log file: ~/.cache/harbour-batterybuddy/harbour-batterybuddy-daemon.log\n");
|
printf("Log file: ~/.cache/harbour-batterybuddy/harbour-batterybuddy-daemon.log\n");
|
||||||
|
@ -68,7 +68,7 @@ int main(int argc, char** argv)
|
||||||
app.setApplicationVersion(APP_VERSION);
|
app.setApplicationVersion(APP_VERSION);
|
||||||
|
|
||||||
Logger* logger = new Logger(verbose, debug, logfile);
|
Logger* logger = new Logger(verbose, debug, logfile);
|
||||||
logE(QString("%1 %2").arg(APP_NAME, APP_VERSION));
|
logL(QString("%1 %2").arg(APP_NAME, APP_VERSION));
|
||||||
|
|
||||||
Battery* battery = new Battery(logger, logLevelSet, &app);
|
Battery* battery = new Battery(logger, logLevelSet, &app);
|
||||||
|
|
||||||
|
|
|
@ -10,16 +10,16 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
// Use like this:
|
// Use like this:
|
||||||
// logV("Settings loaded");
|
// logM("Settings loaded");
|
||||||
|
|
||||||
// Errors (always written - for general messages, too!)
|
// Low setting - always logged
|
||||||
#define logE logger->log
|
#define logL logger->log
|
||||||
|
|
||||||
// Verbose (log, if enabled)
|
// Medium setting - log more values
|
||||||
#define logV if(logger->verbose) logger->log
|
#define logM if(logger->verbose) logger->log
|
||||||
|
|
||||||
// Debug (log, if enabled)
|
// High setting - log everything
|
||||||
#define logD if(logger->debug) logger->log
|
#define logH if(logger->debug) logger->log
|
||||||
|
|
||||||
class Logger : public QObject
|
class Logger : public QObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ Settings::Settings(Logger* newLogger, QObject *parent) : QObject(parent)
|
||||||
mySettings = new QSettings(appName, appName, this);
|
mySettings = new QSettings(appName, appName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
logV("Using " + mySettings->fileName());
|
logM("Using " + mySettings->fileName());
|
||||||
|
|
||||||
QString logFilename = logger->getLogFilename();
|
QString logFilename = logger->getLogFilename();
|
||||||
if(mySettings->value(sLogFilename,QString()).toString() != logFilename) {
|
if(mySettings->value(sLogFilename,QString()).toString() != logFilename) {
|
||||||
|
@ -40,14 +40,14 @@ Settings::Settings(Logger* newLogger, QObject *parent) : QObject(parent)
|
||||||
if(mySettings->contains(key)) {
|
if(mySettings->contains(key)) {
|
||||||
mySettings->setValue(sLowAlert, mySettings->value(key));
|
mySettings->setValue(sLowAlert, mySettings->value(key));
|
||||||
mySettings->remove(key);
|
mySettings->remove(key);
|
||||||
logV(migrate.arg(key));
|
logM(migrate.arg(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
key = "upperLimit";
|
key = "upperLimit";
|
||||||
if(mySettings->contains(key)) {
|
if(mySettings->contains(key)) {
|
||||||
mySettings->setValue(sHighAlert, mySettings->value(key));
|
mySettings->setValue(sHighAlert, mySettings->value(key));
|
||||||
mySettings->remove(key);
|
mySettings->remove(key);
|
||||||
logV(migrate.arg(key));
|
logM(migrate.arg(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
key = "notificationsEnabled";
|
key = "notificationsEnabled";
|
||||||
|
@ -61,7 +61,7 @@ Settings::Settings(Logger* newLogger, QObject *parent) : QObject(parent)
|
||||||
mySettings->setValue(sLowNotificationsInterval, lowNotificationsInterval);
|
mySettings->setValue(sLowNotificationsInterval, lowNotificationsInterval);
|
||||||
}
|
}
|
||||||
mySettings->remove(key);
|
mySettings->remove(key);
|
||||||
logV(migrate.arg(key));
|
logM(migrate.arg(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
key = "interval";
|
key = "interval";
|
||||||
|
@ -69,7 +69,7 @@ Settings::Settings(Logger* newLogger, QObject *parent) : QObject(parent)
|
||||||
mySettings->setValue(sHighNotificationsInterval, mySettings->value(key));
|
mySettings->setValue(sHighNotificationsInterval, mySettings->value(key));
|
||||||
mySettings->setValue(sLowNotificationsInterval, mySettings->value(key));
|
mySettings->setValue(sLowNotificationsInterval, mySettings->value(key));
|
||||||
mySettings->remove(key);
|
mySettings->remove(key);
|
||||||
logV(migrate.arg(key));
|
logM(migrate.arg(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
key = "highNotificationsEnabled";
|
key = "highNotificationsEnabled";
|
||||||
|
@ -77,7 +77,7 @@ Settings::Settings(Logger* newLogger, QObject *parent) : QObject(parent)
|
||||||
if(mySettings->value(key).toInt() == 0)
|
if(mySettings->value(key).toInt() == 0)
|
||||||
mySettings->setValue(sHighNotificationsInterval, 2);
|
mySettings->setValue(sHighNotificationsInterval, 2);
|
||||||
mySettings->remove(key);
|
mySettings->remove(key);
|
||||||
logV(migrate.arg(key));
|
logM(migrate.arg(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
key = "lowNotificationsEnabled";
|
key = "lowNotificationsEnabled";
|
||||||
|
@ -85,7 +85,7 @@ Settings::Settings(Logger* newLogger, QObject *parent) : QObject(parent)
|
||||||
if(mySettings->value(key).toInt() == 0)
|
if(mySettings->value(key).toInt() == 0)
|
||||||
mySettings->setValue(sLowNotificationsInterval, 2);
|
mySettings->setValue(sLowNotificationsInterval, 2);
|
||||||
mySettings->remove(key);
|
mySettings->remove(key);
|
||||||
logV(migrate.arg(key));
|
logM(migrate.arg(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are updated and localized from the config file
|
// These are updated and localized from the config file
|
||||||
|
@ -110,11 +110,11 @@ bool Settings::loadInteger(const char *key, int &currValue, const int min, const
|
||||||
int newValue = mySettings->value(key, currValue).toInt();
|
int newValue = mySettings->value(key, currValue).toInt();
|
||||||
newValue = (newValue <= min ? min : (newValue >= max ? max : newValue));
|
newValue = (newValue <= min ? min : (newValue >= max ? max : newValue));
|
||||||
if(currValue == newValue) {
|
if(currValue == newValue) {
|
||||||
logD(QString("Load: %1 %2 (unchanged)").arg(key).arg(currValue));
|
logH(QString("Load: %1 %2 (unchanged)").arg(key).arg(currValue));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
currValue = newValue;
|
currValue = newValue;
|
||||||
logV(QString("Load: %1 %2").arg(key).arg(currValue));
|
logM(QString("Load: %1 %2").arg(key).arg(currValue));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void Settings::updateConfig(const QString path) {
|
||||||
mySettings = new QSettings(appName, appName, this);
|
mySettings = new QSettings(appName, appName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
logD("Updating configuration...");
|
logH("Updating configuration...");
|
||||||
|
|
||||||
// Read in the values
|
// Read in the values
|
||||||
bool restartTimers = false;
|
bool restartTimers = false;
|
||||||
|
@ -155,7 +155,7 @@ void Settings::updateConfig(const QString path) {
|
||||||
if(oldLogLevel != logLevel) {
|
if(oldLogLevel != logLevel) {
|
||||||
logger->debug = (logLevel == 2);
|
logger->debug = (logLevel == 2);
|
||||||
logger->verbose = (logLevel > 1);
|
logger->verbose = (logLevel > 1);
|
||||||
logE(QString("Log level set to %1").arg((logLevel == 0 ? "low" : (logLevel == 1 ? "medium" : "high"))));
|
logL(QString("Log level set to %1").arg((logLevel == 0 ? "low" : (logLevel == 1 ? "medium" : "high"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete mySettings;
|
delete mySettings;
|
||||||
|
@ -165,11 +165,11 @@ void Settings::updateConfig(const QString path) {
|
||||||
QThread::msleep(100);
|
QThread::msleep(100);
|
||||||
|
|
||||||
if(watcher->files().contains(path)) {
|
if(watcher->files().contains(path)) {
|
||||||
logD("Config file already on watchlist");
|
logH("Config file already on watchlist");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
watcher->addPath(path);
|
watcher->addPath(path);
|
||||||
logD("Config file added to watchlist");
|
logH("Config file added to watchlist");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(restartTimers) {
|
if(restartTimers) {
|
||||||
|
|
Loading…
Reference in a new issue