NetworkSocketAPI

Dependencies:   DnsQuery

Dependents:   HelloWizFi250Interface

Fork of NetworkSocketAPI by NetworkSocketAPI

Committer:
Christopher Haster
Date:
Wed Apr 20 03:19:26 2016 -0500
Revision:
112:e0cbb3e43c20
Parent:
105:2fd212f8da61
Add standardized stack options

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Christopher Haster 105:2fd212f8da61 1 /* WiFiStack
Christopher Haster 105:2fd212f8da61 2 * Copyright (c) 2015 ARM Limited
Christopher Haster 105:2fd212f8da61 3 *
Christopher Haster 105:2fd212f8da61 4 * Licensed under the Apache License, Version 2.0 (the "License");
Christopher Haster 105:2fd212f8da61 5 * you may not use this file except in compliance with the License.
Christopher Haster 105:2fd212f8da61 6 * You may obtain a copy of the License at
Christopher Haster 105:2fd212f8da61 7 *
Christopher Haster 105:2fd212f8da61 8 * http://www.apache.org/licenses/LICENSE-2.0
Christopher Haster 105:2fd212f8da61 9 *
Christopher Haster 105:2fd212f8da61 10 * Unless required by applicable law or agreed to in writing, software
Christopher Haster 105:2fd212f8da61 11 * distributed under the License is distributed on an "AS IS" BASIS,
Christopher Haster 105:2fd212f8da61 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Christopher Haster 105:2fd212f8da61 13 * See the License for the specific language governing permissions and
Christopher Haster 105:2fd212f8da61 14 * limitations under the License.
Christopher Haster 105:2fd212f8da61 15 */
Christopher Haster 105:2fd212f8da61 16
Christopher Haster 105:2fd212f8da61 17 #ifndef WIFI_INTERFACE_H
Christopher Haster 105:2fd212f8da61 18 #define WIFI_INTERFACE_H
Christopher Haster 105:2fd212f8da61 19
Christopher Haster 105:2fd212f8da61 20 #include "NetworkStack.h"
Christopher Haster 105:2fd212f8da61 21
Christopher Haster 105:2fd212f8da61 22 /** Enum of WiFi encryption types
Christopher Haster 105:2fd212f8da61 23 *
Christopher Haster 105:2fd212f8da61 24 * The security type specifies a particular security to use when
Christopher Haster 105:2fd212f8da61 25 * connected to a WiFi network
Christopher Haster 105:2fd212f8da61 26 *
Christopher Haster 105:2fd212f8da61 27 * @enum nsapi_protocol_t
Christopher Haster 105:2fd212f8da61 28 */
Christopher Haster 105:2fd212f8da61 29 enum nsapi_security_t {
Christopher Haster 105:2fd212f8da61 30 NSAPI_SECURITY_NONE = 0, /*!< open access point */
Christopher Haster 105:2fd212f8da61 31 NSAPI_SECURITY_WEP, /*!< phrase conforms to WEP */
Christopher Haster 105:2fd212f8da61 32 NSAPI_SECURITY_WPA, /*!< phrase conforms to WPA */
Christopher Haster 105:2fd212f8da61 33 NSAPI_SECURITY_WPA2, /*!< phrase conforms to WPA2 */
Christopher Haster 105:2fd212f8da61 34 };
Christopher Haster 105:2fd212f8da61 35
Christopher Haster 105:2fd212f8da61 36 /** WiFiStack class
Christopher Haster 105:2fd212f8da61 37 *
Christopher Haster 105:2fd212f8da61 38 * Common interface that is shared between WiFi devices
Christopher Haster 105:2fd212f8da61 39 */
Christopher Haster 105:2fd212f8da61 40 class WiFiStack : public NetworkStack
Christopher Haster 105:2fd212f8da61 41 {
Christopher Haster 105:2fd212f8da61 42 public:
Christopher Haster 105:2fd212f8da61 43 /** Start the interface
Christopher Haster 105:2fd212f8da61 44 *
Christopher Haster 105:2fd212f8da61 45 * Attempts to connect to a WiFi network. If passphrase is invalid,
Christopher Haster 105:2fd212f8da61 46 * NSAPI_ERROR_AUTH_ERROR is returned.
Christopher Haster 105:2fd212f8da61 47 *
Christopher Haster 105:2fd212f8da61 48 * @param ssid Name of the network to connect to
Christopher Haster 105:2fd212f8da61 49 * @param pass Security passphrase to connect to the network
Christopher Haster 105:2fd212f8da61 50 * @param security Type of encryption for connection
Christopher Haster 105:2fd212f8da61 51 * @return 0 on success, negative error code on failure
Christopher Haster 105:2fd212f8da61 52 */
Christopher Haster 105:2fd212f8da61 53 virtual int connect(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE) = 0;
Christopher Haster 105:2fd212f8da61 54
Christopher Haster 105:2fd212f8da61 55 /** Stop the interface
Christopher Haster 105:2fd212f8da61 56 *
Christopher Haster 105:2fd212f8da61 57 * @return 0 on success, negative error code on failure
Christopher Haster 105:2fd212f8da61 58 */
Christopher Haster 105:2fd212f8da61 59 virtual int disconnect() = 0;
Christopher Haster 105:2fd212f8da61 60 };
Christopher Haster 105:2fd212f8da61 61
Christopher Haster 105:2fd212f8da61 62 #endif