Files
MuditaOS/module-apps/application-music-player/AudioNotificationsHandler.cpp
Lefucjusz 2e04d268c4 [MOS-1068] Fix A2DP stream not restarting after song changes
Workaround for the issue that A2DP stream
would sometimes not restart when music
player changes song to the next one.
2024-05-29 17:33:30 +02:00

59 lines
1.8 KiB
C++

// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "AudioNotificationsHandler.hpp"
#include <service-audio/AudioMessage.hpp>
namespace app::music_player
{
AudioNotificationsHandler::AudioNotificationsHandler(
std::shared_ptr<app::music_player::SongsContract::Presenter> presenter)
: presenter(std::move(presenter))
{}
sys::MessagePointer AudioNotificationsHandler::handleAudioStopNotification(
const AudioStopNotification *notification)
{
if (notification == nullptr) {
return sys::msgNotHandled();
}
presenter->handleAudioStopNotifiaction(notification->token);
return sys::msgHandled();
}
sys::MessagePointer AudioNotificationsHandler::handleAudioEofNotification(const AudioStopNotification *notification)
{
if (notification == nullptr) {
return sys::msgNotHandled();
}
presenter->handleAudioEofNotification(notification->token);
return sys::msgHandled();
}
sys::MessagePointer AudioNotificationsHandler::handleAudioPausedNotification(
const AudioPausedNotification *notification)
{
if (notification == nullptr) {
return sys::msgNotHandled();
}
presenter->handleAudioPausedNotification(notification->token);
return sys::msgHandled();
}
sys::MessagePointer AudioNotificationsHandler::handleAudioResumedNotification(
const AudioResumedNotification *notification)
{
if (notification == nullptr) {
return sys::msgNotHandled();
}
presenter->handleAudioResumedNotification(notification->token);
return sys::msgHandled();
}
} // namespace app::music_player