فهرست منبع

Bell/cspot catchup - release

philippe44 1 سال پیش
والد
کامیت
8d4813ceb4

+ 0 - 1
CMakeLists.txt

@@ -70,7 +70,6 @@ set_target_properties(recovery.elf PROPERTIES LINK_LIBRARIES "${BCA};idf::app_re
 # create files with size for recovery 
 # build_size(recovery)
 
-
 # build squeezelite, add app_squeezelite to the link
 add_executable(squeezelite.elf "CMakeLists.txt")
 add_dependencies(squeezelite.elf recovery.elf)

+ 0 - 4
components/spotify/cspot/bell/main/audio-dsp/BellDSP.cpp

@@ -52,10 +52,6 @@ size_t BellDSP::process(uint8_t* data, size_t bytes, int channels,
     return 0;
   }
 
-  size_t bytesPerSample = channels * 2;
-
-  size_t samplesLeftInBuffer = buffer->audioBuffer->size() / bytesPerSample;
-
   // Create a StreamInfo object to pass to the pipeline
   auto streamInfo = std::make_unique<StreamInfo>();
   streamInfo->numChannels = channels;

+ 1 - 2
components/spotify/cspot/bell/main/audio-dsp/include/CentralAudioBuffer.h

@@ -118,8 +118,7 @@ class CentralAudioBuffer {
       return nullptr;
     }
 
-    auto readBytes =
-        audioBuffer->read((uint8_t*)&lastReadChunk, sizeof(AudioChunk));
+    audioBuffer->read((uint8_t*)&lastReadChunk, sizeof(AudioChunk));
     currentSampleRate = static_cast<uint32_t>(lastReadChunk.sampleRate);
     return &lastReadChunk;
   }

+ 4 - 2
components/spotify/cspot/bell/main/io/BellHTTPServer.cpp

@@ -184,8 +184,10 @@ BellHTTPServer::BellHTTPServer(int serverPort) {
   BELL_LOG(info, "HttpServer", "Server listening on port %d", serverPort);
   this->serverPort = serverPort;
   auto port = std::to_string(this->serverPort);
-  const char* options[] = {"listening_ports", port.c_str(), 0};
-  server = std::make_unique<CivetServer>(options);
+
+  civetWebOptions.push_back("listening_ports");
+  civetWebOptions.push_back(port);
+  server = std::make_unique<CivetServer>(civetWebOptions);
 }
 
 std::unique_ptr<BellHTTPServer::HTTPResponse> BellHTTPServer::makeJsonResponse(

+ 6 - 4
components/spotify/cspot/bell/main/io/HTTPClient.cpp

@@ -50,10 +50,12 @@ void HTTPClient::Response::rawRequest(const std::string& url,
   }
 
   socketStream << reqEnd;
+
   // Write request body
   if (content.size() > 0) {
-      socketStream.write((const char*)content.data(), content.size());
+    socketStream.write((const char*)content.data(), content.size());
   }
+
   socketStream.flush();
 
   // Parse response
@@ -123,9 +125,9 @@ void HTTPClient::Response::get(const std::string& url, Headers headers) {
 }
 
 void HTTPClient::Response::post(const std::string& url, Headers headers,
-    const std::vector<uint8_t>& body) {
-    std::string method = "POST";
-    return this->rawRequest(url, method, body, headers);
+                                const std::vector<uint8_t>& body) {
+  std::string method = "POST";
+  return this->rawRequest(url, method, body, headers);
 }
 
 size_t HTTPClient::Response::contentLength() {

+ 13 - 0
components/spotify/cspot/bell/main/io/X509Bundle.cpp

@@ -12,8 +12,21 @@
 
 using namespace bell::X509Bundle;
 
+typedef struct crt_bundle_t {
+  const uint8_t** crts;
+  uint16_t num_certs;
+  size_t x509_crt_bundle_len;
+} crt_bundle_t;
+
+static std::vector<uint8_t> bundleBytes;
+
+static constexpr auto TAG = "X509Bundle";
+static constexpr auto CRT_HEADER_OFFSET = 4;
+static constexpr auto BUNDLE_HEADER_OFFSET = 2;
+
 static mbedtls_x509_crt s_dummy_crt;
 static bool s_should_verify_certs = false;
+static crt_bundle_t s_crt_bundle;
 
 #ifndef MBEDTLS_PRIVATE
 #define MBEDTLS_PRIVATE(member) member

+ 1 - 0
components/spotify/cspot/bell/main/io/include/BellHTTPServer.h

@@ -92,6 +92,7 @@ class BellHTTPServer : public CivetHandler {
 
  private:
   std::unique_ptr<CivetServer> server;
+  std::vector<std::string> civetWebOptions;
   int serverPort = 8080;
 
   Router getRequestsRouter;

+ 7 - 7
components/spotify/cspot/bell/main/io/include/HTTPClient.h

@@ -58,7 +58,7 @@ class HTTPClient {
                     const std::vector<uint8_t>& content, Headers& headers);
     void get(const std::string& url, Headers headers = {});
     void post(const std::string& url, Headers headers = {},
-        const std::vector<uint8_t>& body = {});
+              const std::vector<uint8_t>& body = {});
 
     std::string_view body();
     std::vector<uint8_t> bytes();
@@ -106,12 +106,12 @@ class HTTPClient {
   }
 
   static std::unique_ptr<Response> post(const std::string& url,
-      Headers headers = {},
-      const std::vector<uint8_t>& body = {}) {
-      auto response = std::make_unique<Response>();
-      response->connect(url);
-      response->post(url, headers, body);
-      return response;
+                                        Headers headers = {},
+                                        const std::vector<uint8_t>& body = {}) {
+    auto response = std::make_unique<Response>();
+    response->connect(url);
+    response->post(url, headers, body);
+    return response;
   }
 };
 }  // namespace bell

