mirror of https://github.com/ARMmbed/mbed-os.git
doxygen fixes
parent
ba23fef90b
commit
6cdda58cec
|
@ -18,105 +18,102 @@
|
|||
|
||||
#include "netsocket/NetworkInterface.h"
|
||||
|
||||
/** CellularBase class
|
||||
*
|
||||
* Common interface that is shared between Cellular interfaces
|
||||
/** Common interface that is shared between Cellular interfaces
|
||||
* @addtogroup netsocket
|
||||
*/
|
||||
class CellularBase: public NetworkInterface {
|
||||
|
||||
public:
|
||||
|
||||
/** Get the default Cellular interface.
|
||||
*
|
||||
* This is provided as a weak method so applications can override.
|
||||
* Default behaviour is to get the target's default interface, if
|
||||
* any.
|
||||
*
|
||||
* @return pointer to interface, if any
|
||||
* @return pointer to interface, if any.
|
||||
*/
|
||||
|
||||
static CellularBase *get_default_instance();
|
||||
|
||||
/** Set the Cellular network credentials
|
||||
/** Set the Cellular network credentials.
|
||||
*
|
||||
* Please check documentation of connect() for default behaviour of APN settings.
|
||||
*
|
||||
* @param apn Access point name
|
||||
* @param uname optionally, Username
|
||||
* @param pwd optionally, password
|
||||
* @param apn Access point name.
|
||||
* @param uname Username (optional).
|
||||
* @param pwd Password (optional).
|
||||
*/
|
||||
virtual void set_credentials(const char *apn, const char *uname = 0,
|
||||
const char *pwd = 0) = 0;
|
||||
|
||||
/** Set the pin code for SIM card
|
||||
/** Set the pin code for SIM card.
|
||||
*
|
||||
* @param sim_pin PIN for the SIM card
|
||||
* @param sim_pin PIN for the SIM card.
|
||||
*/
|
||||
virtual void set_sim_pin(const char *sim_pin) = 0;
|
||||
|
||||
/** Start the interface
|
||||
/** Attempt to connect to a Cellular network with a pin and credentials.
|
||||
*
|
||||
* Attempts to connect to a Cellular network.
|
||||
*
|
||||
* @param sim_pin PIN for the SIM card
|
||||
* @param apn optionally, access point name
|
||||
* @param uname optionally, Username
|
||||
* @param pwd optionally, password
|
||||
* @return NSAPI_ERROR_OK on success, or negative error code on failure
|
||||
* @param sim_pin PIN for the SIM card.
|
||||
* @param apn Access point name (optional).
|
||||
* @param uname Username (optional).
|
||||
* @param pwd Password (optional).
|
||||
* @return NSAPI_ERROR_OK on success, or negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t connect(const char *sim_pin, const char *apn = 0,
|
||||
const char *uname = 0,
|
||||
const char *pwd = 0) = 0;
|
||||
|
||||
/** Start the interface
|
||||
/** Attempt to connect to a Cellular network.
|
||||
*
|
||||
* Attempts to connect to a Cellular network.
|
||||
* If the SIM requires a PIN, and it is not set/invalid, NSAPI_ERROR_AUTH_ERROR is returned.
|
||||
* If the SIM requires a PIN, and it is invalid or is not set, NSAPI_ERROR_AUTH_ERROR is returned.
|
||||
*
|
||||
* @return NSAPI_ERROR_OK on success, or negative error code on failure
|
||||
* @return NSAPI_ERROR_OK on success, or negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t connect() = 0;
|
||||
|
||||
/** Stop the interface
|
||||
/** Stop the interface.
|
||||
*
|
||||
* @return 0 on success, or error code on failure
|
||||
* @return NSAPI_ERROR_OK on success, or error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t disconnect() = 0;
|
||||
|
||||
/** Check if the connection is currently established or not
|
||||
/** Check if the connection is currently established or not.
|
||||
*
|
||||
* @return true/false If the cellular module have successfully acquired a carrier and is
|
||||
* connected to an external packet data network using PPP, isConnected()
|
||||
* API returns true and false otherwise.
|
||||
* @return True if the cellular module have successfully acquired a carrier and is
|
||||
* connected to an external packet data network using PPP, false otherwise.
|
||||
*/
|
||||
virtual bool is_connected() = 0;
|
||||
|
||||
/** Get the local IP address
|
||||
/** Get the local IP address.
|
||||
*
|
||||
* @return Null-terminated representation of the local IP address
|
||||
* or null if no IP address has been received
|
||||
* or null if no IP address has been received.
|
||||
*/
|
||||
virtual const char *get_ip_address() = 0;
|
||||
|
||||
/** Get the local network mask
|
||||
/** Get the local network mask.
|
||||
*
|
||||
* @return Null-terminated representation of the local network mask
|
||||
* or null if no network mask has been received
|
||||
* or null if no network mask has been received.
|
||||
*/
|
||||
virtual const char *get_netmask() = 0;
|
||||
|
||||
/** Get the local gateways
|
||||
/** Get the local gateways.
|
||||
*
|
||||
* @return Null-terminated representation of the local gateway
|
||||
* or null if no network mask has been received
|
||||
* or null if no network mask has been received.
|
||||
*/
|
||||
virtual const char *get_gateway() = 0;
|
||||
|
||||
/** @copydoc NetworkInterface::cellularBase
|
||||
*/
|
||||
virtual CellularBase *cellularBase()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
protected:
|
||||
/** Get the target's default Cellular interface.
|
||||
*
|
||||
|
@ -127,6 +124,8 @@ protected:
|
|||
* @return pointer to interface, if any
|
||||
*/
|
||||
static CellularBase *get_target_default_instance();
|
||||
|
||||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
#endif //CELLULAR_BASE_H
|
||||
|
|
|
@ -23,13 +23,14 @@
|
|||
#include "netsocket/NetworkInterface.h"
|
||||
|
||||
|
||||
/** EthInterface class
|
||||
*
|
||||
* Common interface that is shared between ethernet hardware.
|
||||
/** Common interface that is shared between Ethernet hardware.
|
||||
* @addtogroup netsocket
|
||||
*/
|
||||
class EthInterface : public virtual NetworkInterface {
|
||||
public:
|
||||
|
||||
/** @copydoc NetworkInterface::ethInterface
|
||||
*/
|
||||
virtual EthInterface *ethInterface()
|
||||
{
|
||||
return this;
|
||||
|
@ -41,10 +42,11 @@ public:
|
|||
* Default behaviour is to get the target's default interface, if
|
||||
* any.
|
||||
*
|
||||
* @return pointer to interface, if any
|
||||
* @return Pointer to interface, if one exists.
|
||||
*/
|
||||
static EthInterface *get_default_instance();
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
protected:
|
||||
|
||||
/** Get the target's default Ethernet interface.
|
||||
|
@ -53,9 +55,10 @@ protected:
|
|||
* default implementation will invoke EthernetInterface with the
|
||||
* default EMAC and default network stack, if DEVICE_EMAC is set.
|
||||
*
|
||||
* @return pointer to interface, if any
|
||||
* @return Pointer to interface, if one exists.
|
||||
*/
|
||||
static EthInterface *get_target_default_instance();
|
||||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -21,12 +21,11 @@
|
|||
#include "EMACInterface.h"
|
||||
|
||||
|
||||
/** EthernetInterface class
|
||||
* Implementation of the NetworkStack for an EMAC-based Ethernet driver
|
||||
/** Implementation of the NetworkStack for an EMAC-based Ethernet driver.
|
||||
*/
|
||||
class EthernetInterface : public EMACInterface, public EthInterface {
|
||||
public:
|
||||
/** Create an EMAC-based ethernet interface.
|
||||
/** Create an EMAC-based Ethernet interface.
|
||||
*
|
||||
* The default arguments obtain the default EMAC, which will be target-
|
||||
* dependent (and the target may have some JSON option to choose which
|
||||
|
@ -36,8 +35,8 @@ public:
|
|||
* Due to inability to return errors from the constructor, no real
|
||||
* work is done until the first call to connect().
|
||||
*
|
||||
* @param emac Reference to EMAC to use
|
||||
* @param stack Reference to onboard-network stack to use
|
||||
* @param emac Reference to EMAC to use.
|
||||
* @param stack Reference to onboard-network stack to use.
|
||||
*/
|
||||
EthernetInterface(EMAC &emac = EMAC::get_default_instance(),
|
||||
OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance()) : EMACInterface(emac, stack) { }
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
#include "netsocket/NetworkInterface.h"
|
||||
|
||||
|
||||
/** MeshInterface class
|
||||
*
|
||||
* Common interface that is shared between mesh hardware
|
||||
/** Common interface that is shared between mesh hardware
|
||||
* @addtogroup netsocket
|
||||
*/
|
||||
class MeshInterface : public virtual NetworkInterface {
|
||||
public:
|
||||
|
||||
/** @copydoc NetworkInterface::meshInterface
|
||||
*/
|
||||
virtual MeshInterface *meshInterface()
|
||||
{
|
||||
return this;
|
||||
|
@ -41,10 +41,11 @@ public:
|
|||
* Default behaviour is to get the target's default interface, if
|
||||
* any.
|
||||
*
|
||||
* @return pointer to interface, if any
|
||||
* @return pointer to interface, if any.
|
||||
*/
|
||||
static MeshInterface *get_default_instance();
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
protected:
|
||||
|
||||
/** Get the target's default Mesh interface.
|
||||
|
@ -53,9 +54,10 @@ protected:
|
|||
* default implementation will invoke LoWPANNDInterface or ThreadInterface
|
||||
* with the default NanostackRfPhy.
|
||||
*
|
||||
* @return pointer to interface, if any
|
||||
* @return pointer to interface, if any.
|
||||
*/
|
||||
static MeshInterface *get_target_default_instance();
|
||||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -31,9 +31,8 @@ class MeshInterface;
|
|||
class CellularBase;
|
||||
class EMACInterface;
|
||||
|
||||
/** NetworkInterface class
|
||||
/** Common interface that is shared between network devices.
|
||||
*
|
||||
* Common interface that is shared between network devices
|
||||
* @addtogroup netsocket
|
||||
*/
|
||||
class NetworkInterface: public DNS {
|
||||
|
@ -41,13 +40,14 @@ public:
|
|||
|
||||
virtual ~NetworkInterface() {};
|
||||
|
||||
/** Return the default network interface
|
||||
/** Return the default network interface.
|
||||
*
|
||||
* Returns the default network interface, as determined by JSON option
|
||||
* target.network-default-interface-type or other overrides.
|
||||
*
|
||||
* The type of the interface returned can be tested via the ethInterface()
|
||||
* etc downcasts.
|
||||
* The type of the interface returned can be tested by calling ethInterface(),
|
||||
* wifiInterface(), meshInterface(), cellularBase(), emacInterface() and checking
|
||||
* for NULL pointers.
|
||||
*
|
||||
* The default behaviour is to return the default interface for the
|
||||
* interface type specified by target.network-default-interface-type. Targets
|
||||
|
@ -79,41 +79,39 @@ public:
|
|||
*/
|
||||
static NetworkInterface *get_default_instance();
|
||||
|
||||
/** Get the local MAC address
|
||||
/** Get the local MAC address.
|
||||
*
|
||||
* Provided MAC address is intended for info or debug purposes and
|
||||
* may not be provided if the underlying network interface does not
|
||||
* provide a MAC address
|
||||
* may be not provided if the underlying network interface does not
|
||||
* provide a MAC address.
|
||||
*
|
||||
* @return Null-terminated representation of the local MAC address
|
||||
* or null if no MAC address is available
|
||||
* or null if no MAC address is available.
|
||||
*/
|
||||
virtual const char *get_mac_address();
|
||||
|
||||
/** Get the local IP address
|
||||
/** Get the local IP address.
|
||||
*
|
||||
* @return Null-terminated representation of the local IP address
|
||||
* or null if no IP address has been received
|
||||
* or null if no IP address has been received.
|
||||
*/
|
||||
virtual const char *get_ip_address();
|
||||
|
||||
/** Get the local network mask
|
||||
/** Get the local network mask.
|
||||
*
|
||||
* @return Null-terminated representation of the local network mask
|
||||
* or null if no network mask has been received
|
||||
* or null if no network mask has been received.
|
||||
*/
|
||||
virtual const char *get_netmask();
|
||||
|
||||
/** Get the local gateway
|
||||
/** Get the local gateway.
|
||||
*
|
||||
* @return Null-terminated representation of the local gateway
|
||||
* or null if no network mask has been received
|
||||
* or null if no network mask has been received.
|
||||
*/
|
||||
virtual const char *get_gateway();
|
||||
|
||||
/** Set a static IP address
|
||||
*
|
||||
* Configures this network interface to use a static IP address.
|
||||
/** Configure this network interface to use a static IP address.
|
||||
* Implicitly disables DHCP, which can be enabled in set_dhcp.
|
||||
* Requires that the network is disconnected.
|
||||
*
|
||||
|
@ -124,30 +122,29 @@ public:
|
|||
*/
|
||||
virtual nsapi_error_t set_network(const char *ip_address, const char *netmask, const char *gateway);
|
||||
|
||||
/** Enable or disable DHCP on the network
|
||||
/** Enable or disable DHCP on connecting the network.
|
||||
*
|
||||
* Enables DHCP on connecting the network. Defaults to enabled unless
|
||||
* a static IP address has been assigned. Requires that the network is
|
||||
* disconnected.
|
||||
* Enabled by default unless a static IP address has been assigned. Requires
|
||||
* that the network is disconnected.
|
||||
*
|
||||
* @param dhcp True to enable DHCP
|
||||
* @return 0 on success, negative error code on failure
|
||||
* @param dhcp True to enable DHCP.
|
||||
* @return 0 on success, negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t set_dhcp(bool dhcp);
|
||||
|
||||
/** Start the interface
|
||||
/** Start the interface.
|
||||
*
|
||||
* @return 0 on success, negative error code on failure
|
||||
* @return 0 on success, negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t connect() = 0;
|
||||
|
||||
/** Stop the interface
|
||||
/** Stop the interface.
|
||||
*
|
||||
* @return 0 on success, negative error code on failure
|
||||
* @return 0 on success, negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t disconnect() = 0;
|
||||
|
||||
/** Translates a hostname to an IP address with specific version
|
||||
/** Translate a hostname to an IP address with specific version.
|
||||
*
|
||||
* The hostname may be either a domain name or an IP address. If the
|
||||
* hostname is an IP address, no network transactions will be performed.
|
||||
|
@ -155,33 +152,33 @@ public:
|
|||
* If no stack-specific DNS resolution is provided, the hostname
|
||||
* will be resolve using a UDP socket on the stack.
|
||||
*
|
||||
* @param host Hostname to resolve
|
||||
* @param address Destination for the host SocketAddress
|
||||
* @param host Hostname to resolve.
|
||||
* @param address Destination for the host SocketAddress.
|
||||
* @param version IP version of address to resolve, NSAPI_UNSPEC indicates
|
||||
* version is chosen by the stack (defaults to NSAPI_UNSPEC)
|
||||
* @return 0 on success, negative error code on failure
|
||||
* version is chosen by the stack (defaults to NSAPI_UNSPEC).
|
||||
* @return 0 on success, negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t gethostbyname(const char *host,
|
||||
SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC);
|
||||
|
||||
/** Hostname translation callback (asynchronous)
|
||||
/** Hostname translation callback (for use with gethostbyname_async()).
|
||||
*
|
||||
* Callback will be called after DNS resolution completes or a failure occurs.
|
||||
*
|
||||
* Callback should not take more than 10ms to execute, otherwise it might
|
||||
* @note Callback should not take more than 10ms to execute, otherwise it might
|
||||
* prevent underlying thread processing. A portable user of the callback
|
||||
* should not make calls to network operations due to stack size limitations.
|
||||
* The callback should not perform expensive operations such as socket recv/send
|
||||
* calls or blocking operations.
|
||||
*
|
||||
* @param status 0 on success, negative error code on failure
|
||||
* @param address On success, destination for the host SocketAddress
|
||||
* @param result 0 on success, negative error code on failure.
|
||||
* @param address On success, destination for the host SocketAddress.
|
||||
*/
|
||||
typedef mbed::Callback<void (nsapi_error_t result, SocketAddress *address)> hostbyname_cb_t;
|
||||
|
||||
/** Translates a hostname to an IP address (asynchronous)
|
||||
/** Translate a hostname to an IP address (asynchronous).
|
||||
*
|
||||
* The hostname may be either a domain name or an IP address. If the
|
||||
* The hostname may be either a domain name or a dotted IP address. If the
|
||||
* hostname is an IP address, no network transactions will be performed.
|
||||
*
|
||||
* If no stack-specific DNS resolution is provided, the hostname
|
||||
|
@ -192,87 +189,100 @@ public:
|
|||
* is success (IP address was found from DNS cache), callback will be called
|
||||
* before function returns.
|
||||
*
|
||||
* @param host Hostname to resolve
|
||||
* @param callback Callback that is called for result
|
||||
* @param host Hostname to resolve.
|
||||
* @param callback Callback that is called for result.
|
||||
* @param version IP version of address to resolve, NSAPI_UNSPEC indicates
|
||||
* version is chosen by the stack (defaults to NSAPI_UNSPEC)
|
||||
* version is chosen by the stack (defaults to NSAPI_UNSPEC).
|
||||
* @return 0 on immediate success,
|
||||
* negative error code on immediate failure or
|
||||
* a positive unique id that represents the hostname translation operation
|
||||
* and can be passed to cancel
|
||||
* and can be passed to cancel.
|
||||
*/
|
||||
virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback,
|
||||
nsapi_version_t version = NSAPI_UNSPEC);
|
||||
|
||||
/** Cancels asynchronous hostname translation
|
||||
/** Cancel asynchronous hostname translation.
|
||||
*
|
||||
* When translation is cancelled, callback will not be called.
|
||||
*
|
||||
* @param id Unique id of the hostname translation operation
|
||||
* @return 0 on success, negative error code on failure
|
||||
* @param id Unique id of the hostname translation operation (returned
|
||||
* by gethostbyname_async)
|
||||
* @return 0 on success, negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t gethostbyname_async_cancel(int id);
|
||||
|
||||
/** Add a domain name server to list of servers to query
|
||||
*
|
||||
* @param address Destination for the host address
|
||||
* @return 0 on success, negative error code on failure
|
||||
* @param address Address for the dns host.
|
||||
* @return 0 on success, negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t add_dns_server(const SocketAddress &address);
|
||||
|
||||
/** Register callback for status reporting
|
||||
/** Register callback for status reporting.
|
||||
*
|
||||
* The specified status callback function will be called on status changes
|
||||
* on the network. The parameters on the callback are the event type and
|
||||
* event-type dependent reason parameter.
|
||||
*
|
||||
* @param status_cb The callback for status changes
|
||||
* @param status_cb The callback for status changes.
|
||||
*/
|
||||
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
|
||||
|
||||
/** Get the connection status
|
||||
/** Get the connection status.
|
||||
*
|
||||
* @return The connection status according to ConnectionStatusType
|
||||
* @return The connection status (@see nsapi_types.h).
|
||||
*/
|
||||
virtual nsapi_connection_status_t get_connection_status() const;
|
||||
|
||||
/** Set blocking status of connect() which by default should be blocking
|
||||
/** Set blocking status of connect() which by default should be blocking.
|
||||
*
|
||||
* @param blocking true if connect is blocking
|
||||
* @return 0 on success, negative error code on failure
|
||||
* @param blocking Use true to make connect() blocking.
|
||||
* @return 0 on success, negative error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t set_blocking(bool blocking);
|
||||
|
||||
/** Dynamic downcast to an EthInterface */
|
||||
/** Return pointer to an EthInterface.
|
||||
* @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
|
||||
*/
|
||||
virtual EthInterface *ethInterface()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Dynamic downcast to a WiFiInterface */
|
||||
/** Return pointer to a WiFiInterface.
|
||||
* @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
|
||||
*/
|
||||
virtual WiFiInterface *wifiInterface()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Dynamic downcast to a MeshInterface */
|
||||
/** Return pointer to a MeshInterface.
|
||||
* @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
|
||||
*/
|
||||
virtual MeshInterface *meshInterface()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Dynamic downcast to a CellularBase */
|
||||
/** Return pointer to a CellularBase.
|
||||
* @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
|
||||
*/
|
||||
virtual CellularBase *cellularBase()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Dynamic downcast to an EMACInterface */
|
||||
/** Return pointer to an EMACInterface.
|
||||
* @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
|
||||
*/
|
||||
virtual EMACInterface *emacInterface()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
protected:
|
||||
friend class InternetSocket;
|
||||
friend class UDPSocket;
|
||||
|
@ -318,6 +328,7 @@ protected:
|
|||
* performs the search described by get_default_instance.
|
||||
*/
|
||||
static NetworkInterface *get_target_default_instance();
|
||||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
#include "netsocket/NetworkInterface.h"
|
||||
#include "netsocket/WiFiAccessPoint.h"
|
||||
|
||||
/** WiFiInterface class
|
||||
/** Common interface that is shared between WiFi devices.
|
||||
*
|
||||
* Common interface that is shared between WiFi devices
|
||||
* @addtogroup netsocket
|
||||
*/
|
||||
class WiFiInterface: public virtual NetworkInterface {
|
||||
|
@ -35,81 +34,80 @@ public:
|
|||
* Default behaviour is to get the target's default interface, if
|
||||
* any.
|
||||
*
|
||||
* @return pointer to interface, if any
|
||||
* @return pointer to interface, if any.
|
||||
*/
|
||||
static WiFiInterface *get_default_instance();
|
||||
|
||||
/** Set the WiFi network credentials
|
||||
/** Set the WiFi network credentials.
|
||||
*
|
||||
* @param ssid Name of the network to connect to
|
||||
* @param pass Security passphrase to connect to the network
|
||||
* @param ssid Name of the network to connect to.
|
||||
* @param pass Security passphrase to connect to the network.
|
||||
* @param security Type of encryption for connection
|
||||
* (defaults to NSAPI_SECURITY_NONE)
|
||||
* @return 0 on success, or error code on failure
|
||||
* (defaults to NSAPI_SECURITY_NONE).
|
||||
* @return NSAPI_ERROR_OK on success, or error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t set_credentials(const char *ssid, const char *pass,
|
||||
nsapi_security_t security = NSAPI_SECURITY_NONE) = 0;
|
||||
|
||||
/** Set the WiFi network channel
|
||||
/** Set the WiFi network channel.
|
||||
*
|
||||
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0)
|
||||
* @return 0 on success, or error code on failure
|
||||
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0).
|
||||
* @return NSAPI_ERROR_OK on success, or error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t set_channel(uint8_t channel) = 0;
|
||||
|
||||
/** Gets the current radio signal strength for active connection
|
||||
/** Get the current radio signal strength for active connection.
|
||||
*
|
||||
* @return Connection strength in dBm (negative value),
|
||||
* or 0 if measurement impossible
|
||||
* or 0 if measurement impossible.
|
||||
*/
|
||||
virtual int8_t get_rssi() = 0;
|
||||
|
||||
/** Start the interface
|
||||
/** Attempt to connect to a WiFi network.
|
||||
*
|
||||
* Attempts to connect to a WiFi network.
|
||||
*
|
||||
* @param ssid Name of the network to connect to
|
||||
* @param pass Security passphrase to connect to the network
|
||||
* @param security Type of encryption for connection (Default: NSAPI_SECURITY_NONE)
|
||||
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0)
|
||||
* @return 0 on success, or error code on failure
|
||||
* @param ssid Name of the network to connect to.
|
||||
* @param pass Security passphrase to connect to the network.
|
||||
* @param security Type of encryption for connection (Default: NSAPI_SECURITY_NONE).
|
||||
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0).
|
||||
* @return NSAPI_ERROR_OK on success, or error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t connect(const char *ssid, const char *pass,
|
||||
nsapi_security_t security = NSAPI_SECURITY_NONE, uint8_t channel = 0) = 0;
|
||||
|
||||
/** Start the interface
|
||||
*
|
||||
* Attempts to connect to a WiFi network. Requires ssid and passphrase to be set.
|
||||
/** Attempt to connect to a WiFi network. Requires ssid and passphrase to be set.
|
||||
* If passphrase is invalid, NSAPI_ERROR_AUTH_ERROR is returned.
|
||||
*
|
||||
* @return 0 on success, negative error code on failure
|
||||
* @return NSAPI_ERROR_OK on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t connect() = 0;
|
||||
|
||||
/** Stop the interface
|
||||
/** Stop the interface.
|
||||
*
|
||||
* @return 0 on success, or error code on failure
|
||||
* @return NSAPI_ERROR_OK on success, or error code on failure.
|
||||
*/
|
||||
virtual nsapi_error_t disconnect() = 0;
|
||||
|
||||
/** Scan for available networks
|
||||
/** Scan for available networks.
|
||||
*
|
||||
* This function will block. If the @a count is 0, function will only return count of available networks, so that
|
||||
* user can allocated necessary memory. If the \p count is grater than 0 and the a \p res is not NULL it'll be populated
|
||||
* with discovered networks up to value of \p count.
|
||||
* This function will block. If the count is 0, function will only return count of available networks, so that
|
||||
* user can allocated necessary memory. If the count is grater than 0 and the a \p res is not NULL it'll be populated
|
||||
* with discovered networks up to value of count.
|
||||
*
|
||||
* @param res Pointer to allocated array to store discovered AP
|
||||
* @param count Size of allocated @a res array, or 0 to only count available AP
|
||||
* @return Number of entries in \p count, or if \p count was 0 number of available networks,
|
||||
* negative on error see @a nsapi_error
|
||||
* @param res Pointer to allocated array to store discovered APs.
|
||||
* @param count Size of allocated res array, or 0 to only count available APs.
|
||||
* @return Number of entries in res, or if count was 0 number of available networks.
|
||||
* Negative on error (@see nsapi_types.h for nsapi_error).
|
||||
*/
|
||||
virtual nsapi_size_or_error_t scan(WiFiAccessPoint *res, nsapi_size_t count) = 0;
|
||||
|
||||
/** @copydoc NetworkInterface::wifiInterface
|
||||
*/
|
||||
virtual WiFiInterface *wifiInterface()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
protected:
|
||||
|
||||
/** Get the target's default WiFi interface.
|
||||
|
@ -117,9 +115,10 @@ protected:
|
|||
* This is provided as a weak method so targets can override. The
|
||||
* default implementation returns NULL.
|
||||
*
|
||||
* @return pointer to interface, if any
|
||||
* @return pointer to interface, if any.
|
||||
*/
|
||||
static WiFiInterface *get_target_default_instance();
|
||||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue