Mbed OS Reference
Loading...
Searching...
No Matches
nd_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_ND_TASKLET__
18#define __INCLUDE_ND_TASKLET__
19#include "ns_types.h"
20#include "eventOS_event.h"
21#include "mbed-mesh-api/mesh_interface_types.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/**
28 * Type of the network status callback.
29 */
30typedef 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 */
41int8_t nd_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 */
54int8_t nd_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 */
60void nd_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 */
68int8_t nd_tasklet_network_init(int8_t device_id);
69
70/*
71 * \brief Disconnect network interface.
72 *
73 * \param send_cb send possible network status change event if set to true.
74 * \return >= 0 if disconnected successfully.
75 * \return < 0 in case of errors
76 */
77int8_t nd_tasklet_disconnect(bool send_cb);
78
79#ifdef __cplusplus
80}
81#endif
82#endif /* __INCLUDE_ND_TASKLET__ */