Skip to content

Commit

Permalink
Merge branch 'master' into ci
Browse files Browse the repository at this point in the history
  • Loading branch information
abiradarti authored Feb 6, 2023
2 parents ed1c812 + 5eb5d91 commit 43550ba
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 105 deletions.
30 changes: 24 additions & 6 deletions examples/chip-tool/commands/common/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,27 @@ constexpr const char * kJsonCommandKey = "command";
constexpr const char * kJsonCommandSpecifierKey = "command_specifier";
constexpr const char * kJsonArgumentsKey = "arguments";

std::vector<std::string> GetArgumentsFromJson(Command * command, Json::Value & value, bool optional)
bool GetArgumentsFromJson(Command * command, Json::Value & value, bool optional, std::vector<std::string> & outArgs)
{
auto memberNames = value.getMemberNames();

std::vector<std::string> args;
for (size_t i = 0; i < command->GetArgumentsCount(); i++)
{
auto argName = command->GetArgumentName(i);
for (auto const & memberName : value.getMemberNames())
auto argName = command->GetArgumentName(i);
auto memberNamesIterator = memberNames.begin();
while (memberNamesIterator != memberNames.end())
{
auto memberName = *memberNamesIterator;
if (strcasecmp(argName, memberName.c_str()) != 0)
{
memberNamesIterator++;
continue;
}

if (command->GetArgumentIsOptional(i) != optional)
{
memberNamesIterator = memberNames.erase(memberNamesIterator);
continue;
}

Expand All @@ -66,10 +72,20 @@ std::vector<std::string> GetArgumentsFromJson(Command * command, Json::Value & v

auto argValue = value[memberName].asString();
args.push_back(std::move(argValue));
memberNamesIterator = memberNames.erase(memberNamesIterator);
break;
}
}
return args;

if (memberNames.size())
{
auto memberName = memberNames.front();
ChipLogError(chipTool, "The argument \"\%s\" is not supported.", memberName.c_str());
return false;
}

outArgs = args;
return true;
};

// Check for arguments with a starting '"' but no ending '"': those
Expand Down Expand Up @@ -542,8 +558,10 @@ bool Commands::DecodeArgumentsFromBase64EncodedJson(const char * json, std::vect
VerifyOrReturnValue(parsedArguments, false, ChipLogError(chipTool, "Error while parsing json."));
VerifyOrReturnValue(jsonArguments.isObject(), false, ChipLogError(chipTool, "Unexpected json type, expects and object."));

auto mandatoryArguments = GetArgumentsFromJson(command, jsonArguments, false /* addOptional */);
auto optionalArguments = GetArgumentsFromJson(command, jsonArguments, true /* addOptional */);
std::vector<std::string> mandatoryArguments;
std::vector<std::string> optionalArguments;
VerifyOrReturnValue(GetArgumentsFromJson(command, jsonArguments, false /* addOptional */, mandatoryArguments), false);
VerifyOrReturnValue(GetArgumentsFromJson(command, jsonArguments, true /* addOptional */, optionalArguments), false);

args.push_back(std::move(clusterName));
args.push_back(std::move(commandName));
Expand Down
1 change: 0 additions & 1 deletion src/app/common/templates/weak-enum-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
- SaturationMoveMode
- SaturationStepMode
- SecurityType
- StartUpOnOffValue
- StatusCode
- StepMode
- TemperatureDisplayMode
Expand Down
10 changes: 5 additions & 5 deletions src/app/tests/suites/certification/Test_TC_ACL_2_10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ tests:
- label:
"Step 10:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute"
PICS: ACL.S.A0000
command: "readAttribute"
command: "writeAttribute"
attribute: "ACL"
arguments:
value:
Expand All @@ -233,13 +233,13 @@ tests:
]

- label:
"Step 11:TH1 resds DUT Endpoint 0 AccessControl cluster Extension
"Step 11:TH1 reads DUT Endpoint 0 AccessControl cluster Extension
attribute, value is list of AccessControlExtensionStruct containing 1
element"
PICS: ACL.S.A0001
command: "readAttribute"
attribute: "Extension"
arguments:
response:
value: [{ Data: D_OK_EMPTY, FabricIndex: TH1FabricIndex }]

- label:
Expand Down Expand Up @@ -333,8 +333,8 @@ tests:
PICS: ACL.S.A0001
command: "readAttribute"
attribute: "Extension"
arguments:
value: [{ Data: D_OK_EMPTY, FabricIndex: CurrentFabricIndex }]
response:
value: [{ Data: D_OK_EMPTY, FabricIndex: TH1FabricIndex }]

- label:
"Step 18: If DUT is an app on host, examine persistent storage in
Expand Down
20 changes: 10 additions & 10 deletions src/app/tests/suites/certification/Test_TC_ACL_2_8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ tests:
value:
[
{
Privilege: "5",
AuthMode: "2",
Privilege: 5,
AuthMode: 2,
Subjects: [TH1CommissionerNodeId, 1111],
Targets: null,
FabricIndex: TH1FabricIndex,
Expand All @@ -116,8 +116,8 @@ tests:
value:
[
{
Privilege: "5",
AuthMode: "2",
Privilege: 5,
AuthMode: 2,
Subjects: [TH2CommissionerNodeId, 2222],
Targets: null,
FabricIndex: TH2FabricIndex,
Expand All @@ -128,12 +128,12 @@ tests:
PICS: ACL.S.A0000
command: "readAttribute"
attribute: "ACL"
arguments:
response:
value:
[
{
Privilege: "5",
AuthMode: "2",
Privilege: 5,
AuthMode: 2,
Subjects: [TH1CommissionerNodeId, 1111],
Targets: null,
FabricIndex: TH1FabricIndex,
Expand All @@ -145,12 +145,12 @@ tests:
identity: "beta"
command: "readAttribute"
attribute: "ACL"
arguments:
response:
value:
[
{
Privilege: "5",
AuthMode: "2",
Privilege: 5,
AuthMode: 2,
Subjects: [TH2CommissionerNodeId, 2222],
Targets: null,
FabricIndex: TH2FabricIndex,
Expand Down
61 changes: 0 additions & 61 deletions src/app/zap-templates/zcl/data-model/silabs/types-silabs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ limitations under the License.
<field name="opening" mask="0x4"/>
<field name="motorOpening" mask="0x8"/>
</bitmap>
<bitmap name="AlarmMask" type="BITMAP8">
<field name="GeneralHwFault" mask="0x1"/>
<field name="GeneralSwFault" mask="0x2"/>
</bitmap>
<bitmap name="MainsAlarmMask" type="BITMAP8">
<field name="VoltageTooLow" mask="0x1"/>
<field name="VoltageTooHigh" mask="0x2"/>
Expand All @@ -47,22 +43,6 @@ limitations under the License.
<item name="normal" value="0x0"/>
<item name="configure" value="0x1"/>
</enum>
<enum name="PowerSource" type="ENUM8">
<item name="Unknown" value="0x0"/>
<item name="SinglePhaseMains" value="0x1"/>
<item name="ThreePhaseMains" value="0x2"/>
<item name="Battery" value="0x3"/>
<item name="DcSource" value="0x4"/>
<item name="EmergencyMainsConstantPower" value="0x5"/>
<item name="EmergencyMainsTransferSwitch" value="0x6"/>
<item name="BatteryBackup" value="0x80"/>
</enum>
<enum name="PhysicalEnvironment" type="ENUM8">
<item name="Unspecified" value="0x0"/>
<item name="FirstProfileSpecifiedValue" value="0x1"/>
<item name="LastProfileSpecifiedValue" value="0x7f"/>
<item name="Unknown" value="0xff"/>
</enum>
<enum name="BatterySize" type="ENUM8">
<item name="NoBattery" value="0x0"/>
<item name="BuiltIn" value="0x1"/>
Expand Down Expand Up @@ -218,45 +198,4 @@ limitations under the License.
<item name="OnlyCumulatedConsumptionNotCertified" value="0x0002"/>
<item name="NotCertifiedData" value="0x0003"/>
</enum>
<!-- Lighting and Occupancy Types -->
<enum name="GenericDeviceType" type="ENUM8">
<item name="Incandescent" value="0x00"/>
<item name="SpotlightHalogen" value="0x01"/>
<item name="HalogenBulb" value="0x02"/>
<item name="CFL" value="0x03"/>
<item name="LinearFlourescent" value="0x04"/>
<item name="LedBulb" value="0x05"/>
<item name="SpotlightLed" value="0x06"/>
<item name="LedStrip" value="0x07"/>
<item name="LedTube" value="0x08"/>
<item name="GenericIndoorFixture" value="0x09"/>
<item name="GenericOutdoorFixture" value="0x0A"/>
<item name="PendantFixture" value="0x0B"/>
<item name="FloorStandingFixture" value="0x0C"/>
<!-- 0x0D-0xDF reserved -->
<item name="GenericController" value="0xE0"/>
<item name="WallSwitch" value="0xE1"/>
<item name="PortableRemoteController" value="0xE2"/>
<item name="MotionOrLightSensor" value="0xE3"/>
<!-- 0xE4-0xEF reserved -->
<item name="GenericActuator" value="0xF0"/>
<item name="PluginUnit" value="0xF1"/>
<item name="RetrofitActuator" value="0xF2"/>
<!-- 0xF5-0xFE reserved -->
<item name="Unspecified" value="0xFF"/>
</enum>
<enum name="ProductCode" type="ENUM8">
<item name="ManufacturerDefined" value="0x00"/>
<item name="IternationalArticleNumber" value="0x01"/>
<item name="GlobalTradeItemNumber" value="0x02"/>
<item name="UniversalProductCode" value="0x03"/>
<item name="StockKeepingUnit" value="0x04"/>
<!-- 0x05-0xFF reserved -->
</enum>
<enum name="StartUpOnOffValue" type="ENUM8">
<item name="SetToOff" value="0x00"/>
<item name="SetToOn" value="0x01"/>
<item name="SetToToggle" value="0x02"/>
<!-- 0x03-0xFF reserved -->
</enum>
</configurator>
2 changes: 1 addition & 1 deletion third_party/mbedtls/repo
Submodule repo updated from 27276f to c87dc5
12 changes: 0 additions & 12 deletions zzz_generated/app-common/app-common/zap-generated/enums.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 43550ba

Please sign in to comment.