From 07e2fa16fa34ba63c636bb921ff202fe286bed45 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Wed, 28 Oct 2020 21:14:09 +0100 Subject: [PATCH] chip-tool arguments order is reversed --- examples/chip-tool/README.md | 10 +- .../chip-tool/commands/clusters/Commands.h | 321 +++++++++++++++--- .../chip-tool/commands/common/Command.cpp | 10 +- .../chip-tool/commands/common/ModelCommand.h | 4 + .../commands/common/NetworkCommand.h | 10 +- examples/chip-tool/commands/echo/Commands.h | 4 +- .../linux-cirque/test-on-off-cluster.py | 4 +- 7 files changed, 300 insertions(+), 63 deletions(-) diff --git a/examples/chip-tool/README.md b/examples/chip-tool/README.md index bb4da89f60c289..6b9001f2b3c027 100644 --- a/examples/chip-tool/README.md +++ b/examples/chip-tool/README.md @@ -36,14 +36,14 @@ pass it the discriminator and pairing code of the remote device. The command below uses the default values hard-coded into the debug versions of the ESP32 wifi-echo app: - $ chip-tool echo ble 3840 12345678 + $ chip-tool echo ble 12345678 3840 ### Ping a device over IP To start the Client in echo mode, run the built executable and pass it the IP address and port of the server to talk to, as well as the command "echo". - $ chip-tool echo ip 192.168.0.30 8000 + $ chip-tool echo ip 192.168.0.30 11095 If valid values are supplied, it will begin to periodically send messages to the server address provided. @@ -56,11 +56,11 @@ Stop the Client at any time with `Ctrl + C`. ## Using the Client to Send CHIP Commands To use the Client to send a CHIP commands, run the built executable and pass it -the target cluster name, the target command name, an endpoint id as well as the -IP address and port of the server to talk to. The endpoint id must be between 1 +the target cluster name, the target command name, the ip address and port of the +server to talk to as well as an endpoint id. The endpoint id must be between 1 and 240. - $ chip-tool onoff on 1 192.168.0.30 11095 + $ chip-tool onoff on 192.168.0.30 11095 1 The client will send a single command packet and then exit. diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index 53bf21b2d2c6b6..0011f3b0351e19 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -489,6 +489,7 @@ class BarrierControlGoToPercent : public ModelCommand BarrierControlGoToPercent() : ModelCommand("go-to-percent", kBarrierControlClusterId, 0x00) { AddArgument("percentOpen", 0, UINT8_MAX, &mPercentOpen); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -513,7 +514,7 @@ class BarrierControlGoToPercent : public ModelCommand class BarrierControlStop : public ModelCommand { public: - BarrierControlStop() : ModelCommand("stop", kBarrierControlClusterId, 0x01) {} + BarrierControlStop() : ModelCommand("stop", kBarrierControlClusterId, 0x01) { ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -537,6 +538,7 @@ class ReadBarrierControlMovingState : public ModelCommand ReadBarrierControlMovingState() : ModelCommand("read", kBarrierControlClusterId, 0x00) { AddArgument("attr-name", "moving-state"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -561,6 +563,7 @@ class ReadBarrierControlSafetyStatus : public ModelCommand ReadBarrierControlSafetyStatus() : ModelCommand("read", kBarrierControlClusterId, 0x00) { AddArgument("attr-name", "safety-status"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -585,6 +588,7 @@ class ReadBarrierControlCapabilities : public ModelCommand ReadBarrierControlCapabilities() : ModelCommand("read", kBarrierControlClusterId, 0x00) { AddArgument("attr-name", "capabilities"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -609,6 +613,7 @@ class ReadBarrierControlBarrierPosition : public ModelCommand ReadBarrierControlBarrierPosition() : ModelCommand("read", kBarrierControlClusterId, 0x00) { AddArgument("attr-name", "barrier-position"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -644,7 +649,10 @@ class ReadBarrierControlBarrierPosition : public ModelCommand class BasicResetToFactoryDefaults : public ModelCommand { public: - BasicResetToFactoryDefaults() : ModelCommand("reset-to-factory-defaults", kBasicClusterId, 0x00) {} + BasicResetToFactoryDefaults() : ModelCommand("reset-to-factory-defaults", kBasicClusterId, 0x00) + { + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -665,7 +673,11 @@ class BasicResetToFactoryDefaults : public ModelCommand class ReadBasicZCLVersion : public ModelCommand { public: - ReadBasicZCLVersion() : ModelCommand("read", kBasicClusterId, 0x00) { AddArgument("attr-name", "zclversion"); } + ReadBasicZCLVersion() : ModelCommand("read", kBasicClusterId, 0x00) + { + AddArgument("attr-name", "zclversion"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -686,7 +698,11 @@ class ReadBasicZCLVersion : public ModelCommand class ReadBasicPowerSource : public ModelCommand { public: - ReadBasicPowerSource() : ModelCommand("read", kBasicClusterId, 0x00) { AddArgument("attr-name", "power-source"); } + ReadBasicPowerSource() : ModelCommand("read", kBasicClusterId, 0x00) + { + AddArgument("attr-name", "power-source"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -777,6 +793,7 @@ class ColorControlMoveColor : public ModelCommand AddArgument("rateY", INT16_MIN, INT16_MAX, &mRateY); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -813,6 +830,7 @@ class ColorControlMoveColorTemperature : public ModelCommand AddArgument("colorTemperatureMaximumMireds", 0, UINT16_MAX, &mColorTemperatureMaximumMireds); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -850,6 +868,7 @@ class ColorControlMoveHue : public ModelCommand AddArgument("rate", 0, UINT8_MAX, &mRate); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -884,6 +903,7 @@ class ColorControlMoveSaturation : public ModelCommand AddArgument("rate", 0, UINT8_MAX, &mRate); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -919,6 +939,7 @@ class ColorControlMoveToColor : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -954,6 +975,7 @@ class ColorControlMoveToColorTemperature : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -989,6 +1011,7 @@ class ColorControlMoveToHue : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1025,6 +1048,7 @@ class ColorControlMoveToHueAndSaturation : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1060,6 +1084,7 @@ class ColorControlMoveToSaturation : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1095,6 +1120,7 @@ class ColorControlStepColor : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1133,6 +1159,7 @@ class ColorControlStepColorTemperature : public ModelCommand AddArgument("colorTemperatureMaximumMireds", 0, UINT16_MAX, &mColorTemperatureMaximumMireds); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1172,6 +1199,7 @@ class ColorControlStepHue : public ModelCommand AddArgument("transitionTime", 0, UINT8_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1208,6 +1236,7 @@ class ColorControlStepSaturation : public ModelCommand AddArgument("transitionTime", 0, UINT8_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1241,6 +1270,7 @@ class ColorControlStopMoveStep : public ModelCommand { AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1267,7 +1297,11 @@ class ColorControlStopMoveStep : public ModelCommand class ReadColorControlCurrentHue : public ModelCommand { public: - ReadColorControlCurrentHue() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "current-hue"); } + ReadColorControlCurrentHue() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "current-hue"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1291,6 +1325,7 @@ class ReadColorControlCurrentSaturation : public ModelCommand ReadColorControlCurrentSaturation() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "current-saturation"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1315,6 +1350,7 @@ class ReadColorControlRemainingTime : public ModelCommand ReadColorControlRemainingTime() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "remaining-time"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1336,7 +1372,11 @@ class ReadColorControlRemainingTime : public ModelCommand class ReadColorControlCurrentX : public ModelCommand { public: - ReadColorControlCurrentX() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "current-x"); } + ReadColorControlCurrentX() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "current-x"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1357,7 +1397,11 @@ class ReadColorControlCurrentX : public ModelCommand class ReadColorControlCurrentY : public ModelCommand { public: - ReadColorControlCurrentY() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "current-y"); } + ReadColorControlCurrentY() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "current-y"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1381,6 +1425,7 @@ class ReadColorControlColorTemperatureMireds : public ModelCommand ReadColorControlColorTemperatureMireds() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-temperature-mireds"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1402,7 +1447,11 @@ class ReadColorControlColorTemperatureMireds : public ModelCommand class ReadColorControlColorMode : public ModelCommand { public: - ReadColorControlColorMode() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-mode"); } + ReadColorControlColorMode() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "color-mode"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1423,7 +1472,11 @@ class ReadColorControlColorMode : public ModelCommand class ReadColorControlOptions : public ModelCommand { public: - ReadColorControlOptions() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "options"); } + ReadColorControlOptions() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "options"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1447,6 +1500,7 @@ class ReadColorControlNumberOfPrimaries : public ModelCommand ReadColorControlNumberOfPrimaries() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "number-of-primaries"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1468,7 +1522,11 @@ class ReadColorControlNumberOfPrimaries : public ModelCommand class ReadColorControlPrimary1X : public ModelCommand { public: - ReadColorControlPrimary1X() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary1-x"); } + ReadColorControlPrimary1X() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary1-x"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1489,7 +1547,11 @@ class ReadColorControlPrimary1X : public ModelCommand class ReadColorControlPrimary1Y : public ModelCommand { public: - ReadColorControlPrimary1Y() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary1-y"); } + ReadColorControlPrimary1Y() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary1-y"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1513,6 +1575,7 @@ class ReadColorControlPrimary1Intensity : public ModelCommand ReadColorControlPrimary1Intensity() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary1-intensity"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1534,7 +1597,11 @@ class ReadColorControlPrimary1Intensity : public ModelCommand class ReadColorControlPrimary2X : public ModelCommand { public: - ReadColorControlPrimary2X() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary2-x"); } + ReadColorControlPrimary2X() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary2-x"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1555,7 +1622,11 @@ class ReadColorControlPrimary2X : public ModelCommand class ReadColorControlPrimary2Y : public ModelCommand { public: - ReadColorControlPrimary2Y() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary2-y"); } + ReadColorControlPrimary2Y() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary2-y"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1579,6 +1650,7 @@ class ReadColorControlPrimary2Intensity : public ModelCommand ReadColorControlPrimary2Intensity() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary2-intensity"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1600,7 +1672,11 @@ class ReadColorControlPrimary2Intensity : public ModelCommand class ReadColorControlPrimary3X : public ModelCommand { public: - ReadColorControlPrimary3X() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary3-x"); } + ReadColorControlPrimary3X() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary3-x"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1621,7 +1697,11 @@ class ReadColorControlPrimary3X : public ModelCommand class ReadColorControlPrimary3Y : public ModelCommand { public: - ReadColorControlPrimary3Y() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary3-y"); } + ReadColorControlPrimary3Y() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary3-y"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1645,6 +1725,7 @@ class ReadColorControlPrimary3Intensity : public ModelCommand ReadColorControlPrimary3Intensity() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary3-intensity"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1666,7 +1747,11 @@ class ReadColorControlPrimary3Intensity : public ModelCommand class ReadColorControlPrimary4X : public ModelCommand { public: - ReadColorControlPrimary4X() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary4-x"); } + ReadColorControlPrimary4X() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary4-x"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1687,7 +1772,11 @@ class ReadColorControlPrimary4X : public ModelCommand class ReadColorControlPrimary4Y : public ModelCommand { public: - ReadColorControlPrimary4Y() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary4-y"); } + ReadColorControlPrimary4Y() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary4-y"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1711,6 +1800,7 @@ class ReadColorControlPrimary4Intensity : public ModelCommand ReadColorControlPrimary4Intensity() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary4-intensity"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1732,7 +1822,11 @@ class ReadColorControlPrimary4Intensity : public ModelCommand class ReadColorControlPrimary5X : public ModelCommand { public: - ReadColorControlPrimary5X() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary5-x"); } + ReadColorControlPrimary5X() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary5-x"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1753,7 +1847,11 @@ class ReadColorControlPrimary5X : public ModelCommand class ReadColorControlPrimary5Y : public ModelCommand { public: - ReadColorControlPrimary5Y() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary5-y"); } + ReadColorControlPrimary5Y() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary5-y"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1777,6 +1875,7 @@ class ReadColorControlPrimary5Intensity : public ModelCommand ReadColorControlPrimary5Intensity() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary5-intensity"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1798,7 +1897,11 @@ class ReadColorControlPrimary5Intensity : public ModelCommand class ReadColorControlPrimary6X : public ModelCommand { public: - ReadColorControlPrimary6X() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary6-x"); } + ReadColorControlPrimary6X() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary6-x"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1819,7 +1922,11 @@ class ReadColorControlPrimary6X : public ModelCommand class ReadColorControlPrimary6Y : public ModelCommand { public: - ReadColorControlPrimary6Y() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary6-y"); } + ReadColorControlPrimary6Y() : ModelCommand("read", kColorControlClusterId, 0x00) + { + AddArgument("attr-name", "primary6-y"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -1843,6 +1950,7 @@ class ReadColorControlPrimary6Intensity : public ModelCommand ReadColorControlPrimary6Intensity() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "primary6-intensity"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1867,6 +1975,7 @@ class ReadColorControlEnhancedCurrentHue : public ModelCommand ReadColorControlEnhancedCurrentHue() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "enhanced-current-hue"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1891,6 +2000,7 @@ class ReadColorControlEnhancedColorMode : public ModelCommand ReadColorControlEnhancedColorMode() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "enhanced-color-mode"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1915,6 +2025,7 @@ class ReadColorControlColorLoopActive : public ModelCommand ReadColorControlColorLoopActive() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-loop-active"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1939,6 +2050,7 @@ class ReadColorControlColorLoopDirection : public ModelCommand ReadColorControlColorLoopDirection() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-loop-direction"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1963,6 +2075,7 @@ class ReadColorControlColorLoopTime : public ModelCommand ReadColorControlColorLoopTime() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-loop-time"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -1987,6 +2100,7 @@ class ReadColorControlColorLoopStartEnhancedHue : public ModelCommand ReadColorControlColorLoopStartEnhancedHue() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-loop-start-enhanced-hue"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2011,6 +2125,7 @@ class ReadColorControlColorLoopStoredEnhancedHue : public ModelCommand ReadColorControlColorLoopStoredEnhancedHue() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-loop-stored-enhanced-hue"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2035,6 +2150,7 @@ class ReadColorControlColorCapabilities : public ModelCommand ReadColorControlColorCapabilities() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-capabilities"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2059,6 +2175,7 @@ class ReadColorControlColorTempPhysicalMinMireds : public ModelCommand ReadColorControlColorTempPhysicalMinMireds() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-temp-physical-min-mireds"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2083,6 +2200,7 @@ class ReadColorControlColorTempPhysicalMaxMireds : public ModelCommand ReadColorControlColorTempPhysicalMaxMireds() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "color-temp-physical-max-mireds"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2107,6 +2225,7 @@ class ReadColorControlCoupleColorTempToLevelMinMireds : public ModelCommand ReadColorControlCoupleColorTempToLevelMinMireds() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "couple-color-temp-to-level-min-mireds"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2131,6 +2250,7 @@ class ReadColorControlStartUpColorTemperatureMireds : public ModelCommand ReadColorControlStartUpColorTemperatureMireds() : ModelCommand("read", kColorControlClusterId, 0x00) { AddArgument("attr-name", "start-up-color-temperature-mireds"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2705,7 +2825,7 @@ class UnlockWithTimeoutResponse : public ModelCommandResponse class DoorLockClearAllPINCodes : public ModelCommand { public: - DoorLockClearAllPINCodes() : ModelCommand("clear-all-pincodes", kDoorLockClusterId, 0x08) {} + DoorLockClearAllPINCodes() : ModelCommand("clear-all-pincodes", kDoorLockClusterId, 0x08) { ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -2733,7 +2853,7 @@ class DoorLockClearAllPINCodes : public ModelCommand class DoorLockClearAllRFIDCodes : public ModelCommand { public: - DoorLockClearAllRFIDCodes() : ModelCommand("clear-all-rfidcodes", kDoorLockClusterId, 0x19) {} + DoorLockClearAllRFIDCodes() : ModelCommand("clear-all-rfidcodes", kDoorLockClusterId, 0x19) { ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -2764,6 +2884,7 @@ class DoorLockClearHolidaySchedule : public ModelCommand DoorLockClearHolidaySchedule() : ModelCommand("clear-holiday-schedule", kDoorLockClusterId, 0x13) { AddArgument("holidayScheduleID", 0, UINT8_MAX, &mHolidayScheduleID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2798,6 +2919,7 @@ class DoorLockClearPINCode : public ModelCommand DoorLockClearPINCode() : ModelCommand("clear-pincode", kDoorLockClusterId, 0x07) { AddArgument("userID", 0, UINT16_MAX, &mUserID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2832,6 +2954,7 @@ class DoorLockClearRFIDCode : public ModelCommand DoorLockClearRFIDCode() : ModelCommand("clear-rfidcode", kDoorLockClusterId, 0x18) { AddArgument("userID", 0, UINT16_MAX, &mUserID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2867,6 +2990,7 @@ class DoorLockClearWeekdaySchedule : public ModelCommand { AddArgument("scheduleID", 0, UINT8_MAX, &mScheduleID); AddArgument("userID", 0, UINT16_MAX, &mUserID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2903,6 +3027,7 @@ class DoorLockClearYearDaySchedule : public ModelCommand { AddArgument("scheduleID", 0, UINT8_MAX, &mScheduleID); AddArgument("userID", 0, UINT16_MAX, &mUserID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2938,6 +3063,7 @@ class DoorLockGetHolidaySchedule : public ModelCommand DoorLockGetHolidaySchedule() : ModelCommand("get-holiday-schedule", kDoorLockClusterId, 0x12) { AddArgument("holidayScheduleID", 0, UINT8_MAX, &mHolidayScheduleID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -2972,6 +3098,7 @@ class DoorLockGetLogRecord : public ModelCommand DoorLockGetLogRecord() : ModelCommand("get-log-record", kDoorLockClusterId, 0x04) { AddArgument("logIndex", 0, UINT16_MAX, &mLogIndex); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3003,7 +3130,11 @@ class DoorLockGetLogRecord : public ModelCommand class DoorLockGetPINCode : public ModelCommand { public: - DoorLockGetPINCode() : ModelCommand("get-pincode", kDoorLockClusterId, 0x06) { AddArgument("userID", 0, UINT16_MAX, &mUserID); } + DoorLockGetPINCode() : ModelCommand("get-pincode", kDoorLockClusterId, 0x06) + { + AddArgument("userID", 0, UINT16_MAX, &mUserID); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3037,6 +3168,7 @@ class DoorLockGetRFIDCode : public ModelCommand DoorLockGetRFIDCode() : ModelCommand("get-rfidcode", kDoorLockClusterId, 0x17) { AddArgument("userID", 0, UINT16_MAX, &mUserID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3071,6 +3203,7 @@ class DoorLockGetUserType : public ModelCommand DoorLockGetUserType() : ModelCommand("get-user-type", kDoorLockClusterId, 0x15) { AddArgument("userID", 0, UINT16_MAX, &mUserID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3106,6 +3239,7 @@ class DoorLockGetWeekdaySchedule : public ModelCommand { AddArgument("scheduleID", 0, UINT8_MAX, &mScheduleID); AddArgument("userID", 0, UINT16_MAX, &mUserID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3142,6 +3276,7 @@ class DoorLockGetYearDaySchedule : public ModelCommand { AddArgument("scheduleID", 0, UINT8_MAX, &mScheduleID); AddArgument("userID", 0, UINT16_MAX, &mUserID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3174,7 +3309,11 @@ class DoorLockGetYearDaySchedule : public ModelCommand class DoorLockLockDoor : public ModelCommand { public: - DoorLockLockDoor() : ModelCommand("lock-door", kDoorLockClusterId, 0x00) { AddArgument("pINOrRFIDCode", &mPINOrRFIDCode); } + DoorLockLockDoor() : ModelCommand("lock-door", kDoorLockClusterId, 0x00) + { + AddArgument("pINOrRFIDCode", &mPINOrRFIDCode); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3211,6 +3350,7 @@ class DoorLockSetHolidaySchedule : public ModelCommand AddArgument("localStartTime", 0, UINT32_MAX, &mLocalStartTime); AddArgument("localEndTime", 0, UINT32_MAX, &mLocalEndTime); AddArgument("operatingModeDuringHoliday", 0, UINT8_MAX, &mOperatingModeDuringHoliday); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3252,6 +3392,7 @@ class DoorLockSetPINCode : public ModelCommand AddArgument("userStatus", 0, UINT8_MAX, &mUserStatus); AddArgument("userType", 0, UINT8_MAX, &mUserType); AddArgument("pIN", &mPIN); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3293,6 +3434,7 @@ class DoorLockSetRFIDCode : public ModelCommand AddArgument("userStatus", 0, UINT8_MAX, &mUserStatus); AddArgument("userType", 0, UINT8_MAX, &mUserType); AddArgument("rFIDCode", &mRFIDCode); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3332,6 +3474,7 @@ class DoorLockSetUserType : public ModelCommand { AddArgument("userID", 0, UINT16_MAX, &mUserID); AddArgument("userType", 0, UINT8_MAX, &mUserType); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3373,6 +3516,7 @@ class DoorLockSetWeekdaySchedule : public ModelCommand AddArgument("startMinute", 0, UINT8_MAX, &mStartMinute); AddArgument("endHour", 0, UINT8_MAX, &mEndHour); AddArgument("endMinute", 0, UINT8_MAX, &mEndMinute); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3417,6 +3561,7 @@ class DoorLockSetYearDaySchedule : public ModelCommand AddArgument("userID", 0, UINT16_MAX, &mUserID); AddArgument("localStartTime", 0, UINT32_MAX, &mLocalStartTime); AddArgument("localEndTime", 0, UINT32_MAX, &mLocalEndTime); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3452,7 +3597,11 @@ class DoorLockSetYearDaySchedule : public ModelCommand class DoorLockUnlockDoor : public ModelCommand { public: - DoorLockUnlockDoor() : ModelCommand("unlock-door", kDoorLockClusterId, 0x01) { AddArgument("pINOrRFIDCode", &mPINOrRFIDCode); } + DoorLockUnlockDoor() : ModelCommand("unlock-door", kDoorLockClusterId, 0x01) + { + AddArgument("pINOrRFIDCode", &mPINOrRFIDCode); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3487,6 +3636,7 @@ class DoorLockUnlockWithTimeout : public ModelCommand { AddArgument("timeoutInSeconds", 0, UINT16_MAX, &mTimeoutInSeconds); AddArgument("pINOrRFIDCode", &mPINOrRFIDCode); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3520,7 +3670,11 @@ class DoorLockUnlockWithTimeout : public ModelCommand class ReadDoorLockLockState : public ModelCommand { public: - ReadDoorLockLockState() : ModelCommand("read", kDoorLockClusterId, 0x00) { AddArgument("attr-name", "lock-state"); } + ReadDoorLockLockState() : ModelCommand("read", kDoorLockClusterId, 0x00) + { + AddArgument("attr-name", "lock-state"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3541,7 +3695,11 @@ class ReadDoorLockLockState : public ModelCommand class ReadDoorLockLockType : public ModelCommand { public: - ReadDoorLockLockType() : ModelCommand("read", kDoorLockClusterId, 0x00) { AddArgument("attr-name", "lock-type"); } + ReadDoorLockLockType() : ModelCommand("read", kDoorLockClusterId, 0x00) + { + AddArgument("attr-name", "lock-type"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3562,7 +3720,11 @@ class ReadDoorLockLockType : public ModelCommand class ReadDoorLockActuatorEnabled : public ModelCommand { public: - ReadDoorLockActuatorEnabled() : ModelCommand("read", kDoorLockClusterId, 0x00) { AddArgument("attr-name", "actuator-enabled"); } + ReadDoorLockActuatorEnabled() : ModelCommand("read", kDoorLockClusterId, 0x00) + { + AddArgument("attr-name", "actuator-enabled"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3703,6 +3865,7 @@ class GroupsAddGroup : public ModelCommand { AddArgument("groupId", 0, UINT16_MAX, &mGroupId); AddArgument("groupName", &mGroupName); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3739,6 +3902,7 @@ class GroupsAddGroupIfIdentifying : public ModelCommand { AddArgument("groupId", 0, UINT16_MAX, &mGroupId); AddArgument("groupName", &mGroupName); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3769,6 +3933,7 @@ class GroupsGetGroupMembership : public ModelCommand // groupList is an array, but since chip-tool does not support variable // number of arguments, only a single instance is supported. AddArgument("groupList", 0, UINT16_MAX, &mGroupList); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3800,7 +3965,7 @@ class GroupsGetGroupMembership : public ModelCommand class GroupsRemoveAllGroups : public ModelCommand { public: - GroupsRemoveAllGroups() : ModelCommand("remove-all-groups", kGroupsClusterId, 0x04) {} + GroupsRemoveAllGroups() : ModelCommand("remove-all-groups", kGroupsClusterId, 0x04) { ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3821,7 +3986,11 @@ class GroupsRemoveAllGroups : public ModelCommand class GroupsRemoveGroup : public ModelCommand { public: - GroupsRemoveGroup() : ModelCommand("remove-group", kGroupsClusterId, 0x03) { AddArgument("groupId", 0, UINT16_MAX, &mGroupId); } + GroupsRemoveGroup() : ModelCommand("remove-group", kGroupsClusterId, 0x03) + { + AddArgument("groupId", 0, UINT16_MAX, &mGroupId); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3852,7 +4021,11 @@ class GroupsRemoveGroup : public ModelCommand class GroupsViewGroup : public ModelCommand { public: - GroupsViewGroup() : ModelCommand("view-group", kGroupsClusterId, 0x01) { AddArgument("groupId", 0, UINT16_MAX, &mGroupId); } + GroupsViewGroup() : ModelCommand("view-group", kGroupsClusterId, 0x01) + { + AddArgument("groupId", 0, UINT16_MAX, &mGroupId); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3883,7 +4056,11 @@ class GroupsViewGroup : public ModelCommand class ReadGroupsNameSupport : public ModelCommand { public: - ReadGroupsNameSupport() : ModelCommand("read", kGroupsClusterId, 0x00) { AddArgument("attr-name", "name-support"); } + ReadGroupsNameSupport() : ModelCommand("read", kGroupsClusterId, 0x00) + { + AddArgument("attr-name", "name-support"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3940,6 +4117,7 @@ class IdentifyIdentify : public ModelCommand IdentifyIdentify() : ModelCommand("identify", kIdentifyClusterId, 0x00) { AddArgument("identifyTime", 0, UINT16_MAX, &mIdentifyTime); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -3964,7 +4142,7 @@ class IdentifyIdentify : public ModelCommand class IdentifyIdentifyQuery : public ModelCommand { public: - IdentifyIdentifyQuery() : ModelCommand("identify-query", kIdentifyClusterId, 0x01) {} + IdentifyIdentifyQuery() : ModelCommand("identify-query", kIdentifyClusterId, 0x01) { ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -3992,7 +4170,11 @@ class IdentifyIdentifyQuery : public ModelCommand class ReadIdentifyIdentifyTime : public ModelCommand { public: - ReadIdentifyIdentifyTime() : ModelCommand("read", kIdentifyClusterId, 0x00) { AddArgument("attr-name", "identify-time"); } + ReadIdentifyIdentifyTime() : ModelCommand("read", kIdentifyClusterId, 0x00) + { + AddArgument("attr-name", "identify-time"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -4039,6 +4221,7 @@ class LevelMove : public ModelCommand AddArgument("rate", 0, UINT8_MAX, &mRate); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4073,6 +4256,7 @@ class LevelMoveToLevel : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4107,6 +4291,7 @@ class LevelMoveToLevelWithOnOff : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4141,6 +4326,7 @@ class LevelMoveWithOnOff : public ModelCommand AddArgument("rate", 0, UINT8_MAX, &mRate); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4176,6 +4362,7 @@ class LevelStep : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4212,6 +4399,7 @@ class LevelStepWithOnOff : public ModelCommand AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4245,6 +4433,7 @@ class LevelStop : public ModelCommand { AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4274,6 +4463,7 @@ class LevelStopWithOnOff : public ModelCommand { AddArgument("optionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4299,7 +4489,11 @@ class LevelStopWithOnOff : public ModelCommand class ReadLevelCurrentLevel : public ModelCommand { public: - ReadLevelCurrentLevel() : ModelCommand("read", kLevelClusterId, 0x00) { AddArgument("attr-name", "current-level"); } + ReadLevelCurrentLevel() : ModelCommand("read", kLevelClusterId, 0x00) + { + AddArgument("attr-name", "current-level"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -4335,7 +4529,7 @@ class ReadLevelCurrentLevel : public ModelCommand class OnOffOff : public ModelCommand { public: - OnOffOff() : ModelCommand("off", kOnOffClusterId, 0x00) {} + OnOffOff() : ModelCommand("off", kOnOffClusterId, 0x00) { ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -4356,7 +4550,7 @@ class OnOffOff : public ModelCommand class OnOffOn : public ModelCommand { public: - OnOffOn() : ModelCommand("on", kOnOffClusterId, 0x01) {} + OnOffOn() : ModelCommand("on", kOnOffClusterId, 0x01) { ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -4377,7 +4571,7 @@ class OnOffOn : public ModelCommand class OnOffToggle : public ModelCommand { public: - OnOffToggle() : ModelCommand("toggle", kOnOffClusterId, 0x02) {} + OnOffToggle() : ModelCommand("toggle", kOnOffClusterId, 0x02) { ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -4398,7 +4592,11 @@ class OnOffToggle : public ModelCommand class ReadOnOffOnOff : public ModelCommand { public: - ReadOnOffOnOff() : ModelCommand("read", kOnOffClusterId, 0x00) { AddArgument("attr-name", "on-off"); } + ReadOnOffOnOff() : ModelCommand("read", kOnOffClusterId, 0x00) + { + AddArgument("attr-name", "on-off"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -4721,6 +4919,7 @@ class ScenesAddScene : public ModelCommand // number of arguments, only a single instance is supported. AddArgument("clusterId", 0, UINT16_MAX, &mClusterId); AddArgument("extensionFieldSet", &mExtensionFieldSet); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4765,6 +4964,7 @@ class ScenesCopyScene : public ModelCommand AddArgument("sceneIdentifierFrom", 0, UINT8_MAX, &mSceneIdentifierFrom); AddArgument("groupIdentifierTo", 0, UINT16_MAX, &mGroupIdentifierTo); AddArgument("sceneIdentifierTo", 0, UINT8_MAX, &mSceneIdentifierTo); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4811,6 +5011,7 @@ class ScenesEnhancedAddScene : public ModelCommand // number of arguments, only a single instance is supported. AddArgument("clusterId", 0, UINT16_MAX, &mClusterId); AddArgument("extensionFieldSet", &mExtensionFieldSet); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4852,6 +5053,7 @@ class ScenesEnhancedViewScene : public ModelCommand { AddArgument("groupID", 0, UINT16_MAX, &mGroupID); AddArgument("sceneID", 0, UINT8_MAX, &mSceneID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4887,6 +5089,7 @@ class ScenesGetSceneMembership : public ModelCommand ScenesGetSceneMembership() : ModelCommand("get-scene-membership", kScenesClusterId, 0x06) { AddArgument("groupID", 0, UINT16_MAX, &mGroupID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4923,6 +5126,7 @@ class ScenesRecallScene : public ModelCommand AddArgument("groupID", 0, UINT16_MAX, &mGroupID); AddArgument("sceneID", 0, UINT8_MAX, &mSceneID); AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4952,6 +5156,7 @@ class ScenesRemoveAllScenes : public ModelCommand ScenesRemoveAllScenes() : ModelCommand("remove-all-scenes", kScenesClusterId, 0x03) { AddArgument("groupID", 0, UINT16_MAX, &mGroupID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -4987,6 +5192,7 @@ class ScenesRemoveScene : public ModelCommand { AddArgument("groupID", 0, UINT16_MAX, &mGroupID); AddArgument("sceneID", 0, UINT8_MAX, &mSceneID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -5023,6 +5229,7 @@ class ScenesStoreScene : public ModelCommand { AddArgument("groupID", 0, UINT16_MAX, &mGroupID); AddArgument("sceneID", 0, UINT8_MAX, &mSceneID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -5059,6 +5266,7 @@ class ScenesViewScene : public ModelCommand { AddArgument("groupID", 0, UINT16_MAX, &mGroupID); AddArgument("sceneID", 0, UINT8_MAX, &mSceneID); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -5091,7 +5299,11 @@ class ScenesViewScene : public ModelCommand class ReadScenesSceneCount : public ModelCommand { public: - ReadScenesSceneCount() : ModelCommand("read", kScenesClusterId, 0x00) { AddArgument("attr-name", "scene-count"); } + ReadScenesSceneCount() : ModelCommand("read", kScenesClusterId, 0x00) + { + AddArgument("attr-name", "scene-count"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -5112,7 +5324,11 @@ class ReadScenesSceneCount : public ModelCommand class ReadScenesCurrentScene : public ModelCommand { public: - ReadScenesCurrentScene() : ModelCommand("read", kScenesClusterId, 0x00) { AddArgument("attr-name", "current-scene"); } + ReadScenesCurrentScene() : ModelCommand("read", kScenesClusterId, 0x00) + { + AddArgument("attr-name", "current-scene"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -5133,7 +5349,11 @@ class ReadScenesCurrentScene : public ModelCommand class ReadScenesCurrentGroup : public ModelCommand { public: - ReadScenesCurrentGroup() : ModelCommand("read", kScenesClusterId, 0x00) { AddArgument("attr-name", "current-group"); } + ReadScenesCurrentGroup() : ModelCommand("read", kScenesClusterId, 0x00) + { + AddArgument("attr-name", "current-group"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -5154,7 +5374,11 @@ class ReadScenesCurrentGroup : public ModelCommand class ReadScenesSceneValid : public ModelCommand { public: - ReadScenesSceneValid() : ModelCommand("read", kScenesClusterId, 0x00) { AddArgument("attr-name", "scene-valid"); } + ReadScenesSceneValid() : ModelCommand("read", kScenesClusterId, 0x00) + { + AddArgument("attr-name", "scene-valid"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -5175,7 +5399,11 @@ class ReadScenesSceneValid : public ModelCommand class ReadScenesNameSupport : public ModelCommand { public: - ReadScenesNameSupport() : ModelCommand("read", kScenesClusterId, 0x00) { AddArgument("attr-name", "name-support"); } + ReadScenesNameSupport() : ModelCommand("read", kScenesClusterId, 0x00) + { + AddArgument("attr-name", "name-support"); + ModelCommand::AddArguments(); + } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override { @@ -5213,6 +5441,7 @@ class ReadTemperatureMeasurementMeasuredValue : public ModelCommand ReadTemperatureMeasurementMeasuredValue() : ModelCommand("read", kTempMeasurementClusterId, 0x00) { AddArgument("attr-name", "measured-value"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -5237,6 +5466,7 @@ class ReadTemperatureMeasurementMinMeasuredValue : public ModelCommand ReadTemperatureMeasurementMinMeasuredValue() : ModelCommand("read", kTempMeasurementClusterId, 0x00) { AddArgument("attr-name", "min-measured-value"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override @@ -5261,6 +5491,7 @@ class ReadTemperatureMeasurementMaxMeasuredValue : public ModelCommand ReadTemperatureMeasurementMaxMeasuredValue() : ModelCommand("read", kTempMeasurementClusterId, 0x00) { AddArgument("attr-name", "max-measured-value"); + ModelCommand::AddArguments(); } uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index 97aad235df9afb..ca6a4f4d7c0414 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -179,7 +179,7 @@ size_t Command::AddArgument(const char * name, const char * value) arg.name = name; arg.value = const_cast(reinterpret_cast(value)); - mArgs.emplace(mArgs.begin(), arg); + mArgs.emplace_back(arg); return mArgs.size(); } @@ -190,7 +190,7 @@ size_t Command::AddArgument(const char * name, char ** value) arg.name = name; arg.value = reinterpret_cast(value); - mArgs.emplace(mArgs.begin(), arg); + mArgs.emplace_back(arg); return mArgs.size(); } @@ -201,7 +201,7 @@ size_t Command::AddArgument(const char * name, AddressWithInterface * out) arg.name = name; arg.value = reinterpret_cast(out); - mArgs.emplace(mArgs.begin(), arg); + mArgs.emplace_back(arg); return mArgs.size(); } @@ -214,7 +214,7 @@ size_t Command::AddArgument(const char * name, int64_t min, int64_t max, void * arg.min = min; arg.max = max; - mArgs.emplace(mArgs.begin(), arg); + mArgs.emplace_back(arg); return mArgs.size(); } @@ -227,7 +227,7 @@ size_t Command::AddArgument(const char * name, int64_t min, int64_t max, void * arg.min = min; arg.max = max; - mArgs.emplace(mArgs.begin(), arg); + mArgs.emplace_back(arg); return mArgs.size(); } diff --git a/examples/chip-tool/commands/common/ModelCommand.h b/examples/chip-tool/commands/common/ModelCommand.h index 914d766c6952b0..0907f719b9bf62 100644 --- a/examples/chip-tool/commands/common/ModelCommand.h +++ b/examples/chip-tool/commands/common/ModelCommand.h @@ -36,7 +36,11 @@ class ModelCommand : public NetworkCommand public: ModelCommand(const char * commandName, uint16_t clusterId, uint8_t commandId) : NetworkCommand(commandName, NetworkType::UDP), mClusterId(clusterId), mCommandId(commandId) + {} + + void AddArguments() { + NetworkCommand::AddArguments(); AddArgument("endpoint-id", CHIP_ZCL_ENDPOINT_MIN, CHIP_ZCL_ENDPOINT_MAX, &mEndPointId); } diff --git a/examples/chip-tool/commands/common/NetworkCommand.h b/examples/chip-tool/commands/common/NetworkCommand.h index dcc9fc0caa06d8..5ba729c709e46a 100644 --- a/examples/chip-tool/commands/common/NetworkCommand.h +++ b/examples/chip-tool/commands/common/NetworkCommand.h @@ -30,15 +30,17 @@ enum NetworkType class NetworkCommand : public Command { public: - NetworkCommand(const char * commandName, NetworkType type) : Command(commandName), mNetworkType(type) + NetworkCommand(const char * commandName, NetworkType type) : Command(commandName), mNetworkType(type) {} + + void AddArguments() { - if (type == NetworkType::UDP || type == NetworkType::ALL) + if (mNetworkType == NetworkType::UDP || mNetworkType == NetworkType::ALL) { - AddArgument("device-remote-port", 0, UINT16_MAX, &mRemotePort); AddArgument("device-remote-ip", &mRemoteAddr); + AddArgument("device-remote-port", 0, UINT16_MAX, &mRemotePort); } - if (type == NetworkType::BLE || type == NetworkType::ALL) + if (mNetworkType == NetworkType::BLE || mNetworkType == NetworkType::ALL) { AddArgument("setup-pin-code", 0, 134217727, &mSetupPINCode); AddArgument("discriminator", 0, 4096, &mDiscriminator); diff --git a/examples/chip-tool/commands/echo/Commands.h b/examples/chip-tool/commands/echo/Commands.h index 20d65f8961cbfb..94490fe6e68286 100644 --- a/examples/chip-tool/commands/echo/Commands.h +++ b/examples/chip-tool/commands/echo/Commands.h @@ -23,13 +23,13 @@ class Echo : public EchoCommand { public: - Echo() : EchoCommand("ip", NetworkType::UDP) {} + Echo() : EchoCommand("ip", NetworkType::UDP) { NetworkCommand::AddArguments(); } }; class EchoBle : public EchoCommand { public: - EchoBle() : EchoCommand("ble", NetworkType::BLE) {} + EchoBle() : EchoCommand("ble", NetworkType::BLE) { NetworkCommand::AddArguments(); } }; void registerCommandsEcho(Commands & commands) diff --git a/src/test_driver/linux-cirque/test-on-off-cluster.py b/src/test_driver/linux-cirque/test-on-off-cluster.py index 663cd837360019..60be4ac7f63d92 100644 --- a/src/test_driver/linux-cirque/test-on-off-cluster.py +++ b/src/test_driver/linux-cirque/test-on-off-cluster.py @@ -79,7 +79,7 @@ def run_data_model_test(self): for ip in server_ip_address: output = self.execute_device_cmd( - tool_device_id, "chip-tool onoff on 1 {} {}".format(ip, CHIP_PORT)) + tool_device_id, "chip-tool onoff on {} {} 1".format(ip, CHIP_PORT)) self.logger.info( 'checking output does not contain "No response from device"') self.assertFalse(self.sequenceMatch( @@ -87,7 +87,7 @@ def run_data_model_test(self): time.sleep(1) for ip in server_ip_address: output = self.execute_device_cmd( - tool_device_id, "chip-tool onoff off 1 {} {}".format(ip, CHIP_PORT)) + tool_device_id, "chip-tool onoff off {} {} 1".format(ip, CHIP_PORT)) self.logger.info( 'checking output does not contain "No response from device"') self.assertFalse(self.sequenceMatch(