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 Wi-SUN network name
84  *
85  * \param nwk_interface_id to use for networking
86  * \param network_name_ptr Address of the new network name. Can't be NULL.
87  * \return 0 if network name stored successfully
88  * \return < 0 in case of errors
89  */
90 int wisun_tasklet_set_network_name(int8_t nwk_interface_id, char *network_name_ptr);
91 
92 /*
93  * \brief Set Wi-SUN network regulatory domain
94  *
95  * \param nwk_interface_id to use for networking
96  * \param regulatory_domain
97  * \param operating_class
98  * \param operating_mode
99  * \return 0 if regulatory domain is set successfully.
100  * \return < 0 in case of errors
101  */
102 int wisun_tasklet_set_regulatory_domain(int8_t nwk_interface_id, uint8_t regulatory_domain, uint8_t operating_class, uint8_t operating_mode);
103 
104 /*
105  * \brief Set own certificate to Wi-SUN network
106  *
107  * \param cert to use for networking
108  * \param cert_len
109  * \param cert_key
110  * \param cert_key_len
111  * \return 0 if certificate stored successfully
112  * \return < 0 in case of errors
113  */
114 int wisun_tasklet_set_own_certificate(uint8_t *cert, uint16_t cert_len, uint8_t *cert_key, uint16_t cert_key_len);
115 
116 /*
117  * \brief Remove own certificate from Wi-SUN network
118  *
119  * \return 0 if certificates removed successfully
120  * \return < 0 in case of errors
121  */
122 int wisun_tasklet_remove_own_certificates(void);
123 
124 /*
125  * \brief Set trusted certificate to Wi-SUN network
126  *
127  * \param cert to use for networking
128  * \param cert_len
129  * \return 0 if certificate stored successfully
130  * \return < 0 in case of errors
131  */
132 int wisun_tasklet_set_trusted_certificate(uint8_t *cert, uint16_t cert_len);
133 
134 /*
135  * \brief Remove trusted certificate from Wi-SUN network
136  *
137  * \return 0 if certificates removed successfully
138  * \return < 0 in case of errors
139  */
140 int wisun_tasklet_remove_trusted_certificates(void);
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 #endif /* __INCLUDE_WISUN_TASKLET__ */
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.