Tizen 2.0 Release
[apps/osp/Phone.git] / inc / PhnSoundManager.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (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                PhnSoundManager.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 "PhnTypes.h"
33
34 /**
35  * @class SoundManager
36  * @brief This class presents sound related functionality required in call module.
37  *
38  */
39 class SoundManager
40         : public Tizen::Media::IPlayerEventListener
41 {
42 public:
43         SoundManager(void);
44         virtual ~SoundManager(void);
45         //start the sound manager session
46         result StartSession(void);
47         //Change the speaker status
48         result SetSpeakerStatus(bool setSpeaker);
49         //Set the sound mode for the call
50         result SetSoundMode(SoundMode soundMode);
51         void StartAlert(Tizen::Base::String& contactRingTone);
52         void StopAlert(void);
53         result StopSession(void);
54
55 protected:
56                 virtual void OnPlayerOpened(result r);
57                 virtual void OnPlayerEndOfClip(void);
58                 virtual void OnPlayerSeekCompleted(result r);
59                 virtual void OnPlayerBuffering(int percent);
60                 virtual void OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r);
61                 virtual void OnPlayerInterrupted(void);
62                 virtual void OnPlayerReleased(void);
63
64 private:
65         bool IsEarJackConnected(void);
66
67 private:
68         //Sound manager handle
69         sound_call_session_h __pSoundCallSession;
70         //For notifying via vibrate during incoming call
71         Tizen::System::Vibrator* __pVibrator;
72         // Audio player
73         Tizen::Media::Player* __pPlayer;
74         bool __isSoundStatusOn;
75         bool __isVibrateStatusOn;
76 };
77
78 #endif /* _PHN_SOUND_MANAGER_H_ */