Mistake on this page?
Report an issue in GitHub or email us
WisunInterface.h
1 /*
2  * Copyright (c) 2018-2019 ARM Limited. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  * Licensed under the Apache License, Version 2.0 (the License); you may
5  * not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef WISUNINTERFACE_H
18 #define WISUNINTERFACE_H
19 
20 #include "MeshInterfaceNanostack.h"
21 
22 /**
23  * \brief Struct ws_rpl_info Wi-SUN router RPL information.
24  */
25 typedef struct ws_rpl_info {
26  /** Router dodag id */
27  uint8_t rpl_dodag_id[16];
28  /** Router instance identifier */
29  uint8_t instance_id;
30  /** RPL version number */
31  uint8_t version;
32  /** RPL DODAG node current Rank */
33  uint16_t current_rank;
34  /** RPL Primary Parent Rank */
37 
38 /**
39  * \brief Struct ws_stack_state Wi-SUN stack information.
40  */
41 typedef struct ws_stack_state {
42  /** Mesh Interface Global IPv6 Address */
43  uint8_t global_addr[16];
44  /** Mesh Interface Link Local IPv6 Address */
45  uint8_t link_local_addr[16];
46  /** Parent link local address */
47  uint8_t parent_addr[16];
48  /** parent RSSI Out measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
49  uint8_t rsl_out;
50  /** parent RSSI in measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
51  uint8_t rsl_in;
52  /** Wi-SUN join state defined by Wi-SUN specification 1-5 */
53  uint8_t join_state;
54  /** Network PAN ID */
55  uint16_t pan_id;
56  /** Device RF minimum sensitivity configuration. lowest level of radio signal strength packet heard. Range of -174 (0) to +80 (254) dBm*/
57  uint8_t device_min_sens;
59 
60 /**
61  * \brief Struct ws_cca_threshold_table Wi-SUN CCA threshold table information.
62  */
63 typedef struct ws_cca_threshold_table {
64  /** Number of channels */
66  /** CCA threshold table */
67  const int8_t *cca_threshold_table;
69 
70 /** Wi-SUN mesh network interface class
71  *
72  * Configure Nanostack to use Wi-SUN protocol.
73  */
74 class WisunInterface final : public MeshInterfaceNanostack {
75 public:
76  /** Inherit MeshInterfaceNanostack constructors */
77  using MeshInterfaceNanostack::MeshInterfaceNanostack;
78 
79  /**
80  * \brief Set Wi-SUN network name.
81  *
82  * Function stores new network name to mbed-mesh-api and uses it when connect() is called next time.
83  * If device is already connected to the Wi-SUN network then device will restart network discovery after
84  * changing the network name.
85  *
86  * Function overwrites network name defined by Mbed OS configuration.
87  *
88  * \param network_name Network name as NUL terminated string. Can't exceed 32 characters and can't be NULL.
89  * \return MESH_ERROR_NONE on success.
90  * \return MESH_ERROR_UNKNOWN in case of failure.
91  * */
92  mesh_error_t set_network_name(char *network_name);
93 
94  /**
95  * \brief Get Wi-SUN network name.
96  *
97  * Function reads network name from mbed-mesh-api.
98  *
99  * \param network_name Network name as NUL terminated string. Must have space for 33 characters (string and null terminator).
100  * \return MESH_ERROR_NONE on success.
101  * \return MESH_ERROR_UNKNOWN in case of failure.
102  * */
103  mesh_error_t get_network_name(char *network_name);
104 
105  /**
106  * \brief Validate Wi-SUN network name.
107  *
108  * Function validates network name. Function can be used to test that values that will be used on set function are valid.
109  *
110  * \param network_name Network name as NUL terminated string. Can't exceed 32 characters and can't be NULL.
111  * \return MESH_ERROR_NONE on success.
112  * \return MESH_ERROR_UNKNOWN in case of failure.
113  * */
114  mesh_error_t validate_network_name(char *network_name);
115 
116  /**
117  * \brief Set Wi-SUN network regulatory domain, operating class and operating mode.
118  *
119  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
120  * If device is already connected to the Wi-SUN network then device will restart network discovery after
121  * changing the regulatory_domain, operating_class or operating_mode.
122  *
123  * Function overwrites parameters defined by Mbed OS configuration.
124  *
125  * \param regulatory_domain Values defined in Wi-SUN PHY-specification. Use 0xff to use leave parameter unchanged.
126  * \param operating_class Values defined in Wi-SUN PHY-specification. Use 0xff to use leave parameter unchanged.
127  * \param operating_mode Values defined in Wi-SUN PHY-specification. Use 0xff to use leave parameter unchanged.
128  * \return MESH_ERROR_NONE on success.
129  * \return MESH_ERROR_UNKNOWN in case of failure.
130  * */
131  mesh_error_t set_network_regulatory_domain(uint8_t regulatory_domain = 0xff, uint8_t operating_class = 0xff, uint8_t operating_mode = 0xff);
132 
133  /**
134  * \brief Get Wi-SUN network regulatory domain, operating class and operating mode.
135  *
136  * Function reads regulatory_domain, operating_class and operating_mode from mbed-mesh-api.
137  *
138  * \param regulatory_domain Values defined in Wi-SUN PHY-specification.
139  * \param operating_class Values defined in Wi-SUN PHY-specification.
140  * \param operating_mode Values defined in Wi-SUN PHY-specification.
141  * \return MESH_ERROR_NONE on success.
142  * \return MESH_ERROR_UNKNOWN in case of failure.
143  * */
144  mesh_error_t get_network_regulatory_domain(uint8_t *regulatory_domain, uint8_t *operating_class, uint8_t *operating_mode);
145 
146  /**
147  * \brief Validate Wi-SUN network regulatory domain, operating class and operating mode.
148  *
149  * Function validates regulatory_domain, operating_class and operating_mode. Function can be used to test that values that will
150  * be used on set function are valid.
151  *
152  * \param regulatory_domain Values defined in Wi-SUN PHY-specification.
153  * \param operating_class Values defined in Wi-SUN PHY-specification.
154  * \param operating_mode Values defined in Wi-SUN PHY-specification.
155  * \return MESH_ERROR_NONE on success.
156  * \return MESH_ERROR_UNKNOWN in case of failure.
157  * */
158  mesh_error_t validate_network_regulatory_domain(uint8_t regulatory_domain, uint8_t operating_class, uint8_t operating_mode);
159 
160  /**
161  * \brief Set Wi-SUN network size.
162  *
163  * Function stores network size parameter to the mbed-mesh-api and uses it when connect() is called for the next
164  * time. If a device is already connected to the Wi-SUN network, then the device will restart network discovery
165  * after changing the network size.
166  *
167  * It is recommended to set the correct network size because some Wi-SUN network configuration parameters are
168  * adjusted based on the selected network size. A network configured for a small amount of devices may not work
169  * optimally for large number of devices. This is because the network bandwidth is divided with all the devices in
170  * the network. Enough bandwidth must be reserved for application data usage as well as the Wi-SUN network
171  * operations. In addition, the application should adapt to the network characteristics by using the InternetSocket
172  * methods get_stagger_estimate_to_address() and get_rtt_estimate_to_address().
173  *
174  * The network size is measured as hundreds of devices that are expected to join to the network. For example,
175  * for a 400-device network set network size to 4.
176  *
177  * The Wi-SUN stack will automatically adjust timing and RPL configuration values based on the selected network
178  * size and data rate. If a customized timing or RPL values are needed, the APIs below should be invoked after
179  * changing the network size:
180  * - set_timing_parameters() to set timing settings to the Wi-SUN interface.
181  * - rpl_parameters_set() to set RPL settings to the Border Router interface.
182  *
183  * By default the Wi-SUN stack is configured to use a few hundreds of devices.
184  *
185  * The network size should be set to 0 when running certification tests.
186  *
187  * \param network_size Network size in hundreds of devices (e.g. 12 for 1200 devices), 0 for certificate testing.
188  * \return MESH_ERROR_NONE on success.
189  * \return MESH_ERROR_UNKNOWN in case of failure.
190  * */
191  mesh_error_t set_network_size(uint8_t network_size);
192 
193  /**
194  * \brief Get Wi-SUN network size.
195  *
196  * Function reads network size from mbed-mesh-api.
197  *
198  * \param network_size Network size in hundreds of devices, 0x00 for network size certificate.
199  * \return MESH_ERROR_NONE on success.
200  * \return MESH_ERROR_UNKNOWN in case of failure.
201  * */
202  mesh_error_t get_network_size(uint8_t *network_size);
203 
204  /**
205  * \brief Validate Wi-SUN network size.
206  *
207  * Function validates network size from mbed-mesh-api. Function can be used to test that values that will
208  * be used on set function are valid.
209  *
210  * \param network_size Network size in hundreds of devices, 0x00 for network size certificate.
211  * \return MESH_ERROR_NONE on success.
212  * \return MESH_ERROR_UNKNOWN in case of failure.
213  * */
214  mesh_error_t validate_network_size(uint8_t network_size);
215 
216  /**
217  * \brief Set Wi-SUN FHSS channel mask
218  *
219  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
220  * If device is already connected to the Wi-SUN network then settings take effect right away.
221  *
222  * \param channel_mask Values defined in Wi-SUN management API. Channel mask bit field.
223  * \return MESH_ERROR_NONE on success.
224  * \return MESH_ERROR_UNKNOWN in case of failure.
225  * */
226  mesh_error_t set_channel_mask(uint32_t channel_mask[8]);
227 
228  /**
229  * \brief Get Wi-SUN FHSS channel mask
230  *
231  * Function reads FHSS channel mask from mbed-mesh-api.
232  *
233  * \param channel_mask Values defined in Wi-SUN management API. Channel mask bit field.
234  * \return MESH_ERROR_NONE on success.
235  * \return MESH_ERROR_UNKNOWN in case of failure.
236  * */
237  mesh_error_t get_channel_mask(uint32_t *channel_mask);
238 
239  /**
240  * \brief Validate Wi-SUN FHSS channel mask
241  *
242  * Function validates FHSS channel mask. Function can be used to test that values that will
243  * be used on set function are valid.
244  *
245  * \param channel_mask Values defined in Wi-SUN management API. Channel mask bit field.
246  * \return MESH_ERROR_NONE on success.
247  * \return MESH_ERROR_UNKNOWN in case of failure.
248  * */
249  mesh_error_t validate_channel_mask(uint32_t channel_mask[8]);
250 
251  /**
252  * \brief Set Wi-SUN FHSS unicast channel function parameters
253  *
254  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
255  * If device is already connected to the Wi-SUN network then device will restart network discovery after
256  * changing the channel function, fixed channel or dwell interval.
257  *
258  * Function overwrites parameters defined by Mbed OS configuration.
259  *
260  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
261  * \param fixed_channel Used channel when channel function is fixed channel. Use 0xffff when fixed channel function not on use.
262  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1. Use 0x00 to use leave parameter unchanged.
263  * \return MESH_ERROR_NONE on success.
264  * \return MESH_ERROR_UNKNOWN in case of failure.
265  * */
266  mesh_error_t set_unicast_channel_function(mesh_channel_function_t channel_function, uint16_t fixed_channel = 0xffff, uint8_t dwell_interval = 0x00);
267 
268  /**
269  * \brief Get Wi-SUN FHSS unicast channel function parameters
270  *
271  * Function reads FHSS unicast channel function parameters from mbed-mesh-api.
272  *
273  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
274  * \param fixed_channel Used channel when channel function is fixed channel.
275  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
276  * \return MESH_ERROR_NONE on success.
277  * \return MESH_ERROR_UNKNOWN in case of failure.
278  * */
279  mesh_error_t get_unicast_channel_function(mesh_channel_function_t *channel_function, uint16_t *fixed_channel, uint8_t *dwell_interval);
280 
281  /**
282  * \brief Validate Wi-SUN FHSS unicast channel function parameters
283  *
284  * Function validates FHSS unicast channel function parameters. Function can be used to test that values that will
285  * be used on set function are valid.
286  *
287  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
288  * \param fixed_channel Used channel when channel function is fixed channel.
289  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
290  * \return MESH_ERROR_NONE on success.
291  * \return MESH_ERROR_UNKNOWN in case of failure.
292  * */
293  mesh_error_t validate_unicast_channel_function(mesh_channel_function_t channel_function, uint16_t fixed_channel, uint8_t dwell_interval);
294 
295  /**
296  * \brief Set Wi-SUN FHSS broadcast channel function parameters
297  *
298  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
299  * If device is already connected to the Wi-SUN network then device will restart network discovery after
300  * changing the channel function, fixed channel, dwell interval or broadcast_interval.
301  *
302  * Function overwrites parameters defined by Mbed OS configuration.
303  *
304  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
305  * \param fixed_channel Used channel when channel function is fixed channel. Use 0xffff when fixed channel function not on use.
306  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1. Use 0x00 to use leave parameter unchanged.
307  * \param broadcast_interval Used broadcast interval. Use 0x00 to use leave parameter unchanged.
308  * \return MESH_ERROR_NONE on success.
309  * \return MESH_ERROR_UNKNOWN in case of failure.
310  * */
311  mesh_error_t set_broadcast_channel_function(mesh_channel_function_t channel_function, uint16_t fixed_channel = 0xffff, uint8_t dwell_interval = 0x00, uint32_t broadcast_interval = 0x00);
312 
313  /**
314  * \brief Get Wi-SUN FHSS broadcast channel function parameters
315  *
316  * Function reads FHSS broadcast channel function parameters from mbed-mesh-api.
317  *
318  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
319  * \param fixed_channel Used channel when channel function is fixed channel.
320  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
321  * \param broadcast_interval Used broadcast interval.
322  * \return MESH_ERROR_NONE on success.
323  * \return MESH_ERROR_UNKNOWN in case of failure.
324  * */
325  mesh_error_t get_broadcast_channel_function(mesh_channel_function_t *channel_function, uint16_t *fixed_channel, uint8_t *dwell_interval, uint32_t *broadcast_interval);
326 
327  /**
328  * \brief Validate Wi-SUN FHSS broadcast channel function parameters
329  *
330  * Function validates FHSS broadcast channel function parameters from mbed-mesh-api. Function can be used to test that values that will
331  * be used on set function are valid.
332  *
333  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
334  * \param fixed_channel Used channel when channel function is fixed channel.
335  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
336  * \param broadcast_interval Used broadcast interval.
337  * \return MESH_ERROR_NONE on success.
338  * \return MESH_ERROR_UNKNOWN in case of failure.
339  * */
340  mesh_error_t validate_broadcast_channel_function(mesh_channel_function_t channel_function, uint16_t fixed_channel, uint8_t dwell_interval, uint32_t broadcast_interval);
341 
342  /**
343  * \brief Set Wi-SUN timing parameters
344  *
345  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
346  * If device is already connected to the Wi-SUN network then settings take effect right away.
347  *
348  * \param disc_trickle_imin Discovery trickle Imin. Range 1-255 seconds. Use 0x00 to use leave parameter unchanged.
349  * \param disc_trickle_imax Discovery trickle Imax. Range (2-2^8)*Imin. Use 0x00 to use leave parameter unchanged.
350  * \param disc_trickle_k Discovery trickle k. Use 0x00 to use leave parameter unchanged.
351  * \param pan_timeout PAN timeout; seconds; Range 60-15300 seconds. Use 0x00 to use leave parameter unchanged.
352  * \return MESH_ERROR_NONE on success.
353  * \return MESH_ERROR_UNKNOWN in case of failure.
354  * */
355  mesh_error_t set_timing_parameters(uint16_t disc_trickle_imin = 0x00, uint16_t disc_trickle_imax = 0x00, uint8_t disc_trickle_k = 0x00, uint16_t pan_timeout = 0x00);
356 
357  /**
358  * \brief Get Wi-SUN timing parameters
359  *
360  * Function reads timing parameters from mbed-mesh-api.
361  *
362  * \param disc_trickle_imin Discovery trickle Imin. Range 1-255 seconds.
363  * \param disc_trickle_imax Discovery trickle Imax. Range (2-2^8)*Imin.
364  * \param disc_trickle_k Discovery trickle k.
365  * \param pan_timeout PAN timeout; seconds; Range 60-15300 seconds.
366  * \return MESH_ERROR_NONE on success.
367  * \return MESH_ERROR_UNKNOWN in case of failure.
368  * */
369  mesh_error_t get_timing_parameters(uint16_t *disc_trickle_imin, uint16_t *disc_trickle_imax, uint8_t *disc_trickle_k, uint16_t *pan_timeout);
370 
371  /**
372  * \brief Validates Wi-SUN timing parameters
373  *
374  * Function validates timing parameters. Function can be used to test that values that will be used on set
375  * function are valid.
376  *
377  * \param disc_trickle_imin Discovery trickle Imin. Range 1-255 seconds.
378  * \param disc_trickle_imax Discovery trickle Imax. Range (2-2^8)*Imin.
379  * \param disc_trickle_k Discovery trickle k.
380  * \param pan_timeout PAN timeout; seconds; Range 60-15300 seconds.
381  * \return MESH_ERROR_NONE on success.
382  * \return MESH_ERROR_UNKNOWN in case of failure.
383  * */
384  mesh_error_t validate_timing_parameters(uint16_t disc_trickle_imin, uint16_t disc_trickle_imax, uint8_t disc_trickle_k, uint16_t pan_timeout);
385 
386  /**
387  * \brief Set Wi-SUN device minimum sensitivity
388  *
389  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
390  * If device is already connected to the Wi-SUN network then settings take effect right away.
391  *
392  * \param device_min_sens Device minimum sensitivity. Range 0(-174 dB) to 254(+80 dB).
393  * \return MESH_ERROR_NONE on success.
394  * \return MESH_ERROR_UNKNOWN in case of failure.
395  * */
396  mesh_error_t set_device_min_sens(uint8_t device_min_sens);
397 
398  /**
399  * \brief Get Wi-SUN device minimum sensitivity.
400  *
401  * Function reads device minimum sensitivity from mbed-mesh-api.
402  *
403  * \param device_min_sens Device minimum sensitivity. Range 0-254.
404  * \return MESH_ERROR_NONE on success.
405  * \return MESH_ERROR_UNKNOWN in case of failure.
406  * */
407  mesh_error_t get_device_min_sens(uint8_t *device_min_sens);
408 
409  /**
410  * \brief Validates Device minimum sensitivity.
411  *
412  * Function validates device minimum sensitivity. Function can be used to test that values that will be used on set
413  * function are valid.
414  *
415  * \param device_min_sens Device minimum sensitivity. Range 0-254.
416  * \return MESH_ERROR_NONE on success.
417  * \return MESH_ERROR_UNKNOWN in case of failure.
418  * */
419  mesh_error_t validate_device_min_sens(uint8_t device_min_sens);
420 
421  /**
422  * \brief Set own certificate and private key reference to the Wi-SUN network.
423  *
424  * Function can be called several times if intermediate certificates are used. Then each call to the function
425  * adds a certificate reference to own certificate chain. Certificates are in bottom up order i.e. own certificate
426  * is given first and the top certificate is given last.
427  *
428  * PEM formatted certificates must use either "\n" or "\r\n" as line separator. PEM formatted certificates
429  * must be NUL terminated and the NUL terminator is counted to certificate length.
430  *
431  * It is possible to add multiple PEM certificates concatenated together in one call set_own_certificate(). In that
432  * case certificates are in bottom up order i.e. own certificate is given first and the top certificate is given
433  * last. NUL terminator is added after the last concatenated certificate and the NUL terminator is counted to
434  * total concatenated certificate length.
435  *
436  * Function must be called before connecting the device i.e before call to connect() method.
437  * Function will not copy certificate or key, therefore addresses must remain valid.
438  *
439  * \param cert Certificate address.
440  * \param cert_len Certificate length in bytes.
441  * \param cert_key Certificate key address.
442  * \param cert_key_len Certificate key length in bytes.
443  * \return MESH_ERROR_NONE on success.
444  * \return MESH_ERROR_STATE if method is called after calling connect().
445  * \return MESH_ERROR_MEMORY in case of memory allocation failure.
446  * */
447  mesh_error_t set_own_certificate(uint8_t *cert, uint16_t cert_len, uint8_t *cert_key = NULL, uint16_t cert_key_len = 0);
448 
449  /**
450  * \brief Remove own certificates from the Wi-SUN network.
451  *
452  * Function must be called before connecting the device i.e before call to connect() method.
453  *
454  * \return MESH_ERROR_NONE on success.
455  * \return MESH_ERROR_STATE if method is called after calling connect().
456  * */
457  mesh_error_t remove_own_certificates(void);
458 
459  /**
460  * \brief Set trusted certificate reference to the Wi-SUN network.
461  *
462  * Function can be called several times. Each call to the function adds a trusted certificate to Wi-SUN.
463  *
464  * PEM formatted certificates must use either "\n" or "\r\n" as line separator. PEM formatted certificates
465  * must be NUL terminated and the NUL terminator is counted to certificate length.
466  *
467  * It is possible to add multiple PEM certificates concatenated together in one call set_trusted_certificate().
468  * NUL terminator is added after the last concatenated certificate and the NUL terminator is counted to
469  * total concatenated certificate length.
470  *
471  * Function must be called before connecting the device i.e before call to connect() method.
472  * Function will not copy certificate, therefore addresses must remain valid.
473  *
474  * \param cert Certificate address.
475  * \param cert_len Certificate length in bytes.
476  * \return MESH_ERROR_NONE on success.
477  * \return MESH_ERROR_STATE if method is called after calling connect().
478  * \return MESH_ERROR_MEMORY in case of memory allocation failure.
479  * */
480  mesh_error_t set_trusted_certificate(uint8_t *cert, uint16_t cert_len);
481 
482  /**
483  * \brief Remove trusted certificates from the Wi-SUN network.
484  *
485  * Function must be called before connecting the device i.e before call to connect() method.
486  *
487  * \return MESH_ERROR_NONE on success.
488  * \return MESH_ERROR_STATE if method is called after calling connect().
489  * */
490  mesh_error_t remove_trusted_certificates(void);
491 
492  /**
493  * \brief Get router IP address
494  *
495  * \param address
496  * \param len
497  * */
498  bool getRouterIpAddress(char *address, int8_t len);
499 
500  /**
501  * \brief Enable Wi-SUN statistics
502  *
503  * After enabling statistics those can be read using the network, physical layer,
504  * MAC and FHSS and Wi-SUN statistics read functions.
505  *
506  * \return MESH_ERROR_NONE on success.
507  * \return MESH_ERROR_UNKNOWN on error
508  * */
509  mesh_error_t enable_statistics(void);
510 
511  /**
512  * \brief Reads Wi-SUN network statistics
513  *
514  * Reads network statistics.
515  *
516  * \param statistics Network statistics.
517  * \return MESH_ERROR_NONE on success.
518  * \return MESH_ERROR_UNKNOWN on error
519  * */
520  mesh_error_t read_nw_statistics(mesh_nw_statistics_t *statistics);
521 
522  /**
523  * \brief Reads Wi-SUN MAC statistics
524  *
525  * Reads MAC statistics.
526  *
527  * \param statistics MAC statistics.
528  * \return MESH_ERROR_NONE on success.
529  * \return MESH_ERROR_UNKNOWN on error
530  * */
531  mesh_error_t read_mac_statistics(mesh_mac_statistics_t *statistics);
532 
533  /**
534  * \brief Get Wi-SUN Router information.
535  *
536  * Function reads RPL information from nanostack.
537  * Mesh interface must be initialized before calling this function.
538  *
539  * \param info_ptr Structure given to stack where information will be stored
540  *
541  * \return MESH_ERROR_NONE on success.
542  * \return MESH_ERROR_UNKNOWN in case of failure.
543  * */
544  mesh_error_t info_get(ws_rpl_info_t *info_ptr);
545 
546  /**
547  * \brief Get Wi-SUN Stack information.
548  *
549  * Function reads Stack information from nanostack.
550  * Mesh interface must be initialized before calling this function.
551  *
552  * \param stack_info_ptr Structure given to stack where information will be stored
553  *
554  * \return MESH_ERROR_NONE on success.
555  * \return MESH_ERROR_UNKNOWN in case of failure.
556  * */
557  mesh_error_t stack_info_get(ws_stack_state_t *stack_info_ptr);
558 
559  /**
560  * \brief Get Wi-SUN CCA threshold table information.
561  *
562  * Function reads CCA threshold table from nanostack.
563  *
564  ** \param ws_cca_threshold_table_t Structure given to stack where information will be stored
565  **
566  * \return MESH_ERROR_NONE on success.
567  * \return MESH_ERROR_UNKNOWN in case of failure.
568  * */
569  mesh_error_t cca_threshold_table_get(ws_cca_threshold_table_t *table);
570 
571 protected:
572  Nanostack::WisunInterface *get_interface() const;
573  nsapi_error_t do_initialize() override;
574  virtual nsapi_error_t configure();
575 };
576 
577 #endif
uint8_t join_state
Wi-SUN join state defined by Wi-SUN specification 1-5.
Wi-SUN mesh network interface class.
uint8_t version
RPL version number.
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:140
uint16_t primary_parent_rank
RPL Primary Parent Rank.
Mesh physical layer statistics.
Mesh network statistics.
Struct ws_stack_state Wi-SUN stack information.
uint8_t instance_id
Router instance identifier.
const int8_t * cca_threshold_table
CCA threshold table.
uint8_t number_of_channels
Number of channels.
Struct ws_cca_threshold_table Wi-SUN CCA threshold table information.
uint8_t rsl_out
parent RSSI Out measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) ...
uint8_t rsl_in
parent RSSI in measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) t...
uint8_t device_min_sens
Device RF minimum sensitivity configuration.
uint8_t rpl_dodag_id[16]
Router dodag id.
Struct ws_rpl_info Wi-SUN router RPL information.
uint16_t current_rank
RPL DODAG node current Rank.
uint16_t pan_id
Network PAN ID.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.