//
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
, __pVibrator(null)
, __pPlayer(null)
, __lastEndedConferenceCall(false)
+ , __pConnectPlayer(null)
+ , __pDisconnectPlayer(null)
+ , __pReminderPlayer(null)
+ , __pWaitingTonePlayer(null)
{
__timer.Construct(*this);
__isSoundStatusOn = false;
if (__pVibrator != null)
{
delete __pVibrator;
+ __pVibrator = null;
}
if (__pPlayer != null)
{
delete __pPlayer;
+ __pPlayer = null;
+ }
+ if(__pConnectPlayer != null)
+ {
+ delete __pConnectPlayer;
+ __pConnectPlayer = null;
+ }
+ if(__pDisconnectPlayer != null)
+ {
+ delete __pDisconnectPlayer;
+ __pDisconnectPlayer = null;
+ }
+ if(__pReminderPlayer != null)
+ {
+ delete __pReminderPlayer;
+ __pReminderPlayer = null;
+ }
+ if(__pWaitingTonePlayer != null)
+ {
+ delete __pWaitingTonePlayer;
+ __pWaitingTonePlayer = null;
}
}
vconf_get_bool(VCONFKEY_CISSAPPL_MINUTE_MINDER_BOOL, &unknownRejectStatus);
bool ReminderToneSetStatus = unknownRejectStatus;
result res = E_FAILURE;
+ reminderTonePath.Append(MINUTEREMINDERTONE_PATH);
if(ReminderToneSetStatus == true)
{
- if(__pPlayer == null)
+ if(__pReminderPlayer == null)
{
- __pPlayer = new (std::nothrow) Player();
- res = __pPlayer->Construct(*this);
- if(res != E_SUCCESS)
+
+ if(reminderTonePath.IsEmpty() == false)
{
- AppLogDebug("__pPlayer Construct failed with %d",res);
- return;
+ __pReminderPlayer = new (std::nothrow) Player();
+ res = __pReminderPlayer->Construct(*this);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pReminderPlayer Construct failed with %d",res);
+ delete __pReminderPlayer;
+ __pReminderPlayer = null;
+ return;
+ }
+ res = __pReminderPlayer->OpenFile(reminderTonePath,false);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pReminderPlayer OpenFile failed with %d",res);
+ delete __pReminderPlayer;
+ __pReminderPlayer = null;
+ return;
+ }
+ res = __pReminderPlayer->SetLooping(false);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pReminderPlayer SetLooping failed with %d",res);
+ delete __pReminderPlayer;
+ __pReminderPlayer = null;
+ return;
+ }
+ res = __pReminderPlayer->SetVolume(80);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pReminderPlayer SetVolume failed with %d",res);
+ delete __pReminderPlayer;
+ __pReminderPlayer = null;
+ return;
+ }
}
}
- reminderTonePath.Append(MINUTEREMINDERTONE_PATH);
- if(reminderTonePath.IsEmpty() == false)
+ if(__pReminderPlayer != null)
{
- __pPlayer->Stop();
- __pPlayer->Close();
- res = __pPlayer->OpenFile(reminderTonePath,false);
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer OpenFile failed with %d",res);
- return;
- }
- res = __pPlayer->SetLooping(false);
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer SetLooping failed with %d",res);
- return;
- }
- res = __pPlayer->SetVolume(80);
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer SetVolume failed with %d",res);
- return;
- }
SetSoundMode(SOUND_MODE_MEDIA);
- res = __pPlayer->Play();
+ res = __pReminderPlayer->Play();
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer Play failed with %d",res);
+ AppLogDebug("__pReminderPlayer Play failed with %d",res);
return;
}
SetSoundMode(SOUND_MODE_VOICE);
{
AppLogDebug("disconnectToneSetStatus == true");
disconnectTonePath.Append(CALLDISCONNECTTONE_PATH);
- if(__pPlayer == null)
+ if(disconnectTonePath.IsEmpty() == false)
{
- AppLogDebug("__pPlayer == null");
- __pPlayer = new (std::nothrow) Player();
- res = __pPlayer->Construct(*this);
- if(res != E_SUCCESS)
+ if(__pDisconnectPlayer == null)
{
- AppLogDebug("__pPlayer Construct failed with %d",res);
- return;
- }
+ AppLogDebug("__pConnectPlayer == null");
+ __pDisconnectPlayer = new (std::nothrow) Player();
+ res = __pDisconnectPlayer->Construct(*this);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pDisconnectPlayer Construct failed with %d",res);
+ delete __pDisconnectPlayer;
+ __pDisconnectPlayer = null;
+ return;
+ }
+ res = __pDisconnectPlayer->OpenFile(disconnectTonePath,false);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pDisconnectPlayer OpenFile failed with %d",res);
+ delete __pDisconnectPlayer;
+ __pDisconnectPlayer = null;
+ return;
+ }
+ res = __pDisconnectPlayer->SetLooping(false);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pDisconnectPlayer SetLooping failed with %d",res);
+ delete __pDisconnectPlayer;
+ __pDisconnectPlayer = null;
+ return;
+ }
+ res = __pDisconnectPlayer->SetVolume(80);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pDisconnectPlayer SetLooping SetVolume with %d",res);
+ delete __pDisconnectPlayer;
+ __pDisconnectPlayer = null;
+ return;
+ }
+ }
}
- if(disconnectTonePath.IsEmpty() == false)
+
+ if(__pDisconnectPlayer != null)
{
- __pPlayer->Stop();
- __pPlayer->Close();
- AppLogDebug("__pPlayer OpenFile %ls",disconnectTonePath.GetPointer());
- res = __pPlayer->OpenFile(disconnectTonePath,false);
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer OpenFile failed with %d",res);
- return;
- }
- res = __pPlayer->SetLooping(false);
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer SetLooping failed with %d",res);
- return;
- }
- res = __pPlayer->SetVolume(80);
- if(res != E_SUCCESS)
+ AppLogDebug("__pDisconnectPlayer OpenFile %ls",disconnectTonePath.GetPointer());
+ SetSoundMode(SOUND_MODE_MEDIA);
+ AppLogDebug("__pDisconnectPlayer SetVolume");
+ if(__pDisconnectPlayer->GetState() == PLAYER_STATE_PLAYING)
{
- AppLogDebug("__pPlayer SetLooping SetVolume with %d",res);
- return;
+ __pDisconnectPlayer->Stop();
}
- SetSoundMode(SOUND_MODE_MEDIA);
- AppLogDebug("__pPlayer SetVolume");
- res = __pPlayer->Play();
+ res = __pDisconnectPlayer->Play();
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer Play with %d",res);
+ AppLogDebug("__pDisconnectPlayer Play with %d",res);
return;
}
}
+
}
+
+
+
+
AppLogDebug("Exit");
}
void
-SoundManager::SetMinuteReminderTone()
+SoundManager::SetMinuteReminderTone(void)
{
-
- int unknownRejectStatus = -1;
- vconf_get_bool(VCONFKEY_CISSAPPL_MINUTE_MINDER_BOOL, &unknownRejectStatus);
- bool reminderToneSetStatus = unknownRejectStatus;
-
- if(reminderToneSetStatus == true)
- {
- __timer.StartAsRepeatable(60000);
- }
-
+ __timer.StartAsRepeatable(60000);
}
void
-SoundManager::SetConnectTone()
+SoundManager::SetConnectTone(void)
{
String connectTonePath;
if(connectToneSetStatus == true)
{
- if(__pPlayer == null)
+ if(__pConnectPlayer == null)
{
- __pPlayer = new (std::nothrow) Player();
- res = __pPlayer->Construct(*this);
- if(res != E_SUCCESS)
+ if (connectTonePath.IsEmpty() == false)
{
- AppLogDebug("__pPlayer Construct failed with %d",res);
- return;
+ __pConnectPlayer = new (std::nothrow) Player();
+ res = __pConnectPlayer->Construct(*this);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pConnectPlayer Construct failed with %d",res);
+ delete __pConnectPlayer;
+ __pConnectPlayer = null;
+ return;
+ }
+ res = __pConnectPlayer->OpenFile(connectTonePath,false);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pConnectPlayer OpenFile failed with %d",res);
+ delete __pConnectPlayer;
+ __pConnectPlayer = null;
+ return;
+ }
+ res = __pConnectPlayer->SetLooping(false);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pConnectPlayer SetLooping failed with %d",res);
+ delete __pConnectPlayer;
+ __pConnectPlayer = null;
+ return;
+ }
+ res = __pConnectPlayer->SetVolume(80);
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pConnectPlayer SetVolume failed with %d",res);
+ delete __pConnectPlayer;
+ __pConnectPlayer = null;
+ return;
+ }
}
}
- if (connectTonePath.IsEmpty() == false)
- {
- __pPlayer->Stop();
- __pPlayer->Close();
- res = __pPlayer->OpenFile(connectTonePath,false);
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer OpenFile failed with %d",res);
- return;
- }
- res = __pPlayer->SetLooping(false);
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer SetLooping failed with %d",res);
- return;
- }
- res = __pPlayer->SetVolume(80);
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer SetVolume failed with %d",res);
- return;
- }
+ if(__pConnectPlayer != null)
+ {
res = SetSoundMode(SOUND_MODE_MEDIA);
- AppLogDebug("__pPlayer Playing connect tone");
- res = __pPlayer->Play();
+ AppLogDebug("__pConnectPlayer Playing connect tone");
+ res = __pConnectPlayer->Play();
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer Play failed with %d",res);
+ AppLogDebug("__pConnectPlayer Play failed with %d",res);
return;
}
}
+
}
+
+
}
void
-SoundManager::StartAlert(String& contactRingTone)
+SoundManager::SetWaitTone(void)
{
+ CallAlertStatus status= CALL_ALERT_SOUND;
+ int alertStatus = -1;
result res = E_FAILURE;
- AppLogDebug("Enter");
- if(__pSoundCallSession != null)
+ int retVal = vconf_get_int(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT, &alertStatus);
+ if (retVal == 0)
{
- CallAlertStatus status= CALL_ALERT_SOUND;
- int alertStatus = -1;
- int retVal = vconf_get_int(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT, &alertStatus);
- if (retVal == 0)
- {
- status = (CallAlertStatus) alertStatus;
- }
- AppLogDebug("No Alert already in call");
- if(status == CALL_ALERT_SOUND)
+ status = (CallAlertStatus) alertStatus;
+ }
+ AppLogDebug("No Alert already in call");
+ if(status == CALL_ALERT_SOUND)
+ {
+ AppLogDebug("Playing alert tone");
+ String waitingTonePath;
+ waitingTonePath.Append(CALLWAITINGTONE_PATH);
+ if(__pWaitingTonePlayer == null)
{
- AppLogDebug("Playing alert tone");
- String waitingTonePath;
- waitingTonePath.Append(CALLWAITINGTONE_PATH);
- if(__pPlayer == null)
- {
- __pPlayer = new (std::nothrow) Player();
- res = __pPlayer->Construct(*this);
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer Construct failed with %d",res);
- return;
- }
- }
if (waitingTonePath.IsEmpty() == false)
{
- __pPlayer->Stop();
- __pPlayer->Close();
- res = __pPlayer->OpenFile(waitingTonePath,false);
+ __pWaitingTonePlayer = new (std::nothrow) Player();
+ res = __pWaitingTonePlayer->Construct(*this);
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer OpenFile failed with %d",res);
+ AppLogDebug("__pWaitingTonePlayer Construct failed with %d",res);
+ delete __pWaitingTonePlayer;
+ __pWaitingTonePlayer = null;
return;
}
- res = __pPlayer->SetLooping(true);
+ res = __pWaitingTonePlayer->OpenFile(waitingTonePath,false);
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer SetLooping failed with %d",res);
+ AppLogDebug("__pWaitingTonePlayer OpenFile failed with %d",res);
+ delete __pWaitingTonePlayer;
+ __pWaitingTonePlayer = null;
+
return;
}
- res = __pPlayer->SetVolume(80);
+ res = __pWaitingTonePlayer->SetLooping(true);
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer SetVolume failed with %d",res);
+ AppLogDebug("__pWaitingTonePlayer SetLooping failed with %d",res);
+ delete __pWaitingTonePlayer;
+ __pWaitingTonePlayer = null;
+
return;
}
- SetSoundMode(SOUND_MODE_MEDIA);
- res = __pPlayer->Play();
+ res = __pWaitingTonePlayer->SetVolume(80);
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer Play failed with %d",res);
+ AppLogDebug("__pWaitingTonePlayer SetVolume failed with %d",res);
+ delete __pWaitingTonePlayer;
+ __pWaitingTonePlayer = null;
+
return;
}
}
}
+
+ if( __pWaitingTonePlayer != null )
+ {
+ SetSoundMode(SOUND_MODE_MEDIA);
+ res = __pWaitingTonePlayer->Play();
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pWaitingTonePlayer Play failed with %d",res);
+ return;
+ }
+ }
+
+ }
+}
+
+void
+SoundManager::StartAlert(String& contactRingTone)
+{
+ result res = E_FAILURE;
+ IntensityDurationVibrationPattern vibration;
+ vibration.duration = 3000;
+ vibration.intensity = -1;
+ AppLogDebug("Enter");
+ if(__pSoundCallSession != null)
+ {
+ SetWaitTone();
return;
}
else
if(res != E_SUCCESS)
{
AppLogDebug("__pPlayer Construct failed with %d",res);
+ delete __pPlayer;
+ __pPlayer = null;
return;
}
}
ringTonePath.Clear();
ringTonePath.Append(RINGTONE_PATH);
}
- __pPlayer->Close();
+
res = __pPlayer->OpenFile(ringTonePath,false);
if(res != E_SUCCESS)
{
if (__isVibrateStatusOn == true)
{
//todo: Get the level from settings
- res = __pVibrator->Start(3000,1000,1000);
+ __pVibrator->Start(&vibration, 1, 1000);
}
AppLogDebug("Exit");
return;
if (__isSoundStatusOn == true)
{
//todo: stop player
- AppLogDebug("Stopping ring tone");
- res = __pPlayer->Stop();
- if(res != E_SUCCESS)
- {
- AppLogDebug("__pPlayer Stop failed with %d",res);
- return;
- }
- res = __pPlayer->Close();
- if(res != E_SUCCESS)
+ if(__pPlayer != null)
{
- AppLogDebug("__pPlayer Close failed with %d",res);
- return;
+ AppLogDebug("Stopping ring tone");
+ if(__pPlayer->GetState() == PLAYER_STATE_PLAYING)
+ {
+ res = __pPlayer->Stop();
+ }
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pPlayer Stop failed with %d",res);
+ return;
+ }
+ res = __pPlayer->Close();
+ if(res != E_SUCCESS)
+ {
+ AppLogDebug("__pPlayer Close failed with %d",res);
+ return;
+ }
+ SetSoundMode(SOUND_MODE_VOICE);
+ __isSoundStatusOn = false;
+ StopSession();
}
- SetSoundMode(SOUND_MODE_VOICE);
- __isSoundStatusOn = false;
- StopSession();
}
if (__isVibrateStatusOn == true)
{
__pVibrator->Stop();
__isVibrateStatusOn = false;
}
+ if(__pWaitingTonePlayer != null)
+ {
+ if(__pWaitingTonePlayer->GetState() == PLAYER_STATE_PLAYING)
+ {
+ __pWaitingTonePlayer->Stop();
+ }
+ }
+
AppLogDebug("Exit");
}