Skip to content

Commit

Permalink
Merge branch 'master' into feature/wifi_wf200_pin_multiplexing
Browse files Browse the repository at this point in the history
  • Loading branch information
thashok authored Dec 13, 2022
2 parents 282be26 + 77df17f commit 3403098
Show file tree
Hide file tree
Showing 48 changed files with 898 additions and 258 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/examples-openiotsdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,24 @@ jobs:
scripts/examples/openiotsdk_example.sh unit-tests
- name: Test shell example
if: steps.build_shell.outcome == 'success'
# Temporarily disable test due to performance issue with FVP
if: false #steps.build_shell.outcome == 'success'
timeout-minutes: 5
run: |
scripts/examples/openiotsdk_example.sh -C test shell
- name: Test lock-app example
if: steps.build_lock_app.outcome == 'success'
# Temporarily disable test due to performance issue with FVP
if: false #steps.build_lock_app.outcome == 'success'
timeout-minutes: 5
run: |
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME up
scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh -C test -n ${TEST_NETWORK_NAME}tap lock-app
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME down
- name: Run unit tests
if: steps.build_unit_tests.outcome == 'success' && github.event_name == 'pull_request'
# Temporarily disable test due to performance issue with FVP
if: false #steps.build_unit_tests.outcome == 'success' && github.event_name == 'pull_request'
timeout-minutes: 90
run: |
scripts/examples/openiotsdk_example.sh -C run unit-tests
11 changes: 11 additions & 0 deletions examples/all-clusters-app/infineon/psoc6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- [Setting up chip-tool](#setting-up-chip-tool)
- [Commissioning over BLE](#commissioning-over-ble)
- [Notes](#notes)
- [Factory Reset](#factory-reset)
- [OTA Software Update](#ota-software-update)

<hr>
Expand Down Expand Up @@ -123,6 +124,16 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.
$ sudo btmgmt -i hci0 bredr off
$ sudo btmgmt -i hci0 power on
### Factory Reset
- Commissioned Wi-Fi Credentials can be cleared by pressing `USER_BTN2` button
on the board. All the data configured on the device during the initial
commissioning will be deleted and device will be ready for commissioning
again.
- Pressing the button again within 5 seconds will cancel the factory reset of
the board.
## OTA Software Update
For the description of Software Update process with infineon PSoC6 example
Expand Down
11 changes: 11 additions & 0 deletions examples/all-clusters-minimal-app/infineon/psoc6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- [Setting up chip-tool](#setting-up-chip-tool)
- [Commissioning over BLE](#commissioning-over-ble)
- [Notes](#notes)
- [Factory Reset](#factory-reset)
- [OTA Software Update](#ota-software-update)

<hr>
Expand Down Expand Up @@ -123,6 +124,16 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.
$ sudo btmgmt -i hci0 bredr off
$ sudo btmgmt -i hci0 power on
### Factory Reset
- Commissioned Wi-Fi Credentials can be cleared by pressing `USER_BTN2` button
on the board. All the data configured on the device during the initial
commissioning will be deleted and device will be ready for commissioning
again.
- Pressing the button again within 5 seconds will cancel the factory reset of
the board.
## OTA Software Update
For the description of Software Update process with infineon PSoC6 example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include "MTRError_Utils.h"

const uint16_t kListenPort = 5541;
static CHIPToolPersistentStorageDelegate * storage = nil;
std::set<CHIPCommandBridge *> CHIPCommandBridge::sDeferredCleanups;
std::map<std::string, MTRDeviceController *> CHIPCommandBridge::mControllers;
Expand Down Expand Up @@ -118,7 +117,6 @@
}

auto params = [[MTRDeviceControllerFactoryParams alloc] initWithStorage:storage];
params.port = @(kListenPort);
params.shouldStartServer = YES;
params.otaProviderDelegate = mOTADelegate;
NSArray<NSData *> * paaCertResults;
Expand Down
2 changes: 2 additions & 0 deletions examples/darwin-framework-tool/commands/pairing/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "OpenCommissioningWindowCommand.h"
#include "PairingCommandBridge.h"
#include "PrepareCommissioningCommand.h"

class PairCode : public PairingCommandBridge
{
Expand Down Expand Up @@ -71,6 +72,7 @@ void registerCommandsPairing(Commands & commands)
make_unique<PairBleThread>(),
make_unique<Unpair>(),
make_unique<OpenCommissioningWindowCommand>(),
make_unique<PrepareCommissioningCommand>(),
};

commands.Register(clusterName, clusterCommands);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2022 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

#import <Matter/Matter.h>

#include "../common/CHIPCommandBridge.h"

#import "MTRError_Utils.h"

class PrepareCommissioningCommand : public CHIPCommandBridge {
public:
PrepareCommissioningCommand()
: CHIPCommandBridge("prepare-commissioning")
{
}

protected:
/////////// CHIPCommandBridge Interface /////////
CHIP_ERROR RunCommand() override
{
auto * controller = CurrentCommissioner();
NSError * error;
if (![controller prepareCommissioningSession:&error]) {
auto err = MTRErrorToCHIPErrorCode(error);
SetCommandExitStatus(err);
return err;
}

// In interactive mode, we don't want to block the UI until the end of `GetWaitDuration`. So returns early.
if (IsInteractive()) {
SetCommandExitStatus(CHIP_NO_ERROR);
}
return CHIP_NO_ERROR;
}

chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(30); }
};
11 changes: 11 additions & 0 deletions examples/lighting-app/infineon/psoc6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- [Commissioning over BLE](#commissioning-over-ble)
- [Notes](#notes)
- [Cluster control](#cluster-control)
- [Factory Reset](#factory-reset)
- [OTA Software Update](#ota-software-update)

<hr>
Expand Down Expand Up @@ -137,6 +138,16 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.
Light ON and OFF can be observed with 'LED9' on the board. This LED is
configured with `LIGHT_LED` in `include/AppConfig.h`.

### Factory Reset

- Commissioned Wi-Fi Credentials can be cleared by pressing `USER_BTN2` button
on the board. All the data configured on the device during the initial
commissioning will be deleted and device will be ready for commissioning
again.

- Pressing the button again within 5 seconds will cancel the factory reset of
the board.

## OTA Software Update

For the description of Software Update process with infineon PSoC6 example
Expand Down
13 changes: 12 additions & 1 deletion examples/lock-app/infineon/psoc6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- [Commissioning over BLE](#commissioning-over-ble)
- [Notes](#notes)
- [Cluster control](#cluster-control)
- [Factory Reset](#factory-reset)
- [OTA Software Update](#ota-software-update)

<hr>
Expand Down Expand Up @@ -137,8 +138,18 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.
Lock/Unlock status of door can be observed with 'LED9' on the board. This
LED is configured with `LOCK_STATE_LED` in `include/AppConfig.h`.

### Factory Reset

- Commissioned Wi-Fi Credentials can be cleared by pressing `USER_BTN2` button
on the board. All the data configured on the device during the initial
commissioning will be deleted and device will be ready for commissioning
again.

- Pressing the button again within 5 seconds will cancel the factory reset of
the board.

## OTA Software Update

For the description of Software Update process with infineon PSoC6 example
applications see
[Infineon PSoC6 OTA Software Update](../../../docs/guides/infineon_psoc6_software_update.md)
[Infineon PSoC6 OTA Software Update](../../../../docs/guides/infineon_psoc6_software_update.md)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import com.matter.tv.app.api.MatterIntentConstants;
import com.matter.tv.server.model.ContentApp;
import com.matter.tv.server.receivers.ContentAppDiscoveryService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class ContentAppAgentService extends Service {
Expand All @@ -38,6 +40,8 @@ public class ContentAppAgentService extends Service {
private static final int ATTRIBUTE_TIMEOUT = 2; // seconds

private static ResponseRegistry responseRegistry = new ResponseRegistry();
private static ExecutorService executorService =
Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());

private final IBinder appAgentBinder =
new IMatterAppAgent.Stub() {
Expand Down Expand Up @@ -76,8 +80,14 @@ public boolean reportAttributeChange(int clusterId, int attributeId)
ContentApp contentApp =
ContentAppDiscoveryService.getReceiverInstance().getDiscoveredContentApp(pkg);
if (contentApp != null && contentApp.getEndpointId() != ContentApp.INVALID_ENDPOINTID) {
AppPlatformService.get()
.reportAttributeChange(contentApp.getEndpointId(), clusterId, attributeId);
// Make this call async so that even if the content apps make this call during command
// processing and synchronously, the command processing thread will not block for the
// chip stack lock.
executorService.execute(
() -> {
AppPlatformService.get()
.reportAttributeChange(contentApp.getEndpointId(), clusterId, attributeId);
});
return true;
}
Log.e(TAG, "No matter content app found for package " + pkg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@
#define CONFIG_BUILD_FOR_HOST_UNIT_TEST 1

#define CHIP_ENABLE_ROTATING_DEVICE_ID 1

#define CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH 64
8 changes: 4 additions & 4 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def BuildHostFakeTarget():
TargetPart('tests', app=HostApp.TESTS),
])

target.AppendModifier("mbedtls", crypto_library=HostCryptoLibrary.MBEDTLS).ExceptIfRe('-mbedtls')
target.AppendModifier("boringssl", crypto_library=HostCryptoLibrary.BORINGSSL).ExceptIfRe('-boringssl')
target.AppendModifier("mbedtls", crypto_library=HostCryptoLibrary.MBEDTLS).ExceptIfRe('-boringssl')
target.AppendModifier("boringssl", crypto_library=HostCryptoLibrary.BORINGSSL).ExceptIfRe('-mbedtls')
target.AppendModifier("asan", use_asan=True).ExceptIfRe("-tsan")
target.AppendModifier("tsan", use_tsan=True).ExceptIfRe("-asan")
target.AppendModifier("ubsan", use_ubsan=True)
Expand Down Expand Up @@ -136,8 +136,8 @@ def BuildHostTarget():
target.AppendModifier("no-ble", enable_ble=False)
target.AppendModifier("no-wifi", enable_wifi=False)
target.AppendModifier("no-thread", enable_thread=False)
target.AppendModifier("mbedtls", crypto_library=HostCryptoLibrary.MBEDTLS).ExceptIfRe('-mbedtls')
target.AppendModifier("boringssl", crypto_library=HostCryptoLibrary.BORINGSSL).ExceptIfRe('-boringssl')
target.AppendModifier("mbedtls", crypto_library=HostCryptoLibrary.MBEDTLS).ExceptIfRe('-boringssl')
target.AppendModifier("boringssl", crypto_library=HostCryptoLibrary.BORINGSSL).ExceptIfRe('-mbedtls')
target.AppendModifier("asan", use_asan=True).ExceptIfRe("-tsan")
target.AppendModifier("tsan", use_tsan=True).ExceptIfRe("-asan")
target.AppendModifier("ubsan", use_ubsan=True)
Expand Down
18 changes: 10 additions & 8 deletions src/app/server/CommissioningWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ void CommissioningWindowManager::ResetState()
mECMIterations = 0;
mECMSaltLength = 0;

#if CHIP_DEVICE_CONFIG_ENABLE_SED
if (mSEDActiveModeEnabled)
{
DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(false);
mSEDActiveModeEnabled = false;
}
#endif

UpdateWindowStatus(CommissioningWindowStatus::kWindowNotOpen);

UpdateOpenerFabricIndex(NullNullable);
Expand Down Expand Up @@ -223,8 +231,9 @@ CHIP_ERROR CommissioningWindowManager::AdvertiseAndListenForPASE()
mPairingSession.Clear();

#if CHIP_DEVICE_CONFIG_ENABLE_SED
if (!mIsBLE && !mListeningForPASE)
if (!mSEDActiveModeEnabled)
{
mSEDActiveModeEnabled = true;
DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(true);
}
#endif
Expand Down Expand Up @@ -455,13 +464,6 @@ CHIP_ERROR CommissioningWindowManager::StopAdvertisement(bool aShuttingDown)
{
RestoreDiscriminator();

#if CHIP_DEVICE_CONFIG_ENABLE_SED
if (!mIsBLE && mListeningForPASE)
{
DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(false);
}
#endif

mServer->GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::PBKDFParamRequest);
mListeningForPASE = false;
mPairingSession.Clear();
Expand Down
4 changes: 4 additions & 0 deletions src/app/server/CommissioningWindowManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ class CommissioningWindowManager : public SessionEstablishmentDelegate,
uint32_t mECMSaltLength = 0;
uint8_t mECMSalt[kSpake2p_Max_PBKDF_Salt_Length];

#if CHIP_DEVICE_CONFIG_ENABLE_SED
bool mSEDActiveModeEnabled = false;
#endif

// For tests only, so that we can test the commissioning window timeout
// without having to wait 3 minutes.
Optional<System::Clock::Seconds16> mMinCommissioningTimeoutOverride;
Expand Down
Loading

0 comments on commit 3403098

Please sign in to comment.