Socket interface for ESP8266. Implements the NetworkSocketAPI. Requires device to use the Espressif Firmware.

Dependencies:   ESP8266

Dependents:   ESP8266InterfaceTests HelloESP8266Interface

Fork of ESP8266Interface by NetworkSocketAPI

Note

This library assumes your ESP8266 is running the Espressif Firmware. For instructions on how to update your ESP8266 to use the correct firmware see the Firmware Update Wiki Page.

Currently the ESP8266Interface LIbrary has the following Abilities:

Working

  • TCP Client
  • UDP Client
  • Transparent mode (single connection of 1 type at a time)
  • Station Mode (connects to AP)

To be implimented

  • TCP Server
  • UDP Server
  • Multi Connection Mode (able to have up to 5 sockets at a time)
  • AP Mode (Make ESP Chip act like access point)
  • DNS Support (currently websites must be looked up by IP)
  • Error Recovery

Nice but not necessary

  • colorized text for ESP AT Commands in Command line (easier to differentiate from other text)
Committer:
sam_grove
Date:
Wed Jun 17 20:57:21 2015 +0000
Revision:
10:80ece8d5aa2d
Parent:
WiFiInterface.cpp@5:72561d7c6f65
Giving it a name. Being abstract was making thing confusing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 10:80ece8d5aa2d 1 /* ESP8266Interface
sam_grove 2:87009183eb2e 2 * Copyright (c) 2015 ARM Limited
sam_grove 2:87009183eb2e 3 *
sam_grove 2:87009183eb2e 4 * Licensed under the Apache License, Version 2.0 (the "License");
sam_grove 2:87009183eb2e 5 * you may not use this file except in compliance with the License.
sam_grove 2:87009183eb2e 6 * You may obtain a copy of the License at
sam_grove 2:87009183eb2e 7 *
sam_grove 2:87009183eb2e 8 * http://www.apache.org/licenses/LICENSE-2.0
sam_grove 2:87009183eb2e 9 *
sam_grove 2:87009183eb2e 10 * Unless required by applicable law or agreed to in writing, software
sam_grove 2:87009183eb2e 11 * distributed under the License is distributed on an "AS IS" BASIS,
sam_grove 2:87009183eb2e 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sam_grove 2:87009183eb2e 13 * See the License for the specific language governing permissions and
sam_grove 2:87009183eb2e 14 * limitations under the License.
sam_grove 2:87009183eb2e 15 */
sam_grove 2:87009183eb2e 16
sam_grove 10:80ece8d5aa2d 17 #include "ESP8266Interface.h"
sam_grove 10:80ece8d5aa2d 18
sam_grove 10:80ece8d5aa2d 19 ESP8266Interface::ESP8266Interface()
sam_grove 10:80ece8d5aa2d 20 {
sam_grove 10:80ece8d5aa2d 21
sam_grove 10:80ece8d5aa2d 22 }
sam_grove 10:80ece8d5aa2d 23
sam_grove 10:80ece8d5aa2d 24 ESP8266Interface::ESP8266Interface(const char *ap, const char *pass_phrase, wifi_security_t security, uint32_t timeout_ms)
sam_grove 10:80ece8d5aa2d 25 {
sam_grove 10:80ece8d5aa2d 26
sam_grove 10:80ece8d5aa2d 27 }
sam_grove 10:80ece8d5aa2d 28
sam_grove 10:80ece8d5aa2d 29 int32_t ESP8266Interface::init(void) const
sam_grove 10:80ece8d5aa2d 30 {
sam_grove 10:80ece8d5aa2d 31 return -1;
sam_grove 10:80ece8d5aa2d 32 }
sam_grove 10:80ece8d5aa2d 33
sam_grove 10:80ece8d5aa2d 34 int32_t ESP8266Interface::init(const char *ip, const char *mask, const char *gateway) const
sam_grove 10:80ece8d5aa2d 35 {
sam_grove 10:80ece8d5aa2d 36 return -1;
sam_grove 10:80ece8d5aa2d 37 }
sam_grove 10:80ece8d5aa2d 38
sam_grove 10:80ece8d5aa2d 39 int32_t ESP8266Interface::connect(uint32_t timeout_ms) const
sam_grove 10:80ece8d5aa2d 40 {
sam_grove 10:80ece8d5aa2d 41 return -1;
sam_grove 10:80ece8d5aa2d 42 }
sam_grove 10:80ece8d5aa2d 43
sam_grove 10:80ece8d5aa2d 44 int32_t ESP8266Interface::connect(const char *ap, const char *pass_phrase, wifi_security_t security, uint32_t timeout_ms) const
sam_grove 10:80ece8d5aa2d 45 {
sam_grove 10:80ece8d5aa2d 46 return -1;
sam_grove 10:80ece8d5aa2d 47 }
sam_grove 10:80ece8d5aa2d 48
sam_grove 10:80ece8d5aa2d 49 int32_t ESP8266Interface::disconnect(void) const
sam_grove 10:80ece8d5aa2d 50 {
sam_grove 10:80ece8d5aa2d 51 return -1;
sam_grove 10:80ece8d5aa2d 52 }
sam_grove 10:80ece8d5aa2d 53
sam_grove 10:80ece8d5aa2d 54 char *ESP8266Interface::getIPAddress(void) const
sam_grove 10:80ece8d5aa2d 55 {
sam_grove 10:80ece8d5aa2d 56 return 0;
sam_grove 10:80ece8d5aa2d 57 }
sam_grove 10:80ece8d5aa2d 58
sam_grove 10:80ece8d5aa2d 59 char *ESP8266Interface::getGateway(void) const
sam_grove 10:80ece8d5aa2d 60 {
sam_grove 10:80ece8d5aa2d 61 return 0;
sam_grove 10:80ece8d5aa2d 62 }
sam_grove 10:80ece8d5aa2d 63
sam_grove 10:80ece8d5aa2d 64 char *ESP8266Interface::getNetworkMask(void) const
sam_grove 10:80ece8d5aa2d 65 {
sam_grove 10:80ece8d5aa2d 66 return 0;
sam_grove 10:80ece8d5aa2d 67 }
sam_grove 10:80ece8d5aa2d 68
sam_grove 10:80ece8d5aa2d 69 char *ESP8266Interface::getMACAddress(void) const
sam_grove 10:80ece8d5aa2d 70 {
sam_grove 10:80ece8d5aa2d 71 return 0;
sam_grove 10:80ece8d5aa2d 72 }
sam_grove 10:80ece8d5aa2d 73
sam_grove 10:80ece8d5aa2d 74 int32_t ESP8266Interface::isConnected(void) const
sam_grove 10:80ece8d5aa2d 75 {
sam_grove 10:80ece8d5aa2d 76 return -1;
sam_grove 10:80ece8d5aa2d 77 }