2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License)
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 #include <FBaseSysLog.h>
20 #include <FSec_AccessController.h>
21 #include <FMediaAudioManagerTypes.h>
22 #include <FMediaVoipAudioSessionManager.h>
23 #include "FMedia_VoipAudioSessionManagerImpl.h"
25 using namespace Tizen::Base;
26 using namespace Tizen::Base::Collection;
27 using namespace Tizen::Base::Runtime;
28 using namespace Tizen::Security;
30 namespace Tizen { namespace Media
34 VoipAudioSessionManager::VoipAudioSessionManager()
36 __pVoipAudioSessionManagerImpl = _VoipAudioSessionManagerImpl::GetInstance();
39 VoipAudioSessionManager::~VoipAudioSessionManager()
41 if (__pVoipAudioSessionManagerImpl != null)
43 __pVoipAudioSessionManagerImpl = null;
47 VoipAudioSessionManager*
48 VoipAudioSessionManager::GetInstance(void)
52 r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
53 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
55 static VoipAudioSessionManager voipSessionManager;
56 return (&voipSessionManager);
63 VoipAudioSessionManager::EnterCallSession(void)
67 r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
68 SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
70 return __pVoipAudioSessionManagerImpl->EnterCallSession();
75 VoipAudioSessionManager::ExitCallSession(void)
79 r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
80 SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
82 return __pVoipAudioSessionManagerImpl->ExitCallSession();
86 VoipAudioSessionManager::SetCallSessionMode(VoipAudioSessionMode mode)
90 r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
91 SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
93 return __pVoipAudioSessionManagerImpl->SetCallSessionMode(mode);
97 VoipAudioSessionManager::GetCallSessionMode(void) const
101 r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
102 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
104 return __pVoipAudioSessionManagerImpl->GetCallSessionMode();
107 return (VoipAudioSessionMode) -1;