From 351058f13616219bc9a92dcc3580bc6a263e9f18 Mon Sep 17 00:00:00 2001 From: lijayaku Date: Thu, 5 Nov 2020 18:01:05 -0800 Subject: [PATCH 1/5] [ChipTool] Add Payload Parse Command --- examples/chip-tool/BUILD.gn | 1 + examples/chip-tool/README.md | 21 +++++ .../chip-tool/commands/payload/Commands.h | 38 ++++++++ .../commands/payload/ParseCommand.cpp | 92 +++++++++++++++++++ .../chip-tool/commands/payload/ParseCommand.h | 39 ++++++++ examples/chip-tool/main.cpp | 5 +- 6 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 examples/chip-tool/commands/payload/Commands.h create mode 100644 examples/chip-tool/commands/payload/ParseCommand.cpp create mode 100644 examples/chip-tool/commands/payload/ParseCommand.h diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 9f5a4107c0767e..2b3692ae3dbbdc 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -26,6 +26,7 @@ executable("chip-tool") { "commands/common/Logging.cpp", "commands/common/ModelCommand.cpp", "commands/common/NetworkCommand.cpp", + "commands/payload/ParseCommand.cpp", "main.cpp", ] diff --git a/examples/chip-tool/README.md b/examples/chip-tool/README.md index 8f41c23fda8f86..4f9c933e5caca4 100644 --- a/examples/chip-tool/README.md +++ b/examples/chip-tool/README.md @@ -91,3 +91,24 @@ To get the list of parameters for a specific command, run the built executable with the target cluster name and the target command name $ chip-tool onoff on + +## Using the Client for Setup Payload + +### How to parse a setup code + +To parse a setup code, run the built executable with the `payload` cluster name and the `parse` command + + $ chip-tool payload parse code + +#### QR Code + + $ chip-tool payload parse "CH:J20800G008008000" + + +#### QR Code with optional Vendor Info + + $ chip-tool chip-tool payload parse "CH:J20800G008008006DL200UOGMHARTHOMJ300IDL530.I7" + +#### Manual Setup Code + + $ chip-tool payload parse "000003949145367145266" \ No newline at end of file diff --git a/examples/chip-tool/commands/payload/Commands.h b/examples/chip-tool/commands/payload/Commands.h new file mode 100644 index 00000000000000..05938db9ffa7b6 --- /dev/null +++ b/examples/chip-tool/commands/payload/Commands.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 Project CHIP Authors + * All rights reserved. + * + * 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. + * + */ + +#pragma once + +#include "ParseCommand.h" + +class PayloadParse : public ParseCommand +{ +public: + PayloadParse() : ParseCommand("parse") {} +}; + +void registerPayloadCommands(Commands & commands) +{ + const char * clusterName = "Payload"; + + commands_list clusterCommands = { + make_unique(), + }; + + commands.Register(clusterName, clusterCommands); +} \ No newline at end of file diff --git a/examples/chip-tool/commands/payload/ParseCommand.cpp b/examples/chip-tool/commands/payload/ParseCommand.cpp new file mode 100644 index 00000000000000..90a54895d0760b --- /dev/null +++ b/examples/chip-tool/commands/payload/ParseCommand.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2020 Project CHIP Authors + * All rights reserved. + * + * 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. + * + */ + +#include "ParseCommand.h" +#include +#include +#include +#include +#include +#include +#include + +using namespace ::chip; +using namespace ::chip::DeviceController; + +CHIP_ERROR ParseCommand::Run(ChipDeviceController * dc, NodeId remoteId) +{ + std::string codeString(mCode); + SetupPayload payload; + + CHIP_ERROR err = CHIP_NO_ERROR; + err = Parse(codeString, payload); + + SuccessOrExit(err); + + Print(payload); +exit: + return err; +} + +void ParseCommand::Print(chip::SetupPayload payload){ + std::string serialNumber; + std::vector optionalVendorData; + + payload.getSerialNumber(serialNumber); + optionalVendorData = payload.getAllOptionalVendorData(); + + ChipLogProgress(SetupPayload, "RequiresCustomFlow: %u", payload.requiresCustomFlow); + ChipLogProgress(SetupPayload, "VendorID: %u", payload.vendorID); + ChipLogProgress(SetupPayload, "Version: %u", payload.version); + ChipLogProgress(SetupPayload, "ProductID: %u", payload.productID); + ChipLogProgress(SetupPayload, "Discriminator: %u", payload.discriminator); + ChipLogProgress(SetupPayload, "SetUpPINCode: %u", payload.setUpPINCode); + ChipLogProgress(SetupPayload, "RendezvousInformation: %u", payload.rendezvousInformation); + ChipLogProgress(SetupPayload, "SerialNumber: %s", serialNumber.c_str()); + + ChipLogProgress(SetupPayload, "OptionalVendorData Size: %u", optionalVendorData.size()); + + for (const OptionalQRCodeInfo & info : optionalVendorData) + { + if (info.type == optionalQRCodeInfoTypeString) + { + ChipLogProgress(SetupPayload, "OptionalQRCodeInfo: tag=%u,string value=%s",info.tag, info.data.c_str()); + } + else if (info.type == optionalQRCodeInfoTypeInt32) + { + ChipLogProgress(SetupPayload, "OptionalQRCodeInfo: tag=%u,int value=%u",info.tag, info.int32); + } + } +} + +CHIP_ERROR ParseCommand::Parse(std::string codeString, chip::SetupPayload &payload){ + + CHIP_ERROR err = CHIP_NO_ERROR; + + if(IsQRCode(codeString)) { + ChipLogDetail(SetupPayload, "Parsing Base41Representation: %s", codeString.c_str()); + return QRCodeSetupPayloadParser(codeString).populatePayload(payload); + } + + ChipLogDetail(SetupPayload, "Parsing decimalRepresentation: %s", codeString.c_str()); + return ManualSetupPayloadParser(codeString).populatePayload(payload); +} + +bool ParseCommand::IsQRCode(std::string codeString){ + return codeString.rfind("CH:")==0; +} \ No newline at end of file diff --git a/examples/chip-tool/commands/payload/ParseCommand.h b/examples/chip-tool/commands/payload/ParseCommand.h new file mode 100644 index 00000000000000..b771661f1d350d --- /dev/null +++ b/examples/chip-tool/commands/payload/ParseCommand.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020 Project CHIP Authors + * All rights reserved. + * + * 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. + * + */ + +#pragma once + +#include "../common/Command.h" +#include + +class ParseCommand : public Command +{ +public: + ParseCommand(const char * name) : Command(name) + { + AddArgument("code", &mCode); + } + + CHIP_ERROR Run(ChipDeviceController * dc, NodeId remoteId) override; + +private: + char* mCode; + CHIP_ERROR Parse(std::string codeString, chip::SetupPayload &payload); + void Print(chip::SetupPayload payload); + bool IsQRCode(std::string codeString); +}; \ No newline at end of file diff --git a/examples/chip-tool/main.cpp b/examples/chip-tool/main.cpp index 43847874a16748..7f1c44cae11858 100644 --- a/examples/chip-tool/main.cpp +++ b/examples/chip-tool/main.cpp @@ -20,6 +20,7 @@ #include "commands/clusters/Commands.h" #include "commands/echo/Commands.h" +#include "commands/payload/Commands.h" // NOTE: Remote device ID is in sync with the echo server device id // At some point, we may want to add an option to connect to a device without @@ -35,7 +36,9 @@ int main(int argc, char * argv[]) Commands commands; registerCommandsEcho(commands); - registerClusters(commands); + registerPayloadCommands(commands); + registerClusters(commands); + return commands.Run(kLocalDeviceId, kRemoteDeviceId, argc, argv); } From 21f7bd9aea040e61cb45254f3bdf02b386aab4ae Mon Sep 17 00:00:00 2001 From: lijayaku Date: Thu, 5 Nov 2020 18:01:05 -0800 Subject: [PATCH 2/5] [ChipTool] Add Payload Parse Command --- examples/chip-tool/README.md | 7 ++- .../chip-tool/commands/payload/Commands.h | 11 +--- .../commands/payload/ParseCommand.cpp | 53 +++++++++++-------- .../chip-tool/commands/payload/ParseCommand.h | 5 +- examples/chip-tool/main.cpp | 3 +- 5 files changed, 40 insertions(+), 39 deletions(-) diff --git a/examples/chip-tool/README.md b/examples/chip-tool/README.md index 4f9c933e5caca4..cea06d3c42b195 100644 --- a/examples/chip-tool/README.md +++ b/examples/chip-tool/README.md @@ -102,13 +102,12 @@ To parse a setup code, run the built executable with the `payload` cluster name #### QR Code - $ chip-tool payload parse "CH:J20800G008008000" - + $ chip-tool payload parse "CH:#####" #### QR Code with optional Vendor Info - $ chip-tool chip-tool payload parse "CH:J20800G008008006DL200UOGMHARTHOMJ300IDL530.I7" + $ chip-tool chip-tool payload parse "CH:#####" #### Manual Setup Code - $ chip-tool payload parse "000003949145367145266" \ No newline at end of file + $ chip-tool payload parse :#####" diff --git a/examples/chip-tool/commands/payload/Commands.h b/examples/chip-tool/commands/payload/Commands.h index 05938db9ffa7b6..62bbf8e08eaf54 100644 --- a/examples/chip-tool/commands/payload/Commands.h +++ b/examples/chip-tool/commands/payload/Commands.h @@ -20,18 +20,11 @@ #include "ParseCommand.h" -class PayloadParse : public ParseCommand -{ -public: - PayloadParse() : ParseCommand("parse") {} -}; - -void registerPayloadCommands(Commands & commands) +void registerCommandsPayload(Commands & commands) { const char * clusterName = "Payload"; - commands_list clusterCommands = { - make_unique(), + make_unique(), }; commands.Register(clusterName, clusterCommands); diff --git a/examples/chip-tool/commands/payload/ParseCommand.cpp b/examples/chip-tool/commands/payload/ParseCommand.cpp index 90a54895d0760b..9eb3a30909666d 100644 --- a/examples/chip-tool/commands/payload/ParseCommand.cpp +++ b/examples/chip-tool/commands/payload/ParseCommand.cpp @@ -20,10 +20,6 @@ #include #include #include -#include -#include -#include -#include using namespace ::chip; using namespace ::chip::DeviceController; @@ -35,20 +31,18 @@ CHIP_ERROR ParseCommand::Run(ChipDeviceController * dc, NodeId remoteId) CHIP_ERROR err = CHIP_NO_ERROR; err = Parse(codeString, payload); + SuccessOrExit(err); + err = Print(payload); SuccessOrExit(err); - - Print(payload); exit: return err; } -void ParseCommand::Print(chip::SetupPayload payload){ +CHIP_ERROR ParseCommand::Print(chip::SetupPayload payload){ std::string serialNumber; std::vector optionalVendorData; - - payload.getSerialNumber(serialNumber); - optionalVendorData = payload.getAllOptionalVendorData(); + CHIP_ERROR err = CHIP_NO_ERROR; ChipLogProgress(SetupPayload, "RequiresCustomFlow: %u", payload.requiresCustomFlow); ChipLogProgress(SetupPayload, "VendorID: %u", payload.vendorID); @@ -57,10 +51,12 @@ void ParseCommand::Print(chip::SetupPayload payload){ ChipLogProgress(SetupPayload, "Discriminator: %u", payload.discriminator); ChipLogProgress(SetupPayload, "SetUpPINCode: %u", payload.setUpPINCode); ChipLogProgress(SetupPayload, "RendezvousInformation: %u", payload.rendezvousInformation); - ChipLogProgress(SetupPayload, "SerialNumber: %s", serialNumber.c_str()); - - ChipLogProgress(SetupPayload, "OptionalVendorData Size: %u", optionalVendorData.size()); + if (payload.getSerialNumber(serialNumber) == CHIP_NO_ERROR){ + ChipLogProgress(SetupPayload, "SerialNumber: %s", serialNumber.c_str()); + } + + optionalVendorData = payload.getAllOptionalVendorData(); for (const OptionalQRCodeInfo & info : optionalVendorData) { if (info.type == optionalQRCodeInfoTypeString) @@ -71,22 +67,35 @@ void ParseCommand::Print(chip::SetupPayload payload){ { ChipLogProgress(SetupPayload, "OptionalQRCodeInfo: tag=%u,int value=%u",info.tag, info.int32); } + else + { + err = CHIP_ERROR_INVALID_ARGUMENT; + } } + + SuccessOrExit(err); + +exit: + return err; } CHIP_ERROR ParseCommand::Parse(std::string codeString, chip::SetupPayload &payload){ CHIP_ERROR err = CHIP_NO_ERROR; - - if(IsQRCode(codeString)) { - ChipLogDetail(SetupPayload, "Parsing Base41Representation: %s", codeString.c_str()); - return QRCodeSetupPayloadParser(codeString).populatePayload(payload); + if(IsQRCode(codeString)) + { + ChipLogDetail(SetupPayload, "Parsing base41Representation: %s", codeString.c_str()); + err = QRCodeSetupPayloadParser(codeString).populatePayload(payload); + } + else + { + ChipLogDetail(SetupPayload, "Parsing decimalRepresentation: %s", codeString.c_str()); + err = ManualSetupPayloadParser(codeString).populatePayload(payload); } - - ChipLogDetail(SetupPayload, "Parsing decimalRepresentation: %s", codeString.c_str()); - return ManualSetupPayloadParser(codeString).populatePayload(payload); + + return err; } bool ParseCommand::IsQRCode(std::string codeString){ - return codeString.rfind("CH:")==0; -} \ No newline at end of file + return codeString.rfind(QRCODE_PREFIX)==0; +} diff --git a/examples/chip-tool/commands/payload/ParseCommand.h b/examples/chip-tool/commands/payload/ParseCommand.h index b771661f1d350d..7aaeb1d78d6240 100644 --- a/examples/chip-tool/commands/payload/ParseCommand.h +++ b/examples/chip-tool/commands/payload/ParseCommand.h @@ -24,7 +24,7 @@ class ParseCommand : public Command { public: - ParseCommand(const char * name) : Command(name) + ParseCommand() : Command("parse") { AddArgument("code", &mCode); } @@ -34,6 +34,7 @@ class ParseCommand : public Command private: char* mCode; CHIP_ERROR Parse(std::string codeString, chip::SetupPayload &payload); - void Print(chip::SetupPayload payload); + CHIP_ERROR Print(chip::SetupPayload payload); bool IsQRCode(std::string codeString); + const std::string QRCODE_PREFIX = "CH:"; }; \ No newline at end of file diff --git a/examples/chip-tool/main.cpp b/examples/chip-tool/main.cpp index 7f1c44cae11858..f917b2b69c6fe9 100644 --- a/examples/chip-tool/main.cpp +++ b/examples/chip-tool/main.cpp @@ -34,9 +34,8 @@ constexpr chip::NodeId kRemoteDeviceId = 12344321; int main(int argc, char * argv[]) { Commands commands; - registerCommandsEcho(commands); - registerPayloadCommands(commands); + registerCommandsPayload(commands); registerClusters(commands); From 3d98865eaabdd1150d7dc419efd3c2fc4c0fdf35 Mon Sep 17 00:00:00 2001 From: lijujayakumar Date: Thu, 12 Nov 2020 15:53:01 -0800 Subject: [PATCH 3/5] [ChipTool] Restyle issues resolved --- examples/chip-tool/README.md | 3 +- .../chip-tool/commands/payload/Commands.h | 4 +-- .../commands/payload/ParseCommand.cpp | 32 +++++++++++-------- .../chip-tool/commands/payload/ParseCommand.h | 11 +++---- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/examples/chip-tool/README.md b/examples/chip-tool/README.md index cea06d3c42b195..5efb2e4bebe5e0 100644 --- a/examples/chip-tool/README.md +++ b/examples/chip-tool/README.md @@ -96,7 +96,8 @@ with the target cluster name and the target command name ### How to parse a setup code -To parse a setup code, run the built executable with the `payload` cluster name and the `parse` command +To parse a setup code, run the built executable with the `payload` cluster name +and the `parse` command $ chip-tool payload parse code diff --git a/examples/chip-tool/commands/payload/Commands.h b/examples/chip-tool/commands/payload/Commands.h index 62bbf8e08eaf54..83c1124af44910 100644 --- a/examples/chip-tool/commands/payload/Commands.h +++ b/examples/chip-tool/commands/payload/Commands.h @@ -22,10 +22,10 @@ void registerCommandsPayload(Commands & commands) { - const char * clusterName = "Payload"; + const char * clusterName = "Payload"; commands_list clusterCommands = { make_unique(), }; commands.Register(clusterName, clusterCommands); -} \ No newline at end of file +} diff --git a/examples/chip-tool/commands/payload/ParseCommand.cpp b/examples/chip-tool/commands/payload/ParseCommand.cpp index 9eb3a30909666d..aa51c6441632f8 100644 --- a/examples/chip-tool/commands/payload/ParseCommand.cpp +++ b/examples/chip-tool/commands/payload/ParseCommand.cpp @@ -17,20 +17,20 @@ */ #include "ParseCommand.h" -#include #include +#include #include using namespace ::chip; using namespace ::chip::DeviceController; CHIP_ERROR ParseCommand::Run(ChipDeviceController * dc, NodeId remoteId) -{ +{ std::string codeString(mCode); SetupPayload payload; - + CHIP_ERROR err = CHIP_NO_ERROR; - err = Parse(codeString, payload); + err = Parse(codeString, payload); SuccessOrExit(err); err = Print(payload); @@ -39,7 +39,8 @@ CHIP_ERROR ParseCommand::Run(ChipDeviceController * dc, NodeId remoteId) return err; } -CHIP_ERROR ParseCommand::Print(chip::SetupPayload payload){ +CHIP_ERROR ParseCommand::Print(chip::SetupPayload payload) +{ std::string serialNumber; std::vector optionalVendorData; CHIP_ERROR err = CHIP_NO_ERROR; @@ -52,20 +53,21 @@ CHIP_ERROR ParseCommand::Print(chip::SetupPayload payload){ ChipLogProgress(SetupPayload, "SetUpPINCode: %u", payload.setUpPINCode); ChipLogProgress(SetupPayload, "RendezvousInformation: %u", payload.rendezvousInformation); - if (payload.getSerialNumber(serialNumber) == CHIP_NO_ERROR){ + if (payload.getSerialNumber(serialNumber) == CHIP_NO_ERROR) + { ChipLogProgress(SetupPayload, "SerialNumber: %s", serialNumber.c_str()); } optionalVendorData = payload.getAllOptionalVendorData(); for (const OptionalQRCodeInfo & info : optionalVendorData) - { + { if (info.type == optionalQRCodeInfoTypeString) { - ChipLogProgress(SetupPayload, "OptionalQRCodeInfo: tag=%u,string value=%s",info.tag, info.data.c_str()); + ChipLogProgress(SetupPayload, "OptionalQRCodeInfo: tag=%u,string value=%s", info.tag, info.data.c_str()); } else if (info.type == optionalQRCodeInfoTypeInt32) { - ChipLogProgress(SetupPayload, "OptionalQRCodeInfo: tag=%u,int value=%u",info.tag, info.int32); + ChipLogProgress(SetupPayload, "OptionalQRCodeInfo: tag=%u,int value=%u", info.tag, info.int32); } else { @@ -79,10 +81,11 @@ CHIP_ERROR ParseCommand::Print(chip::SetupPayload payload){ return err; } -CHIP_ERROR ParseCommand::Parse(std::string codeString, chip::SetupPayload &payload){ - +CHIP_ERROR ParseCommand::Parse(std::string codeString, chip::SetupPayload & payload) +{ + CHIP_ERROR err = CHIP_NO_ERROR; - if(IsQRCode(codeString)) + if (IsQRCode(codeString)) { ChipLogDetail(SetupPayload, "Parsing base41Representation: %s", codeString.c_str()); err = QRCodeSetupPayloadParser(codeString).populatePayload(payload); @@ -96,6 +99,7 @@ CHIP_ERROR ParseCommand::Parse(std::string codeString, chip::SetupPayload &paylo return err; } -bool ParseCommand::IsQRCode(std::string codeString){ - return codeString.rfind(QRCODE_PREFIX)==0; +bool ParseCommand::IsQRCode(std::string codeString) +{ + return codeString.rfind(QRCODE_PREFIX) == 0; } diff --git a/examples/chip-tool/commands/payload/ParseCommand.h b/examples/chip-tool/commands/payload/ParseCommand.h index 7aaeb1d78d6240..0a3f0f7a17f500 100644 --- a/examples/chip-tool/commands/payload/ParseCommand.h +++ b/examples/chip-tool/commands/payload/ParseCommand.h @@ -24,17 +24,14 @@ class ParseCommand : public Command { public: - ParseCommand() : Command("parse") - { - AddArgument("code", &mCode); - } + ParseCommand() : Command("parse") { AddArgument("code", &mCode); } CHIP_ERROR Run(ChipDeviceController * dc, NodeId remoteId) override; private: - char* mCode; - CHIP_ERROR Parse(std::string codeString, chip::SetupPayload &payload); + char * mCode; + CHIP_ERROR Parse(std::string codeString, chip::SetupPayload & payload); CHIP_ERROR Print(chip::SetupPayload payload); bool IsQRCode(std::string codeString); const std::string QRCODE_PREFIX = "CH:"; -}; \ No newline at end of file +}; From 4a8180e2c49f7e1261e35a32b1f3ee61df95e116 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 12 Nov 2020 23:53:28 +0000 Subject: [PATCH 4/5] Restyled by whitespace --- examples/chip-tool/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chip-tool/main.cpp b/examples/chip-tool/main.cpp index f917b2b69c6fe9..f09e5d63a04ace 100644 --- a/examples/chip-tool/main.cpp +++ b/examples/chip-tool/main.cpp @@ -38,6 +38,6 @@ int main(int argc, char * argv[]) registerCommandsPayload(commands); registerClusters(commands); - + return commands.Run(kLocalDeviceId, kRemoteDeviceId, argc, argv); } From 7ce9721ef58da6d118e3af145f6ab759014266ae Mon Sep 17 00:00:00 2001 From: lijujayakumar Date: Wed, 2 Dec 2020 18:16:21 -0800 Subject: [PATCH 5/5] Resolve build errors caused by Command.h schema change --- examples/chip-tool/BUILD.gn | 2 +- examples/chip-tool/commands/payload/ParseCommand.cpp | 3 +-- examples/chip-tool/commands/payload/ParseCommand.h | 3 +-- examples/chip-tool/main.cpp | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 981d1ba5623720..17ed976ef3b89e 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -25,9 +25,9 @@ executable("chip-tool") { "commands/common/Commands.cpp", "commands/common/Logging.cpp", "commands/common/NetworkCommand.cpp", - "commands/payload/ParseCommand.cpp", "commands/echo/EchoCommand.cpp", "commands/pairing/PairingCommand.cpp", + "commands/payload/ParseCommand.cpp", "config/PersistentStorage.cpp", "main.cpp", ] diff --git a/examples/chip-tool/commands/payload/ParseCommand.cpp b/examples/chip-tool/commands/payload/ParseCommand.cpp index aa51c6441632f8..534efb14e2acc9 100644 --- a/examples/chip-tool/commands/payload/ParseCommand.cpp +++ b/examples/chip-tool/commands/payload/ParseCommand.cpp @@ -22,9 +22,8 @@ #include using namespace ::chip; -using namespace ::chip::DeviceController; -CHIP_ERROR ParseCommand::Run(ChipDeviceController * dc, NodeId remoteId) +CHIP_ERROR ParseCommand::Run(PersistentStorage & storage, NodeId localId, NodeId remoteId) { std::string codeString(mCode); SetupPayload payload; diff --git a/examples/chip-tool/commands/payload/ParseCommand.h b/examples/chip-tool/commands/payload/ParseCommand.h index 0a3f0f7a17f500..f7d2a41a7ad8cc 100644 --- a/examples/chip-tool/commands/payload/ParseCommand.h +++ b/examples/chip-tool/commands/payload/ParseCommand.h @@ -25,8 +25,7 @@ class ParseCommand : public Command { public: ParseCommand() : Command("parse") { AddArgument("code", &mCode); } - - CHIP_ERROR Run(ChipDeviceController * dc, NodeId remoteId) override; + CHIP_ERROR Run(PersistentStorage & storage, NodeId localId, NodeId remoteId) override; private: char * mCode; diff --git a/examples/chip-tool/main.cpp b/examples/chip-tool/main.cpp index e0345098f86b5d..a7bf3ec9b1f478 100644 --- a/examples/chip-tool/main.cpp +++ b/examples/chip-tool/main.cpp @@ -20,8 +20,8 @@ #include "commands/clusters/Commands.h" #include "commands/echo/Commands.h" -#include "commands/payload/Commands.h" #include "commands/pairing/Commands.h" +#include "commands/payload/Commands.h" #include