aboutsummaryrefslogtreecommitdiff
path: root/tests_schema/daemon/testdevice/standard_traits.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests_schema/daemon/testdevice/standard_traits.h')
-rw-r--r--tests_schema/daemon/testdevice/standard_traits.h216
1 files changed, 216 insertions, 0 deletions
diff --git a/tests_schema/daemon/testdevice/standard_traits.h b/tests_schema/daemon/testdevice/standard_traits.h
new file mode 100644
index 0000000..354c783
--- /dev/null
+++ b/tests_schema/daemon/testdevice/standard_traits.h
@@ -0,0 +1,216 @@
+// Copyright 2016 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+namespace standardtraits {
+const char kTraits[] = R"({
+ "lock": {
+ "commands": {
+ "setConfig": {
+ "minimalRole": "user",
+ "parameters": {
+ "lockedState": {
+ "type": "string",
+ "enum": [ "locked", "unlocked" ]
+ }
+ },
+ "errors": [ "jammed", "lockingNotSupported" ]
+ }
+ },
+ "state": {
+ "lockedState": {
+ "type": "string",
+ "enum": [ "locked", "unlocked", "partiallyLocked" ],
+ "isRequired": true
+ },
+ "isLockingSupported": {
+ "type": "boolean",
+ "isRequired": true
+ }
+ }
+ },
+ "onOff": {
+ "commands": {
+ "setConfig": {
+ "minimalRole": "user",
+ "parameters": {
+ "state": {
+ "type": "string",
+ "enum": [ "on", "off" ]
+ }
+ }
+ }
+ },
+ "state": {
+ "state": {
+ "type": "string",
+ "enum": [ "on", "off" ],
+ "isRequired": true
+ }
+ }
+ },
+ "brightness": {
+ "commands": {
+ "setConfig": {
+ "minimalRole": "user",
+ "parameters": {
+ "brightness": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ }
+ }
+ }
+ },
+ "state": {
+ "brightness": {
+ "isRequired": true,
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ }
+ }
+ },
+ "colorTemp": {
+ "commands": {
+ "setConfig": {
+ "minimalRole": "user",
+ "parameters": {
+ "colorTemp": {
+ "type": "integer"
+ }
+ }
+ }
+ },
+ "state": {
+ "colorTemp": {
+ "isRequired": true,
+ "type": "integer"
+ },
+ "minColorTemp": {
+ "isRequired": true,
+ "type": "integer"
+ },
+ "maxColorTemp": {
+ "isRequired": true,
+ "type": "integer"
+ }
+ }
+ },
+ "colorXy": {
+ "commands": {
+ "setConfig": {
+ "minimalRole": "user",
+ "parameters": {
+ "colorSetting": {
+ "type": "object",
+ "required": [
+ "colorX",
+ "colorY"
+ ],
+ "properties": {
+ "colorX": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ },
+ "colorY": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "errors": ["colorOutOfRange"]
+ }
+ },
+ "state": {
+ "colorSetting": {
+ "type": "object",
+ "isRequired": true,
+ "required": [ "colorX", "colorY" ],
+ "properties": {
+ "colorX": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ },
+ "colorY": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ }
+ }
+ },
+ "colorCapRed": {
+ "type": "object",
+ "isRequired": true,
+ "required": [ "colorX", "colorY" ],
+ "properties": {
+ "colorX": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ },
+ "colorY": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ }
+ }
+ },
+ "colorCapGreen": {
+ "type": "object",
+ "isRequired": true,
+ "required": [ "colorX", "colorY" ],
+ "properties": {
+ "colorX": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ },
+ "colorY": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ }
+ }
+ },
+ "colorCapBlue": {
+ "type": "object",
+ "isRequired": true,
+ "required": [ "colorX", "colorY" ],
+ "properties": {
+ "colorX": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ },
+ "colorY": {
+ "type": "number",
+ "minimum": 0.0,
+ "maximum": 1.0
+ }
+ }
+ }
+ }
+ }
+})";
+
+const char kDefaultState[] = R"({
+ "lock":{"isLockingSupported": true},
+ "onOff":{"state": "on"},
+ "brightness":{"brightness": 0.0},
+ "colorTemp":{"colorTemp": 0},
+ "colorXy": {
+ "colorSetting": {"colorX": 0.0, "colorY": 0.0},
+ "colorCapRed": {"colorX": 0.674, "colorY": 0.322},
+ "colorCapGreen":{"colorX": 0.408, "colorY": 0.517},
+ "colorCapBlue": {"colorX": 0.168, "colorY": 0.041}
+ }
+})";
+
+const char kComponent[] = "testdevice";
+} // namespace jsontraits