mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
fixed typo
This commit is contained in:
parent
75fb6e2002
commit
9089448d25
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include <ESP8266httpClient.h>
|
#include <ESP8266httpClient.h>
|
||||||
|
|
||||||
#define USE_SERIAL Serial1
|
#define USE_SERIAL Serial
|
||||||
|
|
||||||
ESP8266WiFiMulti WiFiMulti;
|
ESP8266WiFiMulti WiFiMulti;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ void loop() {
|
|||||||
USE_SERIAL.println(payload);
|
USE_SERIAL.println(payload);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
USE_SERIAL.print("[HTTP] GET... faild, no connection or no HTTP server\n");
|
USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void loop() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
USE_SERIAL.print("[HTTP] GET... faild, no connection or no HTTP server\n");
|
USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <ESP8266httpClient.h>
|
#include <ESP8266httpClient.h>
|
||||||
|
|
||||||
#define USE_SERIAL Serial1
|
#define USE_SERIAL Serial
|
||||||
|
|
||||||
ESP8266WiFiMulti WiFiMulti;
|
ESP8266WiFiMulti WiFiMulti;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ void loop() {
|
|||||||
http.writeToStream(&USE_SERIAL);
|
http.writeToStream(&USE_SERIAL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
USE_SERIAL.print("[HTTP] GET... faild, no connection or no HTTP server\n");
|
USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ void httpClient::begin(String host, uint16_t port, String url, bool https, Strin
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* end
|
* end
|
||||||
* called after the payload is handeld
|
* called after the payload is handled
|
||||||
*/
|
*/
|
||||||
void httpClient::end(void) {
|
void httpClient::end(void) {
|
||||||
if(connected()) {
|
if(connected()) {
|
||||||
@ -176,13 +176,13 @@ int httpClient::sendRequest(const char * type, uint8_t * payload, size_t size) {
|
|||||||
|
|
||||||
// send Header
|
// send Header
|
||||||
if(!sendHeader(type)) {
|
if(!sendHeader(type)) {
|
||||||
return HTTPC_ERROR_SEND_HEADER_FAILD;
|
return HTTPC_ERROR_SEND_HEADER_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// send Payload if needed
|
// send Payload if needed
|
||||||
if(payload && size > 0) {
|
if(payload && size > 0) {
|
||||||
if(_tcp->write(&payload[0], size) != size) {
|
if(_tcp->write(&payload[0], size) != size) {
|
||||||
return HTTPC_ERROR_SEND_PAYLOAD_FAILD;
|
return HTTPC_ERROR_SEND_PAYLOAD_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ int httpClient::getSize(void) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* deprecated Note: this is not working with https!
|
* deprecated Note: this is not working with https!
|
||||||
* returns the stram of the tcp connection
|
* returns the stream of the tcp connection
|
||||||
* @return WiFiClient
|
* @return WiFiClient
|
||||||
*/
|
*/
|
||||||
WiFiClient & httpClient::getStream(void) {
|
WiFiClient & httpClient::getStream(void) {
|
||||||
@ -214,7 +214,7 @@ WiFiClient & httpClient::getStream(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the stram of the tcp connection
|
* returns the stream of the tcp connection
|
||||||
* @return WiFiClient *
|
* @return WiFiClient *
|
||||||
*/
|
*/
|
||||||
WiFiClient * httpClient::getStreamPtr(void) {
|
WiFiClient * httpClient::getStreamPtr(void) {
|
||||||
@ -242,7 +242,7 @@ int httpClient::writeToStream(Stream * stream) {
|
|||||||
return HTTPC_ERROR_NOT_CONNECTED;
|
return HTTPC_ERROR_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get lenght of document (is -1 when Server sends no Content-Length header)
|
// get length of document (is -1 when Server sends no Content-Length header)
|
||||||
int len = _size;
|
int len = _size;
|
||||||
int bytesWritten = 0;
|
int bytesWritten = 0;
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ int httpClient::writeToStream(Stream * stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return all payload as String (may need lot of ram or trigger out of memmory!)
|
* return all payload as String (may need lot of ram or trigger out of memory!)
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
String httpClient::getString(void) {
|
String httpClient::getString(void) {
|
||||||
@ -300,8 +300,9 @@ String httpClient::getString(void) {
|
|||||||
return sstring;
|
return sstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* adds Headder to the request
|
* adds Header to the request
|
||||||
* @param name
|
* @param name
|
||||||
* @param value
|
* @param value
|
||||||
* @param first
|
* @param first
|
||||||
@ -443,7 +444,7 @@ bool httpClient::sendHeader(const char * type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reads the respone from the server
|
* reads the response from the server
|
||||||
* @return int http code
|
* @return int http code
|
||||||
*/
|
*/
|
||||||
int httpClient::handleHeaderResponse() {
|
int httpClient::handleHeaderResponse() {
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
|
|
||||||
/// HTTP client errors
|
/// HTTP client errors
|
||||||
#define HTTPC_ERROR_CONNECTION_REFUSED (-1)
|
#define HTTPC_ERROR_CONNECTION_REFUSED (-1)
|
||||||
#define HTTPC_ERROR_SEND_HEADER_FAILD (-2)
|
#define HTTPC_ERROR_SEND_HEADER_FAILED (-2)
|
||||||
#define HTTPC_ERROR_SEND_PAYLOAD_FAILD (-3)
|
#define HTTPC_ERROR_SEND_PAYLOAD_FAILED (-3)
|
||||||
#define HTTPC_ERROR_NOT_CONNECTED (-4)
|
#define HTTPC_ERROR_NOT_CONNECTED (-4)
|
||||||
#define HTTPC_ERROR_CONNECTION_LOST (-5)
|
#define HTTPC_ERROR_CONNECTION_LOST (-5)
|
||||||
#define HTTPC_ERROR_NO_STREAM (-6)
|
#define HTTPC_ERROR_NO_STREAM (-6)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user