Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NanostackEthernetInterface.h Source File

NanostackEthernetInterface.h

00001 /*
00002  * Copyright (c) 2016 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 NANOSTACKETHERNETINTERFACE_H
00018 #define NANOSTACKETHERNETINTERFACE_H
00019 
00020 #include "EthInterface.h"
00021 #include "MeshInterfaceNanostack.h"
00022 #include "NanostackEthernetPhy.h"
00023 
00024 class Nanostack::EthernetInterface : public Nanostack::Interface {
00025 public:
00026     virtual nsapi_error_t bringup(bool dhcp, const char *ip,
00027                                   const char *netmask, const char *gw,
00028                                   nsapi_ip_stack_t stack = DEFAULT_STACK,
00029                                   bool blocking = true);
00030     virtual nsapi_error_t bringdown();
00031 
00032 private:
00033     friend class Nanostack;
00034     friend class NanostackEthernetInterface;
00035     EthernetInterface(NanostackEthernetPhy &phy) : Interface(phy) {}
00036     nsapi_error_t initialize();
00037 protected:
00038     NanostackEthernetPhy &get_phy() const
00039     {
00040         return static_cast<NanostackEthernetPhy &>(Interface::get_phy());
00041     }
00042 };
00043 
00044 /** Ethernet interface for Nanostack.
00045  *
00046  * Configure Nanostack to use Ethernet connectivity.
00047  */
00048 class NanostackEthernetInterface : public InterfaceNanostack, public EthInterface, private mbed::NonCopyable<NanostackEthernetInterface> {
00049 public:
00050     NanostackEthernetInterface() { }
00051     //NanostackEthernetInterface(NanostackEthernetPhy *phy);
00052 
00053     nsapi_error_t initialize(NanostackEthernetPhy *phy);
00054 
00055 protected:
00056     Nanostack::EthernetInterface *get_interface() const
00057     {
00058         return static_cast<Nanostack::EthernetInterface *>(_interface);
00059     }
00060     virtual nsapi_error_t do_initialize();
00061 
00062 };
00063 
00064 #endif // NANOSTACKETHERNETINTERFACE_H