Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Remove ip cluster flags" #9970

Merged
merged 1 commit into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/guides/ip_commissioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ device into commissioning mode.
### linux builds with an ethernet connection

```bash
gn gen out/debug
gn gen out/debug --args='chip_ip_commissioning=true'
ninja -C out/debug
```

Expand All @@ -59,7 +59,7 @@ The controller builds with IP commissioning support by default, but you can turn
it on or off using

```
scripts/build_python.sh
scripts/build_python.sh --clusters_for_ip_commissioning <true/false>
```

There are two ways to connect via IP: **Discover then connect ip**
Expand Down
4 changes: 4 additions & 0 deletions examples/platform/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ source_set("app-main") {
if (chip_enable_pw_rpc) {
defines += [ "PW_RPC_ENABLED" ]
}
if (chip_ip_commissioning) {
# BLE and on-network. Code defaults to BLE if this is not set.
defines += [ "CONFIG_RENDEZVOUS_MODE=6" ]
}
if (chip_build_libshell) {
defines += [ "ENABLE_CHIP_SHELL" ]
}
Expand Down
1 change: 1 addition & 0 deletions scripts/build/builders/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def generate(self):
gn_args['target_cpu'] = self.board.TargetCpuName()
gn_args['android_ndk_root'] = os.environ['ANDROID_NDK_HOME']
gn_args['android_sdk_root'] = os.environ['ANDROID_HOME']
gn_args['chip_use_clusters_for_ip_commissioning'] = 'true'

args = '--args=%s' % (' '.join([
'%s="%s"' % (key, shlex.quote(value))
Expand Down
8 changes: 4 additions & 4 deletions scripts/build/expected_all_platform_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ west build --cmake-only -d {out}/nrf-nrf5340-pump_controller -b nrf5340dk_nrf534
python3 build/chip/java/tests/generate_jars_for_test.py

# Generating android-arm-chip_tool
gn gen --check --fail-on-unused-args {out}/android-arm-chip_tool '--args=target_os="android" target_cpu="arm" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME"'
gn gen --check --fail-on-unused-args {out}/android-arm-chip_tool '--args=target_os="android" target_cpu="arm" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" chip_use_clusters_for_ip_commissioning="true"'

# Accepting NDK licenses
bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'
Expand All @@ -132,7 +132,7 @@ bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'
python3 build/chip/java/tests/generate_jars_for_test.py

# Generating android-arm64-chip_tool
gn gen --check --fail-on-unused-args {out}/android-arm64-chip_tool '--args=target_os="android" target_cpu="arm64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME"'
gn gen --check --fail-on-unused-args {out}/android-arm64-chip_tool '--args=target_os="android" target_cpu="arm64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" chip_use_clusters_for_ip_commissioning="true"'

# Accepting NDK licenses
bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'
Expand All @@ -141,7 +141,7 @@ bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'
python3 build/chip/java/tests/generate_jars_for_test.py

# Generating android-x64-chip_tool
gn gen --check --fail-on-unused-args {out}/android-x64-chip_tool '--args=target_os="android" target_cpu="x64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME"'
gn gen --check --fail-on-unused-args {out}/android-x64-chip_tool '--args=target_os="android" target_cpu="x64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" chip_use_clusters_for_ip_commissioning="true"'

# Accepting NDK licenses
bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'
Expand All @@ -150,7 +150,7 @@ bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'
python3 build/chip/java/tests/generate_jars_for_test.py

# Generating android-x86-chip_tool
gn gen --check --fail-on-unused-args {out}/android-x86-chip_tool '--args=target_os="android" target_cpu="x86" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME"'
gn gen --check --fail-on-unused-args {out}/android-x86-chip_tool '--args=target_os="android" target_cpu="x86" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" chip_use_clusters_for_ip_commissioning="true"'

# Accepting NDK licenses
bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'
Expand Down
8 changes: 7 additions & 1 deletion scripts/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Input Options:
By default it is false.
-m, --chip_mdns ChipMDNSValue Specify ChipMDNSValue as platform or minimal.
By default it is minimal.
-c, --clusters_for_ip_commissioning true/false Specify whether to use clusters for IP commissioning.
By default it is true.
-p, --enable_pybindings EnableValue Specify whether to enable pybindings as python controller.
"
}
Expand All @@ -74,6 +76,10 @@ while (($#)); do
chip_mdns=$2
shift
;;
--clusters_for_ip_commissioning | -c)
clusters=$2
shift
;;
--enable_pybindings | -p)
enable_pybindings=$2
shift
Expand All @@ -96,7 +102,7 @@ source "$CHIP_ROOT/scripts/activate.sh"
# Generates ninja files
[[ -n "$chip_mdns" ]] && chip_mdns_arg="chip_mdns=\"$chip_mdns\"" || chip_mdns_arg=""

gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="chip_detail_logging=$chip_detail_logging enable_pylib=$enable_pybindings enable_rtti=$enable_pybindings chip_project_config_include_dirs=[\"//config/python\"] $chip_mdns_arg"
gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="chip_detail_logging=$chip_detail_logging enable_pylib=$enable_pybindings enable_rtti=$enable_pybindings chip_use_clusters_for_ip_commissioning=$clusters chip_project_config_include_dirs=[\"//config/python\"] $chip_mdns_arg"

# Compiles python files
# Check pybindings was requested
Expand Down
2 changes: 1 addition & 1 deletion scripts/examples/android_app_ide.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ fi
source scripts/activate.sh
# Build CMake for Android Studio
echo "build ide"
gn gen --check --fail-on-unused-args out/"android_$TARGET_CPU" --args="target_os=\"android\" target_cpu=\"$TARGET_CPU\" android_ndk_root=\"$ANDROID_NDK_HOME\" android_sdk_root=\"$ANDROID_HOME\"" --ide=json --json-ide-script=//scripts/examples/gn_to_cmakelists.py
gn gen --check --fail-on-unused-args out/"android_$TARGET_CPU" --args="target_os=\"android\" target_cpu=\"$TARGET_CPU\" android_ndk_root=\"$ANDROID_NDK_HOME\" android_sdk_root=\"$ANDROID_HOME\" chip_use_clusters_for_ip_commissioning=\"true\"" --ide=json --json-ide-script=//scripts/examples/gn_to_cmakelists.py
8 changes: 8 additions & 0 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ static_library("app") {
"reporting/Engine.h",
]

if (chip_ip_commissioning) {
defines = [
"CONFIG_USE_CLUSTERS_FOR_IP_COMMISSIONING=1",
"CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY=1",
"CHIP_DEVICE_CONFIG_ENABLE_JUST_IN_TIME_PROVISIONING=1",
]
}

public_deps = [
":app_buildconfig",
"${chip_root}/src/lib/support",
Expand Down
1 change: 1 addition & 0 deletions src/app/common_flags.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
declare_args() {
# Temporary flag for interaction model and echo protocols, set it to true to enable
chip_app_use_echo = false
chip_ip_commissioning = false
}
12 changes: 9 additions & 3 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,12 @@ void DeviceCommissioner::OnSessionEstablished()

// TODO: Add code to receive OpCSR from the device, and process the signing request
// For IP rendezvous, this is sent as part of the state machine.
#if CONFIG_USE_CLUSTERS_FOR_IP_COMMISSIONING
bool sendOperationalCertsImmediately = !mIsIPRendezvous;
#else
bool sendOperationalCertsImmediately = true;
#endif

if (sendOperationalCertsImmediately)
{
err = SendOperationalCertificateSigningRequestCommand(device);
Expand Down Expand Up @@ -1463,11 +1468,13 @@ CHIP_ERROR DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion(De
ChipLogProgress(Controller, "Operational credentials provisioned on device %p", device);
VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);

#if CONFIG_USE_CLUSTERS_FOR_IP_COMMISSIONING
if (mIsIPRendezvous)
{
AdvanceCommissioningStage(CHIP_NO_ERROR);
}
else
#endif
{
mPairingSession.ToSerializable(device->GetPairing());
mSystemLayer->CancelTimer(OnSessionEstablishmentTimeoutCallback, this);
Expand Down Expand Up @@ -1740,10 +1747,9 @@ void DeviceCommissioner::OnDeviceConnectedFn(void * context, Device * device)
if (commissioner->mDeviceBeingPaired < kNumMaxActiveDevices)
{
Device * deviceBeingPaired = &commissioner->mActiveDevices[commissioner->mDeviceBeingPaired];
if (device == deviceBeingPaired && commissioner->mIsIPRendezvous)
if (device == deviceBeingPaired && commissioner->mCommissioningStage == CommissioningStage::kFindOperational)
{
commissioner->AdvanceCommissioningStage(CHIP_NO_ERROR);
return;
}
}

Expand Down Expand Up @@ -1954,7 +1960,7 @@ void DeviceCommissioner::AdvanceCommissioningStage(CHIP_ERROR err)
PersistDeviceList();
if (mPairingDelegate != nullptr)
{
mPairingDelegate->OnCommissioningComplete(device->GetDeviceId(), CHIP_NO_ERROR);
mPairingDelegate->OnStatusUpdate(DevicePairingDelegate::SecurePairingSuccess);
}
RendezvousCleanup(CHIP_NO_ERROR);
break;
Expand Down
2 changes: 2 additions & 0 deletions src/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ if (chip_device_platform != "none") {
"CHIP_ENABLE_OPENTHREAD=${chip_enable_openthread}",
"CHIP_WITH_GIO=${chip_with_gio}",
"OPENTHREAD_CONFIG_ENABLE_TOBLE=false",
"CONFIG_USE_CLUSTERS_FOR_IP_COMMISSIONING=${chip_use_clusters_for_ip_commissioning}",
"CHIP_DEVICE_CONFIG_ENABLE_MDNS=${chip_device_config_enable_mdns}",
"CHIP_BYPASS_RENDEZVOUS=${chip_bypass_rendezvous}",
"CHIP_STACK_LOCK_TRACKING_ENABLED=${chip_stack_lock_tracking_log}",
Expand Down Expand Up @@ -208,6 +209,7 @@ if (chip_device_platform != "none") {
chip_device_config_enable_mdns = chip_mdns != "none"
defines += [
"CHIP_DEVICE_CONFIG_ENABLE_MDNS=${chip_device_config_enable_mdns}",
"CONFIG_USE_CLUSTERS_FOR_IP_COMMISSIONING=${chip_use_clusters_for_ip_commissioning}",
"EXTERNAL_KEYVALUESTOREMANAGERIMPL_HEADER=\"controller/java/AndroidKeyValueStoreManagerImpl.h\"",
]
}
Expand Down
3 changes: 3 additions & 0 deletions src/platform/device.gni
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ declare_args() {
} else {
chip_mdns = "none"
}

# Enables full cluster-based commissioning for already-on-network devices.
chip_use_clusters_for_ip_commissioning = false
}

_chip_device_layer = "none"
Expand Down