vtengines/videoteleng/Inc/Base/CVtEngSettings.h
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2004-2006 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:  Video call setting data.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CVTENGSETTINGS_H
       
    21 #define CVTENGSETTINGS_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <bautils.h>
       
    26 #include "MVtEngCRSettingObserver.h"
       
    27 #include "CVtEngCRObserverItem.h"
       
    28 #include "CVtEngCRProxy.h"
       
    29 #include "MVtEngAudio.h"
       
    30 #include "MVtEngMedia.h"
       
    31 #include "MVtEngSessionInfo.h"
       
    32 
       
    33 // CONSTANTS
       
    34 // Default routing.
       
    35 const MVtEngAudio::TVtEngRoutingSetting
       
    36     KVtEngDefaultAudioRouting = MVtEngAudio::EActivateHandsfree;
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class MVtEngSettingObserver;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 *  Container for video call settings.
       
    45 *
       
    46 *  @lib videoteleng.lib
       
    47 *  @since Series 60 2.6
       
    48 */
       
    49 NONSHARABLE_CLASS( CVtEngSettings ) : public CBase
       
    50 , public MVtEngCRSettingObserver
       
    51     {
       
    52     public:
       
    53 
       
    54         /**
       
    55         * Settings ids
       
    56         */
       
    57         enum TSettingId
       
    58             {
       
    59             EStillImage,
       
    60             EStillImagePath,
       
    61             ECallTimer,
       
    62             EHandsetVolume,
       
    63             EHandsfreeVolume,
       
    64             EBTAudioAccessory,
       
    65             EIhfMode,
       
    66             ESelectVolume, // select Handset / Handsfree volume
       
    67             EDataportInfo
       
    68             };
       
    69 
       
    70         /**
       
    71         * Audio configuration
       
    72         */
       
    73         struct TVtEngAudioConfig
       
    74             {
       
    75             // Current volume in use, EFalse: handset,
       
    76             // ETrue: loudspeaker.
       
    77             TBool iCurrentVolume;
       
    78             // Speaker volume
       
    79             MVtEngAudio::TVtEngOutputVolume   iVolume;
       
    80             // Audio routing
       
    81             MVtEngAudio::TVtEngRoutingSetting iRouting;
       
    82             };
       
    83 
       
    84         /**
       
    85         * Video configuration
       
    86         */
       
    87         struct TVtEngVideoConfig
       
    88             {
       
    89             // Still image file name
       
    90             TFileName iStillImageFile;
       
    91             // Determines if still image is valid.
       
    92             TBool iImageIsValid;
       
    93             // Determines if video is enabled.
       
    94             TBool iVideoEnabled;
       
    95             };
       
    96 
       
    97         /**
       
    98         * Video quality framerates
       
    99         */
       
   100         struct TVtEngVideoQualityFrameRateConfig
       
   101             {
       
   102             // Frame rate for videoquality settings detail
       
   103             TInt    iDetail;
       
   104 
       
   105             // Frame rate for videoquality settings normal
       
   106             TInt    iNormal;
       
   107 
       
   108             // Frame rate for videoquality settings motion
       
   109             TInt    iMotion;
       
   110             };
       
   111 
       
   112         /**
       
   113         * Media configuration
       
   114         */
       
   115         struct TVtEngVideoCallConfig
       
   116             {
       
   117             // @see TVtEngAudioConfig
       
   118             TVtEngAudioConfig iAudio;
       
   119             // @see TVtEngVideoConfig
       
   120             TVtEngVideoConfig iVideo;
       
   121             // defines if call timer is enabled
       
   122             TBool iCallTimerOn;
       
   123             // Engine has green light to make connect on Protocol.
       
   124             TBool iReadyForConnect;
       
   125 			// Dataport loaning status
       
   126 			TBool iIsDataportLoaned;
       
   127             };
       
   128 
       
   129     public:  // Constructors and destructor
       
   130 
       
   131         /**
       
   132         * Two-phased constructor.
       
   133         * @return instance of CVtEngSettings
       
   134         */
       
   135         static CVtEngSettings* NewL();
       
   136 
       
   137         /**
       
   138         * Destructor.
       
   139         */
       
   140         virtual ~CVtEngSettings();
       
   141 
       
   142     public: // New functions
       
   143 
       
   144         /**
       
   145         * Creates stored data observers.
       
   146         * @param aObserver callback interface
       
   147         * @param aUid UID to monitor
       
   148         * @param aKey ID to monitor
       
   149         * @param aType which data type
       
   150         */
       
   151         void CreateDataObserverL(
       
   152             MVtEngCRSettingObserver* aObserver, TUid aUid, TUint32 aKey,
       
   153             CCenRepNotifyHandler::TCenRepKeyType aType );
       
   154 
       
   155         /**
       
   156         * Returns configuration.
       
   157         * @return settings data
       
   158         */
       
   159         const CVtEngSettings::TVtEngVideoCallConfig& Config() const;
       
   160 
       
   161         /**
       
   162         * Sets current volume.
       
   163         * @param aVolume selected volume,
       
   164         *        EFalse: handset, ETrue: loudspeaker.
       
   165         */
       
   166         void SetCurrentVolume( TBool aVolume );
       
   167 
       
   168         /**
       
   169         * Returns current volume.
       
   170         * @return EFalse: handset, ETrue: loudspeaker.
       
   171         */
       
   172         TBool CurrentVolume() const;
       
   173 
       
   174         /**
       
   175         * Sets audio output volume levels.
       
   176         * @param aHandsetVolume handset volume level.
       
   177         * @param aHandsfreeVolume handsfree volume level.
       
   178         * @param aInternal not stored to shared data but
       
   179         * internal variable to be used when correct state
       
   180         * is entered.
       
   181         * @return Symbian error code
       
   182         */
       
   183         TInt SetVolume(
       
   184             const TInt aHandsetVolume,
       
   185             const TInt aHandsfreeVolume,
       
   186             const TBool aInternal );
       
   187 
       
   188         /**
       
   189         * Gets audio output volume levels from Shared Data.
       
   190         * @param aVolume volume level.
       
   191         * @param aHandsfree if true handsfree volume is read,
       
   192         * otherwise handset.
       
   193         * @param aInternal not read from shared data but
       
   194         * from internal variable
       
   195         * @return error code
       
   196         */
       
   197         TInt GetVolume(
       
   198             TInt& aVolume,
       
   199             const TBool aHandsfree,
       
   200             const TBool aInternal ) const;
       
   201 
       
   202         /**
       
   203         * Gets maximum audio output volume level.
       
   204         * @return max volume for device
       
   205         */
       
   206         inline TInt MaxVolume( ) const;
       
   207 
       
   208 
       
   209         /**
       
   210         * Gets minimum audio output volume level.
       
   211         * @return max volume for device
       
   212         */
       
   213         inline TInt MinVolume( ) const;
       
   214 
       
   215         /**
       
   216         * Checks the validity of the volume level.
       
   217         * return either constant minimum, constant maximum
       
   218         * or the passed value level.
       
   219         * @param aVolume the volume level to check
       
   220         * @return suitable volume level
       
   221         */
       
   222         inline TInt ValidVolume( const TInt aVolume ) const;
       
   223 
       
   224         /**
       
   225         * Sets audio routing setting.
       
   226         * @param aState audio routing state.
       
   227         */
       
   228         void SetRouting( const MVtEngAudio::TVtEngRoutingSetting& aState );
       
   229 
       
   230         /**
       
   231         * Sets output video state setting.
       
   232         * @param aEnabled ETrue if sending is enabled
       
   233         */
       
   234         void SetVideoEnabled( const TBool aEnabled );
       
   235 
       
   236         /**
       
   237         * Sets connected state.
       
   238         */
       
   239         void SetConnectReady();
       
   240 
       
   241         /**
       
   242         * Reads local variations.
       
   243         */
       
   244         void ReadVariationsL();
       
   245 
       
   246         /**
       
   247         * Gets camera orientations for primary and secondary camera.
       
   248         * @see MVtEngMedia::TCameraOrientation
       
   249         * @param aPrimaryCameraOrientation primary camera orientation.
       
   250         * @param aSecondaryCameraOrientation secondary camera orientation.
       
   251         */
       
   252         void GetCameraOrientations(
       
   253             MVtEngMedia::TCameraOrientation& aPrimaryCameraOrientation,
       
   254             MVtEngMedia::TCameraOrientation& aSecondaryCameraOrientation ) const;
       
   255 
       
   256         /**
       
   257         * Checks if given bits is turned on in local variation.
       
   258         * @param aBits bits to check
       
   259         * @return ETrue if turned on
       
   260         */
       
   261         TBool CheckBits( const TInt aBits );
       
   262 
       
   263         /**
       
   264         * Returns video quality frame rate configuration.
       
   265         * @return Reference to video quality frame rate
       
   266         * configuration.
       
   267         */
       
   268         const TVtEngVideoQualityFrameRateConfig&
       
   269             VideoQualityFrameRateConfig() const;
       
   270 
       
   271         /**
       
   272         * Resets settings to default values.
       
   273         */
       
   274         void ResetAll();
       
   275 
       
   276         /**
       
   277         * Registers interest on setting change.
       
   278         * @param aId event to observe for
       
   279         * @param aObserver setting observer
       
   280         */
       
   281         void NotifyChangeL(
       
   282             TSettingId aId,
       
   283             MVtEngSettingObserver& aObserver );
       
   284 
       
   285         /**
       
   286         * Cancels observering setting changes.
       
   287         * @param aId event to cancel
       
   288         * @param aObserver setting observer
       
   289         */
       
   290         void CancelNotifyChange(
       
   291             TSettingId aId,
       
   292             const MVtEngSettingObserver& aObserver );
       
   293 
       
   294 		/**
       
   295         * Informs setting is dataport loaned or not yet. 
       
   296         * @param aLoaned TBool value is loaned (ETrue) or not (EFalse)
       
   297         */
       
   298 		void SetDataportLoaned( TBool aLoaned );
       
   299 		
       
   300 		/**
       
   301         * Checks if still image exists. 
       
   302         * @return ETrue if still image exists.
       
   303         */
       
   304 		TBool IsDefaultStillImageDefined();
       
   305 		
       
   306 		
       
   307 		
       
   308 		/**
       
   309 		* Sets CLI. 
       
   310 		* @since S60 5.0
       
   311 		* @params aCLI call id and address (MSISDN) availability
       
   312 		*/
       
   313 		void SetCLI( const MVtEngSessionInfo::TCLI& aCLI );
       
   314 		
       
   315 		/**
       
   316 		* Returns CLI
       
   317 		* @since S60 5.0
       
   318 		* @param aCLI call id and address (MSISDN) availability
       
   319 		* @return ETrue if CLI is valid (stored in the first place)
       
   320 		*/
       
   321 		TBool GetCLI( MVtEngSessionInfo::TCLI& aCLI ) const;
       
   322 
       
   323         /**
       
   324 		* Sets dataport info
       
   325 		* @since S60 5.0
       
   326 		* @param aPortInfo port name and number as string
       
   327 		*/
       
   328 		void SetDataportInfoL( const TDesC& aPortInfo );
       
   329 		
       
   330 		/**
       
   331 		* Returns dataport info or NULL if not available yet
       
   332 		* @since S60 5.0
       
   333 		* @return dataport info
       
   334 		*/
       
   335 		const TDesC* DataportInfo() const;
       
   336 		
       
   337 	public:  // From MVtEngCRSettingObserver.
       
   338 
       
   339         /**
       
   340         * Callback to notify changed setting.
       
   341         * @param aUid changed Uid
       
   342         * @param aId changed id
       
   343         * @param aNewValue
       
   344         */
       
   345         void HandleNotifyInt( const TUid aUid, const TUint32 aId,
       
   346             TInt aNewValue );
       
   347 
       
   348         /**
       
   349         * Callback to notify changed setting.
       
   350         * @param aUid changed Uid
       
   351         * @param aId changed id
       
   352         * @param aNewValue
       
   353         */
       
   354         void HandleNotifyReal( const TUid aUid, const TUint32 aId,
       
   355             TReal aNewValue );
       
   356 
       
   357         /**
       
   358         * Callback to notify changed setting.
       
   359         * @param aUid changed Uid
       
   360         * @param aId changed id
       
   361         * @param aNewValue
       
   362         */
       
   363         void HandleNotifyString( const TUid aUid, const TUint32 aId,
       
   364             const TDesC16& aNewValue );
       
   365 
       
   366     private: // New functions.
       
   367         struct TObserverItem
       
   368             {
       
   369             // Callback interface.
       
   370             MVtEngSettingObserver* iObserver;
       
   371             // UID of item.
       
   372             TUid                   iUid;
       
   373             // Key of observer.
       
   374             TPtrC                  iKey;
       
   375             // Integer key, used with CR.
       
   376             TInt                   iIntKey;
       
   377             // Settings internal id.
       
   378             TSettingId             iId;
       
   379             };
       
   380 
       
   381         /**
       
   382         * Finds observer item.
       
   383         * @param aUid
       
   384         * @param aKey
       
   385         * @return observer item or NULL
       
   386         */
       
   387         TObserverItem* FindItem( const TUid& aUid, const TDesC& aKey ) const;
       
   388 
       
   389         /**
       
   390         * Finds observer item.
       
   391         * @param aUid
       
   392         * @param aKey
       
   393         * @return observer item or NULL
       
   394         */
       
   395         TObserverItem* FindItem( const TUid& aUid, const TInt& aKey ) const;
       
   396 
       
   397         /**
       
   398         * Returns value as integer.
       
   399         * @param aValue value to convert
       
   400         * @return value as integer
       
   401         */
       
   402         static TInt SettingAsTInt( const TDesC& aValue );
       
   403 
       
   404         /**
       
   405         * Derived class for internal book keeping. Engine knows whether
       
   406         * CLI has been received from call handling
       
   407         */
       
   408         struct TVtEngCLI : public MVtEngSessionInfo::TCLI
       
   409             {
       
   410             // Set to True when CLI received from call handling.
       
   411             TBool iValid;
       
   412             };
       
   413             
       
   414     private:
       
   415 
       
   416         /**
       
   417         * C++ default constructor.
       
   418         */
       
   419         CVtEngSettings();
       
   420 
       
   421         /**
       
   422         * By default Symbian 2nd phase constructor is private.
       
   423         */
       
   424         void ConstructL();
       
   425 
       
   426         /**
       
   427         * Callback function to inform the observer.
       
   428         * @param aAny pointer to instance of this class.
       
   429         * @return KErrNone always.
       
   430         */
       
   431         static TInt DoInformSelectVolumeObserver( TAny* aAny );
       
   432 
       
   433 
       
   434         /**
       
   435         * Parses VQ frame rates read from cenrep.
       
   436         */
       
   437         void ParseFrameRates( TVtEngVideoQualityFrameRateConfig& aVQFR,
       
   438             const TDesC& aBuffer );
       
   439 
       
   440     private:    // Data
       
   441         // Central Repository proxy.
       
   442         CVtEngCRProxy* iCRProxy;
       
   443 
       
   444         // Settings data.
       
   445         TVtEngVideoCallConfig iConfig;
       
   446 
       
   447         // Setting data observers.
       
   448         CArrayFixFlat<TObserverItem>* iObserverItems;
       
   449 
       
   450         // File system handle.
       
   451         RFs iFs;
       
   452 
       
   453         // Owned idle callback instance.
       
   454         CIdle* iSelectVolumeIdle;
       
   455 
       
   456         // Observer for ESelectVolume.
       
   457         MVtEngSettingObserver* iSelectVolumeObserver;
       
   458         
       
   459         // Observer for EDataportInfo
       
   460         MVtEngSettingObserver* iDataportObserver;
       
   461 
       
   462         // Locally variated bits are read to this.
       
   463         TInt iVariantReadOnlyValues;
       
   464 
       
   465         // If local variations are read
       
   466         TBool iVariationsRead;
       
   467 
       
   468         // Video quality frame rate configuration holder
       
   469         TVtEngVideoQualityFrameRateConfig iVQFRConfig;
       
   470         
       
   471         // If default still image is defined
       
   472         TBool iDefaultStillImageDefined;
       
   473         
       
   474         // CLI information of video call. 
       
   475         TVtEngCLI iCLI;
       
   476         
       
   477         HBufC* iDataportInfo;
       
   478     };
       
   479 
       
   480 #include    "CVtEngSettings.inl"
       
   481 
       
   482 #endif      // CVTENGSETTINGS_H
       
   483 
       
   484 // End of File