Skip to content

Commit

Permalink
Allowing for CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES to be set in
Browse files Browse the repository at this point in the history
build args

The CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES should be
configurable per app, add a configuration that allows for this to be
specified.

Tested by verifying the ninja file was filled in with the right
arguments when building both chip tool as well as the tv-casting-app
  • Loading branch information
cliffamzn authored and sharadb-amazon committed Apr 5, 2023
1 parent 1fec0d2 commit a65c240
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions examples/tv-casting-app/android/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ chip_enable_additional_data_advertising = true
chip_enable_rotating_device_id = true

chip_config_network_layer_ble = false

chip_max_discovered_ip_addresses = 20
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ + (DiscoveredNodeData *)convertToObjCDiscoveredNodeDataFrom:(const chip::Dnssd::
}
for (size_t i = 0; i < cppDiscoveredNodedata->resolutionData.numIPs; i++) {
char addrCString[chip::Inet::IPAddress::kMaxStringLength];
cppDiscoveredNodedata->resolutionData.ipAddress->ToString(addrCString, chip::Inet::IPAddress::kMaxStringLength);
cppDiscoveredNodedata->resolutionData.ipAddress[i].ToString(addrCString, chip::Inet::IPAddress::kMaxStringLength);
objCDiscoveredNodeData.ipAddresses[i] = [NSString stringWithCString:addrCString encoding:NSASCIIStringEncoding];
}
return objCDiscoveredNodeData;
Expand Down
2 changes: 2 additions & 0 deletions examples/tv-casting-app/darwin/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ chip_enable_additional_data_advertising = true
chip_enable_rotating_device_id = true

chip_config_network_layer_ble = false

chip_max_discovered_ip_addresses = 20
2 changes: 2 additions & 0 deletions examples/tv-casting-app/linux/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ chip_build_libshell = true
chip_enable_additional_data_advertising = true

chip_enable_rotating_device_id = true

chip_max_discovered_ip_addresses = 20
3 changes: 1 addition & 2 deletions src/lib/dnssd/Resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ namespace Dnssd {
/// Node resolution data common to both operational and commissionable discovery
struct CommonResolutionData
{
// TODO: is this count OK? Sufficient space for IPv6 LL, GUA, ULA (and maybe IPv4 if enabled)
static constexpr unsigned kMaxIPAddresses = 5;
static constexpr unsigned kMaxIPAddresses = CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES;

Inet::InterfaceId interfaceId;

Expand Down
5 changes: 5 additions & 0 deletions src/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ if (chip_device_platform != "none" && chip_device_platform != "external") {

# The string of device software version was built.
chip_device_config_device_software_version_string = ""

# Define the default number of ip addresses to discover
chip_max_discovered_ip_addresses = 5
}

if (chip_stack_lock_tracking == "auto") {
Expand Down Expand Up @@ -291,6 +294,8 @@ if (chip_device_platform != "none" && chip_device_platform != "external") {
if (chip_device_config_device_software_version_string != "") {
defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${chip_device_config_device_software_version_string}\"" ]
}

defines += [ "CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}" ]
}
} else if (chip_device_platform == "none") {
buildconfig_header("platform_buildconfig") {
Expand Down

0 comments on commit a65c240

Please sign in to comment.