Error checking for Encoder::encode UpdateLEDState
parent
77eed8f58d
commit
21c3fead4a
|
|
@ -109,11 +109,15 @@ bool Encoder::encode(std::vector<uint8_t>& result, Command cmd, std::vector<uint
|
||||||
* In this case, command 0x06 is SetLEDState.
|
* In this case, command 0x06 is SetLEDState.
|
||||||
* This old command type is not really used anywhere else.
|
* This old command type is not really used anywhere else.
|
||||||
*/
|
*/
|
||||||
|
if (arguments.empty()) {
|
||||||
|
report(APIEvent::Type::MessageFormattingError, APIEvent::Severity::Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
msg->network = Network::NetID::Device;
|
msg->network = Network::NetID::Device;
|
||||||
msg->data.reserve(3);
|
msg->data.reserve(3);
|
||||||
msg->data.push_back(0x00);
|
msg->data.push_back(0x00);
|
||||||
msg->data.push_back(0x06);
|
msg->data.push_back(0x06); // SetLEDState
|
||||||
msg->data.push_back(arguments.at(0));
|
msg->data.push_back(arguments.at(0)); // See Device::LEDState
|
||||||
} else {
|
} else {
|
||||||
msg->network = Network::NetID::Main51;
|
msg->network = Network::NetID::Main51;
|
||||||
msg->data.reserve(arguments.size() + 1);
|
msg->data.reserve(arguments.size() + 1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue