From c4b717abd3f1864ff40f0dbadde87ea6c8acec41 Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Wed, 22 Dec 2021 13:24:38 -0500 Subject: [PATCH] Make wifi curl callback a static member --- src/panel/wifi.cpp | 4 ++-- src/panel/wifi.hpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/panel/wifi.cpp b/src/panel/wifi.cpp index 6f64a27..9d00d61 100644 --- a/src/panel/wifi.cpp +++ b/src/panel/wifi.cpp @@ -120,7 +120,7 @@ void wifi::update_texture(){ CURLcode res; curl_easy_setopt(curl, CURLOPT_URL, WIFI_PUBLIC_IP_URL); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, - dashboard::panel::curl_callback); + dashboard::panel::wifi::curl_callback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &public_ip); res = curl_easy_perform(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){ ((std::string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; diff --git a/src/panel/wifi.hpp b/src/panel/wifi.hpp index 7d21661..0bd0e37 100644 --- a/src/panel/wifi.hpp +++ b/src/panel/wifi.hpp @@ -22,6 +22,8 @@ namespace dashboard::panel { wifi(); ~wifi(); + static size_t curl_callback(void*, size_t, size_t, void*); + void draw(); private: void update(); @@ -29,7 +31,6 @@ namespace dashboard::panel { void initTexture(); }; - size_t curl_callback(void*, size_t, size_t, void*); } #include "../board.hpp"