mirror of https://github.com/ARMmbed/mbed-os.git
Remove API changes
-Remove Nanostack::add_ethernet_interface API change -Add get_mac_address to MeshEthernetInterface -Fix compiler warnings by adding overridespull/13936/head
parent
9ede631e76
commit
6a28bce1dd
|
@ -43,6 +43,9 @@ public:
|
|||
nsapi_error_t add_ethernet_interface(EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out) override;
|
||||
nsapi_error_t add_ethernet_interface(EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out, const uint8_t *mac_addr) 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);
|
||||
|
||||
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 */
|
||||
|
@ -72,7 +75,7 @@ protected:
|
|||
* @param interface_name Network interface name
|
||||
* @return NSAPI_ERROR_OK on success, negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version, const char *interface_name);
|
||||
virtual nsapi_error_t gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version, const char *interface_name) override;
|
||||
|
||||
/** Translate a hostname to an IP address (asynchronous) using network interface name.
|
||||
*
|
||||
|
@ -96,7 +99,7 @@ protected:
|
|||
* a positive unique id that represents the hostname translation operation
|
||||
* and can be passed to cancel.
|
||||
*/
|
||||
virtual nsapi_value_or_error_t gethostbyname_async(const char *name, hostbyname_cb_t callback, nsapi_version_t version, const char *interface_name);
|
||||
virtual nsapi_value_or_error_t gethostbyname_async(const char *name, hostbyname_cb_t callback, nsapi_version_t version, const char *interface_name) override;
|
||||
|
||||
/** Get a domain name server from a list of servers to query
|
||||
*
|
||||
|
@ -105,9 +108,10 @@ protected:
|
|||
*
|
||||
* @param index Index of the DNS server, starts from zero
|
||||
* @param address Destination for the host address
|
||||
* @param interface_name Network interface name
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t get_dns_server(int index, SocketAddress *address, const char *interface_name);
|
||||
virtual nsapi_error_t get_dns_server(int index, SocketAddress *address, const char *interface_name) override;
|
||||
|
||||
/** Opens a socket
|
||||
*
|
||||
|
|
|
@ -26,20 +26,13 @@
|
|||
class Nanostack::Interface : public OnboardNetworkStack::Interface, private mbed::NonCopyable<Nanostack::Interface> {
|
||||
public:
|
||||
nsapi_error_t get_ip_address(SocketAddress *address) final;
|
||||
char *get_mac_address(char *buf, nsapi_size_t buflen);
|
||||
char *get_mac_address(char *buf, nsapi_size_t buflen) override;
|
||||
nsapi_error_t set_mac_address(uint8_t *buf, nsapi_size_t buflen);
|
||||
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
|
||||
{
|
||||
NanostackMACPhy *phy = interface_phy.nanostack_mac_phy();
|
||||
if (phy) {
|
||||
phy->get_mac_address(buf);
|
||||
}
|
||||
}
|
||||
virtual void get_mac_address(uint8_t *buf) const;
|
||||
|
||||
/**
|
||||
* \brief Callback from C-layer
|
||||
|
|
|
@ -28,9 +28,10 @@ public:
|
|||
nsapi_ip_stack_t stack = DEFAULT_STACK,
|
||||
bool blocking = true) override;
|
||||
nsapi_error_t bringdown() override;
|
||||
void get_mac_address(uint8_t *buf);
|
||||
char *get_mac_address(char *buf, nsapi_size_t buflen) override;
|
||||
|
||||
char *get_interface_name(char *buf);
|
||||
char *get_interface_name(char *buf) override;
|
||||
private:
|
||||
friend class Nanostack;
|
||||
friend class NanostackEthernetInterface;
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
typedef mbed::Callback<void (uint8_t up, int8_t device_id)> link_state_cb_t;
|
||||
void set_link_state_changed_callback(link_state_cb_t link_state_cb);
|
||||
|
||||
char *get_interface_name(char *buf);
|
||||
char *get_interface_name(char *buf) override;
|
||||
private:
|
||||
friend class Nanostack;
|
||||
PPPInterface(NanostackPPPPhy &phy) : Interface(phy) {}
|
||||
|
|
|
@ -84,6 +84,14 @@ nsapi_connection_status_t Nanostack::Interface::get_connection_status() const
|
|||
return _connect_status;
|
||||
}
|
||||
|
||||
void Nanostack::Interface::get_mac_address(uint8_t *buf) const
|
||||
{
|
||||
NanostackMACPhy *phy = interface_phy.nanostack_mac_phy();
|
||||
if (phy) {
|
||||
phy->get_mac_address(buf);
|
||||
}
|
||||
}
|
||||
|
||||
void Nanostack::Interface::attach(
|
||||
mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
|
||||
{
|
||||
|
|
|
@ -191,7 +191,7 @@ void EMACPhy::set_mac_address(uint8_t *mac)
|
|||
memcpy(mac_addr, mac, sizeof mac_addr);
|
||||
}
|
||||
|
||||
nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out, const uint8_t *mac_addr)
|
||||
nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, Nanostack::EthernetInterface **interface_out, const uint8_t *mac_addr)
|
||||
{
|
||||
if (single_phy) {
|
||||
return NSAPI_ERROR_DEVICE_ERROR;
|
||||
|
@ -224,7 +224,18 @@ nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, Onb
|
|||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out, const uint8_t *mac_addr)
|
||||
{
|
||||
Nanostack::EthernetInterface *interface;
|
||||
nsapi_error_t err = add_ethernet_interface(emac, default_if, &interface, mac_addr);
|
||||
*interface_out = interface;
|
||||
return err;
|
||||
}
|
||||
|
||||
nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out)
|
||||
{
|
||||
return Nanostack::add_ethernet_interface(emac, default_if, interface_out, nullptr);
|
||||
}
|
||||
Nanostack::EthernetInterface *interface;
|
||||
nsapi_error_t err = add_ethernet_interface(emac, default_if, &interface);
|
||||
*interface_out = interface;
|
||||
return err;
|
||||
}
|
|
@ -133,9 +133,18 @@ char *Nanostack::EthernetInterface::get_interface_name(char *buf)
|
|||
return buf;
|
||||
};
|
||||
|
||||
void Nanostack::EthernetInterface::get_mac_address(uint8_t *buf)
|
||||
{
|
||||
if (!buf) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_phy().get_mac_address(buf);
|
||||
}
|
||||
|
||||
char *Nanostack::EthernetInterface::get_mac_address(char *buf, nsapi_size_t buflen)
|
||||
{
|
||||
uint8_t mac_buf[NSAPI_MAC_BYTES];
|
||||
uint8_t mac_buf[NSAPI_MAC_BYTES] = {0};
|
||||
|
||||
if (!buf || buflen < NSAPI_MAC_SIZE) {
|
||||
return NULL;
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
const char *get_mac_address() override;
|
||||
|
||||
/** @copydoc NetworkInterface::set_mac_address */
|
||||
nsapi_error_t set_mac_address(uint8_t *mac_addr, nsapi_size_t addr_len);
|
||||
nsapi_error_t set_mac_address(uint8_t *mac_addr, nsapi_size_t addr_len) override;
|
||||
|
||||
/** @copydoc NetworkInterface::get_ip_address */
|
||||
nsapi_error_t get_ip_address(SocketAddress *address) override;
|
||||
|
@ -151,7 +151,7 @@ protected:
|
|||
char _ip_address[NSAPI_IPv6_SIZE] {};
|
||||
char _netmask[NSAPI_IPv4_SIZE] {};
|
||||
char _gateway[NSAPI_IPv4_SIZE] {};
|
||||
uint8_t _hw_mac_addr[NSAPI_MAC_BYTES];
|
||||
uint8_t _hw_mac_addr[NSAPI_MAC_BYTES] {};
|
||||
mbed::Callback<void(nsapi_event_t, intptr_t)> _connection_status_cb;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue