Skip to content

Commit

Permalink
Merge branch 'master' into feature/silabs_icd
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs authored Oct 23, 2024
2 parents 347377b + 197f698 commit 5ce7f93
Show file tree
Hide file tree
Showing 30 changed files with 709 additions and 369 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-efr32:84
image: ghcr.io/project-chip/chip-build-efr32:85
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
runs-on: ubuntu-latest

container:
image: ghcr.io/project-chip/chip-build-efr32:84
image: ghcr.io/project-chip/chip-build-efr32:85
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
[submodule "third_party/silabs/simplicity_sdk"]
path = third_party/silabs/simplicity_sdk
url = https://github.com/SiliconLabs/simplicity_sdk.git
branch = v2024.6.1-0
branch = v2024.6.2
platforms = silabs
[submodule "third_party/silabs/wiseconnect-wifi-bt-sdk"]
path = third_party/silabs/wiseconnect-wifi-bt-sdk
Expand Down
51 changes: 30 additions & 21 deletions docs/development_controllers/chip-tool/chip_tool_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,29 @@ the setup payload or performing discovery actions.

<hr>

## Source files
## Installation

You can find source files of the CHIP Tool in the `examples/chip-tool`
directory.

> **Note:** The CHIP Tool caches the configuration state in the
> `/tmp/chip_tool_config.ini` file. Deleting this and other `.ini` files in the
> `/tmp` directory can sometimes resolve issues related to stale configuration.
On Linux distributions
[running snapd](https://snapcraft.io/docs/installing-snapd), such as Ubuntu, the
CHIP Tool can be installed using the
[chip-tool snap](https://snapcraft.io/chip-tool). To do this, run:

> **Note:** To make the configuration persistent (since `/tmp` directory might
> be flushed at each reboot) you can change the directory where CHIP Tool caches
> its configuration by using the option `--storage-directory`
```
sudo snap install chip-tool
```

<hr>
## Building from source

## Building and running the CHIP Tool
The source files of the CHIP Tool are available in the `examples/chip-tool`
directory.

Before you can use the CHIP Tool, you must compile it from source on Linux
(amd64/aarch64) or macOS. If you want to run it on Raspberry Pi, it must use a
64-bit OS.
The source can be compiled on Linux (amd64/aarch64) or macOS. If you want to run
it on Raspberry Pi, you must use a 64-bit OS.

> **Note:** To ensure compatibility, always build the CHIP Tool and the Matter
> device from the same revision of the `connectedhomeip` repository.
### Building the CHIP Tool

To build and run the CHIP Tool:
To build the CHIP Tool:

1. Install all required packages for Matter and prepare the source code and the
build system. Read the [Building Matter](../../guides/BUILDING.md) guide for
Expand All @@ -50,10 +46,16 @@ To build and run the CHIP Tool:
In this command, `BUILD_PATH` specifies where the target binaries are to be
placed.
### Running the CHIP Tool
## Running the CHIP Tool
If you installed the CHIP Tool as a snap, the command to run it would be:
```
$ chip-tool
```
To check if the CHIP Tool runs correctly, execute the following command from the
`BUILD_PATH` directory:
If you compiled the CHIP Tool from source, it can be executed with the following
command from the `BUILD_PATH` directory:
```
$ ./chip-tool
Expand All @@ -68,6 +70,13 @@ more complex command by appending it with sub-commands. Examples of specific
commands and their use cases are described in the
[Supported commands and options](#supported-commands-and-options) section.
> **Note:** The CHIP Tool caches the configuration state in the
> `/tmp/chip_tool_config.ini` file. Deleting this and other `.ini` files in the
> `/tmp` directory can sometimes resolve issues related to stale configuration.
> To make the configuration persistent you can change the directory where CHIP
> Tool caches its configuration by using the command line option
> `--storage-directory`
<hr>
## CHIP Tool modes
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ same Matter network.
To perform the unicast binding process, complete the following steps:
1. Build the CHIP Tool according to the steps from the
[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md#building-and-running-the-chip-tool).
[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md#building-from-source).
2. Go to the CHIP Tool build directory.
3. Add an ACL to the development kit that is programmed with the
[Lighting Application Example](../../lighting-app/nrfconnect/README.md) by
Expand Down Expand Up @@ -690,7 +690,7 @@ same Matter network.
To perform the unicast binding process, complete the following steps:
1. Build the CHIP Tool according to the steps from the
[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md#building-and-running-the-chip-tool).
[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md#building-from-source).
2. Go to the CHIP Tool build directory.
3. Add the light switch device to the multicast group by running the following
Expand Down
14 changes: 7 additions & 7 deletions integrations/cloudbuild/smoke-test.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
steps:
- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
entrypoint: "bash"
args:
- "-c"
- |
git config --global --add safe.directory "*"
python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android
id: Submodules
- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
# NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting
# jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3)
env:
Expand All @@ -24,7 +24,7 @@ steps:
path: /pwenv
timeout: 900s

- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: ESP32
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -45,7 +45,7 @@ steps:
volumes:
- name: pwenv
path: /pwenv
- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: NRFConnect
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -66,7 +66,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: EFR32
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -88,7 +88,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: Linux
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand Down Expand Up @@ -141,7 +141,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: Android
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand Down
109 changes: 55 additions & 54 deletions src/app/clusters/thermostat-server/thermostat-server-presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,69 +152,36 @@ bool GetMatchingPresetInPresets(Delegate * delegate, const DataModel::Nullable<B
}

/**
* @brief Returns the length of the list of presets if the pending presets were to be applied. The size of the pending presets list
* calculated, after all the constraint checks are done, is the new size of the updated Presets attribute since the pending
* preset list is expected to have all existing presets with or without edits plus new presets.
* This is called before changes are actually applied.
* @brief Gets the maximum number of presets allowed for a given preset scenario.
*
* @param[in] delegate The delegate to use.
*
* @return count of the updated Presets attribute if the pending presets were applied to it. Return 0 for error cases.
* @param[in] delegate The delegate to use.
* @param[in] presetScenario The presetScenario to match with.
* @param[out] count The maximum number of presets for the specified presetScenario
* @return CHIP_NO_ERROR if the maximum number was determined, or an error if not
*/
uint8_t CountNumberOfPendingPresets(Delegate * delegate)
CHIP_ERROR MaximumPresetScenarioCount(Delegate * delegate, PresetScenarioEnum presetScenario, size_t & count)
{
uint8_t numberOfPendingPresets = 0;

VerifyOrReturnValue(delegate != nullptr, 0);

count = 0;
for (uint8_t i = 0; true; i++)
{
PresetStructWithOwnedMembers pendingPreset;
CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, pendingPreset);

PresetTypeStruct::Type presetType;
auto err = delegate->GetPresetTypeAtIndex(i, presetType);
if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED)
{
break;
// We exhausted the list trying to find the preset scenario
return CHIP_NO_ERROR;
}
if (err != CHIP_NO_ERROR)
{
ChipLogError(Zcl, "CountNumberOfPendingPresets: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT,
err.Format());
return 0;
return err;
}
numberOfPendingPresets++;
}

return numberOfPendingPresets;
}

/**
* @brief Checks if the presetScenario is present in the PresetTypes attribute.
*
* @param[in] delegate The delegate to use.
* @param[in] presetScenario The presetScenario to match with.
*
* @return true if the presetScenario is found, false otherwise.
*/
bool PresetScenarioExistsInPresetTypes(Delegate * delegate, PresetScenarioEnum presetScenario)
{
VerifyOrReturnValue(delegate != nullptr, false);

for (uint8_t i = 0; true; i++)
{
PresetTypeStruct::Type presetType;
auto err = delegate->GetPresetTypeAtIndex(i, presetType);
if (err != CHIP_NO_ERROR)
{
return false;
}

if (presetType.presetScenario == presetScenario)
{
return true;
count = presetType.numberOfPresets;
return CHIP_NO_ERROR;
}
}
return false;
return CHIP_NO_ERROR;
}

/**
Expand Down Expand Up @@ -410,8 +377,16 @@ CHIP_ERROR ThermostatAttrAccess::AppendPendingPreset(Thermostat::Delegate * dele
}
}

if (!PresetScenarioExistsInPresetTypes(delegate, preset.GetPresetScenario()))
size_t maximumPresetCount = delegate->GetNumberOfPresets();
size_t maximumPresetScenarioCount = 0;
if (MaximumPresetScenarioCount(delegate, preset.GetPresetScenario(), maximumPresetScenarioCount) != CHIP_NO_ERROR)
{
return CHIP_IM_GLOBAL_STATUS(InvalidInState);
}

if (maximumPresetScenarioCount == 0)
{
// This is not a supported preset scenario
return CHIP_IM_GLOBAL_STATUS(ConstraintError);
}

Expand All @@ -423,16 +398,42 @@ CHIP_ERROR ThermostatAttrAccess::AppendPendingPreset(Thermostat::Delegate * dele
// Before adding this preset to the pending presets, if the expected length of the pending presets' list
// exceeds the total number of presets supported, return RESOURCE_EXHAUSTED. Note that the preset has not been appended yet.

uint8_t numberOfPendingPresets = CountNumberOfPendingPresets(delegate);
// We're going to append this preset, so let's assume a count as though it had already been inserted
size_t presetCount = 1;
size_t presetScenarioCount = 1;
for (uint8_t i = 0; true; i++)
{
PresetStructWithOwnedMembers otherPreset;
CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, otherPreset);

if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED)
{
break;
}
if (err != CHIP_NO_ERROR)
{
return CHIP_IM_GLOBAL_STATUS(InvalidInState);
}
presetCount++;
if (preset.GetPresetScenario() == otherPreset.GetPresetScenario())
{
presetScenarioCount++;
}
}

// We will be adding one more preset, so reject if the length is already at max.
if (numberOfPendingPresets >= delegate->GetNumberOfPresets())
if (presetCount > maximumPresetCount)
{
ChipLogError(Zcl, "Preset count exceeded %u: %u ", static_cast<unsigned>(maximumPresetCount),
static_cast<unsigned>(presetCount));
return CHIP_IM_GLOBAL_STATUS(ResourceExhausted);
}

// TODO #34556 : Check if the number of presets for each presetScenario exceeds the max number of presets supported for that
// scenario. We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation.
if (presetScenarioCount > maximumPresetScenarioCount)
{
ChipLogError(Zcl, "Preset scenario count exceeded %u: %u ", static_cast<unsigned>(maximumPresetScenarioCount),
static_cast<unsigned>(presetScenarioCount));
return CHIP_IM_GLOBAL_STATUS(ResourceExhausted);
}

return delegate->AppendToPendingPresetList(preset);
}
Expand Down
10 changes: 10 additions & 0 deletions src/app/tests/suites/certification/Test_TC_LVL_2_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ tests:
minValue: MinLevelFeatureMapNotSupportedValue
maxValue: MaxLevelFeatureMapNotSupportedValue

- label: "Step 9c: TH reads the OnLevel attribute from the DUT"
PICS: LVL.S.A0011 && !LVL.S.F01 && !LVL.S.A0002 && !LVL.S.A0003
command: "readAttribute"
attribute: "OnLevel"
response:
constraints:
type: int8u
minValue: 0
maxValue: 254

- label: "Step 10: TH reads the OnTransitionTime attribute from the DUT"
PICS: LVL.S.A0012
command: "readAttribute"
Expand Down
Loading

0 comments on commit 5ce7f93

Please sign in to comment.