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.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
wisun_tasklet.h
00001 /* 00002 * Copyright (c) 2018-2019 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may 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, 00012 * WITHOUT 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_WISUN_TASKLET__ 00018 #define __INCLUDE_WISUN_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 border router IP address 00034 * 00035 * \param address where router 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 wisun_tasklet_get_router_ip_address(char *address, int8_t len); 00042 00043 /* 00044 * \brief Connect to mesh network 00045 * 00046 * \param callback to be called when network state changes 00047 * \param nwk_interface_id to use for networking 00048 * 00049 * \return >= 0 on success 00050 * \return -1 if callback function is used in another tasklet 00051 * \return -2 if memory allocation fails 00052 * \return -3 if network is already connected 00053 */ 00054 int8_t wisun_tasklet_connect(mesh_interface_cb callback, int8_t nwk_interface_id); 00055 00056 /* 00057 * \brief Initialize mesh system. 00058 * Memory pool, timers, traces and support are initialized. 00059 */ 00060 void wisun_tasklet_init(void); 00061 00062 /* 00063 * \brief Create network interface. 00064 * 00065 * \param device_id registered physical device 00066 * \return interface ID that can be used to communication with this interface 00067 * \return -1 in case of MAC initialization fails 00068 * \return -2 in case of error in parameters 00069 * \return -3 in case of memory allocation error 00070 */ 00071 int8_t wisun_tasklet_network_init(int8_t device_id); 00072 00073 /* 00074 * \brief Disconnect network interface. 00075 * 00076 * \param send_cb send possible network status change event if set to true. 00077 * \return >= 0 if disconnected successfully. 00078 * \return < 0 in case of errors 00079 */ 00080 int8_t wisun_tasklet_disconnect(bool send_cb); 00081 00082 /* 00083 * \brief Set Wi-SUN network name 00084 * 00085 * \param nwk_interface_id to use for networking 00086 * \param network_name_ptr Address of the new network name. Can't be NULL. 00087 * \return 0 if network name stored successfully 00088 * \return < 0 in case of errors 00089 */ 00090 int wisun_tasklet_set_network_name(int8_t nwk_interface_id, char *network_name_ptr); 00091 00092 /* 00093 * \brief Set Wi-SUN network regulatory domain 00094 * 00095 * \param nwk_interface_id to use for networking 00096 * \param regulatory_domain 00097 * \param operating_class 00098 * \param operating_mode 00099 * \return 0 if regulatory domain is set successfully. 00100 * \return < 0 in case of errors 00101 */ 00102 int wisun_tasklet_set_regulatory_domain(int8_t nwk_interface_id, uint8_t regulatory_domain, uint8_t operating_class, uint8_t operating_mode); 00103 00104 /* 00105 * \brief Set own certificate to Wi-SUN network 00106 * 00107 * \param cert to use for networking 00108 * \param cert_len 00109 * \param cert_key 00110 * \param cert_key_len 00111 * \return 0 if certificate stored successfully 00112 * \return < 0 in case of errors 00113 */ 00114 int wisun_tasklet_set_own_certificate(uint8_t *cert, uint16_t cert_len, uint8_t *cert_key, uint16_t cert_key_len); 00115 00116 /* 00117 * \brief Remove own certificate from Wi-SUN network 00118 * 00119 * \return 0 if certificates removed successfully 00120 * \return < 0 in case of errors 00121 */ 00122 int wisun_tasklet_remove_own_certificates(void); 00123 00124 /* 00125 * \brief Set trusted certificate to Wi-SUN network 00126 * 00127 * \param cert to use for networking 00128 * \param cert_len 00129 * \return 0 if certificate stored successfully 00130 * \return < 0 in case of errors 00131 */ 00132 int wisun_tasklet_set_trusted_certificate(uint8_t *cert, uint16_t cert_len); 00133 00134 /* 00135 * \brief Remove trusted certificate from Wi-SUN network 00136 * 00137 * \return 0 if certificates removed successfully 00138 * \return < 0 in case of errors 00139 */ 00140 int wisun_tasklet_remove_trusted_certificates(void); 00141 00142 #ifdef __cplusplus 00143 } 00144 #endif 00145 #endif /* __INCLUDE_WISUN_TASKLET__ */
Generated on Tue Jul 12 2022 13:55:03 by
