## Summary - Upgrade platform from espressif32 6.12.0 (Arduino Core 2.0.17) to pioarduino 55.03.37 (Arduino Core 3.3.7, ESP-IDF 5.5.2) - Add WebDAV Class 1 server (RFC 4918) - SD card can be mounted as a network drive - I also slightly fixed the SDK and also made a [pull request ](https://github.com/open-x4-epaper/community-sdk/pull/21) First PR #1030 (was closed because the implementation was based on an old version of the libraries) Issue #439 --------- Co-authored-by: Dave Allie <dave@daveallie.com>
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#pragma once
|
|
#include <HalStorage.h>
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
/**
|
|
* HTTP client utility for fetching content and downloading files.
|
|
* Wraps NetworkClientSecure and HTTPClient for HTTPS requests.
|
|
*/
|
|
class HttpDownloader {
|
|
public:
|
|
using ProgressCallback = std::function<void(size_t downloaded, size_t total)>;
|
|
|
|
enum DownloadError {
|
|
OK = 0,
|
|
HTTP_ERROR,
|
|
FILE_ERROR,
|
|
ABORTED,
|
|
};
|
|
|
|
/**
|
|
* Fetch text content from a URL.
|
|
* @param url The URL to fetch
|
|
* @param outContent The fetched content (output)
|
|
* @return true if fetch succeeded, false on error
|
|
*/
|
|
static bool fetchUrl(const std::string& url, std::string& outContent);
|
|
|
|
static bool fetchUrl(const std::string& url, Stream& stream);
|
|
|
|
/**
|
|
* Download a file to the SD card.
|
|
* @param url The URL to download
|
|
* @param destPath The destination path on SD card
|
|
* @param progress Optional progress callback
|
|
* @return DownloadError indicating success or failure type
|
|
*/
|
|
static DownloadError downloadToFile(const std::string& url, const std::string& destPath,
|
|
ProgressCallback progress = nullptr);
|
|
|
|
private:
|
|
static constexpr size_t DOWNLOAD_CHUNK_SIZE = 1024;
|
|
};
|