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