More work on the device browser
This commit is contained in:
parent
57f68bcdc0
commit
a385188d37
@ -58,6 +58,8 @@
|
|||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "logging/logvaluetool.h"
|
#include "logging/logvaluetool.h"
|
||||||
|
|
||||||
|
#include "types/mediabrowseritem.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -90,6 +92,8 @@ QVariantList JsonTypes::s_networkDeviceState;
|
|||||||
QVariantList JsonTypes::s_userError;
|
QVariantList JsonTypes::s_userError;
|
||||||
QVariantList JsonTypes::s_tagError;
|
QVariantList JsonTypes::s_tagError;
|
||||||
QVariantList JsonTypes::s_cloudConnectionState;
|
QVariantList JsonTypes::s_cloudConnectionState;
|
||||||
|
QVariantList JsonTypes::s_browserIcon;
|
||||||
|
QVariantList JsonTypes::s_mediaBrowserIcon;
|
||||||
|
|
||||||
QVariantMap JsonTypes::s_paramType;
|
QVariantMap JsonTypes::s_paramType;
|
||||||
QVariantMap JsonTypes::s_param;
|
QVariantMap JsonTypes::s_param;
|
||||||
@ -154,6 +158,8 @@ void JsonTypes::init()
|
|||||||
s_userError = enumToStrings(UserManager::staticMetaObject, "UserError");
|
s_userError = enumToStrings(UserManager::staticMetaObject, "UserError");
|
||||||
s_tagError = enumToStrings(TagsStorage::staticMetaObject, "TagError");
|
s_tagError = enumToStrings(TagsStorage::staticMetaObject, "TagError");
|
||||||
s_cloudConnectionState = enumToStrings(CloudManager::staticMetaObject, "CloudConnectionState");
|
s_cloudConnectionState = enumToStrings(CloudManager::staticMetaObject, "CloudConnectionState");
|
||||||
|
s_browserIcon = enumToStrings(BrowserItem::staticMetaObject, "BrowserIcon");
|
||||||
|
s_mediaBrowserIcon = enumToStrings(MediaBrowserItem::staticMetaObject, "MediaBrowserIcon");
|
||||||
|
|
||||||
// ParamType
|
// ParamType
|
||||||
s_paramType.insert("id", basicTypeToString(Uuid));
|
s_paramType.insert("id", basicTypeToString(Uuid));
|
||||||
@ -425,9 +431,11 @@ void JsonTypes::init()
|
|||||||
s_browserItem.insert("id", basicTypeToString(QVariant::String));
|
s_browserItem.insert("id", basicTypeToString(QVariant::String));
|
||||||
s_browserItem.insert("displayName", basicTypeToString(QVariant::String));
|
s_browserItem.insert("displayName", basicTypeToString(QVariant::String));
|
||||||
s_browserItem.insert("description", basicTypeToString(QVariant::String));
|
s_browserItem.insert("description", basicTypeToString(QVariant::String));
|
||||||
|
s_browserItem.insert("icon", browserIconRef());
|
||||||
s_browserItem.insert("thumbnail", basicTypeToString(QVariant::String));
|
s_browserItem.insert("thumbnail", basicTypeToString(QVariant::String));
|
||||||
s_browserItem.insert("executable", basicTypeToString(QVariant::Bool));
|
s_browserItem.insert("executable", basicTypeToString(QVariant::Bool));
|
||||||
s_browserItem.insert("browsable", basicTypeToString(QVariant::Bool));
|
s_browserItem.insert("browsable", basicTypeToString(QVariant::Bool));
|
||||||
|
s_browserItem.insert("o:mediaIcon", mediaBrowserIconRef());
|
||||||
|
|
||||||
s_initialized = true;
|
s_initialized = true;
|
||||||
}
|
}
|
||||||
@ -477,6 +485,8 @@ QVariantMap JsonTypes::allTypes()
|
|||||||
allTypes.insert("UserError", userError());
|
allTypes.insert("UserError", userError());
|
||||||
allTypes.insert("TagError", tagError());
|
allTypes.insert("TagError", tagError());
|
||||||
allTypes.insert("CloudConnectionState", cloudConnectionState());
|
allTypes.insert("CloudConnectionState", cloudConnectionState());
|
||||||
|
allTypes.insert("BrowserIcon", browserIconRef());
|
||||||
|
allTypes.insert("MediaBrowserIcon", mediaBrowserIconRef());
|
||||||
|
|
||||||
allTypes.insert("StateType", stateTypeDescription());
|
allTypes.insert("StateType", stateTypeDescription());
|
||||||
allTypes.insert("StateDescriptor", stateDescriptorDescription());
|
allTypes.insert("StateDescriptor", stateDescriptorDescription());
|
||||||
@ -513,6 +523,7 @@ QVariantMap JsonTypes::allTypes()
|
|||||||
allTypes.insert("MqttPolicy", mqttPolicyDescription());
|
allTypes.insert("MqttPolicy", mqttPolicyDescription());
|
||||||
allTypes.insert("Package", packageDescription());
|
allTypes.insert("Package", packageDescription());
|
||||||
allTypes.insert("Repository", repositoryDescription());
|
allTypes.insert("Repository", repositoryDescription());
|
||||||
|
allTypes.insert("BrowserItem", browserItemDescription());
|
||||||
|
|
||||||
return allTypes;
|
return allTypes;
|
||||||
}
|
}
|
||||||
@ -724,6 +735,10 @@ QVariantMap JsonTypes::packBrowserItem(const BrowserItem &item)
|
|||||||
ret.insert("id", item.id());
|
ret.insert("id", item.id());
|
||||||
ret.insert("displayName", item.displayName());
|
ret.insert("displayName", item.displayName());
|
||||||
ret.insert("description", item.description());
|
ret.insert("description", item.description());
|
||||||
|
ret.insert("icon", browserIconToString(item.icon()));
|
||||||
|
if (item.extendedPropertiesFlags().testFlag(BrowserItem::ExtendedPropertiesMedia)) {
|
||||||
|
ret.insert("mediaIcon", mediaBrowserIconToString(static_cast<MediaBrowserItem::MediaBrowserIcon>(item.extendedProperty("mediaIcon").toInt())));
|
||||||
|
}
|
||||||
ret.insert("thumbnail", item.thumbnail());
|
ret.insert("thumbnail", item.thumbnail());
|
||||||
ret.insert("executable", item.executable());
|
ret.insert("executable", item.executable());
|
||||||
ret.insert("browsable", item.browsable());
|
ret.insert("browsable", item.browsable());
|
||||||
@ -2252,6 +2267,18 @@ QPair<bool, QString> JsonTypes::validateVariant(const QVariant &templateVariant,
|
|||||||
qCWarning(dcJsonRpc()) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(cloudConnectionStateRef());
|
qCWarning(dcJsonRpc()) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(cloudConnectionStateRef());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
} else if (refName == browserIconRef()) {
|
||||||
|
QPair<bool, QString> result = validateEnum(s_browserIcon, variant);
|
||||||
|
if (!result.first) {
|
||||||
|
qCWarning(dcJsonRpc()) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(browserIconRef());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
} else if (refName == mediaBrowserIconRef()) {
|
||||||
|
QPair<bool, QString> result = validateEnum(s_mediaBrowserIcon, variant);
|
||||||
|
if (!result.first) {
|
||||||
|
qCWarning(dcJsonRpc()) << QString("Value %1 not allowed in %2").arg(variant.toString()).arg(mediaBrowserIconRef());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Q_ASSERT_X(false, "JsonTypes", QString("Unhandled ref: %1").arg(refName).toLatin1().data());
|
Q_ASSERT_X(false, "JsonTypes", QString("Unhandled ref: %1").arg(refName).toLatin1().data());
|
||||||
return report(false, QString("Unhandled ref %1. Server implementation incomplete.").arg(refName));
|
return report(false, QString("Unhandled ref %1. Server implementation incomplete.").arg(refName));
|
||||||
|
|||||||
@ -37,6 +37,7 @@
|
|||||||
#include "types/paramtype.h"
|
#include "types/paramtype.h"
|
||||||
#include "types/paramdescriptor.h"
|
#include "types/paramdescriptor.h"
|
||||||
#include "types/ruleactionparam.h"
|
#include "types/ruleactionparam.h"
|
||||||
|
#include "types/mediabrowseritem.h"
|
||||||
|
|
||||||
#include "logging/logging.h"
|
#include "logging/logging.h"
|
||||||
#include "logging/logentry.h"
|
#include "logging/logentry.h"
|
||||||
@ -90,10 +91,8 @@ namespace nymeaserver {
|
|||||||
return s_##typeName; \
|
return s_##typeName; \
|
||||||
} \
|
} \
|
||||||
static QString typeName##ToString(className::enumName value) { \
|
static QString typeName##ToString(className::enumName value) { \
|
||||||
const QMetaObject &metaObject = className::staticMetaObject; \
|
QMetaEnum metaEnum = QMetaEnum::fromType<className::enumName>(); \
|
||||||
int enumIndex = metaObject.indexOfEnumerator(enumString); \
|
return metaEnum.valueToKey(value); \
|
||||||
QMetaEnum metaEnum = metaObject.enumerator(enumIndex); \
|
|
||||||
return metaEnum.valueToKey(metaEnum.value(value)); \
|
|
||||||
} \
|
} \
|
||||||
private: \
|
private: \
|
||||||
static QVariantList s_##typeName; \
|
static QVariantList s_##typeName; \
|
||||||
@ -102,7 +101,6 @@ namespace nymeaserver {
|
|||||||
class JsonTypes
|
class JsonTypes
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
Q_ENUMS(BasicType)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum BasicType {
|
enum BasicType {
|
||||||
@ -118,6 +116,7 @@ public:
|
|||||||
Time,
|
Time,
|
||||||
Object
|
Object
|
||||||
};
|
};
|
||||||
|
Q_ENUM(BasicType)
|
||||||
|
|
||||||
static QVariantMap allTypes();
|
static QVariantMap allTypes();
|
||||||
|
|
||||||
@ -143,6 +142,8 @@ public:
|
|||||||
DECLARE_TYPE(userError, "UserError", UserManager, UserError)
|
DECLARE_TYPE(userError, "UserError", UserManager, UserError)
|
||||||
DECLARE_TYPE(tagError, "TagError", TagsStorage, TagError)
|
DECLARE_TYPE(tagError, "TagError", TagsStorage, TagError)
|
||||||
DECLARE_TYPE(cloudConnectionState, "CloudConnectionState", CloudManager, CloudConnectionState)
|
DECLARE_TYPE(cloudConnectionState, "CloudConnectionState", CloudManager, CloudConnectionState)
|
||||||
|
DECLARE_TYPE(browserIcon, "BrowserIcon", BrowserItem, BrowserIcon)
|
||||||
|
DECLARE_TYPE(mediaBrowserIcon, "MediaBrowserIcon", MediaBrowserItem, MediaBrowserIcon)
|
||||||
|
|
||||||
DECLARE_OBJECT(paramType, "ParamType")
|
DECLARE_OBJECT(paramType, "ParamType")
|
||||||
DECLARE_OBJECT(param, "Param")
|
DECLARE_OBJECT(param, "Param")
|
||||||
|
|||||||
@ -28,11 +28,6 @@ namespace nymeaserver {
|
|||||||
class Logging
|
class Logging
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
Q_ENUMS(LoggingError)
|
|
||||||
Q_ENUMS(LoggingSource)
|
|
||||||
Q_FLAGS(LoggingSources)
|
|
||||||
Q_ENUMS(LoggingLevel)
|
|
||||||
Q_ENUMS(LoggingEventType)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum LoggingError {
|
enum LoggingError {
|
||||||
@ -40,6 +35,7 @@ public:
|
|||||||
LoggingErrorLogEntryNotFound,
|
LoggingErrorLogEntryNotFound,
|
||||||
LoggingErrorInvalidFilterParameter
|
LoggingErrorInvalidFilterParameter
|
||||||
};
|
};
|
||||||
|
Q_ENUM(LoggingError)
|
||||||
|
|
||||||
enum LoggingSource {
|
enum LoggingSource {
|
||||||
LoggingSourceSystem,
|
LoggingSourceSystem,
|
||||||
@ -48,12 +44,15 @@ public:
|
|||||||
LoggingSourceStates,
|
LoggingSourceStates,
|
||||||
LoggingSourceRules
|
LoggingSourceRules
|
||||||
};
|
};
|
||||||
|
Q_ENUM(LoggingSource)
|
||||||
|
Q_FLAGS(LoggingSources)
|
||||||
Q_DECLARE_FLAGS(LoggingSources, LoggingSource)
|
Q_DECLARE_FLAGS(LoggingSources, LoggingSource)
|
||||||
|
|
||||||
enum LoggingLevel {
|
enum LoggingLevel {
|
||||||
LoggingLevelInfo,
|
LoggingLevelInfo,
|
||||||
LoggingLevelAlert
|
LoggingLevelAlert
|
||||||
};
|
};
|
||||||
|
Q_ENUM(LoggingLevel)
|
||||||
|
|
||||||
enum LoggingEventType {
|
enum LoggingEventType {
|
||||||
LoggingEventTypeTrigger,
|
LoggingEventTypeTrigger,
|
||||||
@ -62,8 +61,9 @@ public:
|
|||||||
LoggingEventTypeActionsExecuted,
|
LoggingEventTypeActionsExecuted,
|
||||||
LoggingEventTypeExitActionsExecuted
|
LoggingEventTypeExitActionsExecuted
|
||||||
};
|
};
|
||||||
|
Q_ENUM(LoggingEventType)
|
||||||
|
|
||||||
Logging(QObject *parent = 0);
|
Logging(QObject *parent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,9 +35,6 @@ namespace nymeaserver {
|
|||||||
class NetworkDevice : public QObject
|
class NetworkDevice : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(NetworkDeviceType)
|
|
||||||
Q_ENUMS(NetworkDeviceState)
|
|
||||||
Q_ENUMS(NetworkDeviceStateReason)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NetworkDeviceState {
|
enum NetworkDeviceState {
|
||||||
@ -55,6 +52,7 @@ public:
|
|||||||
NetworkDeviceStateDeactivating = 110,
|
NetworkDeviceStateDeactivating = 110,
|
||||||
NetworkDeviceStateFailed = 120
|
NetworkDeviceStateFailed = 120
|
||||||
};
|
};
|
||||||
|
Q_ENUM(NetworkDeviceState)
|
||||||
|
|
||||||
enum NetworkDeviceStateReason {
|
enum NetworkDeviceStateReason {
|
||||||
NetworkDeviceStateReasonNone = 0,
|
NetworkDeviceStateReasonNone = 0,
|
||||||
@ -121,6 +119,7 @@ public:
|
|||||||
NetworkDeviceStateReasonParentChanged = 61,
|
NetworkDeviceStateReasonParentChanged = 61,
|
||||||
NetworkDeviceStateReasonParentManagedChanged = 62
|
NetworkDeviceStateReasonParentManagedChanged = 62
|
||||||
};
|
};
|
||||||
|
Q_ENUM(NetworkDeviceStateReason)
|
||||||
|
|
||||||
enum NetworkDeviceType {
|
enum NetworkDeviceType {
|
||||||
NetworkDeviceTypeUnknown = 0,
|
NetworkDeviceTypeUnknown = 0,
|
||||||
@ -143,8 +142,9 @@ public:
|
|||||||
NetworkDeviceTypeVXLan = 19,
|
NetworkDeviceTypeVXLan = 19,
|
||||||
NetworkDeviceTypeVEth = 20,
|
NetworkDeviceTypeVEth = 20,
|
||||||
};
|
};
|
||||||
|
Q_ENUM(NetworkDeviceType)
|
||||||
|
|
||||||
explicit NetworkDevice(const QDBusObjectPath &objectPath, QObject *parent = 0);
|
explicit NetworkDevice(const QDBusObjectPath &objectPath, QObject *parent = nullptr);
|
||||||
|
|
||||||
QDBusObjectPath objectPath() const;
|
QDBusObjectPath objectPath() const;
|
||||||
|
|
||||||
|
|||||||
@ -40,9 +40,6 @@ namespace nymeaserver {
|
|||||||
class NetworkManager : public QObject
|
class NetworkManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(NetworkManagerState)
|
|
||||||
Q_ENUMS(NetworkManagerConnectivityState)
|
|
||||||
Q_ENUMS(NetworkManagerError)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NetworkManagerState {
|
enum NetworkManagerState {
|
||||||
@ -55,6 +52,7 @@ public:
|
|||||||
NetworkManagerStateConnectedSite = 60,
|
NetworkManagerStateConnectedSite = 60,
|
||||||
NetworkManagerStateConnectedGlobal = 70
|
NetworkManagerStateConnectedGlobal = 70
|
||||||
};
|
};
|
||||||
|
Q_ENUM(NetworkManagerState)
|
||||||
|
|
||||||
enum NetworkManagerConnectivityState {
|
enum NetworkManagerConnectivityState {
|
||||||
NetworkManagerConnectivityStateUnknown = 0,
|
NetworkManagerConnectivityStateUnknown = 0,
|
||||||
@ -63,6 +61,7 @@ public:
|
|||||||
NetworkManagerConnectivityStateLimited = 3,
|
NetworkManagerConnectivityStateLimited = 3,
|
||||||
NetworkManagerConnectivityStateFull = 4
|
NetworkManagerConnectivityStateFull = 4
|
||||||
};
|
};
|
||||||
|
Q_ENUM(NetworkManagerConnectivityState)
|
||||||
|
|
||||||
enum NetworkManagerError {
|
enum NetworkManagerError {
|
||||||
NetworkManagerErrorNoError,
|
NetworkManagerErrorNoError,
|
||||||
@ -76,8 +75,9 @@ public:
|
|||||||
NetworkManagerErrorNetworkingDisabled,
|
NetworkManagerErrorNetworkingDisabled,
|
||||||
NetworkManagerErrorNetworkManagerNotAvailable
|
NetworkManagerErrorNetworkManagerNotAvailable
|
||||||
};
|
};
|
||||||
|
Q_ENUM(NetworkManagerError)
|
||||||
|
|
||||||
explicit NetworkManager(QObject *parent = 0);
|
explicit NetworkManager(QObject *parent = nullptr);
|
||||||
|
|
||||||
bool available();
|
bool available();
|
||||||
bool wifiAvailable();
|
bool wifiAvailable();
|
||||||
|
|||||||
@ -69,7 +69,6 @@ typedef QList<MqttPolicy> MqttPolicies;
|
|||||||
class NymeaConfiguration : public QObject
|
class NymeaConfiguration : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(ConfigurationError)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum ConfigurationError {
|
enum ConfigurationError {
|
||||||
@ -82,6 +81,7 @@ public:
|
|||||||
ConfigurationErrorBluetoothHardwareNotAvailable,
|
ConfigurationErrorBluetoothHardwareNotAvailable,
|
||||||
ConfigurationErrorInvalidCertificate
|
ConfigurationErrorInvalidCertificate
|
||||||
};
|
};
|
||||||
|
Q_ENUM(ConfigurationError)
|
||||||
|
|
||||||
explicit NymeaConfiguration(QObject *parent = nullptr);
|
explicit NymeaConfiguration(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|||||||
@ -36,8 +36,6 @@ namespace nymeaserver {
|
|||||||
class RuleEngine : public QObject
|
class RuleEngine : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(RuleError)
|
|
||||||
Q_ENUMS(RemovePolicy)
|
|
||||||
public:
|
public:
|
||||||
enum RuleError {
|
enum RuleError {
|
||||||
RuleErrorNoError,
|
RuleErrorNoError,
|
||||||
@ -62,11 +60,13 @@ public:
|
|||||||
RuleErrorNoExitActions,
|
RuleErrorNoExitActions,
|
||||||
RuleErrorInterfaceNotFound
|
RuleErrorInterfaceNotFound
|
||||||
};
|
};
|
||||||
|
Q_ENUM(RuleError)
|
||||||
|
|
||||||
enum RemovePolicy {
|
enum RemovePolicy {
|
||||||
RemovePolicyCascade,
|
RemovePolicyCascade,
|
||||||
RemovePolicyUpdate
|
RemovePolicyUpdate
|
||||||
};
|
};
|
||||||
|
Q_ENUM(RemovePolicy)
|
||||||
|
|
||||||
explicit RuleEngine(QObject *parent = nullptr);
|
explicit RuleEngine(QObject *parent = nullptr);
|
||||||
~RuleEngine();
|
~RuleEngine();
|
||||||
|
|||||||
@ -117,9 +117,10 @@ void TcpServer::sendData(const QUuid &clientId, const QByteArray &data)
|
|||||||
QTcpSocket *client = nullptr;
|
QTcpSocket *client = nullptr;
|
||||||
client = m_clientList.value(clientId);
|
client = m_clientList.value(clientId);
|
||||||
if (client) {
|
if (client) {
|
||||||
|
qCDebug(dcTcpServer()) << "Sending to client" << clientId.toString() << data;
|
||||||
client->write(data + '\n');
|
client->write(data + '\n');
|
||||||
} else {
|
} else {
|
||||||
qWarning(dcTcpServer()) << "Client" << clientId << "unknown to this transport";
|
qCWarning(dcTcpServer()) << "Client" << clientId << "unknown to this transport";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,6 @@ namespace nymeaserver {
|
|||||||
class RepeatingOption
|
class RepeatingOption
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
Q_ENUMS(RepeatingMode)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum RepeatingMode {
|
enum RepeatingMode {
|
||||||
@ -42,6 +41,7 @@ public:
|
|||||||
RepeatingModeMonthly,
|
RepeatingModeMonthly,
|
||||||
RepeatingModeYearly
|
RepeatingModeYearly
|
||||||
};
|
};
|
||||||
|
Q_ENUM(RepeatingMode)
|
||||||
|
|
||||||
RepeatingOption();
|
RepeatingOption();
|
||||||
RepeatingOption(const RepeatingMode &mode, const QList<int> &weekDays = QList<int>(), const QList<int> &monthDays = QList<int>());
|
RepeatingOption(const RepeatingMode &mode, const QList<int> &weekDays = QList<int>(), const QList<int> &monthDays = QList<int>());
|
||||||
|
|||||||
@ -33,7 +33,6 @@ class PushButtonDBusService;
|
|||||||
class UserManager : public QObject
|
class UserManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(UserError)
|
|
||||||
public:
|
public:
|
||||||
enum UserError {
|
enum UserError {
|
||||||
UserErrorNoError,
|
UserErrorNoError,
|
||||||
@ -44,6 +43,7 @@ public:
|
|||||||
UserErrorTokenNotFound,
|
UserErrorTokenNotFound,
|
||||||
UserErrorPermissionDenied
|
UserErrorPermissionDenied
|
||||||
};
|
};
|
||||||
|
Q_ENUM(UserError)
|
||||||
|
|
||||||
explicit UserManager(const QString &dbName, QObject *parent = nullptr);
|
explicit UserManager(const QString &dbName, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,6 @@
|
|||||||
class LIBNYMEA_EXPORT CoapOption
|
class LIBNYMEA_EXPORT CoapOption
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
Q_ENUMS(Option)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Options format: https://tools.ietf.org/html/rfc7252#section-3.1
|
// Options format: https://tools.ietf.org/html/rfc7252#section-3.1
|
||||||
@ -54,6 +53,7 @@ public:
|
|||||||
ProxyScheme = 39,
|
ProxyScheme = 39,
|
||||||
Size1 = 60
|
Size1 = 60
|
||||||
};
|
};
|
||||||
|
Q_ENUM(Option)
|
||||||
|
|
||||||
CoapOption();
|
CoapOption();
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,8 @@ HEADERS += \
|
|||||||
libnymea.h \
|
libnymea.h \
|
||||||
platform/package.h \
|
platform/package.h \
|
||||||
platform/repository.h \
|
platform/repository.h \
|
||||||
types/browseritem.h \
|
types/browseritem.h \
|
||||||
|
types/mediabrowseritem.h \
|
||||||
typeutils.h \
|
typeutils.h \
|
||||||
loggingcategories.h \
|
loggingcategories.h \
|
||||||
nymeasettings.h \
|
nymeasettings.h \
|
||||||
@ -111,7 +112,8 @@ SOURCES += \
|
|||||||
coap/corelinkparser.cpp \
|
coap/corelinkparser.cpp \
|
||||||
coap/corelink.cpp \
|
coap/corelink.cpp \
|
||||||
coap/coapobserveresource.cpp \
|
coap/coapobserveresource.cpp \
|
||||||
types/browseritem.cpp \
|
types/browseritem.cpp \
|
||||||
|
types/mediabrowseritem.cpp \
|
||||||
types/deviceclass.cpp \
|
types/deviceclass.cpp \
|
||||||
types/action.cpp \
|
types/action.cpp \
|
||||||
types/actiontype.cpp \
|
types/actiontype.cpp \
|
||||||
|
|||||||
@ -19,6 +19,11 @@ QString BrowserItem::displayName() const
|
|||||||
return m_displayName;
|
return m_displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserItem::setDisplayName(const QString &displayName)
|
||||||
|
{
|
||||||
|
m_displayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
QString BrowserItem::description() const
|
QString BrowserItem::description() const
|
||||||
{
|
{
|
||||||
return m_description;
|
return m_description;
|
||||||
@ -49,6 +54,16 @@ void BrowserItem::setBrowsable(bool browsable)
|
|||||||
m_browsable = browsable;
|
m_browsable = browsable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BrowserItem::BrowserIcon BrowserItem::icon() const
|
||||||
|
{
|
||||||
|
return m_icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserItem::setIcon(BrowserIcon icon)
|
||||||
|
{
|
||||||
|
m_icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
QString BrowserItem::thumbnail() const
|
QString BrowserItem::thumbnail() const
|
||||||
{
|
{
|
||||||
return m_thumbnail;
|
return m_thumbnail;
|
||||||
@ -59,6 +74,16 @@ void BrowserItem::setThumbnail(const QString &thumbnail)
|
|||||||
m_thumbnail = thumbnail;
|
m_thumbnail = thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BrowserItem::ExtendedPropertiesFlags BrowserItem::extendedPropertiesFlags() const
|
||||||
|
{
|
||||||
|
return m_extendedPropertiesFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant BrowserItem::extendedProperty(const QString &propertyName) const
|
||||||
|
{
|
||||||
|
return m_extendedProperties[propertyName];
|
||||||
|
}
|
||||||
|
|
||||||
BrowserItems::BrowserItems()
|
BrowserItems::BrowserItems()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,30 @@
|
|||||||
|
|
||||||
class LIBNYMEA_EXPORT BrowserItem
|
class LIBNYMEA_EXPORT BrowserItem
|
||||||
{
|
{
|
||||||
|
Q_GADGET
|
||||||
public:
|
public:
|
||||||
|
enum BrowserIcon {
|
||||||
|
BrowserIconNone,
|
||||||
|
BrowserIconFolder,
|
||||||
|
BrowserIconFile,
|
||||||
|
BrowserIconMusic,
|
||||||
|
BrowserIconVideo,
|
||||||
|
BrowserIconPictures,
|
||||||
|
BrowserIconApplication,
|
||||||
|
BrowserIconDocument,
|
||||||
|
BrowserIconPackage,
|
||||||
|
BrowserIconFavorites,
|
||||||
|
};
|
||||||
|
Q_ENUM(BrowserIcon)
|
||||||
|
|
||||||
|
enum ExtendedProperties {
|
||||||
|
ExtendedPropertiesNone = 0x00,
|
||||||
|
ExtendedPropertiesMedia = 0x01
|
||||||
|
};
|
||||||
|
Q_ENUM(ExtendedProperties)
|
||||||
|
Q_DECLARE_FLAGS(ExtendedPropertiesFlags, ExtendedProperties)
|
||||||
|
|
||||||
|
|
||||||
BrowserItem(const QString &id = QString(), const QString &displayName = QString(), bool browsable = false);
|
BrowserItem(const QString &id = QString(), const QString &displayName = QString(), bool browsable = false);
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
@ -26,18 +49,31 @@ public:
|
|||||||
bool browsable() const;
|
bool browsable() const;
|
||||||
void setBrowsable(bool browsable);
|
void setBrowsable(bool browsable);
|
||||||
|
|
||||||
|
BrowserIcon icon() const;
|
||||||
|
void setIcon(BrowserIcon icon);
|
||||||
|
|
||||||
QString thumbnail() const;
|
QString thumbnail() const;
|
||||||
void setThumbnail(const QString &thumbnail);
|
void setThumbnail(const QString &thumbnail);
|
||||||
|
|
||||||
|
ExtendedPropertiesFlags extendedPropertiesFlags() const;
|
||||||
|
QVariant extendedProperty(const QString &propertyName) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_id;
|
QString m_id;
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
bool m_executable = false;
|
bool m_executable = false;
|
||||||
bool m_browsable = false;
|
bool m_browsable = false;
|
||||||
|
BrowserIcon m_icon = BrowserIconNone;
|
||||||
QString m_thumbnail;
|
QString m_thumbnail;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ExtendedPropertiesFlags m_extendedPropertiesFlags = ExtendedPropertiesNone;
|
||||||
|
QHash<QString, QVariant> m_extendedProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BrowserItem::ExtendedPropertiesFlags)
|
||||||
|
|
||||||
|
|
||||||
class LIBNYMEA_EXPORT BrowserItems: public QList<BrowserItem>
|
class LIBNYMEA_EXPORT BrowserItems: public QList<BrowserItem>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,10 +38,6 @@
|
|||||||
class LIBNYMEA_EXPORT DeviceClass
|
class LIBNYMEA_EXPORT DeviceClass
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
Q_ENUMS(CreateMethod)
|
|
||||||
Q_ENUMS(SetupMethod)
|
|
||||||
Q_ENUMS(BasicTag)
|
|
||||||
Q_ENUMS(CreateMethods)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum CreateMethod {
|
enum CreateMethod {
|
||||||
@ -49,6 +45,7 @@ public:
|
|||||||
CreateMethodAuto = 0x02,
|
CreateMethodAuto = 0x02,
|
||||||
CreateMethodDiscovery = 0x04
|
CreateMethodDiscovery = 0x04
|
||||||
};
|
};
|
||||||
|
Q_ENUM(CreateMethod)
|
||||||
Q_DECLARE_FLAGS(CreateMethods, CreateMethod)
|
Q_DECLARE_FLAGS(CreateMethods, CreateMethod)
|
||||||
|
|
||||||
enum SetupMethod {
|
enum SetupMethod {
|
||||||
@ -57,6 +54,7 @@ public:
|
|||||||
SetupMethodEnterPin,
|
SetupMethodEnterPin,
|
||||||
SetupMethodPushButton
|
SetupMethodPushButton
|
||||||
};
|
};
|
||||||
|
Q_ENUM(SetupMethod)
|
||||||
|
|
||||||
DeviceClass(const PluginId &pluginId = PluginId(), const VendorId &vendorId = VendorId(), const DeviceClassId &id = DeviceClassId());
|
DeviceClass(const PluginId &pluginId = PluginId(), const VendorId &vendorId = VendorId(), const DeviceClassId &id = DeviceClassId());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user