Fix for 42792
[apps/osp/Call.git] / inc / CallSoundManager.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                CallSoundManager.h
19  * @brief               This is the header file for the %SoundManager class.
20  *
21  * This header file contains the declarations for %SoundManager class.
22  */
23 #ifndef _PHN_SOUND_MANAGER_H_
24 #define _PHN_SOUND_MANAGER_H_
25
26 #include <FBase.h>
27 #include <FSystem.h>
28 #include <FMedia.h>
29 #include "sound_manager.h"
30 #include "vconf.h"
31 #include "vconf-keys.h"
32 #include "CallTypes.h"
33
34 using namespace Tizen::Base::Runtime;
35 /**
36  * @class SoundManager
37  * @brief This class presents sound related functionality required in call module.
38  *
39  */
40 enum CallAlertStatus
41 {
42         CALL_ALERT_OFF = 0,
43         CALL_ALERT_SOUND,
44         CALL_ALERT_VIBRATE
45 };
46 class SoundManager
47         : public Tizen::Media::IPlayerEventListener
48         , public Tizen::Base::Runtime::ITimerEventListener
49 {
50 public:
51         SoundManager(void);
52         virtual ~SoundManager(void);
53         //start the sound manager session
54         result StartSession(void);
55         //Change the speaker status
56         result SetSpeakerStatus(bool setSpeaker);
57         //Set the sound mode for the call
58         result SetSoundMode(SoundMode soundMode);
59         void StartAlert(Tizen::Base::String& contactRingTone);
60         void StopAlert(void);
61         //set connect tone
62         void SetConnectTone(void);
63         void SetMinuteReminderTone(void);
64         void SetDisconnectTone(void);
65         void SetWaitTone(void);
66         result StopSession(void);
67         Timer* GetTimer();
68         bool GetLastConferenceCall();
69         void SetlastEndedConferenceCall();
70
71 protected:
72                 virtual void OnPlayerOpened(result r);
73                 virtual void OnPlayerEndOfClip(void);
74                 virtual void OnPlayerSeekCompleted(result r);
75                 virtual void OnPlayerBuffering(int percent);
76                 virtual void OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r);
77                 virtual void OnPlayerInterrupted(void);
78                 virtual void OnPlayerReleased(void);
79                 virtual void OnTimerExpired(Timer& timer);
80
81 private:
82         bool IsEarJackConnected(void);
83
84 private:
85         //Sound manager handle
86         sound_call_session_h __pSoundCallSession;
87         //For notifying via vibrate during incoming call
88         Tizen::System::Vibrator* __pVibrator;
89         // Audio player
90         Tizen::Media::Player* __pPlayer;
91         Tizen::Media::Player* __pDisconnectPlayer;
92         Tizen::Media::Player* __pConnectPlayer;
93         Tizen::Media::Player* __pReminderPlayer;
94         Tizen::Media::Player* __pWaitingTonePlayer;
95         bool __isSoundStatusOn;
96         bool __isVibrateStatusOn;
97     Timer __timer;
98         bool __lastEndedConferenceCall;
99 };
100
101 #endif /* _PHN_SOUND_MANAGER_H_ */