LWIPBP3595Interface library for mbed-os.
Dependents: LWIPBP3595Interface_STA_for_mbed-os
Fork of LWIPBP3595Interface by
LWIPBP3595Interface.h@2:c7e325599570, 2016-09-13 (annotated)
- Committer:
- dkato
- Date:
- Tue Sep 13 09:31:41 2016 +0000
- Revision:
- 2:c7e325599570
- Parent:
- 1:abb17eced903
- Child:
- 3:2ff2514e4fca
Change for mbed-os.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tousaki | 0:a933851e5d22 | 1 | /* LWIP implementation of NetworkInterfaceAPI |
tousaki | 0:a933851e5d22 | 2 | * Copyright (c) 2015 ARM Limited |
tousaki | 0:a933851e5d22 | 3 | * |
tousaki | 0:a933851e5d22 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
tousaki | 0:a933851e5d22 | 5 | * you may not use this file except in compliance with the License. |
tousaki | 0:a933851e5d22 | 6 | * You may obtain a copy of the License at |
tousaki | 0:a933851e5d22 | 7 | * |
tousaki | 0:a933851e5d22 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
tousaki | 0:a933851e5d22 | 9 | * |
tousaki | 0:a933851e5d22 | 10 | * Unless required by applicable law or agreed to in writing, software |
tousaki | 0:a933851e5d22 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
tousaki | 0:a933851e5d22 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
tousaki | 0:a933851e5d22 | 13 | * See the License for the specific language governing permissions and |
tousaki | 0:a933851e5d22 | 14 | * limitations under the License. |
tousaki | 0:a933851e5d22 | 15 | */ |
tousaki | 0:a933851e5d22 | 16 | |
dkato | 2:c7e325599570 | 17 | #ifndef LWIPBP3595_INTERFACE_H |
dkato | 2:c7e325599570 | 18 | #define LWIPBP3595_INTERFACE_H |
tousaki | 0:a933851e5d22 | 19 | |
dkato | 2:c7e325599570 | 20 | #include "nsapi.h" |
dkato | 2:c7e325599570 | 21 | #include "rtos.h" |
dkato | 2:c7e325599570 | 22 | #include "lwip/netif.h" |
dkato | 2:c7e325599570 | 23 | |
dkato | 2:c7e325599570 | 24 | // Forward declaration |
dkato | 2:c7e325599570 | 25 | class NetworkStack; |
tousaki | 0:a933851e5d22 | 26 | |
tousaki | 0:a933851e5d22 | 27 | |
dkato | 2:c7e325599570 | 28 | /** EthernetInterface class |
dkato | 2:c7e325599570 | 29 | * Implementation of the NetworkStack for LWIP |
tousaki | 0:a933851e5d22 | 30 | */ |
dkato | 2:c7e325599570 | 31 | class LWIPBP3595Interface : public WiFiInterface |
tousaki | 0:a933851e5d22 | 32 | { |
tousaki | 0:a933851e5d22 | 33 | public: |
dkato | 2:c7e325599570 | 34 | /** Start the interface |
dkato | 2:c7e325599570 | 35 | * |
dkato | 2:c7e325599570 | 36 | * Attempts to connect to a WiFi network. If passphrase is invalid, |
dkato | 2:c7e325599570 | 37 | * NSAPI_ERROR_AUTH_ERROR is returned. |
dkato | 2:c7e325599570 | 38 | * |
dkato | 2:c7e325599570 | 39 | * @param ssid Name of the network to connect to |
dkato | 2:c7e325599570 | 40 | * @param pass Security passphrase to connect to the network |
dkato | 2:c7e325599570 | 41 | * @param security Type of encryption for connection |
dkato | 2:c7e325599570 | 42 | * @return 0 on success, negative error code on failure |
dkato | 2:c7e325599570 | 43 | */ |
dkato | 2:c7e325599570 | 44 | virtual int connect(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_WPA2); |
tousaki | 0:a933851e5d22 | 45 | |
dkato | 2:c7e325599570 | 46 | /** Stop the interface |
dkato | 2:c7e325599570 | 47 | * @return 0 on success, negative on failure |
tousaki | 0:a933851e5d22 | 48 | */ |
tousaki | 0:a933851e5d22 | 49 | virtual int disconnect(); |
tousaki | 0:a933851e5d22 | 50 | |
tousaki | 0:a933851e5d22 | 51 | /** Get the internally stored IP address |
tousaki | 0:a933851e5d22 | 52 | * @return IP address of the interface or null if not yet connected |
tousaki | 0:a933851e5d22 | 53 | */ |
tousaki | 0:a933851e5d22 | 54 | virtual const char *get_ip_address(); |
dkato | 2:c7e325599570 | 55 | |
tousaki | 0:a933851e5d22 | 56 | /** Get the internally stored MAC address |
tousaki | 0:a933851e5d22 | 57 | * @return MAC address of the interface |
tousaki | 0:a933851e5d22 | 58 | */ |
tousaki | 0:a933851e5d22 | 59 | virtual const char *get_mac_address(); |
tousaki | 0:a933851e5d22 | 60 | |
dkato | 2:c7e325599570 | 61 | protected: |
dkato | 2:c7e325599570 | 62 | /** Provide access to the underlying stack |
dkato | 2:c7e325599570 | 63 | * |
dkato | 2:c7e325599570 | 64 | * @return The underlying network stack |
dkato | 2:c7e325599570 | 65 | */ |
dkato | 2:c7e325599570 | 66 | virtual NetworkStack *get_stack(); |
tousaki | 0:a933851e5d22 | 67 | }; |
tousaki | 0:a933851e5d22 | 68 | |
tousaki | 0:a933851e5d22 | 69 | |
tousaki | 0:a933851e5d22 | 70 | #endif |