This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-core/hive/libhive/devicemanager.cpp
Simon Stürz 94f1f39070 aktuell
2013-12-30 02:38:19 +01:00

41 lines
977 B
C++

#include "devicemanager.h"
#include <QDebug>
DeviceManager::DeviceManager(QObject *parent) :
QObject(parent)
{
}
bool DeviceManager::saveDevice(QString deviceType, QUuid uuid, QVariantMap paramters)
{
QSettings settings("hive");
settings.beginGroup(deviceType);
settings.beginGroup(uuid.toString());
QVariantMap::iterator i = paramters.begin();
while (i!= paramters.end()){
settings.setValue(i.key(),i.value());
++i;
}
settings.endGroup();
settings.endGroup();
return true;
}
bool DeviceManager::deleteDevice(QString deviceType, QUuid uuid)
{
QSettings settings("hive");
settings.beginGroup(deviceType);
// controll if we have a stored device with this uuid
if(!settings.childGroups().contains(uuid.toString())){
qDebug() << "no device with uuid" << uuid.toString() << "found.";
return false;
}
settings.remove(uuid.toString());
settings.endGroup();
return true;
}