+ 0 - 13
components/spotify/cspot/bell/main/io/include/X509Bundle.h

@@ -9,19 +9,6 @@
 
 namespace bell::X509Bundle {
 
-typedef struct crt_bundle_t {
-  const uint8_t** crts;
-  uint16_t num_certs;
-  size_t x509_crt_bundle_len;
-} crt_bundle_t;
-
-static crt_bundle_t s_crt_bundle;
-static std::vector<uint8_t> bundleBytes;
-
-static constexpr auto TAG = "X509Bundle";
-static constexpr auto CRT_HEADER_OFFSET = 4;
-static constexpr auto BUNDLE_HEADER_OFFSET = 2;
-
 int crtCheckCertificate(mbedtls_x509_crt* child, const uint8_t* pub_key_buf,
                         size_t pub_key_len);
 /* This callback is called for every certificate in the chain. If the chain

+ 2 - 0
components/spotify/cspot/bell/main/utilities/Crypto.cpp

@@ -12,6 +12,8 @@ extern "C" {
 #include "aes.h"  // for AES_ECB_decrypt, AES_init_ctx, AES_ctx
 }
 
+static unsigned char DHGenerator[1] = {2};
+
 CryptoMbedTLS::CryptoMbedTLS() {}
 
 CryptoMbedTLS::~CryptoMbedTLS() {

+ 0 - 3
components/spotify/cspot/bell/main/utilities/include/Crypto.h

@@ -21,9 +21,6 @@ const static unsigned char DHPrime[] = {
     0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, 0xc2, 0x45,
     0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, 0xf4, 0x4c, 0x42, 0xe9,
     0xa6, 0x3a, 0x36, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
-static unsigned char DHGenerator[1] = {2};
-
 class CryptoMbedTLS {
  private:
   mbedtls_md_context_t sha1Context;

+ 0 - 2
components/spotify/cspot/protobuf/authentication.proto

@@ -1,5 +1,3 @@
-syntax = "proto2";
-
 enum CpuFamily {
     CPU_UNKNOWN = 0x0;
     CPU_X86 = 0x1;

+ 0 - 2
components/spotify/cspot/protobuf/keyexchange.proto

@@ -1,5 +1,3 @@
-syntax = "proto2";
-
 message LoginCryptoDiffieHellmanChallenge {
     required bytes gs = 0xa; 
 }

+ 0 - 2
components/spotify/cspot/protobuf/mercury.proto

@@ -1,5 +1,3 @@
-syntax = "proto2";
-
 message Header {
     optional string uri = 0x01;
     optional string method = 0x03;

+ 0 - 2
components/spotify/cspot/protobuf/spirc.proto

@@ -1,5 +1,3 @@
-syntax = "proto2";
-
 enum MessageType {
     kMessageTypeHello = 0x1;
     kMessageTypeGoodbye = 0x2;