Merge pull request #6264 from jarvte/master

Deprecated warnings for feature/netsocket/cellular
pull/6392/head
Cruz Monrreal 2018-03-16 13:32:09 -05:00 committed by GitHub
commit 7c30faf69d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 43 additions and 8 deletions

View File

@ -18,7 +18,6 @@
#ifndef CELLULAR_NETWORK_H_
#define CELLULAR_NETWORK_H_
#include "CellularInterface.h"
#include "NetworkInterface.h"
#include "CellularList.h"

View File

@ -19,7 +19,6 @@
#include "netsocket/NetworkInterface.h"
/** CellularInterface class
*
* Common interface that is shared between ethernet hardware
@ -30,6 +29,7 @@ class CellularInterface : public NetworkInterface
public:
/** CellularInterface lifetime
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularNetwork.h instead.")
virtual ~CellularInterface() {};
/** Set the cellular network APN and credentials
@ -39,6 +39,7 @@ public:
* @param password Optional password fot the APN
* @return 0 on success, negative error code on failure
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularNetwork.h instead.")
virtual nsapi_error_t set_credentials(const char *apn,
const char *username = 0, const char *password = 0) = 0;
@ -49,6 +50,7 @@ public:
* @param password Optional password for your APN
* @return 0 on success, negative error code on failure
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularNetwork.h instead.")
virtual nsapi_error_t connect(const char *apn,
const char *username = 0, const char *password = 0) = 0;
@ -58,12 +60,14 @@ public:
*
* @return 0 on success, negative error code on failure
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularNetwork.h instead.")
virtual nsapi_error_t connect() = 0;
/** Stop the interface
*
* @return 0 on success, negative error code on failure
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularNetwork.h instead.")
virtual nsapi_error_t disconnect() = 0;
};

View File

@ -23,7 +23,9 @@
/**
* OnboardCellularInterface is an on-board specific implementation.
*
*/
OnboardCellularInterface::OnboardCellularInterface(bool debug) :
UARTCellularInterface(MDMTXD, MDMRXD, MDMDCD, MDMRTS,
MDMCTS, MDMRI, MDMDTR, MDMDSR,

View File

@ -32,12 +32,15 @@ typedef mbed::EasyCellularConnection OnboardCellularInterface;
* could be derived from different implementation classes.
* Portable applications should only rely on it being a CellularBase.
*/
class OnboardCellularInterface : public UARTCellularInterface {
public:
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularPower.h instead.")
OnboardCellularInterface(bool debug = false);
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularPower.h instead.")
virtual ~OnboardCellularInterface();
protected:
@ -46,6 +49,7 @@ protected:
* modem_init() is equivalent to plugging in the device, for example, attaching power and serial port.
* Uses onboard_modem_api.h where the target provides the implementation of onboard_modem_api.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularPower.h instead.")
virtual void modem_init();
/** Sets the modem in unplugged state
@ -54,6 +58,7 @@ protected:
* and serial port. This puts the modem in lowest power state.
* Uses onboard_modem_api.h where the target provides the implementation of onboard_modem_api.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularPower.h instead.")
virtual void modem_deinit();
/** Powers up the modem
@ -62,6 +67,7 @@ protected:
* The driver may repeat this if the modem is not responsive to AT commands.
* Uses onboard_modem_api.h where the target provides the implementation of onboard_modem_api.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularPower.h instead.")
virtual void modem_power_up();
/** Powers down the modem
@ -69,6 +75,7 @@ protected:
* modem_power_down() is equivalent to turning off the modem by button press.
* Uses onboard_modem_api.h where the target provides the implementation of onboard_modem_api.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/framework/API/CellularPower.h instead.")
virtual void modem_power_down();
};

View File

@ -19,7 +19,7 @@
#include <string.h>
#include "nsapi_ppp.h"
#if MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
#include "utils/APN_db.h"
#include "APN_db.h"
#endif //MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
#if defined(FEATURE_COMMON_PAL)
#include "mbed_trace.h"
@ -570,12 +570,12 @@ nsapi_error_t PPPCellularInterface::connect()
user_specified_apn = true;
#endif
}
if (is_connected()) {
return NSAPI_ERROR_IS_CONNECTED;
} else if (_connect_status == NSAPI_STATUS_CONNECTING) {
return NSAPI_ERROR_ALREADY;
}
}
_connect_status = NSAPI_STATUS_CONNECTING;
if (_connection_status_cb) {
@ -677,7 +677,7 @@ nsapi_error_t PPPCellularInterface::connect()
}
tr_info("The APN being used is %s.\n", _apn);
/* Attempt to enter data mode */
success = set_atd(_at); //enter into Data mode with the modem
if (!success) {

View File

@ -99,6 +99,7 @@ typedef struct {
* derived from in order to provide forms for specific interfaces, as well as
* adding extra power and reset controls alongside the FileHandle.
*/
class PPPCellularInterface : public CellularBase {
public:
@ -108,8 +109,10 @@ public:
* The file handle pointer is not accessed within the constructor, only recorded for later
* use - this permits a derived class to pass a pointer to a not-yet-constructed member object.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
PPPCellularInterface(FileHandle *fh, bool debug = false);
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual ~PPPCellularInterface();
/** Set the Cellular network credentials
@ -120,6 +123,7 @@ public:
* @param uname optionally, Username
* @param pwd optionally, password
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual void set_credentials(const char *apn, const char *uname = 0,
const char *pwd = 0);
@ -127,6 +131,7 @@ public:
*
* @param sim_pin PIN for the SIM card
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual void set_sim_pin(const char *sim_pin);
/** Start the interface
@ -144,6 +149,7 @@ public:
* @param pwd optionally, password
* @return NSAPI_ERROR_OK on success, or negative error code on failure
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual nsapi_error_t connect(const char *sim_pin, const char *apn = 0,
const char *uname = 0, const char *pwd = 0);
@ -167,6 +173,7 @@ public:
* Preferred method is to setup APN using 'set_credentials()' API.
* @return 0 on success, negative error code on failure
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual nsapi_error_t connect();
/** Attempt to disconnect from the network
@ -176,6 +183,7 @@ public:
*
* @return 0 on success, negative error code on failure
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual nsapi_error_t disconnect();
/** Adds or removes a SIM facility lock
@ -188,6 +196,7 @@ public:
* @param set can be set to true if the SIM pin check is supposed to be enabled
* and vice versa.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
void set_sim_pin_check(bool set);
/** Change the pin for the SIM card
@ -198,6 +207,7 @@ public:
*
* @param new_pin new pin to be used in string format
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
void set_new_sim_pin(const char *new_pin);
/** Check if the connection is currently established or not
@ -206,6 +216,7 @@ public:
* connected to an external packet data network using PPP, isConnected()
* API returns true and false otherwise.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual bool is_connected();
/** Get the local IP address
@ -213,6 +224,7 @@ public:
* @return Null-terminated representation of the local IP address
* or null if no IP address has been received
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual const char *get_ip_address();
/** Get the local network mask
@ -220,6 +232,7 @@ public:
* @return Null-terminated representation of the local network mask
* or null if no network mask has been received
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual const char *get_netmask();
/** Get the local gateways
@ -227,6 +240,7 @@ public:
* @return Null-terminated representation of the local gateway
* or null if no network mask has been received
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual const char *get_gateway();
@ -234,18 +248,21 @@ public:
*
* @param on set true to enable debug traces
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
void modem_debug_on(bool on);
/** Register callback for status reporting
*
* @param status_cb The callback for status changes
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual void attach(Callback<void(nsapi_event_t, intptr_t)> status_cb);
/** Get the connection status
*
* @return The connection status according to nsapi_connection_status_t
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual nsapi_connection_status_t get_connection_status() const;
/** Set blocking status of connect() which by default should be blocking
@ -253,6 +270,7 @@ public:
* @param blocking true if connect is blocking
* @return 0 on success, negative error code on failure
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual nsapi_error_t set_blocking(bool blocking);
private:
@ -274,7 +292,7 @@ private:
nsapi_error_t initialize_sim_card();
nsapi_error_t setup_context_and_credentials();
bool power_up();
void power_down();
void power_down();
void ppp_status_cb(nsapi_event_t, intptr_t);
protected:

View File

@ -14,6 +14,7 @@
*/
#include "UARTCellularInterface.h"
#if NSAPI_PPP_AVAILABLE
UARTCellularInterface::UARTCellularInterface(PinName txd, PinName rxd, PinName dcd, PinName rts, PinName cts, PinName ri,

View File

@ -29,15 +29,18 @@
* It constructs a FileHandle and passes it back to its base class as well as overrides
* enable_hup() in the base class.
*/
class UARTCellularInterface : public PPPCellularInterface {
public:
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
UARTCellularInterface(PinName tx, PinName rx, PinName dcd = NC, PinName rts = NC, PinName cts = NC, PinName ri = NC,
PinName dtr = NC, PinName dsr = NC, int baud = MBED_CONF_PPP_CELL_IFACE_BAUD_RATE,
bool active_high = false,
bool debug = false);
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual ~UARTCellularInterface();
private:
@ -53,6 +56,7 @@ protected:
* signaling is not desired. enable_hup() controls whether this function should be
* active.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.")
virtual void enable_hup(bool enable);
};

View File

@ -33,7 +33,7 @@
#include "netsocket/NetworkInterface.h"
#include "netsocket/EthInterface.h"
#include "netsocket/WiFiInterface.h"
#include "netsocket/CellularInterface.h"
#include "netsocket/CellularBase.h"
#include "netsocket/MeshInterface.h"
#include "netsocket/Socket.h"