Mistake on this page?
Report an issue in GitHub or email us
wisun_tasklet.h
1 /*
2  * Copyright (c) 2018-2019 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may 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,
12  * WITHOUT 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 __INCLUDE_WISUN_TASKLET__
18 #define __INCLUDE_WISUN_TASKLET__
19 #include "ns_types.h"
20 #include "eventOS_event.h"
21 #include "mbed-mesh-api/mesh_interface_types.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /**
28  * Type of the network status callback.
29  */
30 typedef void (*mesh_interface_cb)(mesh_connection_status_t mesh_status);
31 
32 /*
33  * \brief Read border router IP address
34  *
35  * \param address where router IP address will be written
36  * \param len length of provided address buffer
37  *
38  * \return 0 on success
39  * \return -1 if address reading fails
40  */
41 int8_t wisun_tasklet_get_router_ip_address(char *address, int8_t len);
42 
43 /*
44  * \brief Connect to mesh network
45  *
46  * \param callback to be called when network state changes
47  * \param nwk_interface_id to use for networking
48  *
49  * \return >= 0 on success
50  * \return -1 if callback function is used in another tasklet
51  * \return -2 if memory allocation fails
52  * \return -3 if network is already connected
53  */
54 int8_t wisun_tasklet_connect(mesh_interface_cb callback, int8_t nwk_interface_id);
55 
56 /*
57  * \brief Initialize mesh system.
58  * Memory pool, timers, traces and support are initialized.
59  */
60 void wisun_tasklet_init(void);
61 
62 /*
63  * \brief Create network interface.
64  *
65  * \param device_id registered physical device
66  * \return interface ID that can be used to communication with this interface
67  * \return -1 in case of MAC initialization fails
68  * \return -2 in case of error in parameters
69  * \return -3 in case of memory allocation error
70  */
71 int8_t wisun_tasklet_network_init(int8_t device_id);
72 
73 /*
74  * \brief Disconnect network interface.
75  *
76  * \param send_cb send possible network status change event if set to true.
77  * \return >= 0 if disconnected successfully.
78  * \return < 0 in case of errors
79  */
80 int8_t wisun_tasklet_disconnect(bool send_cb);
81 
82 /*
83  * \brief Set own certificate to Wi-SUN network
84  *
85  * \param cert to use for networking
86  * \param cert_len
87  * \param cert_key
88  * \param cert_key_len
89  * \return 0 if certificate stored successfully
90  * \return < 0 in case of errors
91  */
92 int wisun_tasklet_set_own_certificate(uint8_t *cert, uint16_t cert_len, uint8_t *cert_key, uint16_t cert_key_len);
93 
94 /*
95  * \brief Remove own certificate from Wi-SUN network
96  *
97  * \return 0 if certificates removed successfully
98  * \return < 0 in case of errors
99  */
100 int wisun_tasklet_remove_own_certificates(void);
101 
102 /*
103  * \brief Set trusted certificate to Wi-SUN network
104  *
105  * \param cert to use for networking
106  * \param cert_len
107  * \return 0 if certificate stored successfully
108  * \return < 0 in case of errors
109  */
110 int wisun_tasklet_set_trusted_certificate(uint8_t *cert, uint16_t cert_len);
111 
112 /*
113  * \brief Remove trusted certificate from Wi-SUN network
114  *
115  * \return 0 if certificates removed successfully
116  * \return < 0 in case of errors
117  */
118 int wisun_tasklet_remove_trusted_certificates(void);
119 
120 /*
121  * \brief Start Wi-SUN statistics
122  *
123  * \return 0 Statistics start successful
124  * \return < 0 in case of errors
125  */
126 int wisun_tasklet_statistics_start(void);
127 
128 /*
129  * \brief Reads Wi-SUN network statistics
130  *
131  * \return 0 Statistics read successful
132  * \return < 0 in case of errors
133  */
134 int wisun_tasklet_statistics_nw_read(mesh_nw_statistics_t *stats);
135 
136 /*
137  * \brief Reads Wi-SUN MAC statistics
138  *
139  * \return 0 Statistics read successful
140  * \return < 0 in case of errors
141  */
142 int wisun_tasklet_statistics_mac_read(mesh_mac_statistics_t *stats);
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 #endif /* __INCLUDE_WISUN_TASKLET__ */
Mesh physical layer statistics.
Mesh network statistics.
Callback< R(ArgTs...)> callback(R(*func)(ArgTs...)=0)
Create a callback class with type inferred from the arguments.
Definition: Callback.h:709
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.