Skip to content

Commit 1d1a8f9

Browse files
authored
Merge pull request #14462 from mikaleppanen/feat_wisun_start_wisun_if
[feature-wisun] Added new start methods to Wi-SUN BR with WisunInterface parameter and deprecated the old ones
2 parents 72c3981 + fcac235 commit 1d1a8f9

File tree

2 files changed

+57
-4
lines changed

2 files changed

+57
-4
lines changed

features/nanostack/mbed-mesh-api/mbed-mesh-api/WisunBorderRouter.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ class WisunBorderRouter {
8686
* \return MESH_ERROR_NONE on success.
8787
* \return MESH_ERROR_UNKNOWN in case of failure.
8888
* */
89+
mesh_error_t start(WisunInterface *mesh_if, NetworkInterface *backbone_if);
90+
91+
/**
92+
* \brief Start Wi-SUN Border Router
93+
*
94+
* Starts Wi-SUN Border Router and routing between the mesh and backbone interfaces. Network interfaces
95+
* must be initialized and connected before calling the start. Backbone interface can be either Ethernet
96+
* (EMAC) or Cellular.
97+
*
98+
* \param mesh_if Wi-SUN mesh network interface
99+
* \param backbone_if Backbone network interface
100+
* \return MESH_ERROR_NONE on success.
101+
* \return MESH_ERROR_UNKNOWN in case of failure.
102+
* */
103+
MBED_DEPRECATED_SINCE("mbed-os-5.15.8", "Using NetworkInterface type for mesh_if is deprecated, use WisunInterface instead")
89104
mesh_error_t start(NetworkInterface *mesh_if, NetworkInterface *backbone_if);
90105

91106
/**
@@ -100,6 +115,21 @@ class WisunBorderRouter {
100115
* \return MESH_ERROR_NONE on success.
101116
* \return MESH_ERROR_UNKNOWN in case of failure.
102117
* */
118+
mesh_error_t start(WisunInterface *mesh_if, OnboardNetworkStack::Interface *backbone_if);
119+
120+
/**
121+
* \brief Start Wi-SUN Border Router
122+
*
123+
* Starts Wi-SUN Border Router and routing between the mesh and backbone interfaces. Mesh network interface
124+
* must be initialized and connected before calling the start. Backbone OnboardNetworkStack::Interface must
125+
* be brought up before calling the start. Backbone interface can be either Ethernet (EMAC) or Cellular (PPP).
126+
*
127+
* \param mesh_if Wi-SUN mesh network interface
128+
* \param backbone_if Backbone OnboardNetworkStack::Interface interface
129+
* \return MESH_ERROR_NONE on success.
130+
* \return MESH_ERROR_UNKNOWN in case of failure.
131+
* */
132+
MBED_DEPRECATED_SINCE("mbed-os-5.15.8", "Using NetworkInterface type for mesh_if is deprecated, use WisunInterface instead")
103133
mesh_error_t start(NetworkInterface *mesh_if, OnboardNetworkStack::Interface *backbone_if);
104134

105135
/**

features/nanostack/mbed-mesh-api/source/WisunBorderRouter.cpp

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,17 @@ mesh_error_t WisunBorderRouter::start(NetworkInterface *mesh_if, NetworkInterfac
4040
return MESH_ERROR_PARAM;
4141
}
4242

43-
InterfaceNanostack *nano_mesh_if = reinterpret_cast<InterfaceNanostack *>(mesh_if);
44-
int8_t mesh_if_id = nano_mesh_if->get_interface_id();
43+
WisunInterface *wisun_mesh_if = reinterpret_cast<WisunInterface *>(mesh_if);
44+
return start(wisun_mesh_if, backbone_if);
45+
}
46+
47+
mesh_error_t WisunBorderRouter::start(WisunInterface *mesh_if, NetworkInterface *backbone_if)
48+
{
49+
if (mesh_if == NULL || backbone_if == NULL) {
50+
return MESH_ERROR_PARAM;
51+
}
52+
53+
int8_t mesh_if_id = mesh_if->get_interface_id();
4554
if (mesh_if_id < 0) {
4655
return MESH_ERROR_UNKNOWN;
4756
}
@@ -71,10 +80,24 @@ mesh_error_t WisunBorderRouter::start(NetworkInterface *mesh_if, NetworkInterfac
7180
return MESH_ERROR_NONE;
7281
}
7382

83+
7484
mesh_error_t WisunBorderRouter::start(NetworkInterface *mesh_if, OnboardNetworkStack::Interface *backbone_if)
7585
{
76-
InterfaceNanostack *nano_mesh_if = reinterpret_cast<InterfaceNanostack *>(mesh_if);
77-
int8_t mesh_if_id = nano_mesh_if->get_interface_id();
86+
if (mesh_if == NULL || backbone_if == NULL) {
87+
return MESH_ERROR_PARAM;
88+
}
89+
90+
WisunInterface *wisun_mesh_if = reinterpret_cast<WisunInterface *>(mesh_if);
91+
return start(wisun_mesh_if, backbone_if);
92+
}
93+
94+
mesh_error_t WisunBorderRouter::start(WisunInterface *mesh_if, OnboardNetworkStack::Interface *backbone_if)
95+
{
96+
if (mesh_if == NULL || backbone_if == NULL) {
97+
return MESH_ERROR_PARAM;
98+
}
99+
100+
int8_t mesh_if_id = mesh_if->get_interface_id();
78101
if (mesh_if_id < 0) {
79102
return MESH_ERROR_UNKNOWN;
80103
}

0 commit comments

Comments
 (0)