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
|
|
|
|
|
|
|
static char myBuffer[2048];
|
|
|
|
|
|
|
|
extern "C" void result_callback(void *arg, httpc_result_t httpc_result, u32_t rx_content_len,
|
|
|
|
u32_t srv_res, err_t err);
|
|
|
|
|
|
|
|
extern "C" err_t headers_callback(httpc_state_t *connection, void *arg, struct pbuf *hdr,
|
|
|
|
u16_t hdr_len, u32_t content_len);
|
|
|
|
|
|
|
|
extern "C" err_t body_callback(void *arg, struct altcp_pcb *conn, struct pbuf *p, err_t err);
|
|
|
|
|
|
|
|
class HttpClient {
|
|
|
|
public:
|
|
|
|
HttpClient();
|
|
|
|
std::string retrieveWasteDatesAsCsv();
|
|
|
|
bool m_received{false};
|
|
|
|
|
|
|
|
private:
|
|
|
|
httpc_connection_t m_settings;
|
|
|
|
};
|