--- a/mmshplugins/mmshaoplugin/src/mustsypropertymonitor.cpp Tue Aug 31 15:12:07 2010 +0300
+++ b/mmshplugins/mmshaoplugin/src/mustsypropertymonitor.cpp Wed Sep 01 12:31:01 2010 +0100
@@ -19,11 +19,11 @@
#include "mustsypropertymonitor.h"
#include "muscallconferencemonitor.h"
#include "muscallmonitor.h"
-#include "musvoipcallmonitor.h"
#include "muslogger.h"
-#include "musfactorysettings.h"
+#include "mussettings.h"
+#include "musclirmonitor.h"
-
+#include <etel.h>
#include <e32property.h>
#include <mmtsy_names.h>
#include <ctsydomainpskeys.h>
@@ -33,11 +33,10 @@
// Symbian two-phase constructor.
// -----------------------------------------------------------------------------
//
-CMusTsyPropertyMonitor* CMusTsyPropertyMonitor::NewL( RMobilePhone& aPhone,
- MMusCallStateObserver& aCallStateObserver )
+CMusTsyPropertyMonitor* CMusTsyPropertyMonitor::NewL( RMobilePhone& aPhone )
{
MUS_LOG( "mus: [MUSAO] -> CMusTsyPropertyMonitor::NewL" )
- CMusTsyPropertyMonitor* self = new (ELeave) CMusTsyPropertyMonitor( aPhone, aCallStateObserver );
+ CMusTsyPropertyMonitor* self = new (ELeave) CMusTsyPropertyMonitor(aPhone);
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop( self );
@@ -54,10 +53,9 @@
{
MUS_LOG( "mus: [MUSAO] -> CMusTsyPropertyMonitor::~CMusTsyPropertyMonitor" )
Cancel();
- delete iConferenceMonitor;
- iCallMonitorArray.ResetAndDestroy();
- iCallMonitorArray.Close();
- RemoveAllVoipCallMonitors();
+ delete iConferenceMonitor;
+ delete iClirMonitor;
+ iCallMonitorArray.ResetAndDestroy();
iLine.Close();
MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::~CMusTsyPropertyMonitor" )
}
@@ -72,7 +70,13 @@
CActiveScheduler::Add(this);
User::LeaveIfError( iLine.Open( iPhone, KMmTsyVoice1LineName() ) );
iConferenceMonitor = CMusCallConferenceMonitor::NewL(
- iPhone,iLine,iCallMonitorArray);
+ iPhone,iLine,iCallMonitorArray);
+
+ if (MultimediaSharingSettings::PrivacySetting())
+ {
+ iClirMonitor = CMusClirMonitor::NewL();
+ }
+
User::LeaveIfError( iPropertyEvent.Attach(
KPSUidCtsyCallInformation,
KCTsyCallState ) );
@@ -85,8 +89,8 @@
// C++ constructor.
// -----------------------------------------------------------------------------
//
-CMusTsyPropertyMonitor::CMusTsyPropertyMonitor(RMobilePhone& aPhone, MMusCallStateObserver& aCallStateObserver )
- : CActive( EPriorityNormal ),iPhone(aPhone), iCallStateObserver ( aCallStateObserver )
+CMusTsyPropertyMonitor::CMusTsyPropertyMonitor(RMobilePhone& aPhone)
+ : CActive( EPriorityNormal ),iPhone(aPhone)
{
}
@@ -102,36 +106,24 @@
// subscribe , so that we dont miss any events.
iPropertyEvent.Subscribe( iStatus );
SetActive();
- TPSCTsyCallState callState = EPSCTsyCallStateUninitialized;
- User::LeaveIfError(iPropertyEvent.Get( (TInt&)callState ));
- TPSCTsyCallType callType = EPSCTsyCallTypeUninitialized;
- User::LeaveIfError(RProperty::Get(KPSUidCtsyCallInformation,KCTsyCallType,
- (TInt&)callType));
- MUS_LOG1( "mus: [MUSAO] iTsyCallMonitor->CallState = %d",callState )
- switch(callState)
+ TInt value = EPSCTsyCallStateUninitialized;
+ User::LeaveIfError(iPropertyEvent.Get( value ));
+ MUS_LOG1( "mus: [MUSAO] iTsyCallMonitor->CallState = %d",value )
+ switch(value)
{
- case EPSCTsyCallStateNone:
- MUS_LOG( "mus: [MUSAO] EPSCTsyCallStateNone" )
+ case EPSCTsyCallStateNone:
SetStateL(NMusSessionInformationApi::ENoCall);
// Sometimes disconnected call goes stright to this state
// so we have to call this function to remove call monitors.
- MonitorCallL( callState,callType);
- break;
- case EPSCTsyCallStateDisconnecting:
- MUS_LOG( "mus: [MUSAO] EPSCTsyCallStateDisconnecting" )
- MonitorCallL( callState,callType);
- break;
- case EPSCTsyCallStateAnswering:
- MUS_LOG( "mus: [MUSAO] EPSCTsyCallStateAnswering" )
- MonitorCallL( callState,callType);
- break;
- case EPSCTsyCallStateConnected:
- MUS_LOG( "mus: [MUSAO] EPSCTsyCallStateConnected" )
- MonitorCallL( callState,callType);
- break;
- case EPSCTsyCallStateHold:
- MUS_LOG( "mus: [MUSAO] EPSCTsyCallStateHold" )
- SetStateL(NMusSessionInformationApi::ECallHold);
+ RemoveAllCallMonitor();
+ break;
+ case EPSCTsyCallStateDisconnecting:
+ case EPSCTsyCallStateAnswering:
+ case EPSCTsyCallStateConnected:
+ case EPSCTsyCallStateHold:
+ // in all above states if multible call exist then
+ // we have to find all the calls state and do accordingly.
+ MonitorCallL();
break;
default:
MUS_LOG( "mus: [MUSAO] Undesired CallState " )
@@ -187,13 +179,19 @@
}
MUS_LOG1( "mus: [MUSAO] Call Exist = %d ",isCallExist )
if( !isCallExist )
- {
+ {
+ if ( iClirMonitor )
+ {
+ //Start async reading of CLIR from phone settings
+ iClirMonitor->ReadClir();
+ }
+
CMusCallMonitor* callMonitor = CMusCallMonitor::NewL( aCallName,
IsPttCallExist() );
CleanupStack::PushL( callMonitor );
iCallMonitorArray.AppendL( callMonitor );
CleanupStack::Pop( callMonitor );
- callMonitor->StartMonitorL(iLine, *this, iCallStateObserver );
+ callMonitor->StartMonitorL(iLine, *this);
}
MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::AddCallMonitorL" )
}
@@ -322,52 +320,13 @@
MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::SetStateL" )
}
+
// -----------------------------------------------------------------------------
// CMusTsyPropertyMonitor::MonitorCallL()
-// Decides which call monitor (CS,VOIP etc ) has to be called.
+// Monitors the call and if needed adds/removes call monitor.
// -----------------------------------------------------------------------------
//
-void CMusTsyPropertyMonitor::MonitorCallL( const TPSCTsyCallState& aCallState,
- const TPSCTsyCallType& aCallType)
- {
- MUS_LOG( "mus: [MUSAO] -> CCMusTsyPropertyMonitor::MonitorCallL" )
- switch( aCallType )
- {
- case EPSCTsyCallTypeUninitialized:
- case EPSCTsyCallTypeNone:
- case EPSCTsyCallTypeFax:
- case EPSCTsyCallTypeData:
- case EPSCTsyCallTypeHSCSD:
- case EPSCTsyCallTypeH324Multimedia:
- break;// dont care
- case EPSCTsyCallTypeCSVoice:
- MonitorCSCallL();
- break;
- case EPSCTsyCallTypeVoIP:
- {
- // if error occured when reading factory setting key
- // behave default ie all calls supported.
- TBool supported = ETrue;
- TRAP_IGNORE( supported = MusFactorySettings::IsSupportedL( aCallType ) )
- if( supported)
- {
- MonitorVoipCallL( aCallState );
- }
- break;
- }
- default:
- break;
- }
- // Check now for multimediasharing call criteria.
- CheckCallCriteriaL();
- MUS_LOG( "mus: [MUSAO] <- CCMusTsyPropertyMonitor::MonitorCallL" )
- }
-// -----------------------------------------------------------------------------
-// CMusTsyPropertyMonitor::MonitorCSCallL()
-// Monitors the CS call and if needed adds/removes call monitor.
-// -----------------------------------------------------------------------------
-//
-void CMusTsyPropertyMonitor::MonitorCSCallL()
+void CMusTsyPropertyMonitor::MonitorCallL()
{
MUS_LOG( "mus: [MUSAO] -> CMusTsyPropertyMonitor::MonitorCallL")
TInt callCount;
@@ -390,173 +349,22 @@
{
AddCallMonitorL(callInfo.iCallName);
}
- }
- MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::MonitorCallL")
- }
-
-// -----------------------------------------------------------------------------
-// CMusTsyPropertyMonitor::MonitorVoipCallL()
-// Monitors the voip call and if needed adds/removes call monitor.
-// -----------------------------------------------------------------------------
-//
-void CMusTsyPropertyMonitor::MonitorVoipCallL( const TPSCTsyCallState& aCallState)
- {
- MUS_LOG( "mus: [MUSAO] -> CMusTsyPropertyMonitor::MonitorVoipCallL")
- // TODO : Call Name should be read from covergence api [CCE/CCH]
- // which is not available as of now 22-Dec-2008
- TName callName(_L("Voip 1"));
- switch(aCallState)
- {
- case EPSCTsyCallStateDisconnecting:
- MUS_LOG( "mus: [MUSAO] EPSCTsyCallStateDisconnecting" )
- RemoveVoipCallMonitor(callName);
- break;
- case EPSCTsyCallStateAnswering:
- case EPSCTsyCallStateConnected:
- MUS_LOG( "mus: [MUSAO] EPSCTsyCallStateAnswering/EPSCTsyCallStateConnected" )
- AddVoipCallMonitorL(callName);
- break;
- default:
- break;
- }
- MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::MonitorVoipCallL")
- }
-
-// -----------------------------------------------------------------------------
-// CMusTsyPropertyMonitor::AddVoipCallMonitorL( TName aCallName )
-// Adds new voip call monitor if the call is not monitored already.
-// -----------------------------------------------------------------------------
-//
-void CMusTsyPropertyMonitor::AddVoipCallMonitorL(TName& aCallName)
- {
- MUS_LOG_TDESC( "mus: [MUSAO] -> CMusTsyPropertyMonitor::AddCallMonitorL"\
- ,aCallName )
- TBool isCallExist = EFalse;
- for ( TInt i = 0; i < iVoipCallMonitorArray.Count() && !isCallExist; i++ )
- {
- if( iVoipCallMonitorArray[i]->IsEqual( aCallName ) )
- {
- isCallExist = ETrue;
- }
- }
- MUS_LOG1( "mus: [MUSAO] Call Exist = %d ",isCallExist )
- if( !isCallExist )
- {
- CMusVoipCallMonitor* callMonitor =
- CMusVoipCallMonitor::NewL( aCallName, iCallStateObserver );
- CleanupStack::PushL( callMonitor );
- iVoipCallMonitorArray.AppendL( callMonitor );
- CleanupStack::Pop( callMonitor );
}
- MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::AddCallMonitorL" )
- }
-
-
-// -----------------------------------------------------------------------------
-// CMusTsyPropertyMonitor::RemoveCallEventMonitorL( TName aCallName )
-// Remove the Call Monitor if it exist in array.
-// -----------------------------------------------------------------------------
-//
-void CMusTsyPropertyMonitor::RemoveVoipCallMonitor( TName& aCallName )
- {
- MUS_LOG_TDESC( "mus: [MUSAO] -> CMusTsyPropertyMonitor::RemoveCallMonitor "
- ,aCallName )
- for ( TInt i = 0; i < iVoipCallMonitorArray.Count(); i++ )
- {
- if( iVoipCallMonitorArray[i]->IsEqual( aCallName ) )
- {
- delete iVoipCallMonitorArray[i];
- iVoipCallMonitorArray.Remove(i);
- break;
- }
- }
- MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::RemoveCallMonitor" )
- }
+ // Sometimes when call get disconnected then call object disappears.So
+ // check the call state or open the call , if there is an error or undesired
+ // call state , remove that callmonitor from array.
+ RemoveUnUsedCallMonitors();
-// -----------------------------------------------------------------------------
-// CMusTsyPropertyMonitor::RemoveAllVoipCallMonitors
-// Remove all voip call monitors
-// -----------------------------------------------------------------------------
-//
-void CMusTsyPropertyMonitor::RemoveAllVoipCallMonitors( )
- {
- MUS_LOG( "mus: [MUSAO] -> CMusTsyPropertyMonitor::RemoveAllVoipCallMonitors ")
- iVoipCallMonitorArray.ResetAndDestroy();
- iVoipCallMonitorArray.Close();
- MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::RemoveAllVoipCallMonitors" )
- }
-
-// -----------------------------------------------------------------------------
-// CMusTsyPropertyMonitor::CheckCallCriteria
-// Checks the Multimediasharing call criterias
-// -----------------------------------------------------------------------------
-//
-void CMusTsyPropertyMonitor::CheckCallCriteriaL()
- {
- TInt csCall = iCallMonitorArray.Count();
- TInt voipCall = iVoipCallMonitorArray.Count();
- switch( csCall )
- {
- case 0 :
- {
- switch( voipCall )
- {
- /* No cs call or voip call */
- case 0 :
- {
- User::LeaveIfError(
- RProperty::Set( NMusSessionInformationApi::KCategoryUid,
- NMusSessionInformationApi::KMusCallEvent,
- 0 ));
- SetStateL(NMusSessionInformationApi::ENoCall);
- break;
- }
- /* No cs call but one voip call */
- case 1 :
- {
- iVoipCallMonitorArray[0]->
- SetStateL(NMusSessionInformationApi::ECallConnected);
- break;
- }
- /* No cs call but more than one voip call */
- default: SetStateL(NMusSessionInformationApi::ECallHold);
- break;
- }
- break;
- }
- case 1 :
- {
- switch( voipCall )
- {
- /* One cs call but no voip call */
- case 0 : break;// Will be handled by cs call monitors.
- /* One cs call and one or more voip calls */
- default : SetStateL(NMusSessionInformationApi::ECallHold);
- break;
- }
- break;
- }
- default: // 2 or more CS calls
- {
- /* Sometimes when call get disconnected then call object disappears.So
- * check the call state or open the call , if there is an error or undesired
- * call state , remove that callmonitor from array.
- */
- RemoveUnUsedCallMonitors();
-
- /* It is already multicall so atleast one should be under hold.
- * so set the state first to hold and then let the conference
- * monitor decide the conference state.
- */
- SetStateL(NMusSessionInformationApi::ECallHold);
-
- /* Still we dont know here about conference state so
- * let the conference call monitor decide .
- */
- iConferenceMonitor->SetStateL();
- break;
- }
+ if(iCallMonitorArray.Count() > 1)
+ {
+ // it is already multicall so atleast one should be hold.
+ // so set the state first to hold
+ SetStateL(NMusSessionInformationApi::ECallHold);
+ // still we dont know here about conference state so
+ // let the conference call monitor decide .
+ iConferenceMonitor->SetStateL();
}
+ MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::MonitorCallL")
}
@@ -641,41 +449,4 @@
MUS_LOG( "mus: [MUSAO] <- CMusTsyPropertyMonitor::NotifyCallStateChanged" )
}
-
-
-
-// -----------------------------------------------------------------------------
-// CMusTsyPropertyMonitor::IsDataReadyL
-// -----------------------------------------------------------------------------
-//
-TBool CMusTsyPropertyMonitor::IsDataReadyL()
- {
- MUS_LOG( "mus: [MUSAO] -> CMusTsyPropertyMonitor::IsDataReadyL" )
-
- TBool dataReady = EFalse;
- TInt csCall = iCallMonitorArray.Count();
- TInt voipCall = iVoipCallMonitorArray.Count();
-
- // In case of Conference Notify that data is ready.
- if ( iConferenceMonitor->GetConfStatus() != RMobileConferenceCall::EConferenceIdle )
- {
- MUS_LOG( "mus: [MUSAO] Conference CASE" )
- dataReady = ETrue;
- }
- else if ( csCall == 1 && !voipCall )
- {
- MUS_LOG( "mus: [MUSAO] CS CALL" )
- dataReady = iCallMonitorArray[0]->IsDataReadyL();
- }
- else if ( voipCall == 1 && !csCall )
- {
- MUS_LOG( "mus: [MUSAO] VOIP CALL" )
- dataReady = iVoipCallMonitorArray[0]->IsDataReadyL();
- }
-
- MUS_LOG1( "mus: [MUSAO] <- CMusTsyPropertyMonitor::IsDataReadyL = %d",dataReady)
- return dataReady;
- }
-
// End of file
-