diff --git a/debian/changelog b/debian/changelog index 68d7cb52..1ec4730f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +guh (0.7.0) wily; urgency=medium + + * Add CoAP + * Add OAuth2 + * Parent/child device relation + + -- Simon Stürz Mon, 30 Nov 2015 11:29:03 +0100 + guh (0.6.0) vivid; urgency=medium * Add websocket server diff --git a/guh.pri b/guh.pri index 0d968c11..7473c089 100644 --- a/guh.pri +++ b/guh.pri @@ -2,7 +2,7 @@ GUH_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"') # define protocol versions -JSON_PROTOCOL_VERSION=32 +JSON_PROTOCOL_VERSION=33 REST_API_VERSION=1 DEFINES += GUH_VERSION_STRING=\\\"$${GUH_VERSION_STRING}\\\" \ diff --git a/guh.pro b/guh.pro index b1578f28..7d99b274 100644 --- a/guh.pro +++ b/guh.pro @@ -34,6 +34,8 @@ test.commands = LD_LIBRARY_PATH=$$top_builddir/libguh:$$top_builddir/tests/libgu QMAKE_EXTRA_TARGETS += licensecheck doc test +# Inform about guh build +message(============================================) message(Qt version: $$[QT_VERSION]) message("Building guh version $${GUH_VERSION_STRING}") message("JSON-RPC API version $${JSON_PROTOCOL_VERSION}") @@ -43,6 +45,23 @@ coverage { message("Building coverage.") } +# Build tests +!disabletesting { + message("Building guh with tests") + SUBDIRS += tests + DEFINES += TESTING_ENABLED +} else { + message("Building guh without tests") +} + +# Bluetooth LE support +contains(DEFINES, BLUETOOTH_LE) { + message("Bluetooth LE enabled.") +} else { + message("Bluetooth LE disabled (Qt $${QT_VERSION} < 5.4.0).") +} + +# Websocket support contains(DEFINES, WEBSOCKET){ message("Building guh with websocket.") } else { diff --git a/libguh/types/paramtype.cpp b/libguh/types/paramtype.cpp index 0515d56c..5c77d8bf 100644 --- a/libguh/types/paramtype.cpp +++ b/libguh/types/paramtype.cpp @@ -147,7 +147,7 @@ QList ParamType::allowedValues() const } /*! Sets the list of the allowed values of this ParamType to the given List of \a allowedValues. */ -void ParamType::setAllowedValues(const QList allowedValues) +void ParamType::setAllowedValues(const QList &allowedValues) { m_allowedValues = allowedValues; } diff --git a/libguh/types/paramtype.h b/libguh/types/paramtype.h index c3d7b181..b90ad0f0 100644 --- a/libguh/types/paramtype.h +++ b/libguh/types/paramtype.h @@ -56,7 +56,7 @@ public: void setLimits(const QVariant &min, const QVariant &max); QList allowedValues() const; - void setAllowedValues(const QList allowedValues); + void setAllowedValues(const QList &allowedValues); bool readOnly() const; void setReadOnly(const bool &readOnly); diff --git a/libguh/types/statetype.cpp b/libguh/types/statetype.cpp index 0c9a808d..60a3a379 100644 --- a/libguh/types/statetype.cpp +++ b/libguh/types/statetype.cpp @@ -36,6 +36,10 @@ * hardcode it into the plugin. */ StateType::StateType(const StateTypeId &id): m_id(id), + m_defaultValue(QVariant()), + m_minValue(QVariant()), + m_maxValue(QVariant()), + m_possibleValues(QVariantList()), m_unit(Types::UnitNone) { @@ -83,6 +87,45 @@ void StateType::setDefaultValue(const QVariant &defaultValue) m_defaultValue = defaultValue; } +/*! Returns the minimum value of this StateType. If this value is not set, the QVariant will be invalid. */ +QVariant StateType::minValue() const +{ + return m_minValue; +} + +/*! Set the minimum value of this StateType to \a minValue. If this value is not set, + * there is now lower limit. */ +void StateType::setMinValue(const QVariant &minValue) +{ + m_minValue = minValue; +} + +/*! Returns the maximum value of this StateType. If this value is not set, the QVariant will be invalid. */ +QVariant StateType::maxValue() const +{ + return m_maxValue; +} + +/*! Set the maximum value of this StateType to \a maxValue. If this value is not set, + * there is now upper limit. */ +void StateType::setMaxValue(const QVariant &maxValue) +{ + m_maxValue = maxValue; +} + +/*! Returns the list of possible values of this StateType. If the list is empty or invalid the \l{State} value can take every value. */ +QVariantList StateType::possibleValues() const +{ + return m_possibleValues; +} + + +/*! Set the list of possible values of this StateType to \a possibleValues. */ +void StateType::setPossibleValues(const QVariantList &possibleValues) +{ + m_possibleValues = possibleValues; +} + /*! Returns the unit of this StateType. */ Types::Unit StateType::unit() const { diff --git a/libguh/types/statetype.h b/libguh/types/statetype.h index e5975cff..28737edb 100644 --- a/libguh/types/statetype.h +++ b/libguh/types/statetype.h @@ -42,6 +42,15 @@ public: QVariant defaultValue() const; void setDefaultValue(const QVariant &defaultValue); + QVariant minValue() const; + void setMinValue(const QVariant &minValue); + + QVariant maxValue() const; + void setMaxValue(const QVariant &maxValue); + + QVariantList possibleValues() const; + void setPossibleValues(const QVariantList &possibleValues); + Types::Unit unit() const; void setUnit(const Types::Unit &unit); @@ -50,6 +59,9 @@ private: QString m_name; QVariant::Type m_type; QVariant m_defaultValue; + QVariant m_minValue; + QVariant m_maxValue; + QVariantList m_possibleValues; Types::Unit m_unit; }; diff --git a/server/jsonrpc/jsontypes.cpp b/server/jsonrpc/jsontypes.cpp index 1e8691c1..8ab1846d 100644 --- a/server/jsonrpc/jsontypes.cpp +++ b/server/jsonrpc/jsontypes.cpp @@ -130,6 +130,9 @@ void JsonTypes::init() s_stateType.insert("type", basicTypeRef()); s_stateType.insert("defaultValue", basicTypeToString(Variant)); s_stateType.insert("o:unit", unitRef()); + s_stateType.insert("o:minValue", basicTypeToString(Variant)); + s_stateType.insert("o:maxValue", basicTypeToString(Variant)); + s_stateType.insert("o:possibleValues", QVariantList() << basicTypeToString(Variant)); // State s_state.insert("stateTypeId", basicTypeToString(Uuid)); diff --git a/tests/auto/api.json b/tests/auto/api.json index d35cae77..25da2a69 100644 --- a/tests/auto/api.json +++ b/tests/auto/api.json @@ -1,4 +1,4 @@ -32 +33 { "methods": { "Actions.ExecuteAction": { @@ -798,6 +798,11 @@ "defaultValue": "Variant", "id": "Uuid", "name": "String", + "o:maxValue": "Variant", + "o:minValue": "Variant", + "o:possibleValues": [ + "Variant" + ], "o:unit": "$ref:Unit", "type": "$ref:BasicType" },