mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12488 from kjbracey-arm/override_ns
C++11-ify virtualisation in Nanostack classespull/12526/head
commit
3739ccda0f
|
@ -23,24 +23,15 @@
|
|||
*
|
||||
* Configure Nanostack to use 6LoWPAN-ND protocol.
|
||||
*/
|
||||
class LoWPANNDInterface : public MeshInterfaceNanostack {
|
||||
class LoWPANNDInterface final : public MeshInterfaceNanostack {
|
||||
public:
|
||||
|
||||
/** Create an uninitialized LoWPANNDInterface
|
||||
*
|
||||
* Must initialize to initialize the mesh on a phy.
|
||||
*/
|
||||
LoWPANNDInterface() { }
|
||||
|
||||
/** Create an initialized LoWPANNDInterface
|
||||
*
|
||||
*/
|
||||
LoWPANNDInterface(NanostackRfPhy *phy) : MeshInterfaceNanostack(phy) { }
|
||||
/** Inherit MeshInterfaceNanostack constructors */
|
||||
using MeshInterfaceNanostack::MeshInterfaceNanostack;
|
||||
|
||||
bool getRouterIpAddress(char *address, int8_t len);
|
||||
protected:
|
||||
Nanostack::LoWPANNDInterface *get_interface() const;
|
||||
virtual nsapi_error_t do_initialize();
|
||||
nsapi_error_t do_initialize() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
|
||||
class Nanostack::Interface : public OnboardNetworkStack::Interface, private mbed::NonCopyable<Nanostack::Interface> {
|
||||
public:
|
||||
virtual nsapi_error_t get_ip_address(SocketAddress *address);
|
||||
virtual char *get_mac_address(char *buf, nsapi_size_t buflen);
|
||||
virtual nsapi_error_t get_netmask(SocketAddress *address);
|
||||
virtual nsapi_error_t get_gateway(SocketAddress *address);
|
||||
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
|
||||
virtual nsapi_connection_status_t get_connection_status() const;
|
||||
nsapi_error_t get_ip_address(SocketAddress *address) final;
|
||||
char *get_mac_address(char *buf, nsapi_size_t buflen) final;
|
||||
nsapi_error_t get_netmask(SocketAddress *address) final;
|
||||
nsapi_error_t get_gateway(SocketAddress *address) override;
|
||||
void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb) final;
|
||||
nsapi_connection_status_t get_connection_status() const final;
|
||||
|
||||
void get_mac_address(uint8_t *buf) const
|
||||
{
|
||||
|
@ -59,20 +59,20 @@ private:
|
|||
NanostackPhy &interface_phy;
|
||||
protected:
|
||||
Interface(NanostackPhy &phy);
|
||||
virtual nsapi_error_t register_phy();
|
||||
nsapi_error_t register_phy();
|
||||
NanostackPhy &get_phy() const
|
||||
{
|
||||
return interface_phy;
|
||||
}
|
||||
int8_t interface_id;
|
||||
int8_t _device_id;
|
||||
int8_t interface_id = -1;
|
||||
int8_t _device_id = -1;
|
||||
rtos::Semaphore connect_semaphore;
|
||||
rtos::Semaphore disconnect_semaphore;
|
||||
|
||||
mbed::Callback<void(nsapi_event_t, intptr_t)> _connection_status_cb;
|
||||
nsapi_connection_status_t _connect_status;
|
||||
nsapi_connection_status_t _previous_connection_status;
|
||||
bool _blocking;
|
||||
nsapi_connection_status_t _connect_status = NSAPI_STATUS_DISCONNECTED;
|
||||
nsapi_connection_status_t _previous_connection_status = NSAPI_STATUS_DISCONNECTED;
|
||||
bool _blocking = true;
|
||||
};
|
||||
|
||||
class Nanostack::MeshInterface : public Nanostack::Interface {
|
||||
|
@ -91,21 +91,21 @@ public:
|
|||
*
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t connect();
|
||||
nsapi_error_t connect() override;
|
||||
|
||||
/** Stop the interface
|
||||
*
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t disconnect();
|
||||
nsapi_error_t disconnect() override;
|
||||
|
||||
/** @copydoc NetworkInterface::get_ip_address */
|
||||
virtual nsapi_error_t get_ip_address(SocketAddress *address);
|
||||
nsapi_error_t get_ip_address(SocketAddress *address) override;
|
||||
|
||||
/** Get the internally stored MAC address
|
||||
/return MAC address of the interface
|
||||
*/
|
||||
virtual const char *get_mac_address();
|
||||
const char *get_mac_address() override;
|
||||
|
||||
/** Register callback for status reporting
|
||||
*
|
||||
|
@ -115,20 +115,20 @@ public:
|
|||
*
|
||||
* @param status_cb The callback for status changes
|
||||
*/
|
||||
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
|
||||
void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb) override;
|
||||
|
||||
/** Get the connection status
|
||||
*
|
||||
* @return The connection status according to ConnectionStatusType
|
||||
*/
|
||||
virtual nsapi_connection_status_t get_connection_status() const;
|
||||
nsapi_connection_status_t get_connection_status() const override;
|
||||
|
||||
/** Set blocking status of connect() which by default should be blocking
|
||||
*
|
||||
* @param blocking true if connect is blocking
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t set_blocking(bool blocking);
|
||||
nsapi_error_t set_blocking(bool blocking) override;
|
||||
|
||||
/** Set file system root path.
|
||||
*
|
||||
|
@ -138,7 +138,7 @@ public:
|
|||
* @param root_path Address to NUL-terminated root-path string or NULL to disable file system usage.
|
||||
* @return MESH_ERROR_NONE on success, MESH_ERROR_MEMORY in case of memory failure, MESH_ERROR_UNKNOWN in case of other error.
|
||||
*/
|
||||
virtual nsapi_error_t set_file_system_root_path(const char *root_path);
|
||||
nsapi_error_t set_file_system_root_path(const char *root_path);
|
||||
|
||||
/** Get the interface ID
|
||||
* @return Interface identifier
|
||||
|
@ -149,20 +149,20 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
InterfaceNanostack();
|
||||
virtual Nanostack *get_stack(void);
|
||||
InterfaceNanostack() = default;
|
||||
Nanostack *get_stack(void) override;
|
||||
Nanostack::Interface *get_interface() const
|
||||
{
|
||||
return _interface;
|
||||
}
|
||||
virtual nsapi_error_t do_initialize() = 0;
|
||||
|
||||
Nanostack::Interface *_interface;
|
||||
Nanostack::Interface *_interface = nullptr;
|
||||
|
||||
SocketAddress ip_addr;
|
||||
char mac_addr_str[24];
|
||||
char mac_addr_str[24] {};
|
||||
mbed::Callback<void(nsapi_event_t, intptr_t)> _connection_status_cb;
|
||||
bool _blocking;
|
||||
bool _blocking = true;
|
||||
};
|
||||
|
||||
class MeshInterfaceNanostack : public InterfaceNanostack, public MeshInterface, private mbed::NonCopyable<MeshInterfaceNanostack> {
|
||||
|
@ -178,13 +178,13 @@ public:
|
|||
nsapi_error_t initialize(NanostackRfPhy *phy);
|
||||
|
||||
protected:
|
||||
MeshInterfaceNanostack() : _phy(NULL) { }
|
||||
MeshInterfaceNanostack() = default;
|
||||
MeshInterfaceNanostack(NanostackRfPhy *phy) : _phy(phy) { }
|
||||
Nanostack::MeshInterface *get_interface() const
|
||||
{
|
||||
return static_cast<Nanostack::MeshInterface *>(_interface);
|
||||
}
|
||||
NanostackRfPhy *_phy;
|
||||
NanostackRfPhy *_phy = nullptr;
|
||||
};
|
||||
|
||||
#endif /* MESHINTERFACENANOSTACK_H */
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NANOSTACKEMACINTERFACE_H
|
||||
#define NANOSTACKEMACINTERFACE_H
|
||||
|
||||
#include "MeshInterfaceNanostack.h"
|
||||
#include "NanostackEthernetPhy.h"
|
||||
|
||||
class NanostackEMACInterface : public Nanostack::Interface {
|
||||
public:
|
||||
|
||||
NanostackEMACInterface(EMAC &emac);
|
||||
};
|
||||
|
||||
#endif // NANOSTACKEMACINTERFACE_H
|
|
@ -21,13 +21,13 @@
|
|||
#include "MeshInterfaceNanostack.h"
|
||||
#include "NanostackEthernetPhy.h"
|
||||
|
||||
class Nanostack::EthernetInterface : public Nanostack::Interface {
|
||||
class Nanostack::EthernetInterface final : public Nanostack::Interface {
|
||||
public:
|
||||
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = DEFAULT_STACK,
|
||||
bool blocking = true);
|
||||
virtual nsapi_error_t bringdown();
|
||||
nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = DEFAULT_STACK,
|
||||
bool blocking = true) override;
|
||||
nsapi_error_t bringdown() override;
|
||||
|
||||
private:
|
||||
friend class Nanostack;
|
||||
|
@ -47,8 +47,7 @@ protected:
|
|||
*/
|
||||
class NanostackEthernetInterface : public InterfaceNanostack, public EthInterface, private mbed::NonCopyable<NanostackEthernetInterface> {
|
||||
public:
|
||||
NanostackEthernetInterface() { }
|
||||
//NanostackEthernetInterface(NanostackEthernetPhy *phy);
|
||||
NanostackEthernetInterface() = default;
|
||||
|
||||
nsapi_error_t initialize(NanostackEthernetPhy *phy);
|
||||
|
||||
|
@ -57,7 +56,7 @@ protected:
|
|||
{
|
||||
return static_cast<Nanostack::EthernetInterface *>(_interface);
|
||||
}
|
||||
virtual nsapi_error_t do_initialize();
|
||||
nsapi_error_t do_initialize() override;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -21,26 +21,26 @@
|
|||
#include "PPPInterface.h"
|
||||
#include "NanostackPPPPhy.h"
|
||||
|
||||
class Nanostack::PPPInterface : public Nanostack::Interface {
|
||||
class Nanostack::PPPInterface final : public Nanostack::Interface {
|
||||
public:
|
||||
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = DEFAULT_STACK,
|
||||
bool blocking = true);
|
||||
virtual nsapi_error_t bringdown();
|
||||
nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = DEFAULT_STACK,
|
||||
bool blocking = true) override;
|
||||
nsapi_error_t bringdown() override;
|
||||
|
||||
typedef mbed::Callback<void (uint8_t up, int8_t device_id)> link_state_cb_t;
|
||||
virtual void set_link_state_changed_callback(link_state_cb_t link_state_cb);
|
||||
void set_link_state_changed_callback(link_state_cb_t link_state_cb);
|
||||
|
||||
private:
|
||||
friend class Nanostack;
|
||||
PPPInterface(NanostackPhy &phy) : Interface(phy), link_state_up(false), enet_tasklet_connected(false) {}
|
||||
PPPInterface(NanostackPPPPhy &phy) : Interface(phy) {}
|
||||
nsapi_error_t initialize();
|
||||
void link_state_changed(bool up);
|
||||
nsapi_error_t connect_enet_tasklet();
|
||||
link_state_cb_t link_state_cb;
|
||||
bool link_state_up;
|
||||
bool enet_tasklet_connected;
|
||||
link_state_cb_t link_state_cb = nullptr;
|
||||
bool link_state_up = false;
|
||||
bool enet_tasklet_connected = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NANOSTACKRFINTERFACE_H
|
||||
#define NANOSTACKRFINTERFACE_H
|
||||
|
||||
#include "MeshInterfaceNanostack.h"
|
||||
#include "NanostackRfPhy.h"
|
||||
|
||||
class NanostackRfInterface : public Nanostack::Interface {
|
||||
public:
|
||||
|
||||
NanostackRfInterface(NanostackRfPhy &phy);
|
||||
};
|
||||
|
||||
#endif // NANOSTACKRFINTERFACE_H
|
|
@ -23,19 +23,11 @@
|
|||
*
|
||||
* Configure Nanostack to use Thread protocol.
|
||||
*/
|
||||
class ThreadInterface : public MeshInterfaceNanostack {
|
||||
class ThreadInterface final : public MeshInterfaceNanostack {
|
||||
public:
|
||||
|
||||
/** Create an uninitialized ThreadInterface
|
||||
*
|
||||
* Must initialize to initialize the mesh on a phy.
|
||||
*/
|
||||
ThreadInterface() { }
|
||||
|
||||
/** Create an initialized ThreadInterface
|
||||
*
|
||||
*/
|
||||
ThreadInterface(NanostackRfPhy *phy) : MeshInterfaceNanostack(phy) { }
|
||||
/** Inherit MeshInterfaceNanostack constructors */
|
||||
using MeshInterfaceNanostack::MeshInterfaceNanostack;
|
||||
|
||||
/**
|
||||
* \brief Sets the eui64 for the device configuration.
|
||||
|
@ -64,7 +56,7 @@ public:
|
|||
|
||||
protected:
|
||||
Nanostack::ThreadInterface *get_interface() const;
|
||||
virtual nsapi_error_t do_initialize();
|
||||
nsapi_error_t do_initialize() override;
|
||||
};
|
||||
|
||||
#endif // THREADINTERFACE_H
|
||||
|
|
|
@ -23,19 +23,10 @@
|
|||
*
|
||||
* Configure Nanostack to use Wi-SUN protocol.
|
||||
*/
|
||||
class WisunInterface : public MeshInterfaceNanostack {
|
||||
class WisunInterface final : public MeshInterfaceNanostack {
|
||||
public:
|
||||
|
||||
/** Create an uninitialized WisunInterface
|
||||
*
|
||||
* Must initialize to initialize the mesh on a phy.
|
||||
*/
|
||||
WisunInterface() { }
|
||||
|
||||
/** Create an initialized WisunInterface
|
||||
*
|
||||
*/
|
||||
WisunInterface(NanostackRfPhy *phy) : MeshInterfaceNanostack(phy) { }
|
||||
/** Inherit MeshInterfaceNanostack constructors */
|
||||
using MeshInterfaceNanostack::MeshInterfaceNanostack;
|
||||
|
||||
/**
|
||||
* \brief Set Wi-SUN network name.
|
||||
|
@ -133,7 +124,7 @@ public:
|
|||
bool getRouterIpAddress(char *address, int8_t len);
|
||||
protected:
|
||||
Nanostack::WisunInterface *get_interface() const;
|
||||
virtual nsapi_error_t do_initialize();
|
||||
nsapi_error_t do_initialize() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,19 +24,19 @@
|
|||
#include "ns_trace.h"
|
||||
#define TRACE_GROUP "nslp"
|
||||
|
||||
class Nanostack::LoWPANNDInterface : public Nanostack::MeshInterface {
|
||||
class Nanostack::LoWPANNDInterface final : public Nanostack::MeshInterface {
|
||||
public:
|
||||
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = IPV6_STACK,
|
||||
bool blocking = true);
|
||||
virtual nsapi_error_t bringdown();
|
||||
virtual nsapi_error_t get_gateway(SocketAddress *sockAddr);
|
||||
nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = IPV6_STACK,
|
||||
bool blocking = true) override;
|
||||
nsapi_error_t bringdown() override;
|
||||
nsapi_error_t get_gateway(SocketAddress *sockAddr) override;
|
||||
|
||||
friend class Nanostack;
|
||||
friend class ::LoWPANNDInterface;
|
||||
private:
|
||||
LoWPANNDInterface(NanostackRfPhy &phy) : MeshInterface(phy) { }
|
||||
using MeshInterface::MeshInterface;
|
||||
mesh_error_t init();
|
||||
mesh_error_t mesh_connect();
|
||||
mesh_error_t mesh_disconnect();
|
||||
|
|
|
@ -69,20 +69,11 @@ void Nanostack::Interface::attach(
|
|||
_connection_status_cb = status_cb;
|
||||
}
|
||||
|
||||
Nanostack::Interface::Interface(NanostackPhy &phy) : interface_phy(phy), interface_id(-1), _device_id(-1),
|
||||
_connect_status(NSAPI_STATUS_DISCONNECTED), _previous_connection_status(NSAPI_STATUS_DISCONNECTED), _blocking(true)
|
||||
Nanostack::Interface::Interface(NanostackPhy &phy) : interface_phy(phy)
|
||||
{
|
||||
mesh_system_init();
|
||||
}
|
||||
|
||||
|
||||
InterfaceNanostack::InterfaceNanostack()
|
||||
: _interface(NULL),
|
||||
ip_addr(), mac_addr_str(), _blocking(true)
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
int InterfaceNanostack::connect()
|
||||
{
|
||||
nsapi_error_t error = do_initialize();
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
class EMACPhy : public NanostackEthernetPhy {
|
||||
public:
|
||||
EMACPhy(NanostackMemoryManager &mem, EMAC &m);
|
||||
virtual int8_t phy_register();
|
||||
virtual void get_mac_address(uint8_t *mac);
|
||||
virtual void set_mac_address(uint8_t *mac);
|
||||
int8_t phy_register() override;
|
||||
void get_mac_address(uint8_t *mac) override;
|
||||
void set_mac_address(uint8_t *mac) override;
|
||||
|
||||
int8_t address_write(phy_address_type_e, uint8_t *);
|
||||
int8_t tx(uint8_t *data_ptr, uint16_t data_len, uint8_t tx_handle, data_protocol_e data_flow);
|
||||
|
@ -26,7 +26,7 @@ private:
|
|||
NanostackMemoryManager &memory_manager;
|
||||
EMAC &emac;
|
||||
uint8_t mac_addr[6];
|
||||
int8_t device_id;
|
||||
int8_t device_id = -1;
|
||||
phy_device_driver_s phy;
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ extern "C"
|
|||
return single_phy->tx(data_ptr, data_len, tx_handle, data_flow);
|
||||
}
|
||||
|
||||
EMACPhy::EMACPhy(NanostackMemoryManager &mem, EMAC &m) : memory_manager(mem), emac(m), device_id(-1)
|
||||
EMACPhy::EMACPhy(NanostackMemoryManager &mem, EMAC &m) : memory_manager(mem), emac(m)
|
||||
{
|
||||
/* Same default address logic as lwIP glue uses */
|
||||
#if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
|
||||
|
|
|
@ -29,15 +29,15 @@
|
|||
class PPPPhy : public NanostackPPPPhy {
|
||||
public:
|
||||
PPPPhy(NanostackMemoryManager &mem, PPP &m);
|
||||
virtual int8_t phy_register();
|
||||
int8_t phy_register() override;
|
||||
|
||||
virtual void phy_power_on();
|
||||
virtual void phy_power_off();
|
||||
void phy_power_on();
|
||||
void phy_power_off();
|
||||
|
||||
virtual void get_iid64(uint8_t *iid64);
|
||||
virtual uint16_t get_mtu();
|
||||
void get_iid64(uint8_t *iid64) override;
|
||||
uint16_t get_mtu() override;
|
||||
|
||||
virtual void set_link_state_change_cb(link_state_change_cb_t cb);
|
||||
void set_link_state_change_cb(link_state_change_cb_t cb) override;
|
||||
|
||||
int8_t tx(uint8_t *data_ptr, uint16_t data_len, uint8_t tx_handle, data_protocol_e data_flow);
|
||||
|
||||
|
@ -48,10 +48,10 @@ private:
|
|||
NanostackMemoryManager &memory_manager;
|
||||
PPP &ppp;
|
||||
uint8_t iid64[8];
|
||||
link_state_change_cb_t link_state_change_cb;
|
||||
bool active;
|
||||
bool powered_up;
|
||||
int8_t device_id;
|
||||
link_state_change_cb_t link_state_change_cb = nullptr;
|
||||
bool active = false;
|
||||
bool powered_up = false;
|
||||
int8_t device_id = -1;
|
||||
phy_device_driver_s phy;
|
||||
};
|
||||
|
||||
|
@ -196,7 +196,7 @@ extern "C"
|
|||
return single_phy->tx(data_ptr, data_len, tx_handle, data_flow);
|
||||
}
|
||||
|
||||
PPPPhy::PPPPhy(NanostackMemoryManager &mem, PPP &m) : memory_manager(mem), ppp(m), link_state_change_cb(NULL), active(false), powered_up(false), device_id(-1)
|
||||
PPPPhy::PPPPhy(NanostackMemoryManager &mem, PPP &m) : memory_manager(mem), ppp(m)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
class Nanostack::ThreadInterface : public Nanostack::MeshInterface {
|
||||
public:
|
||||
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = IPV6_STACK,
|
||||
bool blocking = true);
|
||||
virtual nsapi_error_t bringdown();
|
||||
nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = IPV6_STACK,
|
||||
bool blocking = true) override;
|
||||
nsapi_error_t bringdown() override;
|
||||
friend class Nanostack;
|
||||
friend class ::ThreadInterface;
|
||||
private:
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
#include "ns_trace.h"
|
||||
#define TRACE_GROUP "WSIn"
|
||||
|
||||
class Nanostack::WisunInterface : public Nanostack::MeshInterface {
|
||||
class Nanostack::WisunInterface final : public Nanostack::MeshInterface {
|
||||
public:
|
||||
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = IPV6_STACK,
|
||||
bool blocking = true);
|
||||
virtual nsapi_error_t bringdown();
|
||||
virtual nsapi_error_t get_gateway(SocketAddress *address);
|
||||
nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
nsapi_ip_stack_t stack = IPV6_STACK,
|
||||
bool blocking = true) override;
|
||||
nsapi_error_t bringdown() override;
|
||||
nsapi_error_t get_gateway(SocketAddress *address) override;
|
||||
|
||||
friend class Nanostack;
|
||||
friend class ::WisunInterface;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "EMACMemoryManager.h"
|
||||
|
||||
class NanostackMemoryManager : public EMACMemoryManager {
|
||||
class NanostackMemoryManager final : public EMACMemoryManager {
|
||||
public:
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
* @param align Memory alignment requirement in bytes
|
||||
* @return Allocated memory buffer, or NULL in case of error
|
||||
*/
|
||||
virtual emac_mem_buf_t *alloc_heap(uint32_t size, uint32_t align);
|
||||
emac_mem_buf_t *alloc_heap(uint32_t size, uint32_t align) override;
|
||||
|
||||
/**
|
||||
* Allocates memory buffer chain from a pool
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
* @param align Memory alignment requirement for each buffer in bytes
|
||||
* @return Allocated memory buffer chain, or NULL in case of error
|
||||
*/
|
||||
virtual emac_mem_buf_t *alloc_pool(uint32_t size, uint32_t align);
|
||||
emac_mem_buf_t *alloc_pool(uint32_t size, uint32_t align) override;
|
||||
|
||||
/**
|
||||
* Get memory buffer pool allocation unit
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
* @param align Memory alignment requirement in bytes
|
||||
* @return Contiguous memory size
|
||||
*/
|
||||
virtual uint32_t get_pool_alloc_unit(uint32_t align) const;
|
||||
uint32_t get_pool_alloc_unit(uint32_t align) const override;
|
||||
|
||||
/**
|
||||
* Free memory buffer chain
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
*
|
||||
* @param buf Memory buffer chain to be freed.
|
||||
*/
|
||||
virtual void free(emac_mem_buf_t *buf);
|
||||
void free(emac_mem_buf_t *buf) override;
|
||||
|
||||
/**
|
||||
* Return total length of a memory buffer chain
|
||||
|
@ -73,9 +73,7 @@ public:
|
|||
* @param buf Memory buffer chain
|
||||
* @return Total length in bytes
|
||||
*/
|
||||
virtual uint32_t get_total_len(const emac_mem_buf_t *buf) const;
|
||||
|
||||
virtual void set_align_preference(uint32_t align) { }
|
||||
uint32_t get_total_len(const emac_mem_buf_t *buf) const override;
|
||||
|
||||
/**
|
||||
* Copy a memory buffer chain
|
||||
|
@ -86,7 +84,7 @@ public:
|
|||
* @param to_buf Memory buffer chain to copy to
|
||||
* @param from_buf Memory buffer chain to copy from
|
||||
*/
|
||||
virtual void copy(emac_mem_buf_t *to_buf, const emac_mem_buf_t *from_buf);
|
||||
void copy(emac_mem_buf_t *to_buf, const emac_mem_buf_t *from_buf) override;
|
||||
|
||||
|
||||
|
||||
|
@ -100,7 +98,7 @@ public:
|
|||
* @param to_buf Memory buffer chain to concatenate to
|
||||
* @param cat_buf Memory buffer chain to concatenate
|
||||
*/
|
||||
virtual void cat(emac_mem_buf_t *to_buf, emac_mem_buf_t *cat_buf);
|
||||
void cat(emac_mem_buf_t *to_buf, emac_mem_buf_t *cat_buf) override;
|
||||
|
||||
/**
|
||||
* Returns the next buffer
|
||||
|
@ -110,7 +108,7 @@ public:
|
|||
* @param buf Memory buffer
|
||||
* @return The next memory buffer, or NULL if last
|
||||
*/
|
||||
virtual emac_mem_buf_t *get_next(const emac_mem_buf_t *buf) const;
|
||||
emac_mem_buf_t *get_next(const emac_mem_buf_t *buf) const override;
|
||||
|
||||
/**
|
||||
* Return pointer to the payload of the buffer
|
||||
|
@ -118,7 +116,7 @@ public:
|
|||
* @param buf Memory buffer
|
||||
* @return Pointer to the payload
|
||||
*/
|
||||
virtual void *get_ptr(const emac_mem_buf_t *buf) const;
|
||||
void *get_ptr(const emac_mem_buf_t *buf) const override;
|
||||
|
||||
/**
|
||||
* Return payload size of the buffer
|
||||
|
@ -126,7 +124,7 @@ public:
|
|||
* @param buf Memory buffer
|
||||
* @return Size in bytes
|
||||
*/
|
||||
virtual uint32_t get_len(const emac_mem_buf_t *buf) const;
|
||||
uint32_t get_len(const emac_mem_buf_t *buf) const override;
|
||||
|
||||
/**
|
||||
* Sets the payload size of the buffer
|
||||
|
@ -137,7 +135,7 @@ public:
|
|||
* @param buf Memory buffer
|
||||
* @param len Payload size, must be less or equal allocated size
|
||||
*/
|
||||
virtual void set_len(emac_mem_buf_t *buf, uint32_t len);
|
||||
void set_len(emac_mem_buf_t *buf, uint32_t len) override;
|
||||
};
|
||||
|
||||
#endif /* NANOSTACK_MEMORY_MANAGER_H */
|
||||
|
|
|
@ -40,12 +40,12 @@ public:
|
|||
class PPPInterface;
|
||||
|
||||
/* Implement OnboardNetworkStack method */
|
||||
virtual nsapi_error_t add_ethernet_interface(EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out);
|
||||
nsapi_error_t add_ethernet_interface(EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out) override;
|
||||
|
||||
/* Local variant with stronger typing and manual address specification */
|
||||
nsapi_error_t add_ethernet_interface(EMAC &emac, bool default_if, Nanostack::EthernetInterface **interface_out, const uint8_t *mac_addr = NULL);
|
||||
|
||||
virtual nsapi_error_t add_ppp_interface(PPP &ppp, bool default_if, OnboardNetworkStack::Interface **interface_out);
|
||||
nsapi_error_t add_ppp_interface(PPP &ppp, bool default_if, OnboardNetworkStack::Interface **interface_out) override;
|
||||
|
||||
/* Local variant with stronger typing and manual address specification */
|
||||
nsapi_error_t add_ppp_interface(PPP &ppp, bool default_if, Nanostack::PPPInterface **interface_out);
|
||||
|
@ -57,7 +57,7 @@ protected:
|
|||
Nanostack();
|
||||
|
||||
/** @copydoc NetworkStack::get_ip_address */
|
||||
virtual nsapi_error_t get_ip_address(SocketAddress *sockAddr);
|
||||
nsapi_error_t get_ip_address(SocketAddress *sockAddr) override;
|
||||
|
||||
/** Opens a socket
|
||||
*
|
||||
|
@ -71,7 +71,7 @@ protected:
|
|||
* @param proto Protocol of socket to open, NSAPI_TCP or NSAPI_UDP
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t socket_open(void **handle, nsapi_protocol_t proto);
|
||||
nsapi_error_t socket_open(void **handle, nsapi_protocol_t proto) override;
|
||||
|
||||
/** Close the socket
|
||||
*
|
||||
|
@ -81,7 +81,7 @@ protected:
|
|||
* @param handle Socket handle
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t socket_close(void *handle);
|
||||
nsapi_error_t socket_close(void *handle) override;
|
||||
|
||||
/** Bind a specific address to a socket
|
||||
*
|
||||
|
@ -92,7 +92,7 @@ protected:
|
|||
* @param address Local address to bind
|
||||
* @return 0 on success, negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t socket_bind(void *handle, const SocketAddress &address);
|
||||
nsapi_error_t socket_bind(void *handle, const SocketAddress &address) override;
|
||||
|
||||
/** Listen for connections on a TCP socket
|
||||
*
|
||||
|
@ -104,7 +104,7 @@ protected:
|
|||
* simultaneously
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t socket_listen(void *handle, int backlog);
|
||||
nsapi_error_t socket_listen(void *handle, int backlog) override;
|
||||
|
||||
/** Connects TCP socket to a remote host
|
||||
*
|
||||
|
@ -115,7 +115,7 @@ protected:
|
|||
* @param address The SocketAddress of the remote host
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t socket_connect(void *handle, const SocketAddress &address);
|
||||
nsapi_error_t socket_connect(void *handle, const SocketAddress &address) override;
|
||||
|
||||
/** Accepts a connection on a TCP socket
|
||||
*
|
||||
|
@ -135,7 +135,7 @@ protected:
|
|||
* @param address Destination for the remote address or NULL
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t socket_accept(void *handle, void **server, SocketAddress *address);
|
||||
nsapi_error_t socket_accept(void *handle, void **server, SocketAddress *address) override;
|
||||
|
||||
/** Send data over a TCP socket
|
||||
*
|
||||
|
@ -151,7 +151,7 @@ protected:
|
|||
* @return Number of sent bytes on success, negative error
|
||||
* code on failure
|
||||
*/
|
||||
virtual nsapi_size_or_error_t socket_send(void *handle, const void *data, nsapi_size_t size);
|
||||
nsapi_size_or_error_t socket_send(void *handle, const void *data, nsapi_size_t size) override;
|
||||
|
||||
/** Receive data over a TCP socket
|
||||
*
|
||||
|
@ -167,7 +167,7 @@ protected:
|
|||
* @return Number of received bytes on success, negative error
|
||||
* code on failure
|
||||
*/
|
||||
virtual nsapi_size_or_error_t socket_recv(void *handle, void *data, nsapi_size_t size);
|
||||
nsapi_size_or_error_t socket_recv(void *handle, void *data, nsapi_size_t size) override;
|
||||
|
||||
/** Send a packet over a UDP socket
|
||||
*
|
||||
|
@ -184,7 +184,7 @@ protected:
|
|||
* @return Number of sent bytes on success, negative error
|
||||
* code on failure
|
||||
*/
|
||||
virtual nsapi_size_or_error_t socket_sendto(void *handle, const SocketAddress &address, const void *data, nsapi_size_t size);
|
||||
nsapi_size_or_error_t socket_sendto(void *handle, const SocketAddress &address, const void *data, nsapi_size_t size) override;
|
||||
|
||||
/** Receive a packet over a UDP socket
|
||||
*
|
||||
|
@ -201,7 +201,7 @@ protected:
|
|||
* @return Number of received bytes on success, negative error
|
||||
* code on failure
|
||||
*/
|
||||
virtual nsapi_size_or_error_t socket_recvfrom(void *handle, SocketAddress *address, void *buffer, nsapi_size_t size);
|
||||
nsapi_size_or_error_t socket_recvfrom(void *handle, SocketAddress *address, void *buffer, nsapi_size_t size) override;
|
||||
|
||||
/** Register a callback on state change of the socket
|
||||
*
|
||||
|
@ -216,7 +216,7 @@ protected:
|
|||
* @param callback Function to call on state change
|
||||
* @param data Argument to pass to callback
|
||||
*/
|
||||
virtual void socket_attach(void *handle, void (*callback)(void *), void *data);
|
||||
void socket_attach(void *handle, void (*callback)(void *), void *data) override;
|
||||
|
||||
/* Set stack-specific socket options
|
||||
*
|
||||
|
@ -231,7 +231,7 @@ protected:
|
|||
* @param optlen Length of the option value
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t setsockopt(void *handle, int level, int optname, const void *optval, unsigned optlen);
|
||||
nsapi_error_t setsockopt(void *handle, int level, int optname, const void *optval, unsigned optlen) override;
|
||||
|
||||
/* Get stack-specific socket options
|
||||
*
|
||||
|
@ -246,7 +246,7 @@ protected:
|
|||
* @param optlen Length of the option value
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t getsockopt(void *handle, int level, int optname, void *optval, unsigned *optlen);
|
||||
nsapi_error_t getsockopt(void *handle, int level, int optname, void *optval, unsigned *optlen) override;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -268,7 +268,7 @@ private:
|
|||
*
|
||||
* @return Call in callback
|
||||
*/
|
||||
virtual call_in_callback_cb_t get_call_in_callback();
|
||||
call_in_callback_cb_t get_call_in_callback() override;
|
||||
|
||||
/** Call a callback after a delay
|
||||
*
|
||||
|
@ -279,7 +279,7 @@ private:
|
|||
* @param func Callback to be called
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t call_in(int delay, mbed::Callback<void()> func);
|
||||
nsapi_error_t call_in(int delay, mbed::Callback<void()> func) override;
|
||||
|
||||
struct nanostack_callback {
|
||||
mbed::Callback<void()> callback;
|
||||
|
|
|
@ -37,9 +37,8 @@ public:
|
|||
eventOS_scheduler_mutex_release();
|
||||
}
|
||||
|
||||
private:
|
||||
NanostackLockGuard(const NanostackLockGuard &);
|
||||
NanostackLockGuard &operator=(const NanostackLockGuard &);
|
||||
NanostackLockGuard(const NanostackLockGuard &) = delete;
|
||||
NanostackLockGuard &operator=(const NanostackLockGuard &) = delete;
|
||||
};
|
||||
|
||||
#endif /* NANOSTACK_LOCK_GUARD_H_ */
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
*
|
||||
* @return NanostackMACPhy
|
||||
*/
|
||||
virtual NanostackMACPhy *nanostack_mac_phy()
|
||||
NanostackMACPhy *nanostack_mac_phy() final
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
*
|
||||
* @return NanostackPPPPhy
|
||||
*/
|
||||
virtual NanostackPPPPhy *nanostack_ppp_phy()
|
||||
NanostackPPPPhy *nanostack_ppp_phy() final
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
*/
|
||||
virtual NanostackMACPhy *nanostack_mac_phy()
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/** Return pointer to a NanostackPPPPhy.
|
||||
|
@ -49,12 +49,12 @@ public:
|
|||
*/
|
||||
virtual NanostackPPPPhy *nanostack_ppp_phy()
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
NanostackPhy() {}
|
||||
virtual ~NanostackPhy() {}
|
||||
NanostackPhy() = default;
|
||||
virtual ~NanostackPhy() = default;
|
||||
};
|
||||
|
||||
#endif /* NANOSTACK_INTERFACE_H_ */
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
* @return Device driver ID or a negative error
|
||||
* code on failure
|
||||
*/
|
||||
virtual int8_t phy_register()
|
||||
int8_t phy_register() override
|
||||
{
|
||||
return rf_register();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue