Remove object schema parsing in CommandDefinition
The only thing we now care about in CommandDefinition is the
"minimalRole" field. Everything else is a black-box which we just
forward to the server without any semantic parsing.
Also completely removed command visibility support since it no
longer applies to trait/component model.
BUG: 25841230
Change-Id: Ie8fff57ffada289caa7876c2a53150bb116fd65b
Reviewed-on: https://weave-review.googlesource.com/1617
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/examples/daemon/ledflasher/ledflasher.cc b/examples/daemon/ledflasher/ledflasher.cc
index 38314f5..0019d2c 100644
--- a/examples/daemon/ledflasher/ledflasher.cc
+++ b/examples/daemon/ledflasher/ledflasher.cc
@@ -25,7 +25,7 @@
device_ = device;
device->AddStateDefinitionsFromJson(R"({
- "_ledflasher": {"_leds": {"items": "boolean"}}
+ "_ledflasher": {"_leds": {"type": "array", "items": {"type": "boolean"}}}
})");
device->SetStatePropertiesFromJson(R"({
@@ -37,13 +37,13 @@
"_ledflasher": {
"_set":{
"parameters": {
- "_led": {"minimum": 1, "maximum": 3},
- "_on": "boolean"
+ "_led": {"type": "integer", "minimum": 1, "maximum": 3},
+ "_on": {"type": "boolean"}
}
},
"_toggle":{
"parameters": {
- "_led": {"minimum": 1, "maximum": 3}
+ "_led": {"type": "integer", "minimum": 1, "maximum": 3}
}
}
}
diff --git a/examples/daemon/light/light.cc b/examples/daemon/light/light.cc
index d54de93..a7eb9b3 100644
--- a/examples/daemon/light/light.cc
+++ b/examples/daemon/light/light.cc
@@ -18,31 +18,31 @@
device_ = device;
device->AddStateDefinitionsFromJson(R"({
- "onOff": {"state": ["on", "standby"]},
- "brightness": {"brightness": "integer"},
+ "onOff": {"state": {"type": "string", "enum": ["on", "standby"]}},
+ "brightness": {"brightness": {"type": "integer"}},
"colorXY": {
"colorSetting": {
"properties": {
- "colorX": {"minimum": 0.0, "maximum": 1.0},
- "colorY": {"minimum": 0.0, "maximum": 1.0}
+ "colorX": {"type": "number", "minimum": 0.0, "maximum": 1.0},
+ "colorY": {"type": "number", "minimum": 0.0, "maximum": 1.0}
}
},
"colorCapRed": {
"properties": {
- "colorX": {"minimum": 0.0, "maximum": 1.0},
- "colorY": {"minimum": 0.0, "maximum": 1.0}
+ "colorX": {"type": "number", "minimum": 0.0, "maximum": 1.0},
+ "colorY": {"type": "number", "minimum": 0.0, "maximum": 1.0}
}
},
"colorCapGreen": {
"properties": {
- "colorX": {"minimum": 0.0, "maximum": 1.0},
- "colorY": {"minimum": 0.0, "maximum": 1.0}
+ "colorX": {"type": "number", "minimum": 0.0, "maximum": 1.0},
+ "colorY": {"type": "number", "minimum": 0.0, "maximum": 1.0}
}
},
"colorCapBlue": {
"properties": {
- "colorX": {"minimum": 0.0, "maximum": 1.0},
- "colorY": {"minimum": 0.0, "maximum": 1.0}
+ "colorX": {"type": "number", "minimum": 0.0, "maximum": 1.0},
+ "colorY": {"type": "number", "minimum": 0.0, "maximum": 1.0}
}
}
}
@@ -64,7 +64,7 @@
"onOff": {
"setConfig":{
"parameters": {
- "state": ["on", "standby"]
+ "state": {"type": "string", "enum": ["on", "standby"]}
}
}
},
diff --git a/examples/daemon/lock/lock.cc b/examples/daemon/lock/lock.cc
index 3014fb1..7d941c6 100644
--- a/examples/daemon/lock/lock.cc
+++ b/examples/daemon/lock/lock.cc
@@ -35,8 +35,11 @@
device->AddStateDefinitionsFromJson(R"({
"lock": {
- "lockedState": ["locked", "unlocked", "partiallyLocked"],
- "isLockingSupported": "boolean"}
+ "lockedState": {
+ "type": "string",
+ "enum": ["locked", "unlocked", "partiallyLocked"],
+ }
+ "isLockingSupported": {"type": "boolean"}}
})");
device->SetStatePropertiesFromJson(R"({
@@ -51,7 +54,7 @@
"lock": {
"setConfig":{
"parameters": {
- "lockedState": ["locked", "unlocked"]
+ "lockedState": {"type": "string", "enum":["locked", "unlocked"]}
}
}
}
diff --git a/examples/daemon/sample/sample.cc b/examples/daemon/sample/sample.cc
index 905a977..e065b06 100644
--- a/examples/daemon/sample/sample.cc
+++ b/examples/daemon/sample/sample.cc
@@ -27,9 +27,9 @@
"_hello": {
"minimalRole": "user",
"parameters": {
- "_name": "string"
+ "_name": {"type": "string"}
},
- "results": { "_reply": "string" }
+ "results": { "_reply": {"type": "string"} }
},
"_ping": {
"minimalRole": "user",
@@ -38,16 +38,16 @@
"_countdown": {
"minimalRole": "user",
"parameters": {
- "_seconds": {"minimum": 1, "maximum": 25}
+ "_seconds": {"type": "integer", "minimum": 1, "maximum": 25}
},
- "progress": { "_seconds_left": "integer"},
+ "progress": { "_seconds_left": {"type": "integer"}},
"results": {}
}
}
})");
device->AddStateDefinitionsFromJson(R"({
- "_sample": {"_ping_count":"integer"}
+ "_sample": {"_ping_count": {"type": "integer"}}
})");
device->SetStatePropertiesFromJson(R"({
diff --git a/examples/daemon/speaker/speaker.cc b/examples/daemon/speaker/speaker.cc
index 32591f9..178be14 100644
--- a/examples/daemon/speaker/speaker.cc
+++ b/examples/daemon/speaker/speaker.cc
@@ -18,10 +18,10 @@
device_ = device;
device->AddStateDefinitionsFromJson(R"({
- "onOff": {"state": ["on", "standby"]},
+ "onOff": {"state": {"type": "string", "enum": ["on", "standby"]}},
"volume": {
- "volume": "integer",
- "isMuted": "boolean"
+ "volume": {"type": "integer"},
+ "isMuted": {"type": "boolean"}
}
})");
@@ -38,7 +38,7 @@
"onOff": {
"setConfig":{
"parameters": {
- "state": ["on", "standby"]
+ "state": {"type": "string", "enum": ["on", "standby"]}
}
}
},
@@ -50,7 +50,7 @@
"minimum": 0,
"maximum": 100
},
- "isMuted": "boolean"
+ "isMuted": {"type": "boolean"}
}
}
}