Ensure valid instance number

This commit is contained in:
LordGrey
2024-04-25 23:34:53 +02:00
parent 42e809581e
commit 12499c8cbb
17 changed files with 44 additions and 23 deletions

View File

@@ -8,7 +8,9 @@
"enum" : ["adjustment"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -8,7 +8,9 @@
"enum" : ["clear"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -8,7 +8,9 @@
"enum" : ["clearall"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -8,7 +8,9 @@
"enum" : ["color"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -10,7 +10,9 @@
"enum" : ["componentstate"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -13,7 +13,9 @@
"enum" : ["getconfig","getschema","setconfig","restoreconfig","reload"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -8,7 +8,9 @@
"enum" : ["create-effect"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -9,7 +9,9 @@
"enum" : ["delete-effect"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -8,7 +8,9 @@
"enum" : ["effect"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -8,7 +8,9 @@
"enum" : ["image"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -8,7 +8,9 @@
"enum" : ["ledcolors"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -7,9 +7,6 @@
"required" : true,
"enum" : ["logging"]
},
"instance" : {
"type" : "integer"
},
"tan" : {
"type" : "integer"
},

View File

@@ -8,7 +8,9 @@
"enum" : ["processing"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"tan" : {
"type" : "integer"

View File

@@ -12,7 +12,9 @@
"enum": ["getInfo", "subscribe", "unsubscribe", "getSubscriptions", "getSubscriptionCommands"]
},
"instance" : {
"type" : "integer"
"type" : "integer",
"minimum": 0,
"maximum": 255
},
"data": {
"type": ["null", "array"],

View File

@@ -233,7 +233,9 @@ void JsonAPI::handleMessage(const QString &messageString, const QString &httpAut
const quint8 instance = static_cast<quint8>(message.value("instance").toInt());
if (!setHyperionInstance(instance))
{
cmd.isInstanceCmd = InstanceCmd::No;
sendErrorReply(QString("Invalid or stopped instance: %1").arg(instance), cmd);
return;
}
}