voipplugins/voipadapters/dmgenvoipsettings/inc/NSmlDmGeneralVoIPSettingsAdapter.h
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 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:  Device Management General VoIP settings adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __NSMLDMGENERALVOIPSETTINGSADAPTER_H__
       
    20 #define __NSMLDMGENERALVOIPSETTINGSADAPTER_H__
       
    21 
       
    22 #include <smldmadapter.h>
       
    23 
       
    24 /**
       
    25  *  Cleanup item for deleting contents of RPointerArray.
       
    26  *
       
    27  */
       
    28 template <class T>
       
    29 class CleanupResetAndDestroy
       
    30 	{
       
    31 public:
       
    32 	
       
    33 	inline static void PushL(T& aRef);
       
    34 	
       
    35 private:
       
    36 	
       
    37 	static void ResetAndDestroy(TAny *aPtr);
       
    38 	};
       
    39 	
       
    40 template <class T>
       
    41 inline void CleanupResetAndDestroyL(T& aRef);
       
    42 
       
    43 /**
       
    44  *  Entry point for general VoIP settings.
       
    45  *
       
    46  *  Holds general VoIP settings transiently before they are stored permanently
       
    47  *  in Central Repository.
       
    48  *  @since S60 v3.0
       
    49  */
       
    50 class TGenVoIPEntry
       
    51     {
       
    52 
       
    53     public:
       
    54 
       
    55         /**
       
    56          * Status reference for this command.
       
    57          */
       
    58         TInt iStatusRef;
       
    59 
       
    60         /**
       
    61          * For telling whether general VoIP settings are loaded from
       
    62          * Central Repository.
       
    63          */
       
    64         TInt iAreSettingsLoaded;
       
    65 
       
    66         /**
       
    67          * CLIR, Calling Line Identification Restriction.
       
    68          */
       
    69         TInt iClir;
       
    70 
       
    71         /**
       
    72          * Anonymous Call Block rule. Determines the rule for Anonymous Call
       
    73          * Block feature.
       
    74          */
       
    75         TInt iACBRule;
       
    76 
       
    77         /**
       
    78          * Preferred telephony. Tells which telephony mode is preferred.
       
    79          */
       
    80         TInt iPrefTel;
       
    81 
       
    82         /**
       
    83          * Do Not Disturb (DND) setting.
       
    84          */
       
    85         TInt iDnd;
       
    86 
       
    87         /**
       
    88          * Call waiting. Tells whether call waiting is enabled or disabled.
       
    89          */
       
    90         TInt iPSCallWaiting;
       
    91 
       
    92         /**
       
    93          * Telephony preference lock. Tells whether preferred telephony mode 
       
    94          * is UI editable.
       
    95          */
       
    96         TInt iPrefTelLock;
       
    97 
       
    98         /**
       
    99          * Shut down CS radio in WiFi mode. Tells whether CS radio is turned
       
   100          * off in WiFi mode.
       
   101          */
       
   102         TInt iCsRadioWifiOff;
       
   103         
       
   104         /**
       
   105          * VoIP profile name. If preferred telephony mode is set to VoIP,
       
   106          * the service id of this VoIP profile is set as preferred service id.
       
   107          */
       
   108         TBuf8<64> iVoipProfileId;
       
   109     };
       
   110 
       
   111 /**
       
   112  *  CNSmlDmGeneralVoIPSettingsAdapter.
       
   113  *
       
   114  *  Main implementation of Device Management General VoIP Settings Adapter.
       
   115  *  @lib cnsmldmgeneralvoipsettingsadapter.lib
       
   116  *  @since S60 v3.0
       
   117  */
       
   118 class CNSmlDmGeneralVoIPSettingsAdapter : public CSmlDmAdapter
       
   119     {
       
   120 
       
   121 #ifdef EUNIT_TESTING
       
   122     /**
       
   123      * Friend class for unit testing.
       
   124      */
       
   125     friend class UT_CNSmlDmGeneralVoIPSettingsAdapter;
       
   126 #endif
       
   127 
       
   128     public:
       
   129         
       
   130         static CNSmlDmGeneralVoIPSettingsAdapter* NewL( MSmlDmCallback* aDmCallback );
       
   131 
       
   132         static CNSmlDmGeneralVoIPSettingsAdapter* NewLC( MSmlDmCallback* aDmCallback );
       
   133 
       
   134         virtual ~CNSmlDmGeneralVoIPSettingsAdapter();
       
   135 
       
   136     private:
       
   137 
       
   138         CNSmlDmGeneralVoIPSettingsAdapter( TAny* aEcomArguments );
       
   139 
       
   140         /**
       
   141          * By default Symbian 2nd phase constructor is private.
       
   142          */
       
   143         void ConstructL();
       
   144         
       
   145         /**
       
   146          * Fetches leaf object values
       
   147          *
       
   148          * @since S60 v3.0.
       
   149          * @param aURI URI of the object.
       
   150          * @param aLUID LUID of the object.
       
   151          * @param aObject Data of the object.
       
   152          * @return Status code of operation
       
   153          */       
       
   154         CSmlDmAdapter::TError FetchObjectL( 
       
   155             const TDesC8& aURI, 
       
   156             CBufBase& aObject );
       
   157 
       
   158         /**
       
   159          * Loads general VoIP settings from Central Repository.
       
   160          *
       
   161          * @since S60 v3.0.
       
   162          * @param aEntry General VoIP settings entry.
       
   163          * @return Error code for the operation.
       
   164          */
       
   165         TInt LoadSettingsL();
       
   166 
       
   167         /**
       
   168          * Converts descriptor to int.
       
   169          *
       
   170          * @since S60 v3.0.
       
   171          * @param aDes Descriptor to convert.
       
   172          * @return Converted value.
       
   173          */
       
   174         TInt DesToInt( const TDesC8& aDes );
       
   175 
       
   176         /**
       
   177          * Removes last URI segment from aURI
       
   178          *
       
   179          * @since S60 v3.0.
       
   180          * @param aDes Descriptor to handle.
       
   181          * @return Pointer to URI.
       
   182          */        
       
   183         TPtrC8 RemoveLastURISeg( const TDesC8& aURI );
       
   184 
       
   185         /**
       
   186          * Gets number of URI segments.
       
   187          *
       
   188          * @since S60 v3.0.
       
   189          * @param aURI Descriptor to handle.
       
   190          * @return Number of URI segments.
       
   191          */
       
   192         TInt NumOfURISegs( const TDesC8& aURI );
       
   193 
       
   194         /**
       
   195          * Gets last URI segment.
       
   196          *
       
   197          * @since S60 v3.0.
       
   198          * @param aURI Descriptor to handle.
       
   199          * @return Pointer to beginning of last URI segment.
       
   200          */
       
   201         TPtrC8 LastURISeg( const TDesC8& aURI ) const;
       
   202 
       
   203         /**
       
   204          * Removes ./ from URI
       
   205          *
       
   206          * @since S60 v3.0.
       
   207          * @param aURI Descriptor to handle.
       
   208          * @return Pointer to URI.
       
   209          */
       
   210         TPtrC8 RemoveDotSlash( const TDesC8& aURI );
       
   211 
       
   212         // from base class MSmlDmAdapter
       
   213 
       
   214         /**
       
   215          * From MSmlDmAdapter.
       
   216          *
       
   217          * @since S60 v3.0.
       
   218          * @param aDDFVersion for returning DDF version of adapter.
       
   219          */
       
   220         void DDFVersionL( CBufBase& aDDFVersion );
       
   221 
       
   222         /**
       
   223          * From MSmlDmAdapter.
       
   224          *
       
   225          * @since S60 v3.0.
       
   226          * @param aDDF for returning DDF structure of adapter.
       
   227          */
       
   228         void DDFStructureL( MSmlDmDDFObject& aDDF );
       
   229    
       
   230         /**
       
   231          * From MSmlDmAdapter.
       
   232          *
       
   233          * @since S60 v3.0.
       
   234          * @param aURI URI of the object.
       
   235          * @param aLUID LUID of the object.
       
   236          * @param aObject Data of the object.
       
   237          * @param aType MIME type of the object.
       
   238          * @param aStatusRef Reference to correct command.
       
   239          */                                                     
       
   240         void UpdateLeafObjectL( 
       
   241             const TDesC8& aURI, 
       
   242             const TDesC8& aLUID, 
       
   243             const TDesC8& aObject,
       
   244             const TDesC8& aType, 
       
   245             const TInt aStatusRef );
       
   246     
       
   247         /**
       
   248          * From MSmlDmAdapter.
       
   249          * Not supported.
       
   250          *
       
   251          * @param aURI URI of the object.
       
   252          * @param aLUID LUID of the object.
       
   253          * @param aStream Data of the object.
       
   254          * @param aType MIME type of the object.
       
   255          * @param aStatusRef Reference to correct command.
       
   256          */
       
   257         void UpdateLeafObjectL( 
       
   258             const TDesC8& aURI, 
       
   259             const TDesC8& aLUID, 
       
   260             RWriteStream*& aStream,
       
   261             const TDesC8& aType, 
       
   262             TInt aStatusRef );
       
   263 
       
   264         /**
       
   265          * From MSmlDmAdapter.
       
   266          * Deletes (resets) General VoIP Settings profile.
       
   267          *
       
   268          * @since S60 v3.0.
       
   269          * @param aURI URI of the object.
       
   270          * @param aLUID LUID of the object.
       
   271          * @param aStatusRef Reference to correct command.
       
   272          */        
       
   273         void DeleteObjectL( 
       
   274             const TDesC8& aURI, 
       
   275             const TDesC8& aLUID, 
       
   276             const TInt aStatusRef );
       
   277     
       
   278         /**
       
   279          * From MSmlDmAdapter.
       
   280          * Fetches the values of leaf objects.
       
   281          *
       
   282          * @since S60 v3.0.
       
   283          * @param aURI URI of the object.
       
   284          * @param aLUID LUID of the object.
       
   285          * @param aType MIME type of the object.
       
   286          * @param aResultsRef Reference to correct results.
       
   287          * @param aStatusRef Reference to correct command.
       
   288          */                      
       
   289         void FetchLeafObjectL( 
       
   290             const TDesC8& aURI, 
       
   291             const TDesC8& aLUID, 
       
   292             const TDesC8& aType, 
       
   293             const TInt aResultsRef, 
       
   294             const TInt aStatusRef );
       
   295     
       
   296         /**
       
   297          * From MSmlDmAdapter.
       
   298          * Fetches the size of a leaf object.
       
   299          *
       
   300          * @since S60 v3.0.
       
   301          * @param aURI URI of the object.
       
   302          * @param aLUID LUID of the object.
       
   303          * @param aType MIME type of the object.
       
   304          * @param aResultsRef Reference to correct results.
       
   305          * @param aStatusRef Reference to correct command.
       
   306          */                      
       
   307         void FetchLeafObjectSizeL( 
       
   308             const TDesC8& aURI, 
       
   309             const TDesC8& aLUID, 
       
   310             const TDesC8& aType, 
       
   311             TInt aResultsRef, 
       
   312             TInt aStatusRef );
       
   313 
       
   314         /**
       
   315          * From MSmlDmAdapter.
       
   316          * Asks for the list of child objects of the node.
       
   317          *
       
   318          * @since S60 v3.0.
       
   319          * @param aURI URI from DM module.
       
   320          * @param aLUID LUID of the parent object.
       
   321          * @param aPreviousURISegmentList from DM module.
       
   322          * @param aResultsRef results reference from DM module.
       
   323          * @param aStatusRef Reference to correct command.
       
   324          */
       
   325         void ChildURIListL( 
       
   326             const TDesC8& aURI, 
       
   327             const TDesC8& aLUID, 
       
   328             const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
   329             const TInt aResultsRef, 
       
   330             const TInt aStatusRef );
       
   331     
       
   332         /**
       
   333          * From MSmlDmAdapter.
       
   334          * Not supported (there can only be one general VoIP settings node).
       
   335          *
       
   336          * @since S60 v3.0.
       
   337          * @param aURI URI of the object.
       
   338          * @param aParentLUID LUID of the parent object.
       
   339          * @param aStatusRef Reference to correct command.
       
   340          */        
       
   341         void AddNodeObjectL( 
       
   342             const TDesC8& aURI, 
       
   343             const TDesC8& aParentLUID, 
       
   344             const TInt aStatusRef );
       
   345     
       
   346         /**
       
   347          * From MSmlDmAdapter.
       
   348          * Not supported.
       
   349          *
       
   350          * @since S60 v3.0.
       
   351          * @param aURI URI from DM module.
       
   352          * @param aLUID LUID of the object.
       
   353          * @param aArgument Argument for the command.
       
   354          * @param aType MIME type of the object.
       
   355          * @param aStatusRef Reference to correct command.
       
   356          */
       
   357         void ExecuteCommandL( 
       
   358             const TDesC8& aURI, 
       
   359             const TDesC8& aLUID, 
       
   360             const TDesC8& aArgument, 
       
   361             const TDesC8& aType, 
       
   362             const TInt aStatusRef );
       
   363     
       
   364         /**
       
   365          * From MSmlDmAdapter.
       
   366          * Not supported.
       
   367          *
       
   368          * @since S60 v3.0.
       
   369          * @param aURI URI from DM module.
       
   370          * @param aLUID LUID of the object.
       
   371          * @param aStream Argument for the command.
       
   372          * @param aType MIME type of the object.
       
   373          * @param aStatusRef Reference to correct command.
       
   374          */
       
   375         void ExecuteCommandL( 
       
   376             const TDesC8& aURI, 
       
   377             const TDesC8& aLUID, 
       
   378             RWriteStream*& aStream, 
       
   379             const TDesC8& aType, 
       
   380             const TInt aStatusRef );
       
   381     
       
   382         /**
       
   383          * From MSmlDmAdapter.
       
   384          * Not supported.
       
   385          *
       
   386          * @since S60 v3.0.
       
   387          * @param aTargetURI Target URI for the command.
       
   388          * @param aTargetLUID LUID of the target object.
       
   389          * @param aSourceURI Source URI for the command.
       
   390          * @param aSourceLUID LUID of the source object.
       
   391          * @param aType MIME type of the objects.
       
   392          * @param aStatusRef Reference to correct command.
       
   393          */
       
   394         void CopyCommandL( 
       
   395             const TDesC8& aTargetURI, 
       
   396             const TDesC8& aTargetLUID, 
       
   397             const TDesC8& aSourceURI, 
       
   398             const TDesC8& aSourceLUID, 
       
   399             const TDesC8& aType, 
       
   400             TInt aStatusRef );
       
   401     
       
   402         /**
       
   403          * From MSmlDmAdapter.
       
   404          * Not supported.
       
   405          *
       
   406          * @since S60 v3.0.
       
   407          */     
       
   408         void StartAtomicL();
       
   409 
       
   410         /**
       
   411          * From MSmlDmAdapter.
       
   412          * Not supported.
       
   413          *
       
   414          * @since S60 v3.0.
       
   415          */
       
   416         void CommitAtomicL();
       
   417 
       
   418         /**
       
   419          * From MSmlDmAdapter.
       
   420          * Not supported.
       
   421          *
       
   422          * @since S60 v3.0.
       
   423          */
       
   424         void RollbackAtomicL();
       
   425 
       
   426         /**
       
   427          * From MSmlDmAdapter.
       
   428          * Not supported.
       
   429          *
       
   430          * @since S60 v3.0.
       
   431          * @param aItemSize Size limit for stream usage.
       
   432          * @return Streaming support.
       
   433          */
       
   434         TBool StreamingSupport( TInt& aItemSize );
       
   435 
       
   436         /**
       
   437          * From MSmlDmAdapter.
       
   438          * Not supported.
       
   439          *
       
   440          * @since S60 v3.0.
       
   441          */
       
   442         void StreamCommittedL();
       
   443 
       
   444         /**
       
   445          * From MSmlDmAdapter.
       
   446          * Saves modified profiles back to permanent store.
       
   447          *
       
   448          * @since S60 v3.0.
       
   449          */
       
   450         void CompleteOutstandingCmdsL();
       
   451 
       
   452         /**
       
   453          * Gets VoIP profile id.
       
   454          *
       
   455          * @since S60 v3.2.3.
       
   456          * @param aObject URI of the object to fetch.
       
   457          */
       
   458         TUint32 VoIPProfileIdL( const TDesC8& aObject ) const;
       
   459 
       
   460         /**
       
   461          * Resolves the name of the preferred service and saves it to an
       
   462          * internal variable.
       
   463          *
       
   464          * @since S60 v3.2.3.
       
   465          * @param aRepository Reference to a previously opened repository.
       
   466          */
       
   467         TInt ResolvePreferredServiceNameL( CRepository& aRepository );
       
   468 
       
   469     private: // data
       
   470 
       
   471         /**
       
   472          * For returning data to DM module.
       
   473          */
       
   474         MSmlDmCallback* iDmCallback;
       
   475 
       
   476         /**
       
   477          * Profile ID currently being modified.
       
   478          */
       
   479         TInt iProfileID;
       
   480 
       
   481         /**
       
   482          * For knowing status of DM module.
       
   483          */
       
   484         TInt iStatus;
       
   485 
       
   486         /**
       
   487          * Entry point for general VoIP settings.
       
   488          */
       
   489         TGenVoIPEntry iEntry;
       
   490 
       
   491         /**
       
   492          * For returning results to DM module.
       
   493          */
       
   494         CBufBase* iResults;
       
   495 
       
   496     };
       
   497 
       
   498 #endif // __NSMLDMGENERALVOIPSETTINGSADAPTER_H__