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.
AbstractMesh.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 __ABSTRACTMESH_H__ 00018 #define __ABSTRACTMESH_H__ 00019 00020 #include "AbstractNetworkInterface.h" 00021 #include "mbed.h" 00022 #ifdef YOTTA_CFG 00023 #include "core-util/FunctionPointer.h" 00024 00025 using namespace mbed; 00026 using namespace mbed::util; 00027 #endif 00028 00029 /** 00030 * \brief Abstract Mesh networking interface. 00031 * This class can't be instantiated directly. 00032 */ 00033 class AbstractMesh : public AbstractNetworkInterface 00034 { 00035 00036 public: 00037 00038 /** 00039 * Typedef for network callback 00040 */ 00041 #ifdef YOTTA_CFG 00042 typedef FunctionPointer1<void, mesh_connection_status_t> mesh_network_handler_t; 00043 #else 00044 typedef FunctionPointerArg1<void, mesh_connection_status_t> mesh_network_handler_t; 00045 #endif 00046 00047 /** 00048 * Constructor 00049 * \param type mesh network type 00050 */ 00051 AbstractMesh(mesh_network_type_t type); 00052 00053 // Destructor, force derived classes to implement own destructors 00054 // and prevent class creation. 00055 virtual ~AbstractMesh() = 0; 00056 00057 /** 00058 * \brief Initialization of the interface. 00059 * \param registered device is physical device registered 00060 * \param callbackHandler is callback that is called when network state changes 00061 * \return MESH_ERROR_NONE on success. 00062 * \return MESH_ERROR_PARAM when input parameters are illegal (also in case when RF device is already associated to other interface) 00063 * \return MESH_ERROR_MEMORY in case of memory error 00064 * \return MESH_ERROR_UNKNOWN in other error cases 00065 */ 00066 virtual mesh_error_t init(int8_t registered_device_id, mesh_network_handler_t callbackHandler); 00067 00068 /** 00069 * \brief Connect interface to the mesh network 00070 * \return MESH_ERROR_NONE on success. 00071 * \return MESH_ERROR_PARAM in case of illegal parameters. 00072 * \return MESH_ERROR_MEMORY in case of memory error. 00073 * \return MESH_ERROR_STATE if interface is already connected to network. 00074 * \return MESH_ERROR_UNKNOWN in case of unspecified error. 00075 * */ 00076 virtual mesh_error_t connect(); 00077 00078 /** 00079 * \brief Disconnect interface from the mesh network 00080 * \return MESH_ERROR_NONE on success. 00081 * \return MESH_ERROR_UNKNOWN in case of error. 00082 * */ 00083 virtual mesh_error_t disconnect(); 00084 00085 /** 00086 * \brief Callback from C-layer 00087 * \param state state of the network 00088 * */ 00089 void callback(mesh_connection_status_t state); 00090 00091 protected: 00092 00093 /* 00094 * Mesh callback function 00095 */ 00096 mesh_network_handler_t _mesh_network_handler; 00097 00098 /* 00099 * Network interface ID 00100 */ 00101 int8_t _network_interface_id; 00102 00103 /* 00104 * Registered device ID 00105 */ 00106 int8_t _device_id; 00107 00108 /* 00109 * Mesh network type 00110 */ 00111 mesh_network_type_t _mesh_network_type; 00112 }; 00113 00114 #endif /* __ABSTRACTMESH_H__ */
Generated on Tue Jul 12 2022 18:19:26 by
