Simon Cooksey / mbed-os
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MeshThread.h Source File

MeshThread.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 __MESHTHREAD_H__
00018 #define __MESHTHREAD_H__
00019 
00020 #include "AbstractMesh.h"
00021 
00022 /**
00023  * \brief 6LoWPAN Thread mesh networking class.
00024  */
00025 
00026 class MeshThread : public AbstractMesh
00027 {
00028 
00029 public:
00030 
00031     virtual ~MeshThread();
00032 
00033     /*
00034      * \brief Initialization of the interface.
00035      * \param registered device is physical device registered
00036      * \param callbackHandler is callback that is called when network state changes
00037      * \param eui64 pointer to MAC address (8 bytes) of the registered RF driver
00038      * \param pskd Not used
00039      * \return MESH_ERROR_NONE on success.
00040      * \return MESH_ERROR_PARAM when input parameters are illegal (also in case when RF device is already associated to other interface)
00041      * \return MESH_ERROR_MEMORY in case of memory error
00042      * \return MESH_ERROR_UNKNOWN in other error cases
00043      */
00044     mesh_error_t init(int8_t registered_device_id, mesh_network_handler_t callbackHandler, uint8_t *eui64, char *pskd);
00045 
00046     /**
00047      * \brief Overriding initialization of the base class.
00048      * Use method init(int8_t, MeshNetworkHandler_t, uint8_t*, char*)
00049      */
00050     virtual mesh_error_t init(int8_t registered_device_id, mesh_network_handler_t callbackHandler);
00051 
00052     bool getOwnIpAddress(char *address, int8_t len);
00053 
00054     /**
00055      * \brief Set device data polling rate to value given in parameter pollrate. Data polling will be
00056      * disabled if pollrate value is 0.
00057      * \param pollrate data polling rate in seconds. Setting this to 0 disables data polling.
00058      * \return MESH_ERROR_NONE on success.
00059      * \return MESH_ERROR_PARAM in case timeout value is bigger than 864001.
00060      * \return MESH_ERROR_UNKNOWN in case of other error.
00061      * */
00062     virtual mesh_error_t data_poll_rate_set(uint32_t pollrate);
00063 
00064     friend class MeshInterfaceFactory;
00065 
00066 private:
00067     /*
00068      * \brief private constructor for the MeshThread
00069      */
00070     MeshThread();
00071 
00072     /*
00073      * avoid copy/assign object
00074      */
00075     MeshThread(MeshThread const &copy);
00076     MeshThread &operator=(MeshThread const &copy);
00077 };
00078 
00079 #endif /* __MESHTHREAD_H__ */