Skip to content

Commit a2df462

Browse files
author
Mika Leppänen
committed
Nanostack changes for PPP service
Created PPP interface for PPP service. Re-used the ethernet tasklet and PHY driver structure for PPP.
1 parent 3864e12 commit a2df462

File tree

13 files changed

+620
-11
lines changed

13 files changed

+620
-11
lines changed

features/nanostack/mbed-mesh-api/mbed-mesh-api/MeshInterfaceNanostack.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ class Nanostack::Interface : public OnboardNetworkStack::Interface, private mbed
3434

3535
void get_mac_address(uint8_t *buf) const
3636
{
37-
interface_phy.get_mac_address(buf);
37+
NanostackMACPhy *phy = interface_phy.nanostack_mac_phy();
38+
if (phy) {
39+
phy->get_mac_address(buf);
40+
}
3841
}
3942

4043
/**
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2019 ARM Limited. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the License); you may
5+
* not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef NANOSTACKPPPINTERFACE_H
18+
#define NANOSTACKPPPINTERFACE_H
19+
20+
#include "MeshInterfaceNanostack.h"
21+
#include "PPPInterface.h"
22+
#include "NanostackPPPPhy.h"
23+
24+
class Nanostack::PPPInterface : public Nanostack::Interface {
25+
public:
26+
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
27+
const char *netmask, const char *gw,
28+
nsapi_ip_stack_t stack = DEFAULT_STACK,
29+
bool blocking = true);
30+
virtual nsapi_error_t bringdown();
31+
32+
typedef mbed::Callback<void (uint8_t up, int8_t device_id)> link_state_cb_t;
33+
virtual void set_link_state_changed_callback(link_state_cb_t link_state_cb);
34+
35+
private:
36+
friend class Nanostack;
37+
PPPInterface(NanostackPhy &phy) : Interface(phy), link_state_up(false), enet_tasklet_connected(false) {}
38+
nsapi_error_t initialize();
39+
void link_state_changed(bool up);
40+
nsapi_error_t connect_enet_tasklet();
41+
link_state_cb_t link_state_cb;
42+
bool link_state_up;
43+
bool enet_tasklet_connected;
44+
};
45+
46+
#endif

0 commit comments

Comments
 (0)