From 9961c453c6add5d81031c8dad5b79c7362afd575 Mon Sep 17 00:00:00 2001 From: Sharad Binjola Date: Wed, 17 Apr 2024 13:09:07 -0700 Subject: [PATCH 1/2] Make chip::Dnssd::kMaxDeviceNameLen configurable --- examples/tv-casting-app/android/args.gni | 2 ++ examples/tv-casting-app/darwin/args.gni | 2 ++ examples/tv-casting-app/linux/args.gni | 2 ++ src/lib/dnssd/Types.h | 2 +- src/platform/BUILD.gn | 8 +++++++- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/examples/tv-casting-app/android/args.gni b/examples/tv-casting-app/android/args.gni index 3cde6a704dbab7..fa55c9b3c46e1f 100644 --- a/examples/tv-casting-app/android/args.gni +++ b/examples/tv-casting-app/android/args.gni @@ -34,4 +34,6 @@ chip_config_network_layer_ble = false chip_max_discovered_ip_addresses = 20 +chip_max_device_name_len = 128 + enable_rtti = true diff --git a/examples/tv-casting-app/darwin/args.gni b/examples/tv-casting-app/darwin/args.gni index 1158e98e5f2d99..b36fbab2097475 100644 --- a/examples/tv-casting-app/darwin/args.gni +++ b/examples/tv-casting-app/darwin/args.gni @@ -38,3 +38,5 @@ chip_enable_rotating_device_id = true chip_config_network_layer_ble = false chip_max_discovered_ip_addresses = 20 + +chip_max_device_name_len = 128 diff --git a/examples/tv-casting-app/linux/args.gni b/examples/tv-casting-app/linux/args.gni index 03ba28645f8940..02751b24c2b16f 100644 --- a/examples/tv-casting-app/linux/args.gni +++ b/examples/tv-casting-app/linux/args.gni @@ -32,4 +32,6 @@ chip_enable_rotating_device_id = true chip_max_discovered_ip_addresses = 20 +chip_max_device_name_len = 128 + matter_enable_tracing_support = true diff --git a/src/lib/dnssd/Types.h b/src/lib/dnssd/Types.h index 15dbf90670ac34..4ff80db9712a6a 100644 --- a/src/lib/dnssd/Types.h +++ b/src/lib/dnssd/Types.h @@ -200,7 +200,7 @@ struct OperationalNodeData void Reset() { peerId = PeerId(); } }; -inline constexpr size_t kMaxDeviceNameLen = 32; +inline constexpr size_t kMaxDeviceNameLen = CHIP_DEVICE_CONFIG_MAX_DEVICE_NAME_LEN; inline constexpr size_t kMaxRotatingIdLen = 50; inline constexpr size_t kMaxPairingInstructionLen = 128; diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 048b7e96af9025..9f899eb95342fd 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -81,6 +81,9 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { # Define the default number of ip addresses to discover chip_max_discovered_ip_addresses = 5 + # Maximum length of the deviceName in the node discovery data + chip_max_device_name_len = 32 + # Allows enabling dynamic setting of the local MRP configuration, for # devices with multiple radios that have different sleep behavior for # different radios. @@ -380,7 +383,10 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { defines += [ "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${chip_device_config_device_product_id}" ] } - defines += [ "CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}" ] + defines += [ + "CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}", + "CHIP_DEVICE_CONFIG_MAX_DEVICE_NAME_LEN=${chip_max_device_name_len}", + ] visibility = [ ":platform_config_header", From 732f5a73503b90bc90ee7e983c18e99a6f9f943e Mon Sep 17 00:00:00 2001 From: Sharad Binjola Date: Wed, 17 Apr 2024 14:10:21 -0700 Subject: [PATCH 2/2] Setting CHIP_DEVICE_CONFIG_MAX_DEVICE_NAME_LEN for esp32 and stm32 lighting-app --- .../lighting-app/stm32/include/STM32WB5/CHIPProjectConfig.h | 3 +++ .../platform/esp32/external_platform/ESP32_custom/BUILD.gn | 2 ++ 2 files changed, 5 insertions(+) diff --git a/examples/lighting-app/stm32/include/STM32WB5/CHIPProjectConfig.h b/examples/lighting-app/stm32/include/STM32WB5/CHIPProjectConfig.h index a911c565e95a1b..a20356b714fef2 100644 --- a/examples/lighting-app/stm32/include/STM32WB5/CHIPProjectConfig.h +++ b/examples/lighting-app/stm32/include/STM32WB5/CHIPProjectConfig.h @@ -144,6 +144,9 @@ #define CHIP_AUTOMATION_LOGGING 1 #define CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES 5 + +#define CHIP_DEVICE_CONFIG_MAX_DEVICE_NAME_LEN 32 + /** * HIGHWATERMARK * diff --git a/examples/platform/esp32/external_platform/ESP32_custom/BUILD.gn b/examples/platform/esp32/external_platform/ESP32_custom/BUILD.gn index d8d2f92b542ac7..b165b3711176ce 100644 --- a/examples/platform/esp32/external_platform/ESP32_custom/BUILD.gn +++ b/examples/platform/esp32/external_platform/ESP32_custom/BUILD.gn @@ -29,6 +29,7 @@ declare_args() { chip_bt_bluedroid_enabled = true chip_max_discovered_ip_addresses = 5 chip_enable_route_hook = false + chip_max_device_name_len = 32 } buildconfig_header("custom_buildconfig") { @@ -61,6 +62,7 @@ buildconfig_header("custom_buildconfig") { "EXTERNAL_PLATFORMMANAGERIMPL_HEADER=", "CHIP_CONFIG_SOFTWARE_VERSION_NUMBER=${chip_config_software_version_number}", "CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}", + "CHIP_DEVICE_CONFIG_MAX_DEVICE_NAME_LEN=${chip_max_device_name_len}", ] if (chip_enable_ota_requestor) {