mbed-os5 only for TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Revision:
1:9db0e321a9f4
Parent:
0:5b88d5760320
--- a/features/netsocket/NetworkInterface.h	Tue Dec 17 23:23:45 2019 +0000
+++ b/features/netsocket/NetworkInterface.h	Tue Dec 31 06:02:27 2019 +0000
@@ -36,6 +36,7 @@
 class MeshInterface;
 class CellularInterface;
 class EMACInterface;
+class PPPInterface;
 
 /** Common interface that is shared between network devices.
  *
@@ -101,23 +102,50 @@
 
     /** Get the local IP address
      *
-     *  @return         Null-terminated representation of the local IP address
-     *                  or null if not yet connected
+     *  @param          address SocketAddress representation of the local IP address
+     *  @retval         NSAPI_ERROR_OK on success
+     *  @retval         NSAPI_ERROR_UNSUPPORTED if this feature is not supported
+     *  @retval         NSAPI_ERROR_PARAMETER if the provided pointer is invalid
+     *  @retval         NSAPI_ERROR_NO_ADDRESS if the address cannot be obtained from stack
      */
+    virtual nsapi_error_t get_ip_address(SocketAddress *address);
+
+    MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
     virtual const char *get_ip_address();
 
+    /** Get the IPv6 link local address
+     *
+     *  @param          address SocketAddress representation of the link local IPv6 address
+     *  @retval         NSAPI_ERROR_OK on success
+     *  @retval         NSAPI_ERROR_UNSUPPORTED if this feature is not supported
+     *  @retval         NSAPI_ERROR_PARAMETER if the provided pointer is invalid
+     */
+    virtual nsapi_error_t get_ipv6_link_local_address(SocketAddress *address);
+
     /** Get the local network mask.
      *
-     *  @return         Null-terminated representation of the local network mask
-     *                  or null if no network mask has been received.
+     *  @param          address SocketAddress representation of netmask
+     *  @retval         NSAPI_ERROR_OK on success
+     *  @retval         NSAPI_ERROR_UNSUPPORTED if this feature is not supported
+     *  @retval         NSAPI_ERROR_PARAMETER if the provided pointer is invalid
+     *  @retval         NSAPI_ERROR_NO_ADDRESS if the address cannot be obtained from stack
      */
+    virtual nsapi_error_t get_netmask(SocketAddress *address);
+
+    MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
     virtual const char *get_netmask();
 
     /** Get the local gateway.
      *
-     *  @return         Null-terminated representation of the local gateway
-     *                  or null if no network mask has been received.
+     *  @param          address SocketAddress representation of gateway address
+     *  @retval         NSAPI_ERROR_OK on success
+     *  @retval         NSAPI_ERROR_UNSUPPORTED if this feature is not supported
+     *  @retval         NSAPI_ERROR_PARAMETER if the provided pointer is invalid
+     *  @retval         NSAPI_ERROR_NO_ADDRESS if the address cannot be obtained from stack
      */
+    virtual nsapi_error_t get_gateway(SocketAddress *address);
+
+    MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
     virtual const char *get_gateway();
 
     /** Get the network interface name
@@ -131,11 +159,15 @@
      *  Implicitly disables DHCP, which can be enabled in set_dhcp.
      *  Requires that the network is disconnected.
      *
-     *  @param ip_address Null-terminated representation of the local IP address
-     *  @param netmask    Null-terminated representation of the local network mask
-     *  @param gateway    Null-terminated representation of the local gateway
-     *  @return           NSAPI_ERROR_OK on success, negative error code on failure
+     *  @param ip_address SocketAddress object containing the local IP address
+     *  @param netmask    SocketAddress object containing the local network mask
+     *  @param gateway    SocketAddress object containing the local gateway
+     *  @retval           NSAPI_ERROR_OK on success
+     *  @retval           NSAPI_ERROR_UNSUPPORTED if this function is unsupported
      */
+    virtual nsapi_error_t set_network(const SocketAddress &ip_address, const SocketAddress &netmask, const SocketAddress &gateway);
+
+    MBED_DEPRECATED_SINCE("mbed-os-5.15", "String-based APIs are deprecated")
     virtual nsapi_error_t set_network(const char *ip_address, const char *netmask, const char *gateway);
 
     /** Enable or disable DHCP on connecting the network.
@@ -144,7 +176,8 @@
      *  that the network is disconnected.
      *
      *  @param dhcp     True to enable DHCP.
-     *  @return         NSAPI_ERROR_OK on success, negative error code on failure.
+     *  @retval         NSAPI_ERROR_OK on success.
+     *  @retval         NSAPI_ERROR_UNSUPPORTED if operation is not supported.
      */
     virtual nsapi_error_t set_dhcp(bool dhcp);
 
@@ -197,7 +230,9 @@
      *  @param version  IP version of address to resolve, NSAPI_UNSPEC indicates
      *                  version is chosen by the stack (defaults to NSAPI_UNSPEC).
      *  @param interface_name  Network interface name
-     *  @return         NSAPI_ERROR_OK on success, negative error code on failure.
+     *  @retval         NSAPI_ERROR_OK on success
+     *  @retval         int Negative error code on failure.
+     *                  See @ref NetworkStack::gethostbyname
      */
     virtual nsapi_error_t gethostbyname(const char *host,
                                         SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC, const char *interface_name = NULL);
@@ -307,7 +342,7 @@
      * By default, interfaces are in synchronous mode which means that
      * connect() or disconnect() blocks until it reach the target state or requested operation fails.
      *
-     * @param blocking Use true to set NetworkInterface in asynchronous mode.
+     * @param blocking Use false to set NetworkInterface in asynchronous mode.
      * @return NSAPI_ERROR_OK on success
      * @return NSAPI_ERROR_UNSUPPORTED if driver does not support asynchronous mode.
      * @return negative error code on failure.
@@ -338,20 +373,18 @@
         return 0;
     }
 
-    /** Return pointer to a CellularInterface.
+    /** Return pointer to an EMACInterface.
      * @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
-     * @deprecated CellularBase migrated to CellularInterface - use cellularInterface()
      */
-    MBED_DEPRECATED_SINCE("mbed-os-5.12", "CellularBase migrated to CellularInterface - use cellularInterface()")
-    virtual CellularInterface *cellularBase() // virtual retained for binary compatibility
+    virtual EMACInterface *emacInterface()
     {
         return 0;
     }
 
-    /** Return pointer to an EMACInterface.
+    /** Return pointer to a CellularInterface.
      * @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
      */
-    virtual EMACInterface *emacInterface()
+    virtual CellularInterface *cellularInterface()
     {
         return 0;
     }
@@ -416,14 +449,6 @@
      * 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