Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NanostackPPPInterface.h Source File

NanostackPPPInterface.h

00001 /*
00002  * Copyright (c) 2019 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 NANOSTACKPPPINTERFACE_H
00018 #define NANOSTACKPPPINTERFACE_H
00019 
00020 #include "MeshInterfaceNanostack.h"
00021 #include "PPPInterface.h"
00022 #include "NanostackPPPPhy.h"
00023 
00024 class Nanostack::PPPInterface : 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     typedef mbed::Callback<void (uint8_t up, int8_t device_id)> link_state_cb_t;
00033     virtual void set_link_state_changed_callback(link_state_cb_t link_state_cb);
00034 
00035 private:
00036     friend class Nanostack;
00037     PPPInterface(NanostackPhy &phy) : Interface(phy), link_state_up(false), enet_tasklet_connected(false) {}
00038     nsapi_error_t initialize();
00039     void link_state_changed(bool up);
00040     nsapi_error_t connect_enet_tasklet();
00041     link_state_cb_t link_state_cb;
00042     bool link_state_up;
00043     bool enet_tasklet_connected;
00044 };
00045 
00046 #endif