update CSpot + clear audio buffer when changing track

This commit is contained in:
philippe44
2022-08-23 17:06:59 -07:00
parent 36f18fc069
commit 0222dbd6de
22 changed files with 383 additions and 93 deletions

View File

@@ -15,6 +15,8 @@
#include <fstream>
#include "Logger.h"
#include <cJSON.h>
#include <ConfigJSON.h>
#include <random>
ApResolve::ApResolve() {}
@@ -76,19 +78,25 @@ std::string ApResolve::getApList()
jsonData += cur;
}
close(sockFd);
close(sockFd);
return jsonData;
}
std::string ApResolve::fetchFirstApAddress()
{
if (configMan->apOverride != "")
{
return configMan->apOverride;
}
// Fetch json body
auto jsonData = getApList();
// Use cJSON to get first ap address
auto root = cJSON_Parse(jsonData.c_str());
auto apList = cJSON_GetObjectItemCaseSensitive(root, "ap_list");
auto firstAp = cJSON_GetArrayItem(apList, 0);
auto data = std::string(firstAp->valuestring);