Skip to content

Commit

Permalink
CellularBase -> CellularInterface tidy
Browse files Browse the repository at this point in the history
Remove remaining references to deprecated CellularBase in code, avoiding
one warning.

Optimise by removing separate virtual function entries for
NetworkInterface::cellularBase and NetworkInterface::cellularInterface
  • Loading branch information
kjbracey committed Mar 18, 2019
1 parent 6b84b14 commit 24266b5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
8 changes: 0 additions & 8 deletions features/netsocket/CellularInterface.h
Expand Up @@ -116,14 +116,6 @@ class CellularInterface: public NetworkInterface {
*/
virtual const char *get_gateway() = 0;

/** @copydoc NetworkInterface::cellularBase
*/
MBED_DEPRECATED_SINCE("mbed-os-5.12", "Migrated to CellularInterface")
virtual CellularInterface *cellularBase()
{
return this;
}

/** @copydoc NetworkInterface::cellularInterface
*/
virtual CellularInterface *cellularInterface()
Expand Down
21 changes: 10 additions & 11 deletions features/netsocket/NetworkInterface.h
Expand Up @@ -51,7 +51,7 @@ class NetworkInterface: public DNS {
* target.network-default-interface-type or other overrides.
*
* The type of the interface returned can be tested by calling ethInterface(),
* wifiInterface(), meshInterface(), cellularBase(), emacInterface() and checking
* wifiInterface(), meshInterface(), cellularInterface(), emacInterface() and checking
* for NULL pointers.
*
* The default behavior is to return the default interface for the
Expand Down Expand Up @@ -341,12 +341,19 @@ class NetworkInterface: public DNS {
/** Return pointer to a CellularInterface.
* @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.12", "Migrated to CellularInterface")
virtual CellularInterface *cellularBase()
virtual CellularInterface *cellularInterface()
{
return 0;
}

/** Return pointer to a CellularBase.
* @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.12", "Migrated to CellularInterface")
CellularInterface *cellularBase() {
return cellularInterface();
}

/** Return pointer to an EMACInterface.
* @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
*/
Expand Down Expand Up @@ -415,14 +422,6 @@ class NetworkInterface: public DNS {
* configuration).
*/
virtual void set_default_parameters();

/** Return pointer to a CellularInterface.
* @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
*/
virtual CellularInterface *cellularInterface()
{
return 0;
}
};

#endif
Expand Down
10 changes: 5 additions & 5 deletions features/netsocket/NetworkInterfaceDefaults.cpp
Expand Up @@ -18,7 +18,7 @@

#include "EthInterface.h"
#include "WiFiInterface.h"
#include "CellularBase.h"
#include "CellularInterface.h"
#include "MeshInterface.h"

/* Weak default instance static classes for the various abstract classes.
Expand All @@ -40,7 +40,7 @@ MBED_WEAK MeshInterface *MeshInterface::get_default_instance()
return get_target_default_instance();
}

MBED_WEAK CellularBase *CellularBase::get_default_instance()
MBED_WEAK CellularInterface *CellularInterface::get_default_instance()
{
return get_target_default_instance();
}
Expand Down Expand Up @@ -87,9 +87,9 @@ void WiFiInterface::set_default_parameters()
#endif
}

void CellularBase::set_default_parameters()
void CellularInterface::set_default_parameters()
{
/* CellularBase is expected to attempt to work without any parameters - we
/* CellularInterface is expected to attempt to work without any parameters - we
* will try, at least.
*/
#ifdef MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN
Expand Down Expand Up @@ -148,7 +148,7 @@ MBED_WEAK NetworkInterface *NetworkInterface::get_target_default_instance()
#elif MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == CELLULAR
MBED_WEAK NetworkInterface *NetworkInterface::get_target_default_instance()
{
CellularBase *cellular = CellularBase::get_default_instance();
CellularInterface *cellular = CellularInterface::get_default_instance();
if (!cellular) {
return NULL;
}
Expand Down

0 comments on commit 24266b5

Please sign in to comment.