HTTP/HTTPS Client Library for the X-NUCLEO-IDW01M1v2 wifi board.

Dependents:   HTTPClient_HelloWorld_IDW01M1 wifigianluigi HTTPClient_HelloWorld_IDW01M1_Fabio_Ricezione

Fork of HTTPClient by ST Expansion SW Team

Revision:
19:17578cfdb57a
Parent:
16:1f743885e7de
Child:
21:6e5c122ad9e5
--- a/HTTPClient.h	Wed May 07 16:48:10 2014 +0000
+++ b/HTTPClient.h	Mon Nov 07 17:08:02 2016 +0000
@@ -24,13 +24,17 @@
 #ifndef HTTP_CLIENT_H
 #define HTTP_CLIENT_H
 
-#include "TCPSocketConnection.h"
+#include "TCPSocket.h"
+#include "HTTPWifi.h"
 
+#define LICIO
 #define HTTP_CLIENT_DEFAULT_TIMEOUT 15000
+#define CHUNK_SIZE 256
 
 class HTTPData;
 
 #include "IHTTPData.h"
+
 #include "mbed.h"
 
 ///HTTP client results
@@ -58,7 +62,7 @@
 {
 public:
   ///Instantiate the HTTP client
-  HTTPClient();
+  HTTPClient(HTTPWiFi & _m_sock);  
   ~HTTPClient();
   
 #if 0 //TODO add header handlers
@@ -79,7 +83,7 @@
   @param timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
   @return 0 on success, HTTP error (<0) on failure
   */
-  HTTPResult get(const char* url, IHTTPDataIn* pDataIn, int timeout = HTTP_CLIENT_DEFAULT_TIMEOUT); //Blocking
+  HTTPResult get(const char* url, IHTTPDataIn* pDataIn, int timeout /*= HTTP_CLIENT_DEFAULT_TIMEOUT*/); //Blocking
   
   /** Execute a GET request on the URL
   Blocks until completion
@@ -90,7 +94,7 @@
   @param timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
   @return 0 on success, HTTP error (<0) on failure
   */
-  HTTPResult get(const char* url, char* result, size_t maxResultLen, int timeout = HTTP_CLIENT_DEFAULT_TIMEOUT); //Blocking
+  HTTPResult get(const char* url, char* result, size_t maxResultLen, int timeout /*= HTTP_CLIENT_DEFAULT_TIMEOUT*/); //Blocking
 
   /** Execute a POST request on the URL
   Blocks until completion
@@ -100,7 +104,7 @@
   @param timeout waiting timeout in ms (osWaitForever for blocking function, not recommended)
   @return 0 on success, HTTP error (<0) on failure
   */
-  HTTPResult post(const char* url, const IHTTPDataOut& dataOut, IHTTPDataIn* pDataIn, int timeout = HTTP_CLIENT_DEFAULT_TIMEOUT); //Blocking
+  HTTPResult post(const char* url, const IHTTPDataOut& dataOut, IHTTPDataIn* pDataIn, int timeout /*= HTTP_CLIENT_DEFAULT_TIMEOUT*/); //Blocking
   
   /** Execute a PUT request on the URL
   Blocks until completion
@@ -141,14 +145,15 @@
   HTTPResult send(char* buf, size_t len = 0); //0 on success, err code on failure
   HTTPResult parseURL(const char* url, char* scheme, size_t maxSchemeLen, char* host, size_t maxHostLen, uint16_t* port, char* path, size_t maxPathLen); //Parse URL
 
-  //Parameters
-  TCPSocketConnection m_sock;
+  //Parameters 
+  HTTPWiFi m_sock;
   
   int m_timeout;
 
   const char* m_basicAuthUser;
   const char* m_basicAuthPassword;
   int m_httpResponseCode;
+  char buf[CHUNK_SIZE];
 
 };