diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index 419f89f60ddb78..71d1a51edaa4b3 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -29,7 +29,6 @@ #include #include #include -#include constexpr uint16_t kTimeoutInSeconds = 90; diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index 234f1b6cf8a484..894849adf460ed 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -184,7 +184,6 @@ def getSpecificTemplatesTargets(): 'src/controller/python/templates/templates.json': None, 'src/darwin/Framework/CHIP/templates/templates.json': None, 'src/controller/java/templates/templates.json': None, - 'src/app/tests/suites/templates/templates.json': 'zzz_generated/controller-clusters/zap-generated', } targets = [] diff --git a/zzz_generated/controller-clusters/zap-generated/tests/simulated-cluster-objects.h b/zzz_generated/controller-clusters/zap-generated/tests/simulated-cluster-objects.h deleted file mode 100644 index 80a62f725a60b0..00000000000000 --- a/zzz_generated/controller-clusters/zap-generated/tests/simulated-cluster-objects.h +++ /dev/null @@ -1,1223 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// THIS FILE IS GENERATED BY ZAP - -#include -#include - -#pragma once - -namespace chip { - -struct PairWithQRCodeCommand -{ - chip::NodeId nodeId; - chip::CharSpan payload; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), nodeId)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(1), payload)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, nodeId)); - break; - case 1: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, payload)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct PairWithManualCodeCommand -{ - chip::NodeId nodeId; - chip::CharSpan payload; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), nodeId)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(1), payload)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, nodeId)); - break; - case 1: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, payload)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct UnpairCommand -{ - chip::NodeId nodeId; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), nodeId)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, nodeId)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct WaitForMsCommand -{ - uint32_t ms; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), ms)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, ms)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct WaitForCommissioningCommand -{ - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct WaitForCommissioneeCommand -{ - chip::NodeId nodeId; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), nodeId)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, nodeId)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct WaitForCommissionableAdvertisementCommand -{ - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct WaitForOperationalAdvertisementCommand -{ - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionableCommand -{ - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionableByShortDiscriminatorCommand -{ - uint64_t value; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), value)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, value)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionableByLongDiscriminatorCommand -{ - uint64_t value; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), value)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, value)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionableByCommissioningModeCommand -{ - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionableByVendorIdCommand -{ - uint64_t value; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), value)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, value)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionableByDeviceTypeCommand -{ - uint64_t value; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), value)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, value)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionableByNameCommand -{ - chip::CharSpan value; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), value)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, value)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionerCommand -{ - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionerByVendorIdCommand -{ - uint64_t value; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), value)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, value)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FindCommissionerByDeviceTypeCommand -{ - uint64_t value; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), value)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, value)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct DiscoveryCommandResponse -{ - chip::CharSpan hostName; - chip::CharSpan instanceName; - uint16_t longDiscriminator; - uint8_t shortDiscriminator; - uint16_t vendorId; - uint16_t productId; - uint8_t commissioningMode; - uint16_t deviceType; - chip::CharSpan deviceName; - chip::ByteSpan rotatingId; - uint64_t rotatingIdLen; - uint16_t pairingHint; - chip::CharSpan pairingInstruction; - bool supportsTcp; - uint8_t numIPs; - uint16_t port; - Optional mrpRetryIntervalIdle; - Optional mrpRetryIntervalActive; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), hostName)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(1), instanceName)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(2), longDiscriminator)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(3), shortDiscriminator)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(4), vendorId)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(5), productId)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(6), commissioningMode)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(7), deviceType)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(8), deviceName)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(9), rotatingId)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(10), rotatingIdLen)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(11), pairingHint)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(12), pairingInstruction)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(13), supportsTcp)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(14), numIPs)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(15), port)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(16), mrpRetryIntervalIdle)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(17), mrpRetryIntervalActive)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, hostName)); - break; - case 1: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, instanceName)); - break; - case 2: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, longDiscriminator)); - break; - case 3: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, shortDiscriminator)); - break; - case 4: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, vendorId)); - break; - case 5: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, productId)); - break; - case 6: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, commissioningMode)); - break; - case 7: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, deviceType)); - break; - case 8: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, deviceName)); - break; - case 9: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, rotatingId)); - break; - case 10: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, rotatingIdLen)); - break; - case 11: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, pairingHint)); - break; - case 12: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, pairingInstruction)); - break; - case 13: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, supportsTcp)); - break; - case 14: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, numIPs)); - break; - case 15: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, port)); - break; - case 16: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, mrpRetryIntervalIdle)); - break; - case 17: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, mrpRetryIntervalActive)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct LogCommand -{ - chip::CharSpan message; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), message)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, message)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct UserPromptCommand -{ - chip::CharSpan message; - Optional expectedValue; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), message)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(1), expectedValue)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, message)); - break; - case 1: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, expectedValue)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct StartCommand -{ - Optional discriminator; - Optional port; - Optional kvs; - Optional minCommissioningTimeout; - Optional registerKey; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), discriminator)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(1), port)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(2), kvs)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(3), minCommissioningTimeout)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(4), registerKey)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, discriminator)); - break; - case 1: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, port)); - break; - case 2: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, kvs)); - break; - case 3: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, minCommissioningTimeout)); - break; - case 4: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, registerKey)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct StopCommand -{ - Optional registerKey; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), registerKey)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, registerKey)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct RebootCommand -{ - Optional registerKey; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), registerKey)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, registerKey)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -struct FactoryResetCommand -{ - Optional registerKey; - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), registerKey)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; - } - - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::TLV::TLVType outer; - VerifyOrReturnError(chip::TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(chip::TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (chip::TLV::TagNumFromTag(reader.GetTag())) - { - case 0: - ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, registerKey)); - break; - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; - } -}; - -namespace app { -namespace Clusters { - -namespace CommissionerCommands { -namespace Commands { -namespace PairWithQRCode { -using Type = struct PairWithQRCodeCommand; -} -namespace PairWithManualCode { -using Type = struct PairWithManualCodeCommand; -} -namespace Unpair { -using Type = struct UnpairCommand; -} -} // namespace Commands -} // namespace CommissionerCommands - -namespace DelayCommands { -namespace Commands { -namespace WaitForMs { -using Type = struct WaitForMsCommand; -} -namespace WaitForCommissioning { -using Type = struct WaitForCommissioningCommand; -} -namespace WaitForCommissionee { -using Type = struct WaitForCommissioneeCommand; -} -namespace WaitForCommissionableAdvertisement { -using Type = struct WaitForCommissionableAdvertisementCommand; -} -namespace WaitForOperationalAdvertisement { -using Type = struct WaitForOperationalAdvertisementCommand; -} -} // namespace Commands -} // namespace DelayCommands - -namespace DiscoveryCommands { -namespace Commands { -namespace FindCommissionable { -using Type = struct FindCommissionableCommand; -} -namespace FindCommissionableByShortDiscriminator { -using Type = struct FindCommissionableByShortDiscriminatorCommand; -} -namespace FindCommissionableByLongDiscriminator { -using Type = struct FindCommissionableByLongDiscriminatorCommand; -} -namespace FindCommissionableByCommissioningMode { -using Type = struct FindCommissionableByCommissioningModeCommand; -} -namespace FindCommissionableByVendorId { -using Type = struct FindCommissionableByVendorIdCommand; -} -namespace FindCommissionableByDeviceType { -using Type = struct FindCommissionableByDeviceTypeCommand; -} -namespace FindCommissionableByName { -using Type = struct FindCommissionableByNameCommand; -} -namespace FindCommissioner { -using Type = struct FindCommissionerCommand; -} -namespace FindCommissionerByVendorId { -using Type = struct FindCommissionerByVendorIdCommand; -} -namespace FindCommissionerByDeviceType { -using Type = struct FindCommissionerByDeviceTypeCommand; -} -namespace DiscoveryCommandResponse { -using DecodableType = struct DiscoveryCommandResponse; -} -} // namespace Commands -} // namespace DiscoveryCommands - -namespace LogCommands { -namespace Commands { -namespace Log { -using Type = struct LogCommand; -} -namespace UserPrompt { -using Type = struct UserPromptCommand; -} -} // namespace Commands -} // namespace LogCommands - -namespace SystemCommands { -namespace Commands { -namespace Start { -using Type = struct StartCommand; -} -namespace Stop { -using Type = struct StopCommand; -} -namespace Reboot { -using Type = struct RebootCommand; -} -namespace FactoryReset { -using Type = struct FactoryResetCommand; -} -} // namespace Commands -} // namespace SystemCommands - -} // namespace Clusters -} // namespace app - -} // namespace chip