From bb87fa9f0cd8c2a85c6961e99304911f7871b4ae Mon Sep 17 00:00:00 2001 From: "fred.li" Date: Wed, 17 Jun 2020 17:58:04 +0800 Subject: [PATCH] Add WiSun network size configs in JSON --- connectivity/nanostack/mbed-mesh-api/mbed_lib.json | 4 ++++ .../nanostack/mbed-mesh-api/source/WisunInterface.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/connectivity/nanostack/mbed-mesh-api/mbed_lib.json b/connectivity/nanostack/mbed-mesh-api/mbed_lib.json index 121b11d3f54..0732cd84871 100644 --- a/connectivity/nanostack/mbed-mesh-api/mbed_lib.json +++ b/connectivity/nanostack/mbed-mesh-api/mbed_lib.json @@ -120,6 +120,10 @@ "help": "Network name for a wisun network. Maximum network name length can be 32 ASCII characters excluding terminating 0", "value": "\"Wi-SUN Network\"" }, + "wisun-network-size": { + "help": "Expected amount of devices in the network as 100s of devices. with possible pre defined constants NETWORK_SIZE_SMALL, NETWORK_SIZE_MEDIUM, NETWORK_SIZE_LARGE, NETWORK_SIZE_XLARGE. if set to 0 Wi-SUN Certification configuration values are used. If don't define this(default null), then NETWORK_SIZE_MEDIUM will be used.", + "value": null + }, "wisun-regulatory-domain": { "help": "Regulator domain value as specified in the Wi-SUN PHY Specification. Default value 3 is for EU region.", "value": "3" diff --git a/connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp b/connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp index cceaf936694..9f918ea1ac3 100644 --- a/connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp +++ b/connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp @@ -119,6 +119,14 @@ nsapi_error_t WisunInterface::configure() } #endif +#ifdef MBED_CONF_MBED_MESH_API_WISUN_NETWORK_SIZE + status = set_network_size(MBED_CONF_MBED_MESH_API_WISUN_NETWORK_SIZE); + if (status < 0) { + tr_error("Failed to set network size"); + return NSAPI_ERROR_PARAMETER; + } +#endif + return NSAPI_ERROR_OK; }