Knight KE / Mbed OS Game_Master
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ThreadInterface.h Source File

ThreadInterface.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 THREADINTERFACE_H
00018 #define THREADINTERFACE_H
00019 
00020 #include "MeshInterfaceNanostack.h"
00021 
00022 /** Thread mesh network interface class
00023  *
00024  * Configure Nanostack to use Thread protocol.
00025  */
00026 class ThreadInterface : public MeshInterfaceNanostack {
00027 public:
00028 
00029     /** Create an uninitialized ThreadInterface
00030      *
00031      *  Must initialize to initialize the mesh on a phy.
00032      */
00033     ThreadInterface() { }
00034 
00035     /** Create an initialized ThreadInterface
00036      *
00037      */
00038     ThreadInterface(NanostackRfPhy *phy) : MeshInterfaceNanostack(phy) { }
00039 
00040     /**
00041      * \brief Sets the eui64 for the device configuration.
00042      * By default this value is read from the radio driver.
00043      * The value must be set before calling the connect function.
00044      * */
00045     void device_eui64_set(const uint8_t *eui64);
00046 
00047     /**
00048      * \brief Reads the eui64 from the device configuration.
00049      * By default this value is read from the radio driver, but it may have
00050      * been set by device_eui64_set().
00051      * */
00052     void device_eui64_get(uint8_t *eui64);
00053 
00054     /**
00055      * \brief sets the PSKd for the device configuration.
00056      * The default value is overwritten, which is defined in the mbed_lib.json file in the mesh-api
00057      * The value must be set before calling the connect function.
00058      * \return MESH_ERROR_NONE on success.
00059      * \return MESH_ERROR_PARAM in case of illegal parameters.
00060      * \return MESH_ERROR_MEMORY in case of memory error.
00061      * */
00062 
00063     mesh_error_t device_pskd_set(const char *pskd);
00064 
00065     virtual int connect();
00066     virtual int disconnect();
00067 protected:
00068     Nanostack::ThreadInterface *get_interface() const;
00069 };
00070 
00071 #endif // THREADINTERFACE_H