Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466

Dependencies:   ssd1331

Committer:
kadonotakashi
Date:
Thu Oct 11 02:27:46 2018 +0000
Revision:
3:f3764f852aa8
Parent:
0:8fdf9a60065b
Nucreo 446 + SSD1331 test version;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kadonotakashi 0:8fdf9a60065b 1 /* NetworkStack
kadonotakashi 0:8fdf9a60065b 2 * Copyright (c) 2015 ARM Limited
kadonotakashi 0:8fdf9a60065b 3 *
kadonotakashi 0:8fdf9a60065b 4 * Licensed under the Apache License, Version 2.0 (the "License");
kadonotakashi 0:8fdf9a60065b 5 * you may not use this file except in compliance with the License.
kadonotakashi 0:8fdf9a60065b 6 * You may obtain a copy of the License at
kadonotakashi 0:8fdf9a60065b 7 *
kadonotakashi 0:8fdf9a60065b 8 * http://www.apache.org/licenses/LICENSE-2.0
kadonotakashi 0:8fdf9a60065b 9 *
kadonotakashi 0:8fdf9a60065b 10 * Unless required by applicable law or agreed to in writing, software
kadonotakashi 0:8fdf9a60065b 11 * distributed under the License is distributed on an "AS IS" BASIS,
kadonotakashi 0:8fdf9a60065b 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
kadonotakashi 0:8fdf9a60065b 13 * See the License for the specific language governing permissions and
kadonotakashi 0:8fdf9a60065b 14 * limitations under the License.
kadonotakashi 0:8fdf9a60065b 15 */
kadonotakashi 0:8fdf9a60065b 16
kadonotakashi 0:8fdf9a60065b 17 #ifndef NETWORK_INTERFACE_H
kadonotakashi 0:8fdf9a60065b 18 #define NETWORK_INTERFACE_H
kadonotakashi 0:8fdf9a60065b 19
kadonotakashi 0:8fdf9a60065b 20 #include "netsocket/nsapi_types.h"
kadonotakashi 0:8fdf9a60065b 21 #include "netsocket/SocketAddress.h"
kadonotakashi 0:8fdf9a60065b 22 #include "Callback.h"
kadonotakashi 0:8fdf9a60065b 23 #include "DNS.h"
kadonotakashi 0:8fdf9a60065b 24
kadonotakashi 0:8fdf9a60065b 25
kadonotakashi 0:8fdf9a60065b 26 // Predeclared classes
kadonotakashi 0:8fdf9a60065b 27 class NetworkStack;
kadonotakashi 0:8fdf9a60065b 28 class EthInterface;
kadonotakashi 0:8fdf9a60065b 29 class WiFiInterface;
kadonotakashi 0:8fdf9a60065b 30 class MeshInterface;
kadonotakashi 0:8fdf9a60065b 31 class CellularBase;
kadonotakashi 0:8fdf9a60065b 32 class EMACInterface;
kadonotakashi 0:8fdf9a60065b 33
kadonotakashi 0:8fdf9a60065b 34 /** NetworkInterface class
kadonotakashi 0:8fdf9a60065b 35 *
kadonotakashi 0:8fdf9a60065b 36 * Common interface that is shared between network devices
kadonotakashi 0:8fdf9a60065b 37 * @addtogroup netsocket
kadonotakashi 0:8fdf9a60065b 38 */
kadonotakashi 0:8fdf9a60065b 39 class NetworkInterface: public DNS {
kadonotakashi 0:8fdf9a60065b 40 public:
kadonotakashi 0:8fdf9a60065b 41
kadonotakashi 0:8fdf9a60065b 42 virtual ~NetworkInterface() {};
kadonotakashi 0:8fdf9a60065b 43
kadonotakashi 0:8fdf9a60065b 44 /** Return the default network interface
kadonotakashi 0:8fdf9a60065b 45 *
kadonotakashi 0:8fdf9a60065b 46 * Returns the default network interface, as determined by JSON option
kadonotakashi 0:8fdf9a60065b 47 * target.network-default-interface-type or other overrides.
kadonotakashi 0:8fdf9a60065b 48 *
kadonotakashi 0:8fdf9a60065b 49 * The type of the interface returned can be tested via the ethInterface()
kadonotakashi 0:8fdf9a60065b 50 * etc downcasts.
kadonotakashi 0:8fdf9a60065b 51 *
kadonotakashi 0:8fdf9a60065b 52 * The default behaviour is to return the default interface for the
kadonotakashi 0:8fdf9a60065b 53 * interface type specified by target.network-default-interface-type. Targets
kadonotakashi 0:8fdf9a60065b 54 * should set this in their targets.json to guide default selection,
kadonotakashi 0:8fdf9a60065b 55 * and applications may override.
kadonotakashi 0:8fdf9a60065b 56 *
kadonotakashi 0:8fdf9a60065b 57 * The interface returned should be already configured for use such that its
kadonotakashi 0:8fdf9a60065b 58 * connect() method works with no parameters. For connection types needing
kadonotakashi 0:8fdf9a60065b 59 * configuration, settings should normally be obtained from JSON - the
kadonotakashi 0:8fdf9a60065b 60 * settings for the core types are under the "nsapi" JSON config tree.
kadonotakashi 0:8fdf9a60065b 61 *
kadonotakashi 0:8fdf9a60065b 62 * The list of possible settings for default interface type is open-ended,
kadonotakashi 0:8fdf9a60065b 63 * as is the number of possible providers. Core providers are:
kadonotakashi 0:8fdf9a60065b 64 *
kadonotakashi 0:8fdf9a60065b 65 * * ETHERNET: EthernetInterface, using default EMAC and OnboardNetworkStack
kadonotakashi 0:8fdf9a60065b 66 * * MESH: ThreadInterface or LoWPANNDInterface, using default NanostackRfPhy
kadonotakashi 0:8fdf9a60065b 67 * * CELLULAR: OnboardModemInterface
kadonotakashi 0:8fdf9a60065b 68 * * WIFI: None - always provided by a specific class
kadonotakashi 0:8fdf9a60065b 69 *
kadonotakashi 0:8fdf9a60065b 70 * Specific drivers may be activated by other settings of the
kadonotakashi 0:8fdf9a60065b 71 * default-network-interface-type configuration. This will depend on the
kadonotakashi 0:8fdf9a60065b 72 * target and the driver. For example a board may have its default setting
kadonotakashi 0:8fdf9a60065b 73 * as "AUTO" which causes it to autodetect an Ethernet cable. This should
kadonotakashi 0:8fdf9a60065b 74 * be described in the target's documentation.
kadonotakashi 0:8fdf9a60065b 75 *
kadonotakashi 0:8fdf9a60065b 76 * An application can override all target settings by implementing
kadonotakashi 0:8fdf9a60065b 77 * NetworkInterface::get_default_instance() themselves - the default
kadonotakashi 0:8fdf9a60065b 78 * definition is weak, and calls get_target_default_instance().
kadonotakashi 0:8fdf9a60065b 79 */
kadonotakashi 0:8fdf9a60065b 80 static NetworkInterface *get_default_instance();
kadonotakashi 0:8fdf9a60065b 81
kadonotakashi 0:8fdf9a60065b 82 /** Get the local MAC address
kadonotakashi 0:8fdf9a60065b 83 *
kadonotakashi 0:8fdf9a60065b 84 * Provided MAC address is intended for info or debug purposes and
kadonotakashi 0:8fdf9a60065b 85 * may not be provided if the underlying network interface does not
kadonotakashi 0:8fdf9a60065b 86 * provide a MAC address
kadonotakashi 0:8fdf9a60065b 87 *
kadonotakashi 0:8fdf9a60065b 88 * @return Null-terminated representation of the local MAC address
kadonotakashi 0:8fdf9a60065b 89 * or null if no MAC address is available
kadonotakashi 0:8fdf9a60065b 90 */
kadonotakashi 0:8fdf9a60065b 91 virtual const char *get_mac_address();
kadonotakashi 0:8fdf9a60065b 92
kadonotakashi 0:8fdf9a60065b 93 /** Get the local IP address
kadonotakashi 0:8fdf9a60065b 94 *
kadonotakashi 0:8fdf9a60065b 95 * @return Null-terminated representation of the local IP address
kadonotakashi 0:8fdf9a60065b 96 * or null if no IP address has been received
kadonotakashi 0:8fdf9a60065b 97 */
kadonotakashi 0:8fdf9a60065b 98 virtual const char *get_ip_address();
kadonotakashi 0:8fdf9a60065b 99
kadonotakashi 0:8fdf9a60065b 100 /** Get the local network mask
kadonotakashi 0:8fdf9a60065b 101 *
kadonotakashi 0:8fdf9a60065b 102 * @return Null-terminated representation of the local network mask
kadonotakashi 0:8fdf9a60065b 103 * or null if no network mask has been received
kadonotakashi 0:8fdf9a60065b 104 */
kadonotakashi 0:8fdf9a60065b 105 virtual const char *get_netmask();
kadonotakashi 0:8fdf9a60065b 106
kadonotakashi 0:8fdf9a60065b 107 /** Get the local gateway
kadonotakashi 0:8fdf9a60065b 108 *
kadonotakashi 0:8fdf9a60065b 109 * @return Null-terminated representation of the local gateway
kadonotakashi 0:8fdf9a60065b 110 * or null if no network mask has been received
kadonotakashi 0:8fdf9a60065b 111 */
kadonotakashi 0:8fdf9a60065b 112 virtual const char *get_gateway();
kadonotakashi 0:8fdf9a60065b 113
kadonotakashi 0:8fdf9a60065b 114 /** Set a static IP address
kadonotakashi 0:8fdf9a60065b 115 *
kadonotakashi 0:8fdf9a60065b 116 * Configures this network interface to use a static IP address.
kadonotakashi 0:8fdf9a60065b 117 * Implicitly disables DHCP, which can be enabled in set_dhcp.
kadonotakashi 0:8fdf9a60065b 118 * Requires that the network is disconnected.
kadonotakashi 0:8fdf9a60065b 119 *
kadonotakashi 0:8fdf9a60065b 120 * @param ip_address Null-terminated representation of the local IP address
kadonotakashi 0:8fdf9a60065b 121 * @param netmask Null-terminated representation of the local network mask
kadonotakashi 0:8fdf9a60065b 122 * @param gateway Null-terminated representation of the local gateway
kadonotakashi 0:8fdf9a60065b 123 * @return 0 on success, negative error code on failure
kadonotakashi 0:8fdf9a60065b 124 */
kadonotakashi 0:8fdf9a60065b 125 virtual nsapi_error_t set_network(const char *ip_address, const char *netmask, const char *gateway);
kadonotakashi 0:8fdf9a60065b 126
kadonotakashi 0:8fdf9a60065b 127 /** Enable or disable DHCP on the network
kadonotakashi 0:8fdf9a60065b 128 *
kadonotakashi 0:8fdf9a60065b 129 * Enables DHCP on connecting the network. Defaults to enabled unless
kadonotakashi 0:8fdf9a60065b 130 * a static IP address has been assigned. Requires that the network is
kadonotakashi 0:8fdf9a60065b 131 * disconnected.
kadonotakashi 0:8fdf9a60065b 132 *
kadonotakashi 0:8fdf9a60065b 133 * @param dhcp True to enable DHCP
kadonotakashi 0:8fdf9a60065b 134 * @return 0 on success, negative error code on failure
kadonotakashi 0:8fdf9a60065b 135 */
kadonotakashi 0:8fdf9a60065b 136 virtual nsapi_error_t set_dhcp(bool dhcp);
kadonotakashi 0:8fdf9a60065b 137
kadonotakashi 0:8fdf9a60065b 138 /** Start the interface
kadonotakashi 0:8fdf9a60065b 139 *
kadonotakashi 0:8fdf9a60065b 140 * @return 0 on success, negative error code on failure
kadonotakashi 0:8fdf9a60065b 141 */
kadonotakashi 0:8fdf9a60065b 142 virtual nsapi_error_t connect() = 0;
kadonotakashi 0:8fdf9a60065b 143
kadonotakashi 0:8fdf9a60065b 144 /** Stop the interface
kadonotakashi 0:8fdf9a60065b 145 *
kadonotakashi 0:8fdf9a60065b 146 * @return 0 on success, negative error code on failure
kadonotakashi 0:8fdf9a60065b 147 */
kadonotakashi 0:8fdf9a60065b 148 virtual nsapi_error_t disconnect() = 0;
kadonotakashi 0:8fdf9a60065b 149
kadonotakashi 0:8fdf9a60065b 150 /** Translates a hostname to an IP address with specific version
kadonotakashi 0:8fdf9a60065b 151 *
kadonotakashi 0:8fdf9a60065b 152 * The hostname may be either a domain name or an IP address. If the
kadonotakashi 0:8fdf9a60065b 153 * hostname is an IP address, no network transactions will be performed.
kadonotakashi 0:8fdf9a60065b 154 *
kadonotakashi 0:8fdf9a60065b 155 * If no stack-specific DNS resolution is provided, the hostname
kadonotakashi 0:8fdf9a60065b 156 * will be resolve using a UDP socket on the stack.
kadonotakashi 0:8fdf9a60065b 157 *
kadonotakashi 0:8fdf9a60065b 158 * @param host Hostname to resolve
kadonotakashi 0:8fdf9a60065b 159 * @param address Destination for the host SocketAddress
kadonotakashi 0:8fdf9a60065b 160 * @param version IP version of address to resolve, NSAPI_UNSPEC indicates
kadonotakashi 0:8fdf9a60065b 161 * version is chosen by the stack (defaults to NSAPI_UNSPEC)
kadonotakashi 0:8fdf9a60065b 162 * @return 0 on success, negative error code on failure
kadonotakashi 0:8fdf9a60065b 163 */
kadonotakashi 0:8fdf9a60065b 164 virtual nsapi_error_t gethostbyname(const char *host,
kadonotakashi 0:8fdf9a60065b 165 SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC);
kadonotakashi 0:8fdf9a60065b 166
kadonotakashi 0:8fdf9a60065b 167 /** Hostname translation callback (asynchronous)
kadonotakashi 0:8fdf9a60065b 168 *
kadonotakashi 0:8fdf9a60065b 169 * Callback will be called after DNS resolution completes or a failure occurs.
kadonotakashi 0:8fdf9a60065b 170 *
kadonotakashi 0:8fdf9a60065b 171 * Callback should not take more than 10ms to execute, otherwise it might
kadonotakashi 0:8fdf9a60065b 172 * prevent underlying thread processing. A portable user of the callback
kadonotakashi 0:8fdf9a60065b 173 * should not make calls to network operations due to stack size limitations.
kadonotakashi 0:8fdf9a60065b 174 * The callback should not perform expensive operations such as socket recv/send
kadonotakashi 0:8fdf9a60065b 175 * calls or blocking operations.
kadonotakashi 0:8fdf9a60065b 176 *
kadonotakashi 0:8fdf9a60065b 177 * @param status 0 on success, negative error code on failure
kadonotakashi 0:8fdf9a60065b 178 * @param address On success, destination for the host SocketAddress
kadonotakashi 0:8fdf9a60065b 179 */
kadonotakashi 0:8fdf9a60065b 180 typedef mbed::Callback<void (nsapi_error_t result, SocketAddress *address)> hostbyname_cb_t;
kadonotakashi 0:8fdf9a60065b 181
kadonotakashi 0:8fdf9a60065b 182 /** Translates a hostname to an IP address (asynchronous)
kadonotakashi 0:8fdf9a60065b 183 *
kadonotakashi 0:8fdf9a60065b 184 * The hostname may be either a domain name or an IP address. If the
kadonotakashi 0:8fdf9a60065b 185 * hostname is an IP address, no network transactions will be performed.
kadonotakashi 0:8fdf9a60065b 186 *
kadonotakashi 0:8fdf9a60065b 187 * If no stack-specific DNS resolution is provided, the hostname
kadonotakashi 0:8fdf9a60065b 188 * will be resolve using a UDP socket on the stack.
kadonotakashi 0:8fdf9a60065b 189 *
kadonotakashi 0:8fdf9a60065b 190 * Call is non-blocking. Result of the DNS operation is returned by the callback.
kadonotakashi 0:8fdf9a60065b 191 * If this function returns failure, callback will not be called. In case result
kadonotakashi 0:8fdf9a60065b 192 * is success (IP address was found from DNS cache), callback will be called
kadonotakashi 0:8fdf9a60065b 193 * before function returns.
kadonotakashi 0:8fdf9a60065b 194 *
kadonotakashi 0:8fdf9a60065b 195 * @param host Hostname to resolve
kadonotakashi 0:8fdf9a60065b 196 * @param callback Callback that is called for result
kadonotakashi 0:8fdf9a60065b 197 * @param version IP version of address to resolve, NSAPI_UNSPEC indicates
kadonotakashi 0:8fdf9a60065b 198 * version is chosen by the stack (defaults to NSAPI_UNSPEC)
kadonotakashi 0:8fdf9a60065b 199 * @return 0 on immediate success,
kadonotakashi 0:8fdf9a60065b 200 * negative error code on immediate failure or
kadonotakashi 0:8fdf9a60065b 201 * a positive unique id that represents the hostname translation operation
kadonotakashi 0:8fdf9a60065b 202 * and can be passed to cancel
kadonotakashi 0:8fdf9a60065b 203 */
kadonotakashi 0:8fdf9a60065b 204 virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback,
kadonotakashi 0:8fdf9a60065b 205 nsapi_version_t version = NSAPI_UNSPEC);
kadonotakashi 0:8fdf9a60065b 206
kadonotakashi 0:8fdf9a60065b 207 /** Cancels asynchronous hostname translation
kadonotakashi 0:8fdf9a60065b 208 *
kadonotakashi 0:8fdf9a60065b 209 * When translation is cancelled, callback will not be called.
kadonotakashi 0:8fdf9a60065b 210 *
kadonotakashi 0:8fdf9a60065b 211 * @param id Unique id of the hostname translation operation
kadonotakashi 0:8fdf9a60065b 212 * @return 0 on success, negative error code on failure
kadonotakashi 0:8fdf9a60065b 213 */
kadonotakashi 0:8fdf9a60065b 214 virtual nsapi_error_t gethostbyname_async_cancel(int id);
kadonotakashi 0:8fdf9a60065b 215
kadonotakashi 0:8fdf9a60065b 216 /** Add a domain name server to list of servers to query
kadonotakashi 0:8fdf9a60065b 217 *
kadonotakashi 0:8fdf9a60065b 218 * @param address Destination for the host address
kadonotakashi 0:8fdf9a60065b 219 * @return 0 on success, negative error code on failure
kadonotakashi 0:8fdf9a60065b 220 */
kadonotakashi 0:8fdf9a60065b 221 virtual nsapi_error_t add_dns_server(const SocketAddress &address);
kadonotakashi 0:8fdf9a60065b 222
kadonotakashi 0:8fdf9a60065b 223 /** Register callback for status reporting
kadonotakashi 0:8fdf9a60065b 224 *
kadonotakashi 0:8fdf9a60065b 225 * The specified status callback function will be called on status changes
kadonotakashi 0:8fdf9a60065b 226 * on the network. The parameters on the callback are the event type and
kadonotakashi 0:8fdf9a60065b 227 * event-type dependent reason parameter.
kadonotakashi 0:8fdf9a60065b 228 *
kadonotakashi 0:8fdf9a60065b 229 * @param status_cb The callback for status changes
kadonotakashi 0:8fdf9a60065b 230 */
kadonotakashi 0:8fdf9a60065b 231 virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
kadonotakashi 0:8fdf9a60065b 232
kadonotakashi 0:8fdf9a60065b 233 /** Get the connection status
kadonotakashi 0:8fdf9a60065b 234 *
kadonotakashi 0:8fdf9a60065b 235 * @return The connection status according to ConnectionStatusType
kadonotakashi 0:8fdf9a60065b 236 */
kadonotakashi 0:8fdf9a60065b 237 virtual nsapi_connection_status_t get_connection_status() const;
kadonotakashi 0:8fdf9a60065b 238
kadonotakashi 0:8fdf9a60065b 239 /** Set blocking status of connect() which by default should be blocking
kadonotakashi 0:8fdf9a60065b 240 *
kadonotakashi 0:8fdf9a60065b 241 * @param blocking true if connect is blocking
kadonotakashi 0:8fdf9a60065b 242 * @return 0 on success, negative error code on failure
kadonotakashi 0:8fdf9a60065b 243 */
kadonotakashi 0:8fdf9a60065b 244 virtual nsapi_error_t set_blocking(bool blocking);
kadonotakashi 0:8fdf9a60065b 245
kadonotakashi 0:8fdf9a60065b 246 /** Dynamic downcast to an EthInterface */
kadonotakashi 0:8fdf9a60065b 247 virtual EthInterface *ethInterface()
kadonotakashi 0:8fdf9a60065b 248 {
kadonotakashi 0:8fdf9a60065b 249 return 0;
kadonotakashi 0:8fdf9a60065b 250 }
kadonotakashi 0:8fdf9a60065b 251
kadonotakashi 0:8fdf9a60065b 252 /** Dynamic downcast to a WiFiInterface */
kadonotakashi 0:8fdf9a60065b 253 virtual WiFiInterface *wifiInterface()
kadonotakashi 0:8fdf9a60065b 254 {
kadonotakashi 0:8fdf9a60065b 255 return 0;
kadonotakashi 0:8fdf9a60065b 256 }
kadonotakashi 0:8fdf9a60065b 257
kadonotakashi 0:8fdf9a60065b 258 /** Dynamic downcast to a MeshInterface */
kadonotakashi 0:8fdf9a60065b 259 virtual MeshInterface *meshInterface()
kadonotakashi 0:8fdf9a60065b 260 {
kadonotakashi 0:8fdf9a60065b 261 return 0;
kadonotakashi 0:8fdf9a60065b 262 }
kadonotakashi 0:8fdf9a60065b 263
kadonotakashi 0:8fdf9a60065b 264 /** Dynamic downcast to a CellularBase */
kadonotakashi 0:8fdf9a60065b 265 virtual CellularBase *cellularBase()
kadonotakashi 0:8fdf9a60065b 266 {
kadonotakashi 0:8fdf9a60065b 267 return 0;
kadonotakashi 0:8fdf9a60065b 268 }
kadonotakashi 0:8fdf9a60065b 269
kadonotakashi 0:8fdf9a60065b 270 /** Dynamic downcast to an EMACInterface */
kadonotakashi 0:8fdf9a60065b 271 virtual EMACInterface *emacInterface()
kadonotakashi 0:8fdf9a60065b 272 {
kadonotakashi 0:8fdf9a60065b 273 return 0;
kadonotakashi 0:8fdf9a60065b 274 }
kadonotakashi 0:8fdf9a60065b 275
kadonotakashi 0:8fdf9a60065b 276 protected:
kadonotakashi 0:8fdf9a60065b 277 friend class InternetSocket;
kadonotakashi 0:8fdf9a60065b 278 friend class UDPSocket;
kadonotakashi 0:8fdf9a60065b 279 friend class TCPSocket;
kadonotakashi 0:8fdf9a60065b 280 friend class TCPServer;
kadonotakashi 0:8fdf9a60065b 281 friend class SocketAddress;
kadonotakashi 0:8fdf9a60065b 282 template <typename IF>
kadonotakashi 0:8fdf9a60065b 283 friend NetworkStack *nsapi_create_stack(IF *iface);
kadonotakashi 0:8fdf9a60065b 284
kadonotakashi 0:8fdf9a60065b 285 /** Provide access to the NetworkStack object
kadonotakashi 0:8fdf9a60065b 286 *
kadonotakashi 0:8fdf9a60065b 287 * @return The underlying NetworkStack object
kadonotakashi 0:8fdf9a60065b 288 */
kadonotakashi 0:8fdf9a60065b 289 virtual NetworkStack *get_stack() = 0;
kadonotakashi 0:8fdf9a60065b 290
kadonotakashi 0:8fdf9a60065b 291 /** Get the target's default network instance.
kadonotakashi 0:8fdf9a60065b 292 *
kadonotakashi 0:8fdf9a60065b 293 * This method can be overridden by the target. Default implementations
kadonotakashi 0:8fdf9a60065b 294 * are provided weakly by various subsystems as described in
kadonotakashi 0:8fdf9a60065b 295 * NetworkInterface::get_default_instance(), so targets should not
kadonotakashi 0:8fdf9a60065b 296 * need to override in simple cases.
kadonotakashi 0:8fdf9a60065b 297 *
kadonotakashi 0:8fdf9a60065b 298 * If a target has more elaborate interface selection, it can completely
kadonotakashi 0:8fdf9a60065b 299 * override this behaviour by implementing
kadonotakashi 0:8fdf9a60065b 300 * NetworkInterface::get_target_default_instance() themselves, either
kadonotakashi 0:8fdf9a60065b 301 * unconditionally, or for a specific network-default-interface-type setting
kadonotakashi 0:8fdf9a60065b 302 *
kadonotakashi 0:8fdf9a60065b 303 * For example, a device with both Ethernet and Wi-fi could be set up its
kadonotakashi 0:8fdf9a60065b 304 * target so that:
kadonotakashi 0:8fdf9a60065b 305 * * DEVICE_EMAC is set, and it provides EMAC::get_default_instance(),
kadonotakashi 0:8fdf9a60065b 306 * which means EthernetInterface provides EthInterface::get_target_instance()
kadonotakashi 0:8fdf9a60065b 307 * based on that EMAC.
kadonotakashi 0:8fdf9a60065b 308 * * It provides WifiInterface::get_target_default_instance().
kadonotakashi 0:8fdf9a60065b 309 * * The core will route NetworkInterface::get_default_instance() to
kadonotakashi 0:8fdf9a60065b 310 * either of those if network-default-interface-type is set to
kadonotakashi 0:8fdf9a60065b 311 * ETHERNET or WIFI.
kadonotakashi 0:8fdf9a60065b 312 * * The board overrides NetworkInterface::get_target_default_instance()
kadonotakashi 0:8fdf9a60065b 313 * if network-default-interface-type is set to AUTO. This returns
kadonotakashi 0:8fdf9a60065b 314 * either EthInterface::get_default_instance() or WiFIInterface::get_default_instance()
kadonotakashi 0:8fdf9a60065b 315 * depending on a cable detection.
kadonotakashi 0:8fdf9a60065b 316 *
kadonotakashi 0:8fdf9a60065b 317 *
kadonotakashi 0:8fdf9a60065b 318 * performs the search described by get_default_instance.
kadonotakashi 0:8fdf9a60065b 319 */
kadonotakashi 0:8fdf9a60065b 320 static NetworkInterface *get_target_default_instance();
kadonotakashi 0:8fdf9a60065b 321 };
kadonotakashi 0:8fdf9a60065b 322
kadonotakashi 0:8fdf9a60065b 323
kadonotakashi 0:8fdf9a60065b 324 #endif