Mistake on this page?
Report an issue in GitHub or email us
thread_tasklet.h
1 /*
2  * Copyright (c) 2015 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 __INCLUDE_THREAD_TASKLET__
18 #define __INCLUDE_THREAD_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 Connect to mesh network
34  *
35  * \param callback to be called when network state changes
36  * \param nwk_interface_id to use for networking
37  *
38  * \return >= 0 on success
39  * \return -1 if callback function is used in another tasklet
40  * \return -2 if memory allocation fails
41  * \return -3 if network is already connected
42  */
43 int8_t thread_tasklet_connect(mesh_interface_cb callback, int8_t nwk_interface_id);
44 
45 /*
46  * \brief Initialize mesh system.
47  * Memory pool, timers, traces and support are initialized.
48  */
49 void thread_tasklet_init(void);
50 
51 /*
52  * \brief Create network interface.
53  *
54  * \param device_id registered physical device
55  * \return interface ID that can be used to communication with this interface
56  */
57 int8_t thread_tasklet_network_init(int8_t device_id);
58 
59 /*
60  * \brief Sets eui64 for the device configuration
61  * \param eui64 eui64 to be set
62  */
63 void thread_tasklet_device_eui64_set(const uint8_t *eui64);
64 
65 /*
66  * \brief Gets eui64 from the device configuration
67  * \param eui64 buffer for output eui64
68  */
69 void thread_tasklet_device_eui64_get(uint8_t *eui64);
70 
71 /*
72  * \brief Sets PSKd for the device configuration
73  * \param pskd private shared key to be set
74  */
75 uint8_t thread_tasklet_device_pskd_set(const char *pskd);
76 
77 /*
78  * \brief Disconnect network interface.
79  *
80  * \param send_cb send possible network status change event if set to true.
81  * \return >= 0 if disconnected successfully.
82  * \return < 0 in case of errors
83  */
84 int8_t thread_tasklet_disconnect(bool send_cb);
85 
86 /*
87  * \brief Set device data polling rate
88  *
89  * \param timeout timeout between data polls
90  * \return 0 on success
91  * \return < 0 in case of errors
92  */
93 int8_t thread_tasklet_data_poll_rate_set(uint32_t timeout);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 #endif /* __INCLUDE_THREAD_TASKLET__ */
Callback< R(ArgTs...)> callback(R(*func)(ArgTs...)=nullptr) noexcept
Create a callback class with type inferred from the arguments.
Definition: Callback.h:678
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.