Skip to content

Commit

Permalink
Merge pull request #12293 from mirelachirica/remove_empty_api
Browse files Browse the repository at this point in the history
Cellular: Remove API's empty default implemetations
  • Loading branch information
0xc0170 authored Feb 6, 2020
2 parents 9017957 + e2048b0 commit 8dc15ee
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,6 @@ class testContext : public CellularContext
virtual void set_credentials(const char *apn, const char *uname = 0, const char *pwd = 0)
{
}
nsapi_error_t get_netmask(SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}
virtual const char *get_netmask()
{
return NULL;
}
nsapi_error_t get_gateway(SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}
virtual const char *get_gateway()
{
return NULL;
}
virtual bool is_connected()
{
return false;
Expand Down
20 changes: 0 additions & 20 deletions UNITTESTS/stubs/AT_CellularContext_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,26 +149,6 @@ void AT_CellularContext::set_credentials(const char *apn, const char *uname, con

}

nsapi_error_t AT_CellularContext::get_netmask(SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}

const char *AT_CellularContext::get_netmask()
{
return NULL;
}

nsapi_error_t AT_CellularContext::get_gateway(SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}

const char *AT_CellularContext::get_gateway()
{
return NULL;
}

AT_CellularDevice::CellularProperty AT_CellularContext::pdp_type_t_to_cellular_property(pdp_type_t pdp_type)
{
AT_CellularDevice::CellularProperty prop = AT_CellularDevice::PROPERTY_IPV4_PDP_TYPE;
Expand Down
10 changes: 0 additions & 10 deletions UNITTESTS/stubs/CellularDevice_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ void CellularDevice::set_sim_pin(char const *)
{
}

CellularContext *CellularDevice::get_context_list() const
{
return NULL;
}

void CellularDevice::get_retry_timeout_array(uint16_t *timeout, int &array_len) const
{
array_len = CellularDevice_stub::retry_array_length;
Expand Down Expand Up @@ -128,8 +123,3 @@ nsapi_error_t CellularDevice::shutdown()
void CellularDevice::cellular_callback(nsapi_event_t ev, intptr_t ptr, CellularContext *ctx)
{
}

nsapi_error_t CellularDevice::clear()
{
return NSAPI_ERROR_OK;
}
20 changes: 0 additions & 20 deletions UNITTESTS/target_h/myCellularContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,6 @@ class myCellularContext : public CellularContext {

};

nsapi_error_t get_netmask(SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}

const char *get_netmask()
{
return NULL;
};

nsapi_error_t get_gateway(SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}

const char *get_gateway()
{
return NULL;
};

bool get_context()
{
return true;
Expand Down
6 changes: 0 additions & 6 deletions features/cellular/framework/API/CellularContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,6 @@ class CellularContext : public CellularInterface {
virtual nsapi_error_t connect(const char *sim_pin, const char *apn = 0, const char *uname = 0,
const char *pwd = 0) = 0;
virtual void set_credentials(const char *apn, const char *uname = 0, const char *pwd = 0) = 0;
virtual nsapi_error_t get_netmask(SocketAddress *address) = 0;
MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
virtual const char *get_netmask() = 0;
virtual nsapi_error_t get_gateway(SocketAddress *address) = 0;
MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
virtual const char *get_gateway() = 0;
virtual bool is_connected() = 0;

/** Same as NetworkInterface::get_default_instance()
Expand Down
37 changes: 19 additions & 18 deletions features/cellular/framework/API/CellularDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ class CellularDevice {

public: //Virtual functions

/** Clear modem to a default initial state
*
* Clear persistent user data from the modem, such as PDP contexts.
*
* @pre All open network services on modem, such as contexts and sockets, must be closed.
* @post Modem power off/on may be needed to clear modem's runtime state.
* @remark CellularStateMachine calls this on connect when `cellular.clear-on-connect: true`.
*
* @return NSAPI_ERROR_OK on success, otherwise modem may be need power cycling
*/
virtual nsapi_error_t clear();

/** Shutdown cellular device to minimum functionality.
*
* Actual functionality is modem specific, for example UART may is not be responsive without
Expand All @@ -121,12 +109,6 @@ class CellularDevice {
*/
virtual nsapi_error_t shutdown();

/** Get the linked list of CellularContext instances
*
* @return Pointer to first item in linked list
*/
virtual CellularContext *get_context_list() const;

/** Get event queue that can be chained to main event queue.
* @return event queue
*/
Expand All @@ -142,6 +124,25 @@ class CellularDevice {

public: //Pure virtual functions

/** Clear modem to a default initial state
*
* Clear persistent user data from the modem, such as PDP contexts.
*
* @pre All open network services on modem, such as contexts and sockets, must be closed.
* @post Modem power off/on may be needed to clear modem's runtime state.
* @remark CellularStateMachine calls this on connect when `cellular.clear-on-connect: true`.
*
* @return NSAPI_ERROR_OK on success, otherwise modem may be need power cycling
*/
virtual nsapi_error_t clear() = 0;


/** Get the linked list of CellularContext instances
*
* @return Pointer to first item in linked list
*/
virtual CellularContext *get_context_list() const = 0;

/** Sets the modem up for powering on
* This is equivalent to plugging in the device, i.e., attaching power and serial port.
* In general, hard_power_on and soft_power_on provides a simple hardware abstraction layer
Expand Down
20 changes: 0 additions & 20 deletions features/cellular/framework/AT/AT_CellularContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,26 +213,6 @@ NetworkStack *AT_CellularContext::get_stack()
return _stack;
}

nsapi_error_t AT_CellularContext::get_netmask(SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}

const char *AT_CellularContext::get_netmask()
{
return NULL;
}

nsapi_error_t AT_CellularContext::get_gateway(SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}

const char *AT_CellularContext::get_gateway()
{
return NULL;
}

nsapi_error_t AT_CellularContext::get_ip_address(SocketAddress *address)
{
if (!address) {
Expand Down
4 changes: 0 additions & 4 deletions features/cellular/framework/AT/AT_CellularContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ class AT_CellularContext : public CellularContext {
virtual nsapi_error_t connect(const char *sim_pin, const char *apn = 0, const char *uname = 0,
const char *pwd = 0);
virtual void set_credentials(const char *apn, const char *uname = 0, const char *pwd = 0);
virtual nsapi_error_t get_netmask(SocketAddress *address);
virtual const char *get_netmask();
virtual nsapi_error_t get_gateway(SocketAddress *address);
virtual const char *get_gateway();

// from CellularContext
virtual nsapi_error_t get_pdpcontext_params(pdpContextList_t &params_list);
Expand Down
11 changes: 0 additions & 11 deletions features/cellular/framework/device/CellularDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ events::EventQueue *CellularDevice::get_queue()
return &_queue;
}

CellularContext *CellularDevice::get_context_list() const
{
return NULL;
}

void CellularDevice::get_retry_timeout_array(uint16_t *timeout, int &array_len) const
{
if (_state_machine && timeout) {
Expand Down Expand Up @@ -261,10 +256,4 @@ void CellularDevice::set_retry_timeout_array(const uint16_t timeout[], int array
}
}

nsapi_error_t CellularDevice::clear()
{
return NSAPI_ERROR_OK;
}


} // namespace mbed
12 changes: 0 additions & 12 deletions features/netsocket/CellularInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,6 @@ class CellularInterface: public NetworkInterface {
MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
virtual const char *get_ip_address() = 0;

/** @copydoc NetworkInterface::get_netmask */
virtual nsapi_error_t get_netmask(SocketAddress *address) = 0;

MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
virtual const char *get_netmask() = 0;

/** @copydoc NetworkInterface::get_gateway */
virtual nsapi_error_t get_gateway(SocketAddress *address) = 0;

MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
virtual const char *get_gateway() = 0;

/** @copydoc NetworkInterface::cellularInterface
*/
virtual CellularInterface *cellularInterface()
Expand Down

0 comments on commit 8dc15ee

Please sign in to comment.