ap

Dependencies:   DnsQuery

Dependents:   WizFi310_TCP_Echo_Server_Example

Fork of NetworkSocketAPI by NetworkSocketAPI

Committer:
maru536
Date:
Sun Oct 01 20:55:24 2017 +0000
Revision:
126:636a06d0aa42
Parent:
114:964eba6394bc
merge1

Who changed what in which revision?

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