Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
WiFiInterface.h@30:3cc78f5db99d, 2016-02-22 (annotated)
- Committer:
- geky
- Date:
- Mon Feb 22 21:03:38 2016 +0000
- Branch:
- api-changes
- Revision:
- 30:3cc78f5db99d
- Parent:
- 26:9774a2edad71
- Child:
- 41:3ec1c97e9bbf
Standardized formatting
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 | |
| Christopher Haster |
21:35ed15069189 | 17 | #ifndef WIFI_INTERFACE_H |
| Christopher Haster |
21:35ed15069189 | 18 | #define WIFI_INTERFACE_H |
| sam_grove | 7:b147c08301be | 19 | |
| sam_grove | 7:b147c08301be | 20 | #include "NetworkInterface.h" |
| sam_grove | 7:b147c08301be | 21 | |
| Christopher Haster |
21:35ed15069189 | 22 | /** Enum for WiFi 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 | |
| Christopher Haster |
21:35ed15069189 | 31 | |
| Christopher Haster |
21:35ed15069189 | 32 | /** WiFiInterface class |
| Christopher Haster |
21:35ed15069189 | 33 | * Common interface that is shared between WiFi devices |
| sam_grove | 7:b147c08301be | 34 | */ |
| sam_grove | 7:b147c08301be | 35 | class WiFiInterface : public NetworkInterface |
| sam_grove | 7:b147c08301be | 36 | { |
| sam_grove | 7:b147c08301be | 37 | public: |
| Christopher Haster |
21:35ed15069189 | 38 | /** Start the interface |
| Christopher Haster |
21:35ed15069189 | 39 | * @param ssid Name of the network to connect to |
| Christopher Haster |
21:35ed15069189 | 40 | * @param pass Security passphrase to connect to the network |
| Christopher Haster |
21:35ed15069189 | 41 | * @param security Type of encryption to connect with |
| Christopher Haster |
21:35ed15069189 | 42 | * @param timeout_ms Time in milliseconds to wait for a connection |
| Christopher Haster |
21:35ed15069189 | 43 | * @return 0 on success |
| sam_grove | 7:b147c08301be | 44 | */ |
| Christopher Haster |
21:35ed15069189 | 45 | virtual int32_t connect( |
| geky | 30:3cc78f5db99d | 46 | const char *ssid, |
| geky | 30:3cc78f5db99d | 47 | const char *pass, |
| geky | 30:3cc78f5db99d | 48 | wifi_security_t security = WI_NONE, |
| geky | 30:3cc78f5db99d | 49 | uint32_t timeout_ms = 15000) = 0; |
| Christopher Haster |
21:35ed15069189 | 50 | |
| Christopher Haster |
21:35ed15069189 | 51 | /** Stop the interface |
| Christopher Haster |
21:35ed15069189 | 52 | * @return 0 on success |
| Christopher Haster |
21:35ed15069189 | 53 | */ |
| Christopher Haster |
21:35ed15069189 | 54 | virtual int32_t disconnect() = 0; |
| sam_grove | 7:b147c08301be | 55 | }; |
| sam_grove | 7:b147c08301be | 56 | |
| sam_grove | 7:b147c08301be | 57 | #endif |
