mmshplugins/mmshaoplugin/inc/mustsypropertymonitor.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     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 
       
    20 #ifndef MUSTSYPROPERTYMONITOR_H
       
    21 #define MUSTSYPROPERTYMONITOR_H
       
    22 
       
    23 #include "musunittesting.h"
       
    24 #include "mussesseioninformationapi.h"
       
    25 #include "mmustsypropertyobserver.h"
       
    26 // Enable the below line if Kodiak Ptt has to be monitered
       
    27 // #include "mmusptteventobserver.h"
       
    28 #include <etelmm.h>
       
    29 #include <e32base.h>
       
    30 #include <e32property.h>
       
    31 
       
    32 class CMusCallMonitor;
       
    33 class CMusPTTCallMonitor;
       
    34 class CMusCallConferenceMonitor;
       
    35 class CMusClirMonitor;
       
    36 
       
    37 /**
       
    38  * This class monitors the line event,if call is connected
       
    39  * it creats new call event monitor . If call is disconnected
       
    40  * it removes the call monitor . Also it responds to Ptt Events.
       
    41  *
       
    42  * @lib musaoplugin.dll
       
    43  */
       
    44 
       
    45 class CMusTsyPropertyMonitor : public CActive,
       
    46                                public MMusTsyPropertyObserver
       
    47 // Enable the below line if Kodiak Ptt has to be monitered
       
    48 // ,public MMusPttEventObserver
       
    49     {
       
    50 
       
    51     public: // constructors and destructor
       
    52 
       
    53         /**
       
    54          * Two-phased constructor.
       
    55          */
       
    56         static CMusTsyPropertyMonitor* NewL( RMobilePhone& aPhone );
       
    57 
       
    58         /**
       
    59          * Destructor.
       
    60          */
       
    61         ~CMusTsyPropertyMonitor();
       
    62 
       
    63         /*
       
    64          * Returns the current call object.
       
    65          */
       
    66 
       
    67         const RCall& Call();
       
    68         
       
    69         /**
       
    70          * Function from MMusTsyPropertyObserver
       
    71          */
       
    72         void NotifyCallStateChanged(NMusSessionInformationApi::TMusCallEvent aVal, TName& aCallName);
       
    73 
       
    74     private:
       
    75 
       
    76         /**
       
    77          * C++ constructor.
       
    78          */
       
    79         CMusTsyPropertyMonitor( RMobilePhone& aPhone );
       
    80 
       
    81         /**
       
    82          * Symbian 2nd-phase constructor.
       
    83          */
       
    84         void ConstructL();
       
    85 
       
    86 
       
    87     private: // functions from base class CActive
       
    88 
       
    89         /**
       
    90          * Handles an active object's request completion event.
       
    91          */
       
    92         void RunL();
       
    93 
       
    94         /**
       
    95          * cancels of an outstanding request
       
    96          */
       
    97         void DoCancel();
       
    98 
       
    99         /*
       
   100          * Handles a leave occurring in the request completion 
       
   101          * event handler RunL().
       
   102          * Always return KErrNone since it must handle this error
       
   103          * if it comes to this place.
       
   104          */
       
   105         TInt RunError( TInt aError );
       
   106 
       
   107 
       
   108     private: 
       
   109         /*
       
   110          * If the call Monitor doesnt exist then it creats one new
       
   111          * CMusCallMonitor class and add into array. 
       
   112          * Leavs if objects creation fails.
       
   113          */
       
   114         void AddCallMonitorL( TName& aCallName );
       
   115 
       
   116         /*
       
   117          * It removs the CMusCallMonitor object from array
       
   118          * based on the call name.         
       
   119          */
       
   120 
       
   121         void RemoveCallMonitor( TName& aCallName );
       
   122 
       
   123         /*
       
   124          * It checks the property key of PTT call.If call exist ETrue
       
   125          * else otherwise.
       
   126          */
       
   127         TBool IsPttCallExist();      
       
   128 
       
   129         /**
       
   130           * Sets the multimediasharing propery key value
       
   131           * if the value is same before then dont report it.
       
   132           */
       
   133         void SetStateL(NMusSessionInformationApi::TMusCallEvent aVal);          
       
   134 
       
   135         /**
       
   136           * Add / Remove Call Monitors based on Mus criteria          
       
   137           */
       
   138         void MonitorCallL();
       
   139 
       
   140          /**
       
   141           * Delete all call monitor        
       
   142           */
       
   143         void RemoveAllCallMonitor();
       
   144 
       
   145         /**
       
   146           * Check Call Staus from Call.   
       
   147           */
       
   148         RMobileCall::TMobileCallStatus CallStatus(const TDesC& aCallName);
       
   149         
       
   150         /**
       
   151           * Remove Unused Call monitorts. Sometime the call gets disconnected
       
   152           * and call state goes unnoticed.so its good to check and remove unused 
       
   153           * call monitors.
       
   154           */
       
   155         
       
   156         void RemoveUnUsedCallMonitors();
       
   157 
       
   158    private:
       
   159         /*
       
   160          * It will be called from CMusPttCallMonitor class incase any Ptt
       
   161          * event occurs. It will stop or start call monitoring based on this.
       
   162          * It could leave if start/stop of call monitor fails.         
       
   163          */
       
   164 	
       
   165 	// Enable the below line if Kodiak Ptt has to be monitered
       
   166         // void PttCallEventOccuredL( TPSCTsyKodiakPtt& aVal);
       
   167 
       
   168 
       
   169     private:    // Data               
       
   170 
       
   171         /**
       
   172          * RMobilePhone handle.It is not owned . So don't close it.
       
   173          */
       
   174         RMobilePhone& iPhone;
       
   175 
       
   176         /**
       
   177          * RMobileLine handle
       
   178          */
       
   179         RMobileLine iLine;
       
   180 
       
   181         /**
       
   182          * Array of Call Monitors.
       
   183          */
       
   184         RPointerArray<CMusCallMonitor> iCallMonitorArray;
       
   185 
       
   186         /**
       
   187          * Conference call monitor, owned.
       
   188          */
       
   189         CMusCallConferenceMonitor* iConferenceMonitor;
       
   190         
       
   191         /**
       
   192          * Instance of RProperty.
       
   193          */
       
   194         RProperty iPropertyEvent;
       
   195         
       
   196         CMusClirMonitor* iClirMonitor;
       
   197         
       
   198 
       
   199         MUS_UNITTEST( UT_CMusTsyPropertyMonitor )
       
   200 
       
   201     };
       
   202 
       
   203 #endif // MUSTSYPROPERTYMONITOR_H