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 typedef enum {
71  WISUN_OTHER = 0, /**< temporary or soon to be removed neighbor*/
72  WISUN_PRIMARY_PARENT, /**< Primary parent used for upward packets and used from Border router downwards*/
73  WISUN_SECONDARY_PARENT, /**< Secondary parent reported to border router and might be used as alternate route*/
74  WISUN_CANDIDATE_PARENT, /**< Candidate neighbor that is considered as parent if there is problem with active parents*/
75  WISUN_CHILD /**< Child with registered address*/
76 } ws_nbr_type_e;
77 
78 /**
79  * \brief Struct ws_nbr_info_t Gives the neighbor information.
80  */
81 typedef struct ws_nbr_info {
82  /** Link local address*/
83  uint8_t link_local_address[16];
84  /** Global address if it is known set to 0 if not available*/
85  uint8_t global_address[16];
86  /** parent RSSI Out measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
87  uint8_t rsl_out;
88  /** parent RSSI in measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
89  uint8_t rsl_in;
90  /** RPL Rank value for parents 0xffff for neighbors RANK is unknown*/
91  uint16_t rpl_rank;
92  /** Measured ETX value if known set to 0xFFFF if not known or Child*/
93  uint16_t etx;
94  /** Remaining lifetime Link lifetime for parents and ARO lifetime for children*/
95  uint32_t lifetime;
96  /** Neighbour type (Primary Parent, Secondary Parent, Candidate parent, child, other(Temporary neighbours))*/
97  ws_nbr_type_e type;
99 
100 
101 /** Wi-SUN mesh network interface class
102  *
103  * Configure Nanostack to use Wi-SUN protocol.
104  */
106 public:
107  /** Inherit MeshInterfaceNanostack constructors */
108  using MeshInterfaceNanostack::MeshInterfaceNanostack;
109 
110  /**
111  * \brief Set Wi-SUN network name.
112  *
113  * Function stores new network name to mbed-mesh-api and uses it when connect() is called next time.
114  * If device is already connected to the Wi-SUN network then device will restart network discovery after
115  * changing the network name.
116  *
117  * Function overwrites network name defined by Mbed OS configuration.
118  *
119  * \param network_name Network name as NUL terminated string. Can't exceed 32 characters and can't be NULL.
120  * \return MESH_ERROR_NONE on success.
121  * \return MESH_ERROR_UNKNOWN in case of failure.
122  * */
123  mesh_error_t set_network_name(char *network_name);
124 
125  /**
126  * \brief Get Wi-SUN network name.
127  *
128  * Function reads network name from mbed-mesh-api.
129  *
130  * \param network_name Network name as NUL terminated string. Must have space for 33 characters (string and null terminator).
131  * \return MESH_ERROR_NONE on success.
132  * \return MESH_ERROR_UNKNOWN in case of failure.
133  * */
134  mesh_error_t get_network_name(char *network_name);
135 
136  /**
137  * \brief Validate Wi-SUN network name.
138  *
139  * Function validates network name. Function can be used to test that values that will be used on set function are valid.
140  *
141  * \param network_name Network name as NUL terminated string. Can't exceed 32 characters and can't be NULL.
142  * \return MESH_ERROR_NONE on success.
143  * \return MESH_ERROR_UNKNOWN in case of failure.
144  * */
145  mesh_error_t validate_network_name(char *network_name);
146 
147  /**
148  * \brief Set Wi-SUN network regulatory domain, operating class and operating mode.
149  *
150  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
151  * If device is already connected to the Wi-SUN network then device will restart network discovery after
152  * changing the regulatory_domain, operating_class or operating_mode.
153  *
154  * Function overwrites parameters defined by Mbed OS configuration.
155  *
156  * \param regulatory_domain Values defined in Wi-SUN PHY-specification. Use 0xff to use leave parameter unchanged.
157  * \param operating_class Values defined in Wi-SUN PHY-specification. Use 0xff to use leave parameter unchanged.
158  * \param operating_mode Values defined in Wi-SUN PHY-specification. Use 0xff to use leave parameter unchanged.
159  * \return MESH_ERROR_NONE on success.
160  * \return MESH_ERROR_UNKNOWN in case of failure.
161  * */
162  mesh_error_t set_network_regulatory_domain(uint8_t regulatory_domain = 0xff, uint8_t operating_class = 0xff, uint8_t operating_mode = 0xff);
163 
164  /**
165  * \brief Get Wi-SUN network regulatory domain, operating class and operating mode.
166  *
167  * Function reads regulatory_domain, operating_class and operating_mode from mbed-mesh-api.
168  *
169  * \param regulatory_domain Values defined in Wi-SUN PHY-specification.
170  * \param operating_class Values defined in Wi-SUN PHY-specification.
171  * \param operating_mode Values defined in Wi-SUN PHY-specification.
172  * \return MESH_ERROR_NONE on success.
173  * \return MESH_ERROR_UNKNOWN in case of failure.
174  * */
175  mesh_error_t get_network_regulatory_domain(uint8_t *regulatory_domain, uint8_t *operating_class, uint8_t *operating_mode);
176 
177  /**
178  * \brief Validate Wi-SUN network regulatory domain, operating class and operating mode.
179  *
180  * Function validates regulatory_domain, operating_class and operating_mode. Function can be used to test that values that will
181  * be used on set function are valid.
182  *
183  * \param regulatory_domain Values defined in Wi-SUN PHY-specification.
184  * \param operating_class Values defined in Wi-SUN PHY-specification.
185  * \param operating_mode Values defined in Wi-SUN PHY-specification.
186  * \return MESH_ERROR_NONE on success.
187  * \return MESH_ERROR_UNKNOWN in case of failure.
188  * */
189  mesh_error_t validate_network_regulatory_domain(uint8_t regulatory_domain, uint8_t operating_class, uint8_t operating_mode);
190 
191  /**
192  * \brief Set Wi-SUN network size.
193  *
194  * Function stores network size parameter to the mbed-mesh-api and uses it when connect() is called for the next
195  * time. If a device is already connected to the Wi-SUN network, then the device will restart network discovery
196  * after changing the network size.
197  *
198  * It is recommended to set the correct network size because some Wi-SUN network configuration parameters are
199  * adjusted based on the selected network size. A network configured for a small amount of devices may not work
200  * optimally for large number of devices. This is because the network bandwidth is divided with all the devices in
201  * the network. Enough bandwidth must be reserved for application data usage as well as the Wi-SUN network
202  * operations. In addition, the application should adapt to the network characteristics by using the InternetSocket
203  * methods get_stagger_estimate_to_address() and get_rtt_estimate_to_address().
204  *
205  * The network size is measured as hundreds of devices that are expected to join to the network. For example,
206  * for a 400-device network set network size to 4.
207  *
208  * The Wi-SUN stack will automatically adjust timing and RPL configuration values based on the selected network
209  * size and data rate. If a customized timing or RPL values are needed, the APIs below should be invoked after
210  * changing the network size:
211  * - set_timing_parameters() to set timing settings to the Wi-SUN interface.
212  * - rpl_parameters_set() to set RPL settings to the Border Router interface.
213  *
214  * By default the Wi-SUN stack is configured to use a few hundreds of devices.
215  *
216  * The network size should be set to 0 when running certification tests.
217  *
218  * \param network_size Network size in hundreds of devices (e.g. 12 for 1200 devices), 0 for certificate testing.
219  * \return MESH_ERROR_NONE on success.
220  * \return MESH_ERROR_UNKNOWN in case of failure.
221  * */
222  mesh_error_t set_network_size(uint8_t network_size);
223 
224  /**
225  * \brief Get Wi-SUN network size.
226  *
227  * Function reads network size from mbed-mesh-api.
228  *
229  * \param network_size Network size in hundreds of devices, 0x00 for network size certificate.
230  * \return MESH_ERROR_NONE on success.
231  * \return MESH_ERROR_UNKNOWN in case of failure.
232  * */
233  mesh_error_t get_network_size(uint8_t *network_size);
234 
235  /**
236  * \brief Validate Wi-SUN network size.
237  *
238  * Function validates network size from mbed-mesh-api. Function can be used to test that values that will
239  * be used on set function are valid.
240  *
241  * \param network_size Network size in hundreds of devices, 0x00 for network size certificate.
242  * \return MESH_ERROR_NONE on success.
243  * \return MESH_ERROR_UNKNOWN in case of failure.
244  * */
245  mesh_error_t validate_network_size(uint8_t network_size);
246 
247  /**
248  * \brief Set Wi-SUN FHSS channel mask
249  *
250  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
251  * If device is already connected to the Wi-SUN network then settings take effect right away.
252  *
253  * \param channel_mask Values defined in Wi-SUN management API. Channel mask bit field.
254  * \return MESH_ERROR_NONE on success.
255  * \return MESH_ERROR_UNKNOWN in case of failure.
256  * */
257  mesh_error_t set_channel_mask(uint32_t channel_mask[8]);
258 
259  /**
260  * \brief Get Wi-SUN FHSS channel mask
261  *
262  * Function reads FHSS channel mask from mbed-mesh-api.
263  *
264  * \param channel_mask Values defined in Wi-SUN management API. Channel mask bit field.
265  * \return MESH_ERROR_NONE on success.
266  * \return MESH_ERROR_UNKNOWN in case of failure.
267  * */
268  mesh_error_t get_channel_mask(uint32_t *channel_mask);
269 
270  /**
271  * \brief Validate Wi-SUN FHSS channel mask
272  *
273  * Function validates FHSS channel mask. Function can be used to test that values that will
274  * be used on set function are valid.
275  *
276  * \param channel_mask Values defined in Wi-SUN management API. Channel mask bit field.
277  * \return MESH_ERROR_NONE on success.
278  * \return MESH_ERROR_UNKNOWN in case of failure.
279  * */
280  mesh_error_t validate_channel_mask(uint32_t channel_mask[8]);
281 
282  /**
283  * \brief Set Wi-SUN FHSS unicast channel function parameters
284  *
285  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
286  * If device is already connected to the Wi-SUN network then device will restart network discovery after
287  * changing the channel function, fixed channel or dwell interval.
288  *
289  * Function overwrites parameters defined by Mbed OS configuration.
290  *
291  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
292  * \param fixed_channel Used channel when channel function is fixed channel. Use 0xffff when fixed channel function not on use.
293  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1. Use 0x00 to use leave parameter unchanged.
294  * \return MESH_ERROR_NONE on success.
295  * \return MESH_ERROR_UNKNOWN in case of failure.
296  * */
297  mesh_error_t set_unicast_channel_function(mesh_channel_function_t channel_function, uint16_t fixed_channel = 0xffff, uint8_t dwell_interval = 0x00);
298 
299  /**
300  * \brief Get Wi-SUN FHSS unicast channel function parameters
301  *
302  * Function reads FHSS unicast channel function parameters from mbed-mesh-api.
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.
306  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
307  * \return MESH_ERROR_NONE on success.
308  * \return MESH_ERROR_UNKNOWN in case of failure.
309  * */
310  mesh_error_t get_unicast_channel_function(mesh_channel_function_t *channel_function, uint16_t *fixed_channel, uint8_t *dwell_interval);
311 
312  /**
313  * \brief Validate Wi-SUN FHSS unicast channel function parameters
314  *
315  * Function validates FHSS unicast channel function parameters. Function can be used to test that values that will
316  * be used on set function are valid.
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  * \return MESH_ERROR_NONE on success.
322  * \return MESH_ERROR_UNKNOWN in case of failure.
323  * */
324  mesh_error_t validate_unicast_channel_function(mesh_channel_function_t channel_function, uint16_t fixed_channel, uint8_t dwell_interval);
325 
326  /**
327  * \brief Set Wi-SUN FHSS broadcast channel function parameters
328  *
329  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
330  * If device is already connected to the Wi-SUN network then device will restart network discovery after
331  * changing the channel function, fixed channel, dwell interval or broadcast_interval.
332  *
333  * Function overwrites parameters defined by Mbed OS configuration.
334  *
335  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
336  * \param fixed_channel Used channel when channel function is fixed channel. Use 0xffff when fixed channel function not on use.
337  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1. Use 0x00 to use leave parameter unchanged.
338  * \param broadcast_interval Used broadcast interval. Use 0x00 to use leave parameter unchanged.
339  * \return MESH_ERROR_NONE on success.
340  * \return MESH_ERROR_UNKNOWN in case of failure.
341  * */
342  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);
343 
344  /**
345  * \brief Get Wi-SUN FHSS broadcast channel function parameters
346  *
347  * Function reads FHSS broadcast channel function parameters from mbed-mesh-api.
348  *
349  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
350  * \param fixed_channel Used channel when channel function is fixed channel.
351  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
352  * \param broadcast_interval Used broadcast interval.
353  * \return MESH_ERROR_NONE on success.
354  * \return MESH_ERROR_UNKNOWN in case of failure.
355  * */
356  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);
357 
358  /**
359  * \brief Validate Wi-SUN FHSS broadcast channel function parameters
360  *
361  * Function validates FHSS broadcast channel function parameters from mbed-mesh-api. Function can be used to test that values that will
362  * be used on set function are valid.
363  *
364  * \param channel_function Channel function. Fixed, TR51CF, DH1CF or vendor defined.
365  * \param fixed_channel Used channel when channel function is fixed channel.
366  * \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
367  * \param broadcast_interval Used broadcast interval.
368  * \return MESH_ERROR_NONE on success.
369  * \return MESH_ERROR_UNKNOWN in case of failure.
370  * */
371  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);
372 
373  /**
374  * \brief Set Wi-SUN timing parameters
375  *
376  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
377  * If device is already connected to the Wi-SUN network then settings take effect right away.
378  *
379  * \param disc_trickle_imin Discovery trickle Imin. Range 1-255 seconds. Use 0x00 to use leave parameter unchanged.
380  * \param disc_trickle_imax Discovery trickle Imax. Range (2-2^8)*Imin. Use 0x00 to use leave parameter unchanged.
381  * \param disc_trickle_k Discovery trickle k. Use 0x00 to use leave parameter unchanged.
382  * \param pan_timeout PAN timeout; seconds; Range 60-15300 seconds. Use 0x00 to use leave parameter unchanged.
383  * \return MESH_ERROR_NONE on success.
384  * \return MESH_ERROR_UNKNOWN in case of failure.
385  * */
386  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);
387 
388  /**
389  * \brief Get Wi-SUN timing parameters
390  *
391  * Function reads timing parameters from mbed-mesh-api.
392  *
393  * \param disc_trickle_imin Discovery trickle Imin. Range 1-255 seconds.
394  * \param disc_trickle_imax Discovery trickle Imax. Range (2-2^8)*Imin.
395  * \param disc_trickle_k Discovery trickle k.
396  * \param pan_timeout PAN timeout; seconds; Range 60-15300 seconds.
397  * \return MESH_ERROR_NONE on success.
398  * \return MESH_ERROR_UNKNOWN in case of failure.
399  * */
400  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);
401 
402  /**
403  * \brief Validates Wi-SUN timing parameters
404  *
405  * Function validates timing parameters. Function can be used to test that values that will be used on set
406  * function are valid.
407  *
408  * \param disc_trickle_imin Discovery trickle Imin. Range 1-255 seconds.
409  * \param disc_trickle_imax Discovery trickle Imax. Range (2-2^8)*Imin.
410  * \param disc_trickle_k Discovery trickle k.
411  * \param pan_timeout PAN timeout; seconds; Range 60-15300 seconds.
412  * \return MESH_ERROR_NONE on success.
413  * \return MESH_ERROR_UNKNOWN in case of failure.
414  * */
415  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);
416 
417  /**
418  * \brief Set Wi-SUN device minimum sensitivity
419  *
420  * Function stores new parameters to mbed-mesh-api and uses them when connect() is called next time.
421  * If device is already connected to the Wi-SUN network then settings take effect right away.
422  *
423  * \param device_min_sens Device minimum sensitivity. Range 0(-174 dB) to 254(+80 dB).
424  * \return MESH_ERROR_NONE on success.
425  * \return MESH_ERROR_UNKNOWN in case of failure.
426  * */
427  mesh_error_t set_device_min_sens(uint8_t device_min_sens);
428 
429  /**
430  * \brief Get Wi-SUN device minimum sensitivity.
431  *
432  * Function reads device minimum sensitivity from mbed-mesh-api.
433  *
434  * \param device_min_sens Device minimum sensitivity. Range 0-254.
435  * \return MESH_ERROR_NONE on success.
436  * \return MESH_ERROR_UNKNOWN in case of failure.
437  * */
438  mesh_error_t get_device_min_sens(uint8_t *device_min_sens);
439 
440  /**
441  * \brief Validates Device minimum sensitivity.
442  *
443  * Function validates device minimum sensitivity. Function can be used to test that values that will be used on set
444  * function are valid.
445  *
446  * \param device_min_sens Device minimum sensitivity. Range 0-254.
447  * \return MESH_ERROR_NONE on success.
448  * \return MESH_ERROR_UNKNOWN in case of failure.
449  * */
450  mesh_error_t validate_device_min_sens(uint8_t device_min_sens);
451 
452  /**
453  * \brief Set own certificate and private key reference to the Wi-SUN network.
454  *
455  * Function can be called several times if intermediate certificates are used. Then each call to the function
456  * adds a certificate reference to own certificate chain. Certificates are in bottom up order i.e. own certificate
457  * is given first and the top certificate is given last.
458  *
459  * PEM formatted certificates must use either "\n" or "\r\n" as line separator. PEM formatted certificates
460  * must be NUL terminated and the NUL terminator is counted to certificate length.
461  *
462  * It is possible to add multiple PEM certificates concatenated together in one call set_own_certificate(). In that
463  * case certificates are in bottom up order i.e. own certificate is given first and the top certificate is given
464  * last. NUL terminator is added after the last concatenated certificate and the NUL terminator is counted to
465  * total concatenated certificate length.
466  *
467  * Function must be called before connecting the device i.e before call to connect() method.
468  * Function will not copy certificate or key, therefore addresses must remain valid.
469  *
470  * \param cert Certificate address.
471  * \param cert_len Certificate length in bytes.
472  * \param cert_key Certificate key address.
473  * \param cert_key_len Certificate key length in bytes.
474  * \return MESH_ERROR_NONE on success.
475  * \return MESH_ERROR_STATE if method is called after calling connect().
476  * \return MESH_ERROR_MEMORY in case of memory allocation failure.
477  * */
478  mesh_error_t set_own_certificate(uint8_t *cert, uint16_t cert_len, uint8_t *cert_key = NULL, uint16_t cert_key_len = 0);
479 
480  /**
481  * \brief Remove own certificates from the Wi-SUN network.
482  *
483  * Function must be called before connecting the device i.e before call to connect() method.
484  *
485  * \return MESH_ERROR_NONE on success.
486  * \return MESH_ERROR_STATE if method is called after calling connect().
487  * */
488  mesh_error_t remove_own_certificates(void);
489 
490  /**
491  * \brief Set trusted certificate reference to the Wi-SUN network.
492  *
493  * Function can be called several times. Each call to the function adds a trusted certificate to Wi-SUN.
494  *
495  * PEM formatted certificates must use either "\n" or "\r\n" as line separator. PEM formatted certificates
496  * must be NUL terminated and the NUL terminator is counted to certificate length.
497  *
498  * It is possible to add multiple PEM certificates concatenated together in one call set_trusted_certificate().
499  * NUL terminator is added after the last concatenated certificate and the NUL terminator is counted to
500  * total concatenated certificate length.
501  *
502  * Function must be called before connecting the device i.e before call to connect() method.
503  * Function will not copy certificate, therefore addresses must remain valid.
504  *
505  * \param cert Certificate address.
506  * \param cert_len Certificate length in bytes.
507  * \return MESH_ERROR_NONE on success.
508  * \return MESH_ERROR_STATE if method is called after calling connect().
509  * \return MESH_ERROR_MEMORY in case of memory allocation failure.
510  * */
511  mesh_error_t set_trusted_certificate(uint8_t *cert, uint16_t cert_len);
512 
513  /**
514  * \brief Remove trusted certificates from the Wi-SUN network.
515  *
516  * Function must be called before connecting the device i.e before call to connect() method.
517  *
518  * \return MESH_ERROR_NONE on success.
519  * \return MESH_ERROR_STATE if method is called after calling connect().
520  * */
521  mesh_error_t remove_trusted_certificates(void);
522 
523  /**
524  * \brief Get router IP address
525  *
526  * \param address
527  * \param len
528  * */
529  bool getRouterIpAddress(char *address, int8_t len);
530 
531  /**
532  * \brief Enable Wi-SUN statistics
533  *
534  * After enabling statistics those can be read using the network, physical layer,
535  * MAC and FHSS and Wi-SUN statistics read functions.
536  *
537  * \return MESH_ERROR_NONE on success.
538  * \return MESH_ERROR_UNKNOWN on error
539  * */
540  mesh_error_t enable_statistics(void);
541 
542  /**
543  * \brief Reset Wi-SUN statistics
544  *
545  * Resets MAC statistics and Wi-SUN statistics.
546  *
547  * \return MESH_ERROR_NONE on success.
548  * \return MESH_ERROR_UNKNOWN on error
549  * */
550  mesh_error_t reset_statistics(void);
551 
552  /**
553  * \brief Reads Wi-SUN network statistics
554  *
555  * Reads network statistics.
556  *
557  * \param statistics Network statistics.
558  * \return MESH_ERROR_NONE on success.
559  * \return MESH_ERROR_UNKNOWN on error
560  * */
561  mesh_error_t read_nw_statistics(mesh_nw_statistics_t *statistics);
562 
563  /**
564  * \brief Reads Wi-SUN MAC statistics
565  *
566  * Reads MAC statistics.
567  *
568  * \param statistics MAC statistics.
569  * \return MESH_ERROR_NONE on success.
570  * \return MESH_ERROR_UNKNOWN on error
571  * */
572  mesh_error_t read_mac_statistics(mesh_mac_statistics_t *statistics);
573 
574  /**
575  * \brief Get Wi-SUN Router information.
576  *
577  * Function reads RPL information from nanostack.
578  * Mesh interface must be initialized before calling this function.
579  *
580  * \param info_ptr Structure given to stack where information will be stored
581  *
582  * \return MESH_ERROR_NONE on success.
583  * \return MESH_ERROR_UNKNOWN in case of failure.
584  * */
585  mesh_error_t info_get(ws_rpl_info_t *info_ptr);
586 
587  /**
588  * \brief Get Wi-SUN Stack information.
589  *
590  * Function reads Stack information from nanostack.
591  * Mesh interface must be initialized before calling this function.
592  *
593  * \param stack_info_ptr Structure given to stack where information will be stored
594  *
595  * \return MESH_ERROR_NONE on success.
596  * \return MESH_ERROR_UNKNOWN in case of failure.
597  * */
598  mesh_error_t stack_info_get(ws_stack_state_t *stack_info_ptr);
599 
600  /**
601  * \brief Get Wi-SUN CCA threshold table information.
602  *
603  * Function reads CCA threshold table from nanostack.
604  *
605  ** \param ws_cca_threshold_table_t Structure given to stack where information will be stored
606  **
607  * \return MESH_ERROR_NONE on success.
608  * \return MESH_ERROR_UNKNOWN in case of failure.
609  * */
610  mesh_error_t cca_threshold_table_get(ws_cca_threshold_table_t *table);
611 
612  /**
613  * \brief Get Wi-SUN Neighbor table information.
614  *
615  * To allocate correct amount of memory first use the API with nbr_ptr = NULL to get current amount
616  * of neighbors in count pointer. Then Allocate the memory and call the function to fill the table.
617  *
618  * \param nbr_ptr Pointer to memory where Neighbor table entries can be written.
619  * \param count amount of neighbor table entries allocated to memory.
620  *
621  * \return MESH_ERROR_NONE on success.
622  * \return MESH_ERROR_UNKNOWN in case of failure.
623  * */
624  mesh_error_t nbr_info_get(ws_nbr_info_t *nbr_ptr, uint16_t *count);
625 
626 protected:
627  Nanostack::WisunInterface *get_interface() const;
628  nsapi_error_t do_initialize() override;
629  virtual nsapi_error_t configure();
630 };
631 
632 #endif
uint8_t rsl_out
parent RSSI Out measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) ...
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
uint8_t rsl_in
parent RSSI in measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) t...
Struct ws_nbr_info_t Gives the neighbor information.
uint16_t primary_parent_rank
RPL Primary Parent Rank.
ws_nbr_type_e type
Neighbour type (Primary Parent, Secondary Parent, Candidate parent, child, other(Temporary neighbours...
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.
uint16_t rpl_rank
RPL Rank value for parents 0xffff for neighbors RANK is unknown.
uint32_t lifetime
Remaining lifetime Link lifetime for parents and ARO lifetime for children.
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.
uint16_t etx
Measured ETX value if known set to 0xFFFF if not known or Child.
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.