modified by ohneta

Dependents:   HelloESP8266Interface_mine

Fork of NetworkSocketAPI by NetworkSocketAPI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WiFiInterface.h Source File

WiFiInterface.h

00001 /* WiFiInterface Base Class
00002  * Copyright (c) 2015 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef WIFIINTERFACE_H
00018 #define WIFIINTERFACE_H
00019 
00020 #include "NetworkInterface.h"
00021 
00022 /* wifi_security_t enum for encryption types
00023  */
00024 typedef enum wifi_security_t {
00025     WI_NONE = 0,    /*!< No security for connection */
00026     WI_WEP,         /*!< WEP  encryption */
00027     WI_WPA,         /*!< WPA  encryption */
00028     WI_WPA2,        /*!< WPA2 encryption */
00029 } wifi_security_t;
00030 
00031 /** WiFiInterface class.
00032     This is a common interface to handle how WiFi connects to an access point
00033  */
00034 class WiFiInterface : public NetworkInterface
00035 {
00036 public:
00037 
00038     // make sure to import the base symbol that needs an implementation for classes that have ap and phrase in the constructor
00039     using NetworkInterface::connect;
00040         
00041     /** Start the interface using ap name, phrase and security attributes
00042         @param ap Name of the network the radio should connect to
00043         @param pass_pharase The security phrase needed for connecting to the network
00044         @param security Type of encryption the network requires for connection
00045         @param timeout_ms Time in miliseconds to wait while attempting to connect before timing out
00046         @returns 0 on success, a negative number on failure
00047      */
00048     virtual int32_t connect(const char *ap, const char *pass_phrase = 0, wifi_security_t security = WI_NONE, uint32_t timeout_ms = 15000)  = 0;
00049     
00050 };
00051 
00052 #endif