~aleteoryx/muditaos

ref: f4bcc5ce6f0d66f6ee55949f9978ad0c0399fddb muditaos/module-apps/application-settings/models/apps/AudioSettingsModel.hpp -rw-r--r-- 3.0 KiB
f4bcc5ce — Dawid Wojtas [BH-1758] Fix information about next alarm ring 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <Application.hpp>

namespace audio
{
    enum class PlaybackType;
}

namespace audio_settings
{
    enum class PlaybackType
    {
        Notifications,
        KeypadSound,
        CallRingtone,
        TextMessageRingtone,
        Alarm
    };

    /// @brief Abstract audio settings model interface class
    class AbstractAudioSettingsModel
    {
      public:
        virtual ~AbstractAudioSettingsModel() noexcept = default;

        [[nodiscard]] virtual bool isVibrationEnabled()                 = 0;
        virtual void setVibrationEnabled()                              = 0;
        virtual void setVibrationDisabled()                             = 0;
        virtual void setVibrationLevel(audio::VibrationLevel vol)       = 0;
        [[nodiscard]] virtual audio::VibrationLevel getVibrationLevel() = 0;
        [[nodiscard]] virtual bool isSystemSoundEnabled()               = 0;
        virtual void setIsSystemSoundEnabled()                          = 0;
        virtual void setIsSystemSoundDisabled()                         = 0;
        [[nodiscard]] virtual bool isSoundEnabled()                     = 0;
        virtual void setSoundEnabled()                                  = 0;
        virtual void setSoundDisabled()                                 = 0;
        /// @return sound file path, returns empty string if not found
        [[nodiscard]] virtual std::string getSound() = 0;
        /// @param sound file path
        virtual void setSound(std::string filePath)                 = 0;
        [[nodiscard]] virtual audio::Volume getVolume()             = 0;
        virtual void setVolume(audio::Volume vol)                   = 0;
        [[nodiscard]] virtual audio::PlaybackType getPlaybackType() = 0;
    };

    class AudioSettingsModel : public AbstractAudioSettingsModel
    {
      public:
        /// @param application application pointer
        /// @param playbackType playback type
        AudioSettingsModel(app::ApplicationCommon *application, PlaybackType playbackType);

        bool isVibrationEnabled() override;
        void setVibrationEnabled() override;
        void setVibrationDisabled() override;
        void setVibrationLevel(audio::VibrationLevel vol) override;
        audio::VibrationLevel getVibrationLevel() override;
        bool isSystemSoundEnabled() override;
        void setIsSystemSoundEnabled() override;
        void setIsSystemSoundDisabled() override;
        bool isSoundEnabled() override;
        void setSoundEnabled() override;
        void setSoundDisabled() override;
        std::string getSound() override;
        void setSound(std::string) override;
        audio::Volume getVolume() override;
        void setVolume(audio::Volume vol) override;
        audio::PlaybackType getPlaybackType() override;

      private:
        app::ApplicationCommon *application = nullptr;
        audio::PlaybackType playbackType;
    };
} // namespace audio_settings