mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 13:07:03 +03:00
alignment to 4.0 + misc cspot fixes
This commit is contained in:
@@ -76,6 +76,8 @@ std::string ApResolve::getApList()
|
||||
jsonData += cur;
|
||||
}
|
||||
|
||||
close(sockFd);
|
||||
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,6 @@ void MercuryManager::stop() {
|
||||
isRunning = false;
|
||||
audioChunkManager->close();
|
||||
std::scoped_lock(audioChunkManager->runningMutex, this->runningMutex);
|
||||
this->session->close();
|
||||
CSPOT_LOG(debug, "mercury stopped");
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,8 @@ size_t PlainConnection::writeBlock(const std::vector<uint8_t> &data)
|
||||
|
||||
void PlainConnection::closeSocket()
|
||||
{
|
||||
CSPOT_LOG(info, "Closing socket...");
|
||||
shutdown(this->apSock, SHUT_RDWR);
|
||||
close(this->apSock);
|
||||
CSPOT_LOG(info, "Closing socket...");
|
||||
shutdown(this->apSock, SHUT_RDWR);
|
||||
close(this->apSock);
|
||||
this->apSock = -1;
|
||||
}
|
||||
|
||||
@@ -43,13 +43,20 @@ void SpircController::setPause(bool isPaused, bool notifyPlayer) {
|
||||
CSPOT_LOG(debug, "External pause command");
|
||||
if (notifyPlayer) player->pause();
|
||||
state->setPlaybackState(PlaybackState::Paused);
|
||||
notify();
|
||||
} else {
|
||||
CSPOT_LOG(debug, "External play command");
|
||||
if (notifyPlayer) player->play();
|
||||
state->setPlaybackState(PlaybackState::Playing);
|
||||
notify();
|
||||
}
|
||||
notify();
|
||||
}
|
||||
|
||||
void SpircController::disconnect(void) {
|
||||
player->cancelCurrentTrack();
|
||||
stopPlayer();
|
||||
state->setActive(false);
|
||||
notify();
|
||||
sendEvent(CSpotEventType::DISC);
|
||||
}
|
||||
|
||||
void SpircController::playToggle() {
|
||||
@@ -104,10 +111,7 @@ void SpircController::handleFrame(std::vector<uint8_t> &data) {
|
||||
// Pause the playback if another player took control
|
||||
if (state->isActive() &&
|
||||
state->remoteFrame.device_state->is_active.value()) {
|
||||
sendEvent(CSpotEventType::DISC);
|
||||
state->setActive(false);
|
||||
notify();
|
||||
player->cancelCurrentTrack();
|
||||
disconnect();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user