Skip to content

Commit

Permalink
Extend build flags for ip commissioning. (#7214)
Browse files Browse the repository at this point in the history
Lets the linux builds be built with IP commissioning support. Adds
the on-network flag to the QR code on the app main.

Test: lighting-app on linux - comes up in commissioning mode,
      chip-device-ctrl connect -qr "[qr code]" can find and
      commission the device.
  • Loading branch information
cecille authored and pull[bot] committed Jul 3, 2021
1 parent 7ba3609 commit 2a168b1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/platform/linux/AppMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ int ChipLinuxAppInit(int argc, char ** argv)
SuccessOrExit(err);

ConfigurationMgr().LogDeviceConfig();
#ifdef CONFIG_RENDEZVOUS_MODE
PrintOnboardingCodes(static_cast<chip::RendezvousInformationFlags>(CONFIG_RENDEZVOUS_MODE));
#else
PrintOnboardingCodes(chip::RendezvousInformationFlag::kBLE);
#endif

#if defined(PW_RPC_ENABLED)
chip::rpc::Init();
Expand Down
6 changes: 6 additions & 0 deletions examples/platform/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

import("//build_overrides/chip.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/app/common_flags.gni")

config("app-main-config") {
include_dirs = [ "." ]
}

source_set("app-main") {
defines = []
sources = [
"AppMain.cpp",
"AppMain.h",
Expand All @@ -32,6 +34,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" ]
}

public_deps = [
"${chip_root}/src/app/server",
Expand Down
9 changes: 9 additions & 0 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ static_library("app") {
assert(false, "Unknown IM critical section implementation.")
}

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

public_deps = [
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
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
}

0 comments on commit 2a168b1

Please sign in to comment.