Make wifi curl callback a static member

This commit is contained in:
Tyler Perkins 2021-12-22 13:24:38 -05:00
parent f59ec8e67b
commit c4b717abd3
2 changed files with 4 additions and 3 deletions

View File

@ -120,7 +120,7 @@ void wifi::update_texture(){
CURLcode res; CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, WIFI_PUBLIC_IP_URL); curl_easy_setopt(curl, CURLOPT_URL, WIFI_PUBLIC_IP_URL);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
dashboard::panel::curl_callback); dashboard::panel::wifi::curl_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &public_ip); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &public_ip);
res = curl_easy_perform(curl); res = curl_easy_perform(curl);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
@ -156,7 +156,7 @@ void wifi::initTexture(){
} }
} }
size_t dashboard::panel::curl_callback(void* contents, size_t size, size_t dashboard::panel::wifi::curl_callback(void* contents, size_t size,
size_t nmemb, void* userp){ size_t nmemb, void* userp){
((std::string*)userp)->append((char*)contents, size * nmemb); ((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb; return size * nmemb;

View File

@ -22,6 +22,8 @@ namespace dashboard::panel {
wifi(); wifi();
~wifi(); ~wifi();
static size_t curl_callback(void*, size_t, size_t, void*);
void draw(); void draw();
private: private:
void update(); void update();
@ -29,7 +31,6 @@ namespace dashboard::panel {
void initTexture(); void initTexture();
}; };
size_t curl_callback(void*, size_t, size_t, void*);
} }
#include "../board.hpp" #include "../board.hpp"