mmshplugins/mmshaoplugin/inc/mustsypropertymonitor.h
changeset 22 496ad160a278
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Monitor that observes the Line and create call monitor
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MUSTSYPROPERTYMONITOR_H
       
    20 #define MUSTSYPROPERTYMONITOR_H
       
    21 
       
    22 // Enable the below line if Kodiak Ptt has to be monitered
       
    23 // #include "mmusptteventobserver.h"
       
    24 #include <etel.h>
       
    25 #include <etelmm.h>
       
    26 #include <e32base.h>
       
    27 #include <e32property.h>
       
    28 #include <ctsydomainpskeys.h>
       
    29 
       
    30 #include "musunittesting.h"
       
    31 #include "mussesseioninformationapi.h"
       
    32 #include "mmustsypropertyobserver.h"
       
    33 #include "mmuscallstateobserver.h"
       
    34 
       
    35 class CMusCallMonitor;
       
    36 class CMusVoipCallMonitor;
       
    37 class CMusPTTCallMonitor;
       
    38 class CMusCallConferenceMonitor;
       
    39 
       
    40 /**
       
    41  * This class monitors the line event,if call is connected
       
    42  * it creats new call event monitor . If call is disconnected
       
    43  * it removes the call monitor . Also it responds to Ptt Events.
       
    44  *
       
    45  * @lib musaoplugin.dll
       
    46  */
       
    47 
       
    48 class CMusTsyPropertyMonitor : public CActive,
       
    49                                public MMusTsyPropertyObserver
       
    50 // Enable the below line if Kodiak Ptt has to be monitered
       
    51 // ,public MMusPttEventObserver
       
    52     {
       
    53 
       
    54     public: // constructors and destructor
       
    55 
       
    56         /**
       
    57          * Two-phased constructor.
       
    58          */
       
    59         static CMusTsyPropertyMonitor* NewL( RMobilePhone& aPhone, 
       
    60                                              MMusCallStateObserver& aCallStateObserver );
       
    61 
       
    62         /**
       
    63          * Destructor.
       
    64          */
       
    65         ~CMusTsyPropertyMonitor();
       
    66 
       
    67         /*
       
    68          * Returns the current call object.
       
    69          */
       
    70 
       
    71         const RCall& Call();
       
    72         
       
    73         /**
       
    74          * Function from MMusTsyPropertyObserver
       
    75          */
       
    76         void NotifyCallStateChanged(NMusSessionInformationApi::TMusCallEvent aVal, TName& aCallName);
       
    77         
       
    78         /**
       
    79          * Checks from the corresponding monitors if the data is ready.
       
    80          */
       
    81         TBool IsDataReadyL();
       
    82 
       
    83     private:
       
    84 
       
    85         /**
       
    86          * C++ constructor.
       
    87          */
       
    88         CMusTsyPropertyMonitor( RMobilePhone& aPhone, MMusCallStateObserver& aCallStateObserve );
       
    89 
       
    90         /**
       
    91          * Symbian 2nd-phase constructor.
       
    92          */
       
    93         void ConstructL();
       
    94         
       
    95 
       
    96     private: // functions from base class CActive
       
    97 
       
    98         /**
       
    99          * Handles an active object's request completion event.
       
   100          */
       
   101         void RunL();
       
   102 
       
   103         /**
       
   104          * cancels of an outstanding request
       
   105          */
       
   106         void DoCancel();
       
   107 
       
   108         /*
       
   109          * Handles a leave occurring in the request completion 
       
   110          * event handler RunL().
       
   111          * Always return KErrNone since it must handle this error
       
   112          * if it comes to this place.
       
   113          */
       
   114         TInt RunError( TInt aError );
       
   115 
       
   116 
       
   117     private: 
       
   118         /*
       
   119          * If the call Monitor doesnt exist then it creats one new
       
   120          * CMusCallMonitor class and add into array. 
       
   121          * Leavs if objects creation fails.
       
   122          */
       
   123         void AddCallMonitorL( TName& aCallName );
       
   124 
       
   125         /*
       
   126          * It removs the CMusCallMonitor object from array
       
   127          * based on the call name.         
       
   128          */
       
   129 
       
   130         void RemoveCallMonitor( TName& aCallName );
       
   131 
       
   132         /*
       
   133          * It checks the property key of PTT call.If call exist ETrue
       
   134          * else otherwise.
       
   135          */
       
   136         TBool IsPttCallExist();      
       
   137 
       
   138         /**
       
   139           * Sets the multimediasharing propery key value
       
   140           * if the value is same before then dont report it.
       
   141           */
       
   142         void SetStateL(NMusSessionInformationApi::TMusCallEvent aVal);          
       
   143 
       
   144         /**
       
   145           * Add / Remove Call Monitors based on Mus criteria          
       
   146           */
       
   147         void MonitorCallL(const TPSCTsyCallState& aCallState,
       
   148                 const TPSCTsyCallType& aCallType);
       
   149         
       
   150         /**
       
   151           * Add / Remove Call Monitors based on Mus criteria          
       
   152           */
       
   153         void MonitorCSCallL();
       
   154         
       
   155     private: // Voip related 
       
   156         /*
       
   157          * If the call Monitor doesnt exist then it creats one new
       
   158          * CMusCallMonitor class and add into array. 
       
   159          * Leavs if objects creation fails.
       
   160          */
       
   161         void AddVoipCallMonitorL( TName& aCallName );
       
   162 
       
   163         /*
       
   164          * It removs the CMusCallMonitor object from array
       
   165          * based on the call name.         
       
   166          */
       
   167 
       
   168         void RemoveVoipCallMonitor( TName& aCallName );
       
   169         
       
   170         /**
       
   171          * Add / Remove Call Monitors based on Mus criteria          
       
   172          */
       
   173        void MonitorVoipCallL(const TPSCTsyCallState& aCallState);
       
   174 
       
   175         /**
       
   176          * Removes and reset the voip call monitor array
       
   177          */
       
   178        void RemoveAllVoipCallMonitors( );
       
   179        
       
   180         /**
       
   181          * Checks multimediasharing call criteria's
       
   182          */
       
   183        void CheckCallCriteriaL();
       
   184 
       
   185 
       
   186          /**
       
   187           * Delete all call monitor        
       
   188           */
       
   189         void RemoveAllCallMonitor();
       
   190 
       
   191         /**
       
   192           * Check Call Staus from Call.   
       
   193           */
       
   194         RMobileCall::TMobileCallStatus CallStatus(const TDesC& aCallName);
       
   195         
       
   196         /**
       
   197           * Remove Unused Call monitorts. Sometime the call gets disconnected
       
   198           * and call state goes unnoticed.so its good to check and remove unused 
       
   199           * call monitors.
       
   200           */
       
   201         
       
   202         void RemoveUnUsedCallMonitors();
       
   203 
       
   204    private:
       
   205         /*
       
   206          * It will be called from CMusPttCallMonitor class incase any Ptt
       
   207          * event occurs. It will stop or start call monitoring based on this.
       
   208          * It could leave if start/stop of call monitor fails.         
       
   209          */
       
   210 	
       
   211 	// Enable the below line if Kodiak Ptt has to be monitered
       
   212         // void PttCallEventOccuredL( TPSCTsyKodiakPtt& aVal);
       
   213 
       
   214 
       
   215     private:    // Data               
       
   216 
       
   217         /**
       
   218          * RMobilePhone handle.It is not owned . So don't close it.
       
   219          */
       
   220         RMobilePhone& iPhone;
       
   221 
       
   222         /**
       
   223          * RMobileLine handle
       
   224          */
       
   225         RMobileLine iLine;
       
   226 
       
   227         /**
       
   228          * Array of Call Monitors.
       
   229          */
       
   230         RPointerArray<CMusCallMonitor> iCallMonitorArray;
       
   231 
       
   232         /**
       
   233          * Array of voip Call Monitors.
       
   234          */
       
   235         RPointerArray<CMusVoipCallMonitor> iVoipCallMonitorArray;
       
   236         
       
   237         /**
       
   238          * Conference call monitor, owned.
       
   239          */
       
   240         CMusCallConferenceMonitor* iConferenceMonitor;
       
   241         
       
   242         /**
       
   243          * Instance of RProperty.
       
   244          */
       
   245         RProperty iPropertyEvent;  
       
   246         
       
   247         /*
       
   248          * Reference of callstate observer not owned
       
   249          */
       
   250         MMusCallStateObserver& iCallStateObserver;
       
   251 
       
   252         MUS_UNITTEST( UT_CMusTsyPropertyMonitor )
       
   253         MUS_UNITTEST( UT_CMusAoPlugin )
       
   254         
       
   255     };
       
   256 
       
   257 #endif // MUSTSYPROPERTYMONITOR_H