Intermediate commit (device browser)
This commit is contained in:
parent
c6a0cecb0f
commit
933d92ab06
@ -710,6 +710,14 @@ Device::DeviceError DeviceManagerImplementation::removeConfiguredDevice(const De
|
||||
return Device::DeviceErrorNoError;
|
||||
}
|
||||
|
||||
BrowserItems DeviceManagerImplementation::browseDevice(const DeviceId &deviceId, const QString &browser, const BrowserItemId &node)
|
||||
{
|
||||
Q_UNUSED(deviceId)
|
||||
Q_UNUSED(browser)
|
||||
Q_UNUSED(node)
|
||||
return BrowserItems();
|
||||
}
|
||||
|
||||
QString DeviceManagerImplementation::translate(const PluginId &pluginId, const QString &string, const QLocale &locale)
|
||||
{
|
||||
return m_translator->translate(pluginId, string, locale);
|
||||
|
||||
@ -97,6 +97,8 @@ public:
|
||||
|
||||
Device::DeviceError removeConfiguredDevice(const DeviceId &deviceId) override;
|
||||
|
||||
BrowserItems browseDevice(const DeviceId &deviceId, const QString &browser, const BrowserItemId &node = BrowserItemId()) override;
|
||||
|
||||
QString translate(const PluginId &pluginId, const QString &string, const QLocale &locale) override;
|
||||
|
||||
signals:
|
||||
|
||||
@ -665,6 +665,21 @@ JsonReply *DeviceHandler::GetStateValues(const QVariantMap ¶ms) const
|
||||
return createReply(returns);
|
||||
}
|
||||
|
||||
JsonReply *DeviceHandler::BrowseDevice(const QVariantMap ¶ms) const
|
||||
{
|
||||
QVariantMap returns;
|
||||
DeviceId deviceId = DeviceId(params.value("deviceId").toString());
|
||||
QString browser = params.value("browser").toString();
|
||||
|
||||
Device *device = NymeaCore::instance()->deviceManager()->findConfiguredDevice(deviceId);
|
||||
if (!device) {
|
||||
returns.insert("deviceError", JsonTypes::deviceErrorToString(Device::DeviceErrorDeviceNotFound));
|
||||
return createReply(returns);
|
||||
}
|
||||
NymeaCore::instance()->deviceManager()->browseDevice(device->id(), browser);
|
||||
return createReply(returns);
|
||||
}
|
||||
|
||||
void DeviceHandler::pluginConfigChanged(const PluginId &id, const ParamList &config)
|
||||
{
|
||||
QVariantMap params;
|
||||
|
||||
@ -57,6 +57,8 @@ public:
|
||||
Q_INVOKABLE JsonReply *GetStateValue(const QVariantMap ¶ms) const;
|
||||
Q_INVOKABLE JsonReply *GetStateValues(const QVariantMap ¶ms) const;
|
||||
|
||||
Q_INVOKABLE JsonReply *BrowseDevice(const QVariantMap ¶ms) const;
|
||||
|
||||
signals:
|
||||
void PluginConfigurationChanged(const QVariantMap ¶ms);
|
||||
void StateChanged(const QVariantMap ¶ms);
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include "deviceplugin.h"
|
||||
#include "types/interface.h"
|
||||
#include "types/vendor.h"
|
||||
#include "types/browseritem.h"
|
||||
|
||||
class DeviceManager : public QObject
|
||||
{
|
||||
@ -69,6 +70,8 @@ public:
|
||||
|
||||
virtual Device::DeviceError removeConfiguredDevice(const DeviceId &deviceId) = 0;
|
||||
|
||||
virtual BrowserItems browseDevice(const DeviceId &deviceId, const QString &browser, const BrowserItemId &node = BrowserItemId()) = 0;
|
||||
|
||||
virtual QString translate(const PluginId &pluginId, const QString &string, const QLocale &locale) = 0;
|
||||
|
||||
signals:
|
||||
|
||||
@ -15,6 +15,7 @@ HEADERS += \
|
||||
libnymea.h \
|
||||
platform/package.h \
|
||||
platform/repository.h \
|
||||
types/browseritem.h \
|
||||
typeutils.h \
|
||||
loggingcategories.h \
|
||||
nymeasettings.h \
|
||||
@ -110,6 +111,7 @@ SOURCES += \
|
||||
coap/corelinkparser.cpp \
|
||||
coap/corelink.cpp \
|
||||
coap/coapobserveresource.cpp \
|
||||
types/browseritem.cpp \
|
||||
types/deviceclass.cpp \
|
||||
types/action.cpp \
|
||||
types/actiontype.cpp \
|
||||
|
||||
6
libnymea/types/browseritem.cpp
Normal file
6
libnymea/types/browseritem.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "browseritem.h"
|
||||
|
||||
BrowserItem::BrowserItem()
|
||||
{
|
||||
|
||||
}
|
||||
21
libnymea/types/browseritem.h
Normal file
21
libnymea/types/browseritem.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef BROWSERITEM_H
|
||||
#define BROWSERITEM_H
|
||||
|
||||
#include "libnymea.h"
|
||||
#include "typeutils.h"
|
||||
|
||||
#include <QList>
|
||||
|
||||
class LIBNYMEA_EXPORT BrowserItem
|
||||
{
|
||||
public:
|
||||
BrowserItem();
|
||||
};
|
||||
|
||||
|
||||
class LIBNYMEA_EXPORT BrowserItems: public QList<BrowserItem>
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
#endif // BROWSERITEM_H
|
||||
@ -60,6 +60,8 @@ DECLARE_TYPE_ID(Rule)
|
||||
|
||||
DECLARE_TYPE_ID(PairingTransaction)
|
||||
|
||||
DECLARE_TYPE_ID(BrowserItem)
|
||||
|
||||
class LIBNYMEA_EXPORT Types
|
||||
{
|
||||
Q_GADGET
|
||||
|
||||
Reference in New Issue
Block a user