LWIPBP3595Interface library for mbed-os.
Dependents: LWIPBP3595Interface_STA_for_mbed-os
Fork of LWIPBP3595Interface by
Diff: LWIPBP3595Interface.h
- Revision:
- 2:c7e325599570
- Parent:
- 1:abb17eced903
- Child:
- 3:2ff2514e4fca
--- a/LWIPBP3595Interface.h Tue May 31 05:56:27 2016 +0000 +++ b/LWIPBP3595Interface.h Tue Sep 13 09:31:41 2016 +0000 @@ -1,8 +1,3 @@ -/* LWIPBP3595Interface.h */ -/* Copyright (C) 2016 Grape Systems, Inc. */ -/* The base file is LWIPInterface.h. */ - -/* LWIPInterface.h */ /* LWIP implementation of NetworkInterfaceAPI * Copyright (c) 2015 ARM Limited * @@ -19,47 +14,56 @@ * limitations under the License. */ -#ifndef LWIP_BP3595_INTERFACE_H -#define LWIP_BP3595_INTERFACE_H +#ifndef LWIPBP3595_INTERFACE_H +#define LWIPBP3595_INTERFACE_H -#include "LWIPInterface.h" -#include "WiFiInterface.h" +#include "nsapi.h" +#include "rtos.h" +#include "lwip/netif.h" + +// Forward declaration +class NetworkStack; -/** LWIPBP3595Interface class - * Implementation of the NetworkInterface for LWIP +/** EthernetInterface class + * Implementation of the NetworkStack for LWIP */ -class LWIPBP3595Interface : public LWIPInterface +class LWIPBP3595Interface : public WiFiInterface { public: + /** Start the interface + * + * Attempts to connect to a WiFi network. If passphrase is invalid, + * NSAPI_ERROR_AUTH_ERROR is returned. + * + * @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 + * @return 0 on success, negative error code on failure + */ + virtual int connect(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_WPA2); - /** Start the interface - * @param ssid Name of the network to connect to - * @param pass Security passphrase to connect to the network - * @param security Type of encryption to connect with - * @return 0 on success + /** Stop the interface + * @return 0 on success, negative on failure */ - virtual int connect( - const char *ssid, - const char *pass, - nsapi_security_t security = NSAPI_SECURITY_WPA2); - virtual int disconnect(); /** Get the internally stored IP address * @return IP address of the interface or null if not yet connected */ virtual const char *get_ip_address(); - + /** Get the internally stored MAC address * @return MAC address of the interface */ virtual const char *get_mac_address(); -private: - // Implementation of EthernetInterface - virtual int connect() {return 0;} - +protected: + /** Provide access to the underlying stack + * + * @return The underlying network stack + */ + virtual NetworkStack *get_stack(); };