File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed
features/nanostack/mbed-mesh-api Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,22 @@ class WisunInterface : public MeshInterfaceNanostack {
166166 * */
167167 mesh_error_t validate_network_regulatory_domain (uint8_t regulatory_domain, uint8_t operating_class, uint8_t operating_mode);
168168
169+ /* *
170+ * \brief Set Wi-SUN network PHY mode and channel plan IDs.
171+ *
172+ * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
173+ * If device is already connected to the Wi-SUN network then device will restart network discovery after
174+ * changing the phy_mode_id or channel_plan_id.
175+ *
176+ * Function overwrites parameters defined by Mbed OS configuration.
177+ *
178+ * \param phy_mode_id Values defined in Wi-SUN PHY-specification. Use 0xff to leave parameter unchanged.
179+ * \param channel_plan_id Values defined in Wi-SUN PHY-specification. Use 0xff to leave parameter unchanged.
180+ * \return MESH_ERROR_NONE on success.
181+ * \return MESH_ERROR_UNKNOWN in case of failure.
182+ * */
183+ mesh_error_t set_network_phy_mode_and_channel_plan_id (uint8_t phy_mode_id, uint8_t channel_plan_id);
184+
169185 /* *
170186 * \brief Set Wi-SUN network size.
171187 *
Original file line number Diff line number Diff line change 136136 "help" : " Operating mode. Use 255 to use Nanostack default" ,
137137 "value" : " 255"
138138 },
139+ "wisun-phy-mode-id" : {
140+ "help" : " PHY mode ID as specified in the Wi-SUN PHY Specification. With default value 255, parameter is not used." ,
141+ "value" : " 255"
142+ },
143+ "wisun-channel-plan-id" : {
144+ "help" : " Channel plan ID as specified in the Wi-SUN PHY Specification. With default value 255, parameter is not used." ,
145+ "value" : " 255"
146+ },
139147 "wisun-uc-channel-function" : {
140148 "help" : " Unicast channel function." ,
141149 "value" : " 255"
Original file line number Diff line number Diff line change @@ -98,6 +98,15 @@ nsapi_error_t WisunInterface::configure()
9898 }
9999#endif
100100
101+ #if (MBED_CONF_MBED_MESH_API_WISUN_PHY_MODE_ID != 255) || (MBED_CONF_MBED_MESH_API_WISUN_CHANNEL_PLAN_ID != 255)
102+ status = set_network_phy_mode_and_channel_plan_id (MBED_CONF_MBED_MESH_API_WISUN_PHY_MODE_ID,
103+ MBED_CONF_MBED_MESH_API_WISUN_CHANNEL_PLAN_ID);
104+ if (status != MESH_ERROR_NONE) {
105+ tr_error (" Failed to set PHY mode and channel plan ID!" );
106+ return NSAPI_ERROR_PARAMETER;
107+ }
108+ #endif
109+
101110#if (MBED_CONF_MBED_MESH_API_WISUN_UC_CHANNEL_FUNCTION != 255)
102111 status = set_unicast_channel_function (static_cast <mesh_channel_function_t >(MBED_CONF_MBED_MESH_API_WISUN_UC_CHANNEL_FUNCTION),
103112 MBED_CONF_MBED_MESH_API_WISUN_UC_FIXED_CHANNEL,
@@ -306,6 +315,20 @@ mesh_error_t WisunInterface::validate_network_regulatory_domain(uint8_t regulato
306315 return MESH_ERROR_NONE;
307316}
308317
318+ mesh_error_t WisunInterface::set_network_phy_mode_and_channel_plan_id (uint8_t phy_mode_id, uint8_t channel_plan_id)
319+ {
320+ int status = ws_management_phy_mode_id_set (get_interface_id (), phy_mode_id);
321+ if (status != 0 ) {
322+ return MESH_ERROR_UNKNOWN;
323+ }
324+ status = ws_management_channel_plan_id_set (get_interface_id (), channel_plan_id);
325+ if (status != 0 ) {
326+ return MESH_ERROR_UNKNOWN;
327+ }
328+
329+ return MESH_ERROR_NONE;
330+ }
331+
309332mesh_error_t WisunInterface::set_network_size (uint8_t network_size)
310333{
311334 if (network_size == 0xff ) {
You can’t perform that action at this time.
0 commit comments