Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os by
nd_tasklet.h
00001 /* 00002 * Copyright (c) 2015 ARM Limited. All rights reserved. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * Licensed under the Apache License, Version 2.0 (the License); you may 00005 * not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 00012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef __INCLUDE_ND_TASKLET__ 00018 #define __INCLUDE_ND_TASKLET__ 00019 #include "ns_types.h" 00020 #include "eventOS_event.h" 00021 #include "mbed-mesh-api/mesh_interface_types.h" 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /** 00028 * Type of the network status callback. 00029 */ 00030 typedef void (*mesh_interface_cb)(mesh_connection_status_t mesh_status); 00031 00032 /* 00033 * \brief Read own global IP address 00034 * 00035 * \param address where own IP address will be written 00036 * \param len length of provided address buffer 00037 * 00038 * \return 0 on success 00039 * \return -1 if address reading fails 00040 */ 00041 int8_t nd_tasklet_get_ip_address(char *address, int8_t len); 00042 00043 /* 00044 * \brief Read border router IP address 00045 * 00046 * \param address where router IP address will be written 00047 * \param len length of provided address buffer 00048 * 00049 * \return 0 on success 00050 * \return -1 if address reading fails 00051 */ 00052 int8_t nd_tasklet_get_router_ip_address(char *address, int8_t len); 00053 00054 /* 00055 * \brief Connect to mesh network 00056 * 00057 * \param callback to be called when network state changes 00058 * \param nwk_interface_id to use for networking 00059 * 00060 * \return >= 0 on success 00061 * \return -1 if callback function is used in another tasklet 00062 * \return -2 if memory allocation fails 00063 * \return -3 if network is already connected 00064 */ 00065 int8_t nd_tasklet_connect(mesh_interface_cb callback, int8_t nwk_interface_id); 00066 00067 /* 00068 * \brief Initialize mesh system. 00069 * Memory pool, timers, traces and support are initialized. 00070 */ 00071 void nd_tasklet_init(void); 00072 00073 /* 00074 * \brief Create network interface. 00075 * 00076 * \param device_id registered physical device 00077 * \return interface ID that can be used to communication with this interface 00078 */ 00079 int8_t nd_tasklet_network_init(int8_t device_id); 00080 00081 /* 00082 * \brief Disconnect network interface. 00083 * 00084 * \param send_cb send possible network status change event if set to true. 00085 * \return >= 0 if disconnected successfully. 00086 * \return < 0 in case of errors 00087 */ 00088 int8_t nd_tasklet_disconnect(bool send_cb); 00089 00090 #ifdef __cplusplus 00091 } 00092 #endif 00093 #endif /* __INCLUDE_ND_TASKLET__ */
Generated on Tue Jul 12 2022 13:16:00 by
