--- a/mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp Tue Jul 06 14:50:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp Wed Aug 18 10:17:22 2010 +0300
@@ -26,9 +26,7 @@
#include "tmsshared.h"
#include "tmsclientserver.h"
#include "tmstarsettings.h"
-#include "tmsdtmftoneplayer.h"
-#include "tmsdtmfprovider.h"
-#include "tmsdtmfnotifier.h"
+#include "tmssyncvol.h"
using namespace TMS;
@@ -58,9 +56,7 @@
iCSUplink = NULL;
iRouting = NULL;
iTarSettings = NULL;
- iDTMFDnlinkPlayer = NULL;
- iDTMFUplinkPlayer = NULL;
- iDTMFNotifier = NULL;
+ iResetVolNotifier = NULL;
TRACE_PRN_FN_EXT;
}
@@ -84,11 +80,9 @@
delete iRouting;
delete iTarSettings;
- delete iDTMFUplinkPlayer;
- delete iDTMFDnlinkPlayer;
- delete iDTMFNotifier;
delete iCSUplink;
delete iCSDownlink;
+ delete iResetVolNotifier;
if (iMsgQueueUp.Handle() > 0)
{
@@ -112,8 +106,8 @@
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_SUCCESS);
iNextStreamId = 1;
- iUplinkInitialized = FALSE;
- iDnlinkInitialized = FALSE;
+ iUplState = EIdle;
+ iDnlState = EIdle;
TRACE_PRN_FN_EXT;
return status;
}
@@ -133,12 +127,11 @@
case TMS_STREAM_UPLINK:
{
status = TMS_RESULT_ALREADY_EXIST;
- if (!iUplinkInitialized)
+ if (iUplState == EIdle)
{
iUplinkStreamId = iNextStreamId;
outStrmId = iUplinkStreamId;
iNextStreamId++;
- //iUplinkInitialized = TRUE; //not initialized yet!
status = TMS_RESULT_SUCCESS;
}
break;
@@ -146,12 +139,11 @@
case TMS_STREAM_DOWNLINK:
{
status = TMS_RESULT_ALREADY_EXIST;
- if (!iDnlinkInitialized)
+ if (iDnlState == EIdle)
{
iDnlinkStreamId = iNextStreamId;
outStrmId = iDnlinkStreamId;
iNextStreamId++;
- //iDnlinkInitialized = TRUE; //not initialized yet!
status = TMS_RESULT_SUCCESS;
}
break;
@@ -242,15 +234,6 @@
{
TRAP(status, iCSUplink = TMSCSUplink::NewL(*this, retrytime));
}
- if (!iDTMFUplinkPlayer && status == TMS_RESULT_SUCCESS)
- {
- TRAP(status, iDTMFUplinkPlayer = TMSDTMFProvider::NewL());
- iDTMFUplinkPlayer->AddObserver(*this);
- }
- if (!iDTMFNotifier && status == TMS_RESULT_SUCCESS)
- {
- TRAP(status, iDTMFNotifier = TMSDtmfNotifier::NewL());
- }
return status;
}
@@ -275,15 +258,6 @@
{
TRAP(status, iTarSettings = TMSTarSettings::NewL());
}
- if (!iDTMFDnlinkPlayer && status == TMS_RESULT_SUCCESS)
- {
- TRAP(status, iDTMFDnlinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this,
- KAudioDTMFString, KAudioPriorityDTMFString));
- }
- if (!iDTMFNotifier && status == TMS_RESULT_SUCCESS)
- {
- TRAP(status, iDTMFNotifier = TMSDtmfNotifier::NewL());
- }
return status;
}
@@ -301,7 +275,8 @@
{
case TMS_STREAM_UPLINK:
{
- if (iCSUplink && strmId == iUplinkStreamId)
+ if (iCSUplink && strmId == iUplinkStreamId &&
+ iUplState == EInitialized)
{
iCSUplink->Activate(retrytime);
status = TMS_RESULT_SUCCESS;
@@ -310,7 +285,16 @@
}
case TMS_STREAM_DOWNLINK:
{
- if (iCSDownlink && strmId == iDnlinkStreamId)
+ if(!iResetVolNotifier)
+ {
+ TRAP(status, iResetVolNotifier = TMSSyncVol::NewL());
+ }
+ if(iResetVolNotifier)
+ {
+ iResetVolNotifier->SetSyncVol();
+ }
+ if (iCSDownlink && strmId == iDnlinkStreamId &&
+ iDnlState == EInitialized)
{
iCSDownlink->Activate(retrytime);
status = TMS_RESULT_SUCCESS;
@@ -359,6 +343,7 @@
if (iCSUplink && strmId == iUplinkStreamId)
{
iCSUplink->Deactivate();
+ iUplState = EInitialized;
status = TMS_RESULT_SUCCESS;
NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
}
@@ -369,6 +354,7 @@
if (iCSDownlink && strmId == iDnlinkStreamId)
{
iCSDownlink->Deactivate();
+ iDnlState = EInitialized;
status = TMS_RESULT_SUCCESS;
NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
}
@@ -402,16 +388,18 @@
if (iCSUplink && strmId == iUplinkStreamId)
{
iCSUplink->Deactivate();
- iUplinkInitialized = FALSE;
+ iUplState = EIdle;
status = TMS_RESULT_SUCCESS;
NotifyClient(iUplinkStreamId, ECmdUplinkDeInitComplete, status);
}
break;
+ }
case TMS_STREAM_DOWNLINK:
+ {
if (iCSDownlink && strmId == iDnlinkStreamId)
{
iCSDownlink->Deactivate();
- iDnlinkInitialized = FALSE;
+ iDnlState = EIdle;
status = TMS_RESULT_SUCCESS;
NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete,
status);
@@ -445,7 +433,7 @@
if (strmId == iUplinkStreamId)
{
iUplinkStreamId = -1;
- iUplinkInitialized = FALSE;
+ iUplState = EIdle;
}
break;
}
@@ -454,7 +442,7 @@
if (strmId == iDnlinkStreamId)
{
iDnlinkStreamId = -1;
- iDnlinkInitialized = FALSE;
+ iDnlState = EIdle;
}
break;
}
@@ -521,7 +509,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSDownlink && iDnlinkInitialized)
+ if (iCSDownlink && iDnlState != EIdle)
{
volume = iCSDownlink->MaxVolume();
status = TMS_RESULT_SUCCESS;
@@ -540,7 +528,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSDownlink && iDnlinkInitialized)
+ if (iCSDownlink && iDnlState != EIdle)
{
iCSDownlink->SetVolume(volume);
status = TMS_RESULT_SUCCESS;
@@ -559,7 +547,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSDownlink && iDnlinkInitialized)
+ if (iCSDownlink && iDnlState != EIdle)
{
volume = iCSDownlink->Volume();
status = TMS_RESULT_SUCCESS;
@@ -577,7 +565,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSUplink && iUplinkInitialized)
+ if (iCSUplink && iUplState != EIdle)
{
gain = iCSUplink->MaxGain();
status = TMS_RESULT_SUCCESS;
@@ -596,7 +584,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSUplink && iUplinkInitialized)
+ if (iCSUplink && iUplState != EIdle)
{
iCSUplink->SetGain(gain);
status = TMS_RESULT_SUCCESS;
@@ -615,7 +603,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSUplink && iUplinkInitialized)
+ if (iCSUplink && iUplState != EIdle)
{
gain = iCSUplink->Gain();
status = TMS_RESULT_SUCCESS;
@@ -633,7 +621,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSDownlink && iDnlinkInitialized)
+ if (iCSDownlink && iDnlState != EIdle)
{
volume = iCSDownlink->MaxVolume();
status = TMS_RESULT_SUCCESS;
@@ -653,7 +641,7 @@
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
iGlobalVol = volume;
- if (iCSDownlink && iDnlinkInitialized)
+ if (iCSDownlink && iDnlState != EIdle)
{
iCSDownlink->SetVolume(volume);
status = TMS_RESULT_SUCCESS;
@@ -671,7 +659,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSDownlink && iDnlinkInitialized)
+ if (iCSDownlink && iDnlState != EIdle)
{
volume = iCSDownlink->Volume();
status = TMS_RESULT_SUCCESS;
@@ -689,7 +677,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSUplink && iUplinkInitialized)
+ if (iCSUplink && iUplState != EIdle)
{
gain = iCSUplink->MaxGain();
status = TMS_RESULT_SUCCESS;
@@ -709,7 +697,7 @@
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
iGlobalGain = gain;
- if (iCSUplink && iUplinkInitialized)
+ if (iCSUplink && iUplState != EIdle)
{
iCSUplink->SetGain(gain);
status = TMS_RESULT_SUCCESS;
@@ -727,7 +715,7 @@
{
TRACE_PRN_FN_ENT;
gint status(TMS_RESULT_INVALID_STATE);
- if (iCSUplink && iUplinkInitialized)
+ if (iCSUplink && iUplState != EIdle)
{
gain = iCSUplink->Gain();
status = TMS_RESULT_SUCCESS;
@@ -942,7 +930,6 @@
status = TMS_RESULT_SUCCESS;
output = TOTMSOUTPUT(taroutput);
}
-
TRACE_PRN_FN_EXT;
return status;
}
@@ -984,10 +971,8 @@
RBufWriteStream stream;
stream.Open(*outputsbuf);
CleanupClosePushL(stream);
-
TArray<CTelephonyAudioRouting::TAudioOutput>
availableOutputs = iRouting->AvailableOutputs();
-
guint numOfItems = availableOutputs.Count();
count = numOfItems;
for (guint i = 0; i < numOfItems; i++)
@@ -995,7 +980,6 @@
tmsoutput = TOTMSOUTPUT(availableOutputs[i]);
stream.WriteUint32L(tmsoutput);
}
-
CleanupStack::PopAndDestroy(&stream);
status = TMS_RESULT_SUCCESS;
}
@@ -1005,176 +989,6 @@
}
// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::StartDTMF
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::StartDTMF(const TMSStreamType strmtype, TDes& dtmfstring)
- {
- TRACE_PRN_FN_ENT;
- gint status(TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED);
- TmsMsgBufPckg dtmfpckg;
- dtmfpckg().iStatus = status;
- dtmfpckg().iRequest = ECmdDTMFTonePlayFinished;
-
- if (strmtype == TMS_STREAM_DOWNLINK && iDnlinkInitialized)
- {
- if (iDTMFDnlinkPlayer)
- {
- iDTMFDnlinkPlayer->PlayDtmfTone(dtmfstring);
- status = TMS_RESULT_SUCCESS;
- }
- dtmfpckg().iStatus = TMS_RESULT_SUCCESS;
- dtmfpckg().iRequest = ECmdDTMFToneDnlPlayStarted;
- }
- else if (strmtype == TMS_STREAM_UPLINK && iUplinkInitialized)
- {
- //use etel for uplink
- if (iDTMFUplinkPlayer)
- {
- status = iDTMFUplinkPlayer->SendDtmfToneString(dtmfstring);
- status = TMS_RESULT_SUCCESS;
- }
- dtmfpckg().iStatus = TMSUtility::EtelToTMSResult(status);
- dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted;
- }
-
- if (iDTMFNotifier)
- {
- iDTMFNotifier->SetDtmf(dtmfpckg);
- }
-
- TRACE_PRN_IF_ERR(status);
- TRACE_PRN_FN_EXT;
- return status;
- }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::StopDTMF
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::StopDTMF(const TMSStreamType streamtype)
- {
- TRACE_PRN_FN_ENT;
- gint status(TMS_RESULT_SUCCESS);
-
- if (streamtype == TMS_STREAM_DOWNLINK && iDTMFDnlinkPlayer)
- {
- iDTMFDnlinkPlayer->Cancel();
- }
- else if (streamtype == TMS_STREAM_UPLINK && iDTMFUplinkPlayer)
- {
- status = iDTMFUplinkPlayer->StopDtmfTone();
- status = TMSUtility::EtelToTMSResult(status);
- }
-
- TRACE_PRN_FN_EXT;
- return status;
- }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::ContinueDTMF
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::ContinueDTMF(const gboolean sending)
- {
- TRACE_PRN_FN_ENT;
- gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-
- if (iDTMFUplinkPlayer)
- {
- status = iDTMFUplinkPlayer->ContinueDtmfStringSending(sending);
- status = TMSUtility::EtelToTMSResult(status);
- }
-
- TRACE_PRN_FN_EXT;
- return status;
- }
-
-//From TMSDTMFTonePlayerObserver
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::DTMFInitCompleted
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::DTMFInitCompleted(gint /*status*/)
- {
- TRACE_PRN_FN_ENT;
- // TODO: process error
- TRACE_PRN_FN_EXT;
- }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::DTMFToneFinished
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::DTMFToneFinished(gint status)
- {
- TRACE_PRN_FN_ENT;
- TRACE_PRN_IF_ERR(status);
- TmsMsgBufPckg dtmfpckg;
-
- // KErrUnderflow indicates end of DTMF playback.
- if (status == KErrUnderflow || status == KErrInUse)
- {
- status = TMS_RESULT_SUCCESS;
- }
- dtmfpckg().iStatus = TMSUtility::TMSResult(status);
- dtmfpckg().iRequest = ECmdDTMFTonePlayFinished;
- if (iDTMFNotifier)
- {
- iDTMFNotifier->SetDtmf(dtmfpckg);
- }
- TRACE_PRN_FN_EXT;
- }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::HandleDTMFEvent
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::HandleDTMFEvent(
- const TMSDTMFObserver::TCCPDtmfEvent event, const gint status,
- const TChar /*tone*/)
- {
- TRACE_PRN_FN_ENT;
- TmsMsgBufPckg dtmfpckg;
-
- TRACE_PRN_N1(_L("**TMS TMSCallCSAdpt::HandleDTMFEvent error:%d"), status);
-
- dtmfpckg().iStatus = TMSUtility::EtelToTMSResult(status);
-
- switch (event)
- {
- case ECCPDtmfUnknown: //Unknown
- break;
- case ECCPDtmfManualStart: //DTMF sending started manually
- case ECCPDtmfSequenceStart: //Automatic DTMF sending initialized
- dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted;
- break;
- case ECCPDtmfManualStop: //DTMF sending stopped manually
- case ECCPDtmfManualAbort: //DTMF sending aborted manually
- case ECCPDtmfSequenceStop: //Automatic DTMF sending stopped
- case ECCPDtmfSequenceAbort: //Automatic DTMF sending aborted
- case ECCPDtmfStopInDtmfString: //There was stop mark in DTMF string
- case ECCPDtmfStringSendingCompleted: //DTMF sending success
- dtmfpckg().iRequest = ECmdDTMFTonePlayFinished;
- break;
- default:
- break;
- }
-
- if (iDTMFNotifier)
- {
- iDTMFNotifier->SetDtmf(dtmfpckg, TRUE);
- }
- TRACE_PRN_FN_EXT;
- }
-
-// -----------------------------------------------------------------------------
// TMSCallCSAdpt::DownlinkInitCompleted
// From TMSCSDevSoundObserver
// -----------------------------------------------------------------------------
@@ -1184,7 +998,7 @@
TRACE_PRN_FN_ENT;
if (status == TMS_RESULT_SUCCESS)
{
- iDnlinkInitialized = TRUE;
+ iDnlState = EInitialized;
}
NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
TRACE_PRN_FN_EXT;
@@ -1200,7 +1014,7 @@
TRACE_PRN_FN_ENT;
if (status == TMS_RESULT_SUCCESS)
{
- iUplinkInitialized = TRUE;
+ iUplState = EInitialized;
}
NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
TRACE_PRN_FN_EXT;
@@ -1214,6 +1028,10 @@
void TMSCallCSAdpt::UplinkActivationCompleted(gint status)
{
TRACE_PRN_FN_ENT;
+ if (status == TMS_RESULT_SUCCESS)
+ {
+ iUplState = EActivated;
+ }
NotifyClient(iUplinkStreamId, ECmdUplinkStarted, status);
TRACE_PRN_FN_EXT;
}
@@ -1226,6 +1044,10 @@
void TMSCallCSAdpt::DownlinkActivationCompleted(gint status)
{
TRACE_PRN_FN_ENT;
+ if (status == TMS_RESULT_SUCCESS)
+ {
+ iDnlState = EActivated;
+ }
NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, status);
TRACE_PRN_FN_EXT;
}