Skip to content

Commit 8dc15ee

Browse files
authored
Merge pull request #12293 from mirelachirica/remove_empty_api
Cellular: Remove API's empty default implemetations
2 parents 9017957 + e2048b0 commit 8dc15ee

File tree

10 files changed

+19
-137
lines changed

10 files changed

+19
-137
lines changed

Diff for: UNITTESTS/features/cellular/framework/device/cellularcontext/cellularcontexttest.cpp

-16
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,6 @@ class testContext : public CellularContext
111111
virtual void set_credentials(const char *apn, const char *uname = 0, const char *pwd = 0)
112112
{
113113
}
114-
nsapi_error_t get_netmask(SocketAddress *address)
115-
{
116-
return NSAPI_ERROR_UNSUPPORTED;
117-
}
118-
virtual const char *get_netmask()
119-
{
120-
return NULL;
121-
}
122-
nsapi_error_t get_gateway(SocketAddress *address)
123-
{
124-
return NSAPI_ERROR_UNSUPPORTED;
125-
}
126-
virtual const char *get_gateway()
127-
{
128-
return NULL;
129-
}
130114
virtual bool is_connected()
131115
{
132116
return false;

Diff for: UNITTESTS/stubs/AT_CellularContext_stub.cpp

-20
Original file line numberDiff line numberDiff line change
@@ -149,26 +149,6 @@ void AT_CellularContext::set_credentials(const char *apn, const char *uname, con
149149

150150
}
151151

152-
nsapi_error_t AT_CellularContext::get_netmask(SocketAddress *address)
153-
{
154-
return NSAPI_ERROR_UNSUPPORTED;
155-
}
156-
157-
const char *AT_CellularContext::get_netmask()
158-
{
159-
return NULL;
160-
}
161-
162-
nsapi_error_t AT_CellularContext::get_gateway(SocketAddress *address)
163-
{
164-
return NSAPI_ERROR_UNSUPPORTED;
165-
}
166-
167-
const char *AT_CellularContext::get_gateway()
168-
{
169-
return NULL;
170-
}
171-
172152
AT_CellularDevice::CellularProperty AT_CellularContext::pdp_type_t_to_cellular_property(pdp_type_t pdp_type)
173153
{
174154
AT_CellularDevice::CellularProperty prop = AT_CellularDevice::PROPERTY_IPV4_PDP_TYPE;

Diff for: UNITTESTS/stubs/CellularDevice_stub.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ void CellularDevice::set_sim_pin(char const *)
6464
{
6565
}
6666

67-
CellularContext *CellularDevice::get_context_list() const
68-
{
69-
return NULL;
70-
}
71-
7267
void CellularDevice::get_retry_timeout_array(uint16_t *timeout, int &array_len) const
7368
{
7469
array_len = CellularDevice_stub::retry_array_length;
@@ -128,8 +123,3 @@ nsapi_error_t CellularDevice::shutdown()
128123
void CellularDevice::cellular_callback(nsapi_event_t ev, intptr_t ptr, CellularContext *ctx)
129124
{
130125
}
131-
132-
nsapi_error_t CellularDevice::clear()
133-
{
134-
return NSAPI_ERROR_OK;
135-
}

Diff for: UNITTESTS/target_h/myCellularContext.h

-20
Original file line numberDiff line numberDiff line change
@@ -135,26 +135,6 @@ class myCellularContext : public CellularContext {
135135

136136
};
137137

138-
nsapi_error_t get_netmask(SocketAddress *address)
139-
{
140-
return NSAPI_ERROR_UNSUPPORTED;
141-
}
142-
143-
const char *get_netmask()
144-
{
145-
return NULL;
146-
};
147-
148-
nsapi_error_t get_gateway(SocketAddress *address)
149-
{
150-
return NSAPI_ERROR_UNSUPPORTED;
151-
}
152-
153-
const char *get_gateway()
154-
{
155-
return NULL;
156-
};
157-
158138
bool get_context()
159139
{
160140
return true;

Diff for: features/cellular/framework/API/CellularContext.h

-6
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,6 @@ class CellularContext : public CellularInterface {
146146
virtual nsapi_error_t connect(const char *sim_pin, const char *apn = 0, const char *uname = 0,
147147
const char *pwd = 0) = 0;
148148
virtual void set_credentials(const char *apn, const char *uname = 0, const char *pwd = 0) = 0;
149-
virtual nsapi_error_t get_netmask(SocketAddress *address) = 0;
150-
MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
151-
virtual const char *get_netmask() = 0;
152-
virtual nsapi_error_t get_gateway(SocketAddress *address) = 0;
153-
MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
154-
virtual const char *get_gateway() = 0;
155149
virtual bool is_connected() = 0;
156150

157151
/** Same as NetworkInterface::get_default_instance()

Diff for: features/cellular/framework/API/CellularDevice.h

+19-18
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,6 @@ class CellularDevice {
9797

9898
public: //Virtual functions
9999

100-
/** Clear modem to a default initial state
101-
*
102-
* Clear persistent user data from the modem, such as PDP contexts.
103-
*
104-
* @pre All open network services on modem, such as contexts and sockets, must be closed.
105-
* @post Modem power off/on may be needed to clear modem's runtime state.
106-
* @remark CellularStateMachine calls this on connect when `cellular.clear-on-connect: true`.
107-
*
108-
* @return NSAPI_ERROR_OK on success, otherwise modem may be need power cycling
109-
*/
110-
virtual nsapi_error_t clear();
111-
112100
/** Shutdown cellular device to minimum functionality.
113101
*
114102
* Actual functionality is modem specific, for example UART may is not be responsive without
@@ -121,12 +109,6 @@ class CellularDevice {
121109
*/
122110
virtual nsapi_error_t shutdown();
123111

124-
/** Get the linked list of CellularContext instances
125-
*
126-
* @return Pointer to first item in linked list
127-
*/
128-
virtual CellularContext *get_context_list() const;
129-
130112
/** Get event queue that can be chained to main event queue.
131113
* @return event queue
132114
*/
@@ -142,6 +124,25 @@ class CellularDevice {
142124

143125
public: //Pure virtual functions
144126

127+
/** Clear modem to a default initial state
128+
*
129+
* Clear persistent user data from the modem, such as PDP contexts.
130+
*
131+
* @pre All open network services on modem, such as contexts and sockets, must be closed.
132+
* @post Modem power off/on may be needed to clear modem's runtime state.
133+
* @remark CellularStateMachine calls this on connect when `cellular.clear-on-connect: true`.
134+
*
135+
* @return NSAPI_ERROR_OK on success, otherwise modem may be need power cycling
136+
*/
137+
virtual nsapi_error_t clear() = 0;
138+
139+
140+
/** Get the linked list of CellularContext instances
141+
*
142+
* @return Pointer to first item in linked list
143+
*/
144+
virtual CellularContext *get_context_list() const = 0;
145+
145146
/** Sets the modem up for powering on
146147
* This is equivalent to plugging in the device, i.e., attaching power and serial port.
147148
* In general, hard_power_on and soft_power_on provides a simple hardware abstraction layer

Diff for: features/cellular/framework/AT/AT_CellularContext.cpp

-20
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,6 @@ NetworkStack *AT_CellularContext::get_stack()
213213
return _stack;
214214
}
215215

216-
nsapi_error_t AT_CellularContext::get_netmask(SocketAddress *address)
217-
{
218-
return NSAPI_ERROR_UNSUPPORTED;
219-
}
220-
221-
const char *AT_CellularContext::get_netmask()
222-
{
223-
return NULL;
224-
}
225-
226-
nsapi_error_t AT_CellularContext::get_gateway(SocketAddress *address)
227-
{
228-
return NSAPI_ERROR_UNSUPPORTED;
229-
}
230-
231-
const char *AT_CellularContext::get_gateway()
232-
{
233-
return NULL;
234-
}
235-
236216
nsapi_error_t AT_CellularContext::get_ip_address(SocketAddress *address)
237217
{
238218
if (!address) {

Diff for: features/cellular/framework/AT/AT_CellularContext.h

-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ class AT_CellularContext : public CellularContext {
4848
virtual nsapi_error_t connect(const char *sim_pin, const char *apn = 0, const char *uname = 0,
4949
const char *pwd = 0);
5050
virtual void set_credentials(const char *apn, const char *uname = 0, const char *pwd = 0);
51-
virtual nsapi_error_t get_netmask(SocketAddress *address);
52-
virtual const char *get_netmask();
53-
virtual nsapi_error_t get_gateway(SocketAddress *address);
54-
virtual const char *get_gateway();
5551

5652
// from CellularContext
5753
virtual nsapi_error_t get_pdpcontext_params(pdpContextList_t &params_list);

Diff for: features/cellular/framework/device/CellularDevice.cpp

-11
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ events::EventQueue *CellularDevice::get_queue()
7474
return &_queue;
7575
}
7676

77-
CellularContext *CellularDevice::get_context_list() const
78-
{
79-
return NULL;
80-
}
81-
8277
void CellularDevice::get_retry_timeout_array(uint16_t *timeout, int &array_len) const
8378
{
8479
if (_state_machine && timeout) {
@@ -261,10 +256,4 @@ void CellularDevice::set_retry_timeout_array(const uint16_t timeout[], int array
261256
}
262257
}
263258

264-
nsapi_error_t CellularDevice::clear()
265-
{
266-
return NSAPI_ERROR_OK;
267-
}
268-
269-
270259
} // namespace mbed

Diff for: features/netsocket/CellularInterface.h

-12
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,6 @@ class CellularInterface: public NetworkInterface {
101101
MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
102102
virtual const char *get_ip_address() = 0;
103103

104-
/** @copydoc NetworkInterface::get_netmask */
105-
virtual nsapi_error_t get_netmask(SocketAddress *address) = 0;
106-
107-
MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
108-
virtual const char *get_netmask() = 0;
109-
110-
/** @copydoc NetworkInterface::get_gateway */
111-
virtual nsapi_error_t get_gateway(SocketAddress *address) = 0;
112-
113-
MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
114-
virtual const char *get_gateway() = 0;
115-
116104
/** @copydoc NetworkInterface::cellularInterface
117105
*/
118106
virtual CellularInterface *cellularInterface()

0 commit comments

Comments
 (0)