|
libPocuter
1.0
Support library for programming the Pocuter
|
HTTP(S) download. More...
#include <PocuterHTTP.h>
Public Types | |
| enum | HTTPERROR { HTTPERROR_OK = 0, HTTPERROR_CONNECT_FAILED, HTTPERROR_NO_MEMORY, HTTPERROR_FILE_OPEN_FAILED, HTTPERROR_DOWNLOAD_FAILED, HTTPERROR_MORE_STEPS, HTTPERROR_UNKNOWN } |
Public Member Functions | |
| virtual HTTPERROR | downloadFile (const uint8_t *url, const uint8_t *destination, bool stepwise, uint8_t *percent, const uint8_t *PEMcert=NULL)=0 |
| download a file from web More... | |
| virtual HTTPERROR | getResponse (const uint8_t *url, uint8_t *response, size_t maxSize, uint16_t timeout=5000, const uint8_t *PEMcert=NULL)=0 |
| sends a get request to a server More... | |
HTTP(S) download.
|
pure virtual |
download a file from web
| url | the url to the file |
| destination | the destination on the sd card (beginning with the value you get from PocuterSDCard::getMountPoint() ) |
| stepwise | If true download a file step by step instead of downloading everything at once. This way you can realize a progress bar for example. |
| percent | (out) Shows how much percent of the file has been downloaded so far. Is always 100 if stepwise=false. This is only available if the http header contains "content-length" |
| PEMcert | (optional) if it is an https address, you need to add the root certificate to trust the server. |
|
pure virtual |
sends a get request to a server
| url | the url for the get request |
| response | the response text. You must allocate enough memory for the response. |
| maxSize | the max size you can hold in the response |
| timeout | (optional) timeout in ms |
| PEMcert | (optional) if it is an https address, you need to add the root certificate to trust the server. |