unique UUID per CSPOT player

This commit is contained in:
Philippe G
2021-12-27 14:49:12 -08:00
parent 51c178ca46
commit d7d47d1127
4 changed files with 14 additions and 3 deletions

View File

@@ -3,8 +3,10 @@
#define MAX_VOLUME 65536 #define MAX_VOLUME 65536
// variable weakly set in ZeroconfAuthentificator.cpp
extern char deviceId[];
// Hardcoded information sent to spotify servers // Hardcoded information sent to spotify servers
const char * const deviceId = "162137fd329622137a14901634264e6f332e2422";
const char * const informationString = "cspot"; const char * const informationString = "cspot";
const char * const brandName = "corn"; const char * const brandName = "corn";
const char * const versionString = "cspot-1.0"; const char * const versionString = "cspot-1.0";

View File

@@ -7,6 +7,9 @@
#include "Logger.h" #include "Logger.h"
#include "ConfigJSON.h" #include "ConfigJSON.h"
// provide weak deviceId (see ConstantParameters.h)
char deviceId[] __attribute__((weak)) = "162137fd329622137a14901634264e6f332e2422";
ZeroconfAuthenticator::ZeroconfAuthenticator(authCallback callback, std::shared_ptr<bell::BaseHTTPServer> httpServer) { ZeroconfAuthenticator::ZeroconfAuthenticator(authCallback callback, std::shared_ptr<bell::BaseHTTPServer> httpServer) {
this->gotBlobCallback = callback; this->gotBlobCallback = callback;
srand((unsigned int)time(NULL)); srand((unsigned int)time(NULL));

View File

@@ -16,6 +16,8 @@
#include "cspot_private.h" #include "cspot_private.h"
#include "cspot_sink.h" #include "cspot_sink.h"
char EXT_RAM_ATTR deviceId[16];
static EXT_RAM_ATTR struct cspot_cb_s { static EXT_RAM_ATTR struct cspot_cb_s {
cspot_cmd_vcb_t cmd; cspot_cmd_vcb_t cmd;
cspot_data_cb_t data; cspot_data_cb_t data;
@@ -147,11 +149,15 @@ static bool cmd_handler(cspot_event_t event, ...) {
*/ */
static void cspot_sink_start(nm_state_t state_id, int sub_state) { static void cspot_sink_start(nm_state_t state_id, int sub_state) {
const char *hostname; const char *hostname;
uint8_t mac[6];
cmd_handler_chain = cspot_cbs.cmd; cmd_handler_chain = cspot_cbs.cmd;
network_get_hostname(&hostname); network_get_hostname(&hostname);
ESP_LOGI(TAG, "Starting Spotify (CSpot) servicename %s", hostname); esp_netif_get_mac(network_get_active_interface(), mac);
for (int i = 0; i < 6; i++) sprintf(deviceId + 2*i, "%02x", mac[i]);
ESP_LOGI(TAG, "Starting Spotify (CSpot) servicename %s with id %s", hostname, deviceId);
cspot = cspot_create(hostname, cmd_handler, cspot_cbs.data); cspot = cspot_create(hostname, cmd_handler, cspot_cbs.data);
} }

File diff suppressed because one or more lines are too long