Initialize Tizen 2.3
[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 "ITapiCall.h"
30 #include "sound_manager.h"
31 #include "vconf.h"
32 #include "vconf-keys.h"
33 #include "CallTypes.h"
34
35 using namespace Tizen::Base::Runtime;
36 /**
37  * @class SoundManager
38  * @brief This class presents sound related functionality required in call module.
39  *
40  */
41 enum CallAlertStatus
42 {
43         CALL_ALERT_OFF = 0,
44         CALL_ALERT_SOUND,
45         CALL_ALERT_VIBRATE
46 };
47 class SoundManager
48         : public Tizen::Media::IPlayerEventListener
49         , public Tizen::Base::Runtime::ITimerEventListener
50 {
51 public:
52         SoundManager(void);
53         virtual ~SoundManager(void);
54         //start the sound manager session
55         result StartSession(void);
56         //Change the speaker status
57         result SetSpeakerStatus(bool setSpeaker);
58         //Set the sound mode for the call
59         result SetSoundMode(SoundMode soundMode);
60         void StartAlert(Tizen::Base::String& contactRingTone);
61         void ResumeAlert(Tizen::Base::String& contactRingTone);
62         void StopAlert(void);
63         //set connect tone
64         void SetConnectTone(void);
65         void SetMinuteReminderTone(void);
66         void SetDisconnectTone(void);
67         void SetWaitTone(void);
68         result StopSession(void);
69         Timer* GetTimer();
70         bool GetLastConferenceCall();
71         void SetlastEndedConferenceCall();
72         result SetSoundPath(bool bSpeaker=false);
73         static void HandleCallbackResponse(TapiHandle* pHandle, int callBackResult, void* pData, void* pUserData){}
74
75 protected:
76                 virtual void OnPlayerOpened(result r);
77                 virtual void OnPlayerEndOfClip(void);
78                 virtual void OnPlayerSeekCompleted(result r);
79                 virtual void OnPlayerBuffering(int percent);
80                 virtual void OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r);
81                 virtual void OnPlayerInterrupted(void);
82                 virtual void OnPlayerReleased(void);
83                 virtual void OnTimerExpired(Timer& timer);
84
85 private:
86         bool IsEarJackConnected(void);
87
88 private:
89         //Sound manager handle
90         sound_call_session_h __pSoundCallSession;
91         //For notifying via vibrate during incoming call
92         Tizen::System::Vibrator* __pVibrator;
93         // Audio player
94         Tizen::Media::Player* __pPlayer;
95         Tizen::Media::Player* __pDisconnectPlayer;
96         Tizen::Media::Player* __pConnectPlayer;
97         Tizen::Media::Player* __pReminderPlayer;
98         Tizen::Media::Player* __pWaitingTonePlayer;
99         bool __isSoundStatusOn;
100         bool __isVibrateStatusOn;
101     Timer __timer;
102         bool __lastEndedConferenceCall;
103 };
104
105 #endif /* _PHN_SOUND_MANAGER_H_ */