modified by ohneta
Dependents: HelloESP8266Interface_mine
Fork of NetworkSocketAPI by
WiFiInterface.h@20:efe7e291422b, 2015-11-10 (annotated)
- Committer:
- ohneta
- Date:
- Tue Nov 10 14:56:42 2015 +0000
- Revision:
- 20:efe7e291422b
- Parent:
- 13:f84e69b3fdd3
modified syntax error.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 7:b147c08301be | 1 | /* WiFiInterface Base Class |
sam_grove | 7:b147c08301be | 2 | * Copyright (c) 2015 ARM Limited |
sam_grove | 7:b147c08301be | 3 | * |
sam_grove | 7:b147c08301be | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
sam_grove | 7:b147c08301be | 5 | * you may not use this file except in compliance with the License. |
sam_grove | 7:b147c08301be | 6 | * You may obtain a copy of the License at |
sam_grove | 7:b147c08301be | 7 | * |
sam_grove | 7:b147c08301be | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
sam_grove | 7:b147c08301be | 9 | * |
sam_grove | 7:b147c08301be | 10 | * Unless required by applicable law or agreed to in writing, software |
sam_grove | 7:b147c08301be | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
sam_grove | 7:b147c08301be | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
sam_grove | 7:b147c08301be | 13 | * See the License for the specific language governing permissions and |
sam_grove | 7:b147c08301be | 14 | * limitations under the License. |
sam_grove | 7:b147c08301be | 15 | */ |
sam_grove | 7:b147c08301be | 16 | |
sam_grove | 7:b147c08301be | 17 | #ifndef WIFIINTERFACE_H |
sam_grove | 7:b147c08301be | 18 | #define WIFIINTERFACE_H |
sam_grove | 7:b147c08301be | 19 | |
sam_grove | 7:b147c08301be | 20 | #include "NetworkInterface.h" |
sam_grove | 7:b147c08301be | 21 | |
sam_grove | 7:b147c08301be | 22 | /* wifi_security_t enum for encryption types |
sam_grove | 7:b147c08301be | 23 | */ |
sam_grove | 7:b147c08301be | 24 | typedef enum wifi_security_t { |
sam_grove | 7:b147c08301be | 25 | WI_NONE = 0, /*!< No security for connection */ |
sam_grove | 7:b147c08301be | 26 | WI_WEP, /*!< WEP encryption */ |
sam_grove | 7:b147c08301be | 27 | WI_WPA, /*!< WPA encryption */ |
sam_grove | 7:b147c08301be | 28 | WI_WPA2, /*!< WPA2 encryption */ |
sam_grove | 7:b147c08301be | 29 | } wifi_security_t; |
sam_grove | 7:b147c08301be | 30 | |
sam_grove | 7:b147c08301be | 31 | /** WiFiInterface class. |
sam_grove | 7:b147c08301be | 32 | This is a common interface to handle how WiFi connects to an access point |
sam_grove | 7:b147c08301be | 33 | */ |
sam_grove | 7:b147c08301be | 34 | class WiFiInterface : public NetworkInterface |
sam_grove | 7:b147c08301be | 35 | { |
sam_grove | 7:b147c08301be | 36 | public: |
sam_grove | 7:b147c08301be | 37 | |
sam_grove | 7:b147c08301be | 38 | // make sure to import the base symbol that needs an implementation for classes that have ap and phrase in the constructor |
sam_grove | 7:b147c08301be | 39 | using NetworkInterface::connect; |
sam_grove | 7:b147c08301be | 40 | |
sam_grove | 7:b147c08301be | 41 | /** Start the interface using ap name, phrase and security attributes |
sam_grove | 7:b147c08301be | 42 | @param ap Name of the network the radio should connect to |
sam_grove | 7:b147c08301be | 43 | @param pass_pharase The security phrase needed for connecting to the network |
sam_grove | 7:b147c08301be | 44 | @param security Type of encryption the network requires for connection |
sam_grove | 7:b147c08301be | 45 | @param timeout_ms Time in miliseconds to wait while attempting to connect before timing out |
sam_grove | 7:b147c08301be | 46 | @returns 0 on success, a negative number on failure |
sam_grove | 7:b147c08301be | 47 | */ |
sarahmarshy | 13:f84e69b3fdd3 | 48 | virtual int32_t connect(const char *ap, const char *pass_phrase = 0, wifi_security_t security = WI_NONE, uint32_t timeout_ms = 15000) = 0; |
sam_grove | 7:b147c08301be | 49 | |
sam_grove | 7:b147c08301be | 50 | }; |
sam_grove | 7:b147c08301be | 51 | |
sam_grove | 7:b147c08301be | 52 | #endif |