mmsharing/mmshui/inc/musuieventcontroller.h
branchRCL_3
changeset 33 bc78a40cd63c
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
       
     1 /*
       
     2 * Copyright (c) 2005 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MUSUIEVENTCONTROLLER_H
       
    20 #define MUSUIEVENTCONTROLLER_H
       
    21 
       
    22 #include "musuipropertyobserver.h"
       
    23 #include "musuicallbackobserver.h"
       
    24 #include "musuibitmapdecoderobserver.h"
       
    25 #include "musresourceproperties.h"
       
    26 #include "musuidefinitions.h"
       
    27 #include "musmanagercommon.h"
       
    28 #include "musuimmcobserver.h"
       
    29 #include "musunittesting.h"
       
    30 
       
    31 #include "musengsessionobserver.h"
       
    32 #include "musengaudioroutingobserver.h"
       
    33 #include "musengvolumechangeobserver.h"
       
    34 
       
    35 #include <aknappui.h>        // CAknAppUiBase::TAppUiOrientation
       
    36 
       
    37 class CMusUiCallbackService;
       
    38 class MMusUiEventObserver;
       
    39 class CMusUiMmcMonitor;
       
    40 class CMusUiPropertyWatch;
       
    41 class CMusUiBitmapDecoder;
       
    42 class CFbsBitmap;
       
    43 class CMusEngMceSession;
       
    44 class MMusUiSharingObserver;
       
    45 class CMusUiActivityManager;
       
    46 class CMusUiResourceHandler;
       
    47 
       
    48 using namespace MultimediaSharing;
       
    49 
       
    50 
       
    51 /**
       
    52  *
       
    53  *
       
    54  * @lib musui.exe
       
    55  */
       
    56 class CMusUiEventController : public CBase, 
       
    57                               public MMusUiPropertyObserver, 
       
    58                               public MMusUiCallbackObserver,
       
    59                               public MMusUiMmcObserver,
       
    60                               public MMusEngSessionObserver,
       
    61                               public MMusEngAudioRoutingObserver,
       
    62                               public MMusEngVolumeChangeObserver
       
    63     {
       
    64 
       
    65 public: // enumerations
       
    66 
       
    67     enum TMusUiShutdownState
       
    68             {
       
    69             EMusUiShutdownNotDefined,
       
    70             EMusUiShutdownStarted,
       
    71             EMusUiShutdownVideoSaved,
       
    72             EMusUiShutdownContactSavingQueried,
       
    73             EMusUiShutdownOver
       
    74             };    
       
    75 
       
    76 
       
    77 public:
       
    78 
       
    79     /**
       
    80     * 
       
    81     */
       
    82 	virtual ~CMusUiEventController();
       
    83 
       
    84 	
       
    85 protected:
       
    86 
       
    87     /**
       
    88     * 
       
    89     */
       
    90 	void ConstructL();
       
    91 	
       
    92     /**
       
    93     * 
       
    94     */
       
    95 	CMusUiEventController( MMusUiEventObserver& aEventObserver,
       
    96 	                       MMusUiSharingObserver& aSharingObserver );
       
    97 
       
    98 
       
    99 public:	// From MMusUiPropertyObserver
       
   100 
       
   101     /**
       
   102     * Sets the property key value common to all sharing types.
       
   103     * To be overridden for specific key values.
       
   104     * CMusUiPropertyWatch calls MMusUiPropertyObserver::PropertyChanged,
       
   105     * when P&S key values change
       
   106     *
       
   107     * @param TUint aKey - The Property key
       
   108     * @param TInt aValue - The value of the Property key
       
   109     */
       
   110     virtual	void PropertyChanged( const TUint aKey, const TInt aValue );
       
   111 	
       
   112     /**
       
   113     * 
       
   114     */
       
   115 	virtual void HandlePropertyError( const TInt aReason );
       
   116 
       
   117 
       
   118 public:	// From MMusUiCallbackObserver
       
   119 
       
   120     /**
       
   121     * Handles async events common to all session types.
       
   122     * Should be called if child classes are not able to handle the call.
       
   123     */
       
   124     virtual void HandleAsyncEventL( TMusUiAsyncEvent aEventId );
       
   125 
       
   126     /**
       
   127     * Error handler for HandleAsyncEventL.
       
   128     */
       
   129     virtual TInt HandleAsyncError( TInt aError );
       
   130 
       
   131 
       
   132 public:	// From MMusUiMmcObserver
       
   133 
       
   134     /**
       
   135     * 
       
   136     */
       
   137     virtual void MmcRemoved();
       
   138 
       
   139 
       
   140 public: // From 
       
   141 
       
   142     /**
       
   143     * Handles session establishment procedures common to all session types.
       
   144     */
       
   145     virtual void SessionEstablished();
       
   146     
       
   147 
       
   148 public: // From MMusEngAudioRoutingObserver
       
   149     
       
   150     /**
       
   151     * Indicates that some other application has changed audio routing.
       
   152     *
       
   153     */
       
   154     virtual void AudioRoutingChanged( TBool aShowNote );
       
   155     
       
   156     /**
       
   157     * Before doing audio routing, permission is asked
       
   158     *
       
   159     */
       
   160     virtual TBool AudioRouteChangeAllowed() const;
       
   161     
       
   162 public: // From MMusEngVolumeChangeObserver
       
   163     
       
   164     /**
       
   165     * Indicates that some other application has changed volume level.
       
   166     *
       
   167     */
       
   168     virtual void VolumeChanged( TInt aVolume, TBool aAudioRouteChanged );
       
   169     
       
   170 
       
   171 public:	// New functions
       
   172 	
       
   173 	/**
       
   174     * 
       
   175     */
       
   176 	void SetRect( const TRect& aRect );
       
   177 
       
   178     /**
       
   179     * 
       
   180     */
       
   181     const TDesC& MusContactName();
       
   182     
       
   183     /**
       
   184     * 
       
   185     */
       
   186 	const TDesC& MusVideoCodecValue();
       
   187 
       
   188     /**
       
   189     * 
       
   190     */
       
   191 	const TDesC& MusTelNumberValue();
       
   192     
       
   193     /**
       
   194     * 
       
   195     */
       
   196     const TDesC& SessionTimeFormatted( const TTimeIntervalSeconds& aSeconds );
       
   197     
       
   198     /**
       
   199     * 
       
   200     */
       
   201     void SaveContactQueryL();
       
   202     
       
   203     /**
       
   204     * 
       
   205     */
       
   206     void HandleError( const TInt aError );
       
   207 
       
   208     /**
       
   209     * Starts shutdown process
       
   210     */
       
   211     void HandleExitL( TBool aTerminateCall = EFalse );
       
   212 
       
   213     /**
       
   214     * 
       
   215     */
       
   216     void AsyncQueryDialogAcceptedL( TBool aAccepted );
       
   217     
       
   218     /**
       
   219     * 
       
   220     */
       
   221     TBool ExitOccured();
       
   222     
       
   223     /**
       
   224     *
       
   225     */
       
   226     TBool AudioRoutingCanBeChanged();
       
   227     
       
   228     /**
       
   229     * 
       
   230     */
       
   231     TBool IsLoudSpeakerEnabled();
       
   232     
       
   233     /**
       
   234     * 
       
   235     */
       
   236     TBool DeviceHasDedicatedVolumeKeys();
       
   237     
       
   238     /**
       
   239     * Queries flag for session state
       
   240     */
       
   241     TBool ConnectionEstablished() const;
       
   242     
       
   243     /**
       
   244     * Set session initialization state
       
   245     */
       
   246     void SetConnectionInitialized( TBool aConnectionInitialized );
       
   247     
       
   248     /**
       
   249     * Queries flag for session state
       
   250     */
       
   251     TBool ConnectionInitialized() const;
       
   252     
       
   253     /**
       
   254     * 
       
   255     */
       
   256     void EnableDisplayL( TBool aEnable );
       
   257     
       
   258     /**
       
   259     * 
       
   260     */
       
   261     void ChangeOrientationL( CAknAppUiBase::TAppUiOrientation aOrientation );
       
   262     
       
   263     /**
       
   264     * 
       
   265     */
       
   266     TBool ToolbarVolumeSelected();
       
   267     
       
   268     /**
       
   269     *
       
   270     */ 
       
   271     TBool IsMicMutedL();
       
   272     
       
   273     /**
       
   274     * Function to be overridden in sibling classes
       
   275     * @return EFalse by default
       
   276     */
       
   277     virtual TBool ManualAddressTyped() const;
       
   278     
       
   279     /**
       
   280     * 
       
   281     */
       
   282     virtual void HandleForegroundEventL( TBool aForeground );
       
   283     
       
   284     /**
       
   285     * 
       
   286     */
       
   287     virtual TBool IsForeground() const;
       
   288     
       
   289     /**
       
   290     * 
       
   291     */
       
   292     virtual void OfferToolbarEventL( TInt aCommand );
       
   293     
       
   294     /**
       
   295     * 
       
   296     */
       
   297     virtual void HandleCommandL( TInt aCommand );
       
   298 
       
   299     /**
       
   300     * Returns a pointer to engine side session.
       
   301     */
       
   302     virtual CMusEngMceSession* EngineSession() = 0;
       
   303     
       
   304     /**
       
   305     * 
       
   306     */
       
   307     virtual const TDesC& TypedAddress() const = 0;
       
   308     
       
   309     /**
       
   310     * 
       
   311     */
       
   312     virtual void DeleteEngineSession() = 0;
       
   313       
       
   314     /**
       
   315     * 
       
   316     */
       
   317     TBool IsDisplayEnabledL();
       
   318     
       
   319     /**
       
   320      * 
       
   321      */
       
   322     TBool IsAudioRoutingLoudSpeaker();
       
   323 
       
   324 protected:    // New functions
       
   325 
       
   326     /**
       
   327     * General functionality of exit procedure
       
   328     */
       
   329     virtual void ExitProcedureL( TBool aUserAcceptance );
       
   330     
       
   331     /**
       
   332     * Handles status changes common to all sharing types.
       
   333     * To be overridden in sibling classes for sharing type specific 
       
   334     * status changes.
       
   335     */
       
   336     virtual void HandleChangedStatusL( TMusAvailabilityStatus aStatus );    
       
   337     
       
   338     
       
   339 protected:
       
   340         
       
   341     /**
       
   342     * 
       
   343     */
       
   344 	MMusUiEventObserver& iEventObserver;
       
   345 	
       
   346     /**
       
   347     *
       
   348     */
       
   349     MMusUiSharingObserver& iSharingObserver;
       
   350     
       
   351     /**
       
   352     * 
       
   353     */
       
   354 	CMusUiCallbackService* iCallbackService;
       
   355 
       
   356     /**
       
   357     * Flag of the connection state
       
   358     */
       
   359 	TBool iConnectionEstablished;
       
   360 	
       
   361 	/**
       
   362     * Flag of the connection state
       
   363     */
       
   364 	TBool iConnectionInitialized;
       
   365 
       
   366     /**
       
   367     * 
       
   368     */
       
   369 	TFileName iVideoFilePath;
       
   370 	
       
   371     /**
       
   372     * 
       
   373     */
       
   374 	TFileName iLocalizedVideoFilePath;
       
   375 	
       
   376     /**
       
   377     * 
       
   378     */
       
   379 	TFileName iVideoFileNamePlain;
       
   380 	
       
   381 	/**
       
   382     * 
       
   383     */
       
   384 	TInt iSipProfileId;
       
   385 	
       
   386 	/**
       
   387     * 
       
   388     */
       
   389 	TInt iContactId;
       
   390 	
       
   391 	/**
       
   392     * 
       
   393     */
       
   394 	HBufC* iContactName;
       
   395 
       
   396     /**
       
   397     * 
       
   398     */
       
   399 	HBufC* iTelNumber;
       
   400 	
       
   401     /**
       
   402     * 
       
   403     */
       
   404 	HBufC* iDialogPrompt;
       
   405     
       
   406     /**
       
   407     * 
       
   408     */
       
   409 	HBufC* iVideoCodec;
       
   410 	
       
   411     /**
       
   412     * 
       
   413     */
       
   414     TBool iForeground;
       
   415 
       
   416     /**
       
   417     * ETrue if operator specific functionality is needed 
       
   418     */
       
   419     TBool iOperatorSpecificFunctionality;
       
   420     
       
   421     /**
       
   422     *
       
   423     */
       
   424     CMusUiResourceHandler* iResourceHandler;
       
   425     
       
   426 	/**
       
   427     * 
       
   428     */
       
   429     TMusUiShutdownState iShutdownState;
       
   430     
       
   431     /**
       
   432 	* Flag indicating whether show "loudspeaker deactived"
       
   433 	*/
       
   434     TBool iShowDialog;
       
   435     
       
   436    
       
   437 private:
       
   438 	
       
   439     /**
       
   440     * 
       
   441     */
       
   442 	CMusUiMmcMonitor* iMmcMonitor;
       
   443 	
       
   444 	/**
       
   445     * 
       
   446     */
       
   447     CMusUiActivityManager* iActivityManager;
       
   448 
       
   449     /**
       
   450     * 
       
   451     */
       
   452     CMusUiPropertyWatch* iStatusPropertyWatch; 
       
   453     
       
   454     /**
       
   455     * 
       
   456     */  
       
   457     CMusUiPropertyWatch* iMicMuteStatusPropertyWatch;
       
   458 
       
   459     /**
       
   460     * 
       
   461     */
       
   462     TBuf<7> iTimeBuffer;
       
   463     
       
   464     /**
       
   465      * Flag of the Volume item in the Toolbar
       
   466      */
       
   467     TBool iToolbarVolumeSelected;
       
   468     
       
   469     /**
       
   470     * Flag indicating whether call has ended
       
   471     */
       
   472     TBool iActiveCall;
       
   473     
       
   474     MUS_UNITTEST( UT_CMusUiEventController )
       
   475     MUS_UNITTEST( UT_CMusUiLiveSharingController )
       
   476     MUS_UNITTEST( UT_CMusUiClipSharingController )
       
   477     MUS_UNITTEST( UT_CMusUiReceiveController )
       
   478     };
       
   479 
       
   480 #endif // MUSUIEVENTCONTROLLER_H
       
   481 
       
   482 // end of file