Base class for IP Based Networking Libraries
Dependencies: DnsQuery
Dependents: TempTower BSDInterfaceTests HelloBSDInterface ESP8266InterfaceTests ... more
For a complete getting started guide see the wiki...
Network Socket API
The Network Socket API provides a common interface for using sockets on network devices. The API provides a simple class-based interface that should be familiar to users experienced with other socket APIs. Additionally, the API provides a simple interface for implementing network devices, making it easy to connect hardware agnostic programs to new devices.
Network Interfaces
The NetworkInterface provides an abstract class for network devices that support sockets. Devices should provide a DeviceInterface class that inherits this interface and adds implementation specific methods for using the device. A NetworkInterface must be provided to a Socket constructor to open a socket on the interface. Currently two subclasses are defined for common devices, EthernetInterface
and WiFiInterface.
Sockets
The Socket class is used for managing network sockets. Once opened, the socket provides a pipe through which data can sent and recieved to a specific endpoint. The socket class can be instantiated as either a TCPSocket
or a UDPSocket
which defines the protocol used for the connection.
Revision 88:6cfd38609828, committed 2016-04-06
- Comitter:
- geky
- Date:
- Wed Apr 06 13:50:19 2016 +0000
- Parent:
- 87:94e2cf3a06be
- Child:
- 89:b1d417383c0d
- Commit message:
- Refactored WiFi enum
Changed in this revision
WiFiInterface.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/WiFiInterface.h Tue Apr 05 23:47:04 2016 +0000 +++ b/WiFiInterface.h Wed Apr 06 13:50:19 2016 +0000 @@ -19,33 +19,33 @@ #include "NetworkInterface.h" +/** Enum for WiFi encryption types +*/ +enum nsapi_security_t { + NSAPI_SECURITY_NONE = 0, /*!< open access point */ + NSAPI_SECURITY_WEP, /*!< phrase conforms to WEP */ + NSAPI_SECURITY_WPA, /*!< phrase conforms to WPA */ + NSAPI_SECURITY_WPA2, /*!< phrase conforms to WPA2 */ +}; + /** WiFiInterface class * Common interface that is shared between WiFi devices */ class WiFiInterface : public NetworkInterface { public: - /** Enum for WiFi encryption types - */ - enum security_t { - SECURITY_NONE = 0, /*!< open access point */ - SECURITY_WEP, /*!< phrase conforms to WEP */ - SECURITY_WPA, /*!< phrase conforms to WPA */ - SECURITY_WPA2, /*!< phrase conforms to 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 for connection /return 0 on success, negative on failure */ - virtual int connect(const char *ssid, const char *pass, security_t security = SECURITY_NONE) = 0; + virtual int connect(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE) = 0; /** Stop the interface /return 0 on success, negative on failure */ - virtual int32_t disconnect() = 0; + virtual int disconnect() = 0; }; #endif