2023-01-02 14:28:51 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "lwip/apps/http_client.h"
|
|
|
|
#include "pico/cyw43_arch.h"
|
2023-01-03 08:57:39 +01:00
|
|
|
//#include "pico/stdlib.h"
|
2023-01-02 14:28:51 +01:00
|
|
|
|
2023-01-03 17:04:37 +01:00
|
|
|
static char myHeaderBuffer[2048];
|
|
|
|
static char myBodyBuffer[2048];
|
2023-01-02 14:28:51 +01:00
|
|
|
|
2023-01-03 17:04:37 +01:00
|
|
|
void result_callback(void *arg, httpc_result_t httpc_result, u32_t rx_content_len,
|
2023-01-02 14:28:51 +01:00
|
|
|
u32_t srv_res, err_t err);
|
|
|
|
|
2023-01-03 17:04:37 +01:00
|
|
|
err_t headers_callback(httpc_state_t *connection, void *arg, struct pbuf *hdr,
|
2023-01-02 14:28:51 +01:00
|
|
|
u16_t hdr_len, u32_t content_len);
|
|
|
|
|
2023-01-03 17:04:37 +01:00
|
|
|
err_t body_callback(void *arg, struct altcp_pcb *conn, struct pbuf *p, err_t err);
|
2023-01-02 14:28:51 +01:00
|
|
|
|
|
|
|
class HttpClient {
|
|
|
|
public:
|
|
|
|
HttpClient();
|
|
|
|
std::string retrieveWasteDatesAsCsv();
|
|
|
|
bool m_received{false};
|
|
|
|
|
|
|
|
private:
|
|
|
|
httpc_connection_t m_settings;
|
|
|
|
};
|