voipplugins/voipadapters/dmvoipadapter/inc/nsmldmvoipadapter.h
changeset 0 a4daefaec16c
child 10 ed1e38b404e5
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2002-2008 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 VoIP Settings Adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __NSMLDMVOIPADAPTER_H__
       
    20 #define __NSMLDMVOIPADAPTER_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <smldmadapter.h>
       
    25 
       
    26 // CONSTANTS
       
    27 const TUint KMaxTerminalTypeLength = 64;
       
    28 const TUint KWlanMacAddressLength  = 50;
       
    29 const TUint KPhoneModelLength      = 20;
       
    30 const TInt KMaxUriLength           = 64;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 class CRCSEProfileRegistry;
       
    34 class CRCSEProfileEntry;
       
    35 class CRCSEAudioCodecRegistry;
       
    36 class CRCSEAudioCodecEntry;
       
    37 class MSIPProfileRegistryObserver;
       
    38 class CSIPProfileRegistryObserver;
       
    39 class CSIPManagedProfileRegistry;
       
    40 class CSIPManagedProfile;
       
    41 class CCoeEnv;
       
    42 class CDMVoIPSPSettings;
       
    43 
       
    44 /**
       
    45  *  CNSmlDmVoIPAdapter
       
    46  *  ?other_description_lines
       
    47  *
       
    48  *  @lib ?library
       
    49  *  @since Series 60_3.0
       
    50  */
       
    51 class CNSmlDmVoIPAdapter : public CSmlDmAdapter
       
    52     {
       
    53     #ifdef _DEBUG
       
    54     /**
       
    55      * Friend class for unit testing.
       
    56      */
       
    57     friend class UT_CNSmlDmVoIPAdapter;
       
    58     #endif
       
    59 
       
    60     public:
       
    61 
       
    62         static CNSmlDmVoIPAdapter* NewL( MSmlDmCallback* aDmCallback );
       
    63 
       
    64         virtual ~CNSmlDmVoIPAdapter();
       
    65 
       
    66     /**  For setting telephony preference */
       
    67 	enum TTelephonyPreference
       
    68 			{
       
    69             ECSPreferred,
       
    70             EPSPreferred
       
    71 			};
       
    72 
       
    73     private:
       
    74 
       
    75 // From base class NSmlDmAdapter
       
    76 
       
    77         /**
       
    78          * From CNsmlDmAdapter
       
    79          * @since Series 60_3.0
       
    80          * @param aVersion for returning DDF version of adapter
       
    81          */
       
    82         void DDFVersionL( CBufBase& aDDFVersion );
       
    83 
       
    84         /**
       
    85          * From CNsmlDmAdapter
       
    86          * @since Series 60_3.0
       
    87          * @param aDDF for returning DDF structure of adapter
       
    88          */
       
    89         void DDFStructureL( MSmlDmDDFObject& aDDF );
       
    90 
       
    91         /**
       
    92          * From CNsmlDmAdapter
       
    93          * @since Series 60_3.0
       
    94          * @param aURI URI from dm-module
       
    95          * @param aParentLUID luid mapping from dm-module
       
    96          * @param aType object type from dm-module
       
    97          * @param aStatusRef status from dm-module
       
    98          */                            
       
    99         void UpdateLeafObjectL( 
       
   100             const TDesC8& aURI, 
       
   101             const TDesC8& aLUID, 
       
   102             const TDesC8& aObject,
       
   103             const TDesC8& /*aType*/, 
       
   104             const TInt aStatusRef );
       
   105 
       
   106         /**
       
   107          * From CNsmlDmAdapter
       
   108          * @since Series 60_3.0
       
   109          * @param aURI URI from dm-module
       
   110          * @param aParentLUID luid mapping from dm-module
       
   111          * @param aType object type from dm-module
       
   112          * @param aStatusRef status from dm-module
       
   113          */                            
       
   114         void UpdateLeafObjectL( 
       
   115             const TDesC8& /*aURI*/, 
       
   116             const TDesC8& /*aLUID*/, 
       
   117             RWriteStream*& /*aStream*/,
       
   118             const TDesC8& /*aType*/, 
       
   119             TInt aStatusRef );
       
   120 
       
   121         /**
       
   122          * From CNsmlDmAdapter
       
   123          * @since Series 60_3.0
       
   124          * @param aURI URI from dm-module
       
   125          * @param aLUID luid mapping from dm-module
       
   126          * @param aStatusRef status from dm-module
       
   127          */        
       
   128         void DeleteObjectL( 
       
   129             const TDesC8& aURI, 
       
   130             const TDesC8& aLUID, 
       
   131             const TInt aStatusRef );
       
   132 
       
   133         /**
       
   134          * From CNsmlDmAdapter
       
   135          * @since Series 60_3.0
       
   136          * @param aURI URI from dm-module
       
   137          * @param aLUID luid mapping from dm-module
       
   138          * @param aType object type from dm-module
       
   139          * @param aResultsRef results reference from dm-module
       
   140          * @param aStatusRef status reference from dm-module
       
   141          */        
       
   142         void FetchLeafObjectL( 
       
   143             const TDesC8& aURI, 
       
   144             const TDesC8& aLUID, 
       
   145             const TDesC8& aType, 
       
   146             const TInt aResultsRef, 
       
   147             const TInt aStatusRef );
       
   148 
       
   149         /**
       
   150          * From CNsmlDmAdapter
       
   151          * @since Series 60_3.0
       
   152          * @param aURI URI from dm-module
       
   153          * @param aLUID luid mapping from dm-module
       
   154          * @param CArrayFix previousURISegmentList from dm-module
       
   155          * @param aResultsRef results reference from dm-module
       
   156          * @param aStatusRef status reference from dm-module
       
   157          */
       
   158         void ChildURIListL( 
       
   159             const TDesC8& aURI, 
       
   160             const TDesC8& aLUID, 
       
   161             const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
   162             const TInt aResultsRef, 
       
   163             const TInt aStatusRef );
       
   164 
       
   165         /**
       
   166          * From CNsmlDmAdapter
       
   167          * @since Series 60_3.0
       
   168          * @param aURI URI from dm-module
       
   169          * @param aParentLUID luid mapping from dm-module
       
   170          * @param aStatusRef status from dm-module
       
   171          */        
       
   172         void AddNodeObjectL( 
       
   173             const TDesC8& aURI, 
       
   174             const TDesC8& aParentLUID, 
       
   175             const TInt aStatusRef );
       
   176 
       
   177         /**
       
   178          * From CNsmlDmAdapter
       
   179          * @since Series 60_3.0
       
   180          * @param ?arg1 ?description
       
   181          * 
       
   182          */
       
   183         void ExecuteCommandL( 
       
   184             const TDesC8& aURI, 
       
   185             const TDesC8& aLUID, 
       
   186             const TDesC8& aArgument, 
       
   187             const TDesC8& aType, 
       
   188             const TInt aStatusRef );
       
   189 
       
   190         /**
       
   191          * From CNsmlDmAdapter
       
   192          * @since Series 60_3.0
       
   193          * @param ?arg1 ?description
       
   194          * 
       
   195          */
       
   196         void ExecuteCommandL( 
       
   197             const TDesC8& aURI, 
       
   198             const TDesC8& aLUID, 
       
   199             RWriteStream*& aStream, 
       
   200             const TDesC8& aType, 
       
   201             const TInt aStatusRef );
       
   202 
       
   203         /**
       
   204          * From CNsmlDmAdapter
       
   205          * @since Series 60_3.0
       
   206          * @param ?arg1 ?description
       
   207          * 
       
   208          */   
       
   209         void CopyCommandL( 
       
   210             const TDesC8& aTargetURI, 
       
   211             const TDesC8& aTargetLUID, 
       
   212             const TDesC8& aSourceURI, 
       
   213             const TDesC8& aSourceLUID, 
       
   214             const TDesC8& aType, 
       
   215             TInt aStatusRef );
       
   216 
       
   217         /**
       
   218          * From CNsmlDmAdapter
       
   219          * @since Series 60_3.0
       
   220          * @param ?arg1 ?description
       
   221          * 
       
   222          */
       
   223         void FetchLeafObjectSizeL( const TDesC8& aURI, 
       
   224             const TDesC8& aLUID, 
       
   225             const TDesC8& aType, 
       
   226             TInt aResultsRef, 
       
   227             TInt aStatusRef );
       
   228 
       
   229         /**
       
   230          * From CNsmlDmAdapter
       
   231          * @since Series 60_3.0
       
   232          * @param ?arg1 ?description
       
   233          * 
       
   234          */
       
   235         void StartAtomicL();
       
   236 
       
   237         /**
       
   238          * From CNsmlDmAdapter
       
   239          * @since Series 60_3.0
       
   240          * @param ?arg1 ?description
       
   241          * 
       
   242          */
       
   243         void CommitAtomicL();
       
   244 
       
   245         /**
       
   246          * From CNsmlDmAdapter
       
   247          * @since Series 60_3.0
       
   248          * @param ?arg1 ?description
       
   249          * 
       
   250          */
       
   251         void RollbackAtomicL();
       
   252 
       
   253         /**
       
   254          * From CNsmlDmAdapter
       
   255          * @since Series 60_3.0
       
   256          * @param ?arg1 ?description
       
   257          * 
       
   258          */
       
   259         TBool StreamingSupport( TInt& aItemSize );
       
   260 
       
   261         /**
       
   262          * From CNsmlDmAdapter
       
   263          * @since Series 60_3.0
       
   264          * @param ?arg1 ?description
       
   265          * 
       
   266          */
       
   267         void StreamCommittedL();
       
   268 
       
   269         /**
       
   270          * From CNsmlDmAdapter
       
   271          * @since Series 60_3.0
       
   272          * @param ?arg1 ?description
       
   273          * 
       
   274          */
       
   275         void CompleteOutstandingCmdsL();
       
   276 
       
   277     private: 
       
   278 
       
   279         CNSmlDmVoIPAdapter( TAny* aEcomArguments );
       
   280 
       
   281         void ConstructL();
       
   282 
       
   283         /**
       
   284          * Fetches object based on URI and LUID.
       
   285          * @since Series 60_3.0
       
   286          * @param aURI URI of the object.
       
   287          * @param aLUID LUID of the object.
       
   288          * @param aObject The object.
       
   289          * @return DM error status.
       
   290          */
       
   291         CSmlDmAdapter::TError FetchObjectL( 
       
   292             const TDesC8& aURI,
       
   293             const TDesC8& aLUID, 
       
   294             CBufBase& aObject );
       
   295 
       
   296         /**
       
   297          * Loads SIP profile information
       
   298          * @since Series 60_3.0
       
   299          */        
       
   300         void LoadProfilesL();
       
   301 
       
   302         /**
       
   303          * Converts 8 bit descriptor to integer.
       
   304          * @since Series 60_3.0
       
   305          * @param aDes Descriptor to convert
       
   306          * @return integer
       
   307          */        
       
   308         TInt DesToInt( const TDesC8& aDes ) const;
       
   309 
       
   310         /**
       
   311          * Converts descriptor to unsigned integer
       
   312          * @since Series 60_3.0
       
   313          * @param aDes Descriptor to convert
       
   314          * @return unsigned integer
       
   315          */        
       
   316         TUint DesToTUint( const TDesC8& aDes ) const;
       
   317 
       
   318         /**
       
   319          * Removes last uri segment from aURI
       
   320          * @since Series 60_3.0
       
   321          * @param aDes Descriptor to handle
       
   322          * @return pointer to uri
       
   323          */        
       
   324         const TPtrC8 RemoveLastURISeg( const TDesC8& aURI ) const;
       
   325 
       
   326         /**
       
   327          * Gets number of uri segments.
       
   328          * @since Series 60_3.0
       
   329          * @param aURI Descriptor to handle
       
   330          * @return pointer to uri
       
   331          */
       
   332         TInt NumOfURISegs( const TDesC8& aURI ) const;
       
   333 
       
   334         /**
       
   335          * Gets last uri segment.
       
   336          * @since Series 60_3.0
       
   337          * @param aURI Descriptor to handle
       
   338          * @return integer
       
   339          */
       
   340         const TPtrC8 LastURISeg( const TDesC8& aURI ) const;
       
   341 
       
   342         /**
       
   343          * Removes ./ from uri
       
   344          * @since Series 60_3.0
       
   345          * @param aURI Descriptor to handle
       
   346          * @return pointer to uri
       
   347          */
       
   348         const TPtrC8 RemoveDotSlash( const TDesC8& aURI ) const;
       
   349 
       
   350         /**
       
   351          * Get Sip URI reference from SIP adapter
       
   352          * @since Series 60_3.0
       
   353          * @param aObject Object to insert found URI.
       
   354          * @param aID SIP profile ID to get URI
       
   355          * @return errorcode to tell wether operation was successful
       
   356          */        
       
   357         MSmlDmAdapter::TError GetSipIdL( CBufBase& aObject, 
       
   358             TUint32 aID ) const;
       
   359 
       
   360         /**
       
   361          * Set SipRef value according to aObject
       
   362          * Converts aObject to TUint 
       
   363          * @since Series 60_3.0
       
   364          * @param aObject SIP reference to change
       
   365          * @return SIP profile ID as TUint
       
   366          */
       
   367         TUint32 SetSipRefL( const TDesC8& aObject ) const;
       
   368 
       
   369         /**
       
   370          * Get Sccp URI reference from SIP adapter
       
   371          * @since Series 60_3.0
       
   372          * @param aObject Object to insert found URI.
       
   373          * @param aID SIP profile ID to get URI
       
   374          * @return errorcode to tell wether operation was successful
       
   375          */        
       
   376         MSmlDmAdapter::TError GetSccpIdL( CBufBase& aObject, 
       
   377             TUint32 aID ) const;
       
   378 
       
   379         /**
       
   380          * Set SccpRef value according to aObject
       
   381          * Converts aObject to TUint 
       
   382          * @since Series 60_3.0
       
   383          * @param aObject SIP reference to change
       
   384          * @return SIP profile ID as TUint
       
   385           */
       
   386         TUint SetSccpRefL( const TDesC8& aObject ) const;
       
   387 
       
   388         /**
       
   389          * Check for duplicate settingsName and rename if same
       
   390          * @since Series 60_3.0
       
   391          * @param aProfile Profile to check.
       
   392          */
       
   393         TBool CheckDuplicateNameL( CRCSEProfileEntry& aEntry );
       
   394 
       
   395         /**
       
   396          * Check for duplicate providerName and rename if same
       
   397          * @since Series 60_3.0
       
   398          * @param aProfile Profile to check.
       
   399          */
       
   400         TBool CheckDuplicateProviderL( CRCSEProfileEntry& aEntry );
       
   401 
       
   402         /**
       
   403          * Finds profile location in profile array.
       
   404          * @since Series 60_3.0
       
   405          * @param aURI Descriptor to look for
       
   406          * @return Profile location TInt
       
   407          */
       
   408         TInt FindProfileLocation( const TDesC8& aURI ) const;
       
   409 
       
   410         /**
       
   411          * Finds codec location in codec array.
       
   412          * @since Series 60_3.0
       
   413          * @param aID CodecId
       
   414          * @return Profile location TInt
       
   415          */
       
   416         TInt FindCodecLocation( TUint32 aID ) const;
       
   417 
       
   418 	    /**
       
   419 	     * Sets CS/PS telephony preference
       
   420 	     * @since Series 60_3.0
       
   421 	     * @param aTelephonyPreference state to set
       
   422 	     */
       
   423 	    void SetTelephonyPreferenceL( const TTelephonyPreference& 
       
   424 	        aTelephonyPreference );
       
   425 
       
   426         /**
       
   427          * Get Terminal Type for SIP User Agent Header.
       
   428          * @since S60 v3.0
       
   429          * @param aTeminalType Terminal type.
       
   430          */
       
   431         void GetTerminalTypeL( TBuf<KMaxTerminalTypeLength>& aTerminalType ) 
       
   432             const;
       
   433 
       
   434         /**
       
   435          * Get WLAN MAC address for SIP User Agent Header.
       
   436          * @since S60 v3.0
       
   437          * @param aMac WLAN MAC address.
       
   438          */
       
   439         void GetWlanMacAddressL( TBuf<KWlanMacAddressLength>& aMac ) const;
       
   440 
       
   441         /**
       
   442          * Get NAT/FW Domain specific URI according to given profile ID.
       
   443          * @since S60 3.2
       
   444          * @param aObject URI to be set.
       
   445          * @param aProfileId Profile ID from which the URI is to be found.
       
   446          * @return DM error status.
       
   447          */
       
   448         MSmlDmAdapter::TError GetNatFwUriL( TBuf16<KMaxUriLength>& aObject, 
       
   449             TInt aProfileId ) const;
       
   450 
       
   451         /**
       
   452          * Get NAT/FW Domain specific ID according to given URI.
       
   453          * @since S60 3.2
       
   454          * @param aObject URI with which to resolve the ID.
       
   455          * @return NAT/FW Domain specific ID.
       
   456          */
       
   457         TUint32 NatFwIdL( const TDesC8& aObject ) const;
       
   458 
       
   459         /**
       
   460          * Get Access Point ID (connection reference) according to aObject.
       
   461          * @since S60 3.2
       
   462          * @param aObject URI to look from AP adapter.
       
   463          * @return Access point ID number.
       
   464          */    
       
   465         TInt ConRefL( const TDesC8& aObject ) const;
       
   466 
       
   467         /**
       
   468          * Get Access Point URI reference from AP adapter.
       
   469          * @since S60 3.2
       
   470          * @param aObject Object into which to insert found URI.
       
   471          * @param aIapID IAP ID to look for.
       
   472          * @return DM error status.
       
   473          */
       
   474         MSmlDmAdapter::TError GetConRefL( CBufBase& aObject, 
       
   475             TInt aIapId ) const;
       
   476 
       
   477         /**
       
   478          * Get Presence profile URI according to given profile ID.
       
   479          * @since S60 3.2
       
   480          * @param aObject URI to be set.
       
   481          * @param aProfileId Profile ID from which the URI is to be found.
       
   482          * @return DM error status.
       
   483          */
       
   484         MSmlDmAdapter::TError GetPresenceUriL( TBuf16<KMaxUriLength>& aObject,
       
   485             TUint32 aProfileId ) const;
       
   486 
       
   487         /**
       
   488          * Get Presence profile ID according to given URI.
       
   489          * @since S60 3.2
       
   490          * @param aObject URI with which to resolve the ID.
       
   491          * @return Presence profile ID.
       
   492          */
       
   493         TUint32 PresenceIdL( const TDesC8& aObject ) const;
       
   494 
       
   495         /**
       
   496          * Get SNAP ID.
       
   497          * @since S60 3.2.
       
   498          * @param aUri URI from which to find SNAP ID.
       
   499          * @return SNAP ID.
       
   500          */
       
   501         TInt SnapIdL( const TDesC8& aUri );
       
   502 
       
   503         /**
       
   504          * Set SNAP URI.
       
   505          * @since S60 3.2.
       
   506          * @param aObject Object in which found URI is set.
       
   507          * @param aSnapId SNAP ID from which to find URI.
       
   508          * @return ETrue if successful, EFalse if not.
       
   509          */
       
   510         MSmlDmAdapter::TError GetSnapUriL( TDes8& aObject, TInt aSnapId );
       
   511 
       
   512         /**
       
   513          * Updates Codec specific object.
       
   514          * @since S60 3.2
       
   515          * @param aLUID luid mapping from dm-module
       
   516          * @param aUriSeg Last URI segment.
       
   517          * @param aObject Data of the object.
       
   518          * @return Value indicating if object was found.
       
   519          */
       
   520         CSmlDmAdapter::TError UpdateCodecSpecificObject( 
       
   521             const TDesC8& aLUID, const TDesC8& aUriSeg, 
       
   522             const TDesC8& aObject );
       
   523 
       
   524         /**
       
   525          * Fetches the values of Codec specific leaf objects.
       
   526          * @since S60 3.2
       
   527          * @param aLUID luid mapping from dm-module
       
   528          * @param aUriSeg Last URI segment.
       
   529          * @param aSegmentResult Storage for fetched objects.
       
   530          * @return Value indicating if object was found.
       
   531          */
       
   532         CSmlDmAdapter::TError FetchCodecObject( const TDesC8& aLUID,
       
   533             const TDesC8& aUriSeg, TDes8& aSegmentResult );
       
   534 
       
   535         /**
       
   536          * Inserts Codec specific leaf objects.
       
   537          * @since S60 3.2
       
   538          * @param aCurrentURISegmentList List for leaf objects.
       
   539          */
       
   540         void CodecChildListL( CBufBase* const aCurrentURISegmentList );
       
   541             
       
   542         /**
       
   543          * Updates Setting Ids specific object.
       
   544          * @since S60 3.2
       
   545          * @param aLUID luid mapping from dm-module
       
   546          * @param aUriSeg Last URI segment.
       
   547          * @param aObject Data of the object.
       
   548          * @return Value indicating if object was found.
       
   549          */
       
   550         CSmlDmAdapter::TError UpdateSettingIdsSpecificObjectL( 
       
   551             const TDesC8& aLUID, const TDesC8& aUriSeg, 
       
   552             const TDesC8& aObject );
       
   553             
       
   554         /**
       
   555          * Inserts Voip leaf objects.
       
   556          * @since S60 3.2
       
   557          * @param aCurrentURISegmentList List for leaf objects.
       
   558          */
       
   559         void VoipChildListL( CBufBase* const aCurrentURISegmentList );
       
   560 
       
   561     private:    // Data
       
   562 
       
   563         /**
       
   564          * RCSE profile registry handle.
       
   565          * Own.
       
   566          */
       
   567         CRCSEProfileRegistry* iCRCSEProfile;
       
   568 
       
   569         /**
       
   570          * RCSE codec registry handle.
       
   571          * Own.
       
   572          */
       
   573         CRCSEAudioCodecRegistry* iCRCSEAudioCodec;
       
   574 
       
   575         /**
       
   576          * Handle for DM callback interface.
       
   577          * Not own.
       
   578          */
       
   579         MSmlDmCallback* iDmCallback;
       
   580 
       
   581         /**
       
   582          * For telling status of command to the adapter.
       
   583          */
       
   584         TInt iStatusRef;
       
   585 
       
   586         /**
       
   587          * Array of pointers to all profile entries.
       
   588          * Own.
       
   589          */
       
   590         RPointerArray<CRCSEProfileEntry> iProfileEntries;
       
   591 
       
   592         /**
       
   593          * Array of pointers to all codec entries.
       
   594          * Own.
       
   595          */
       
   596         RPointerArray<CRCSEAudioCodecEntry> iCodecEntries;
       
   597 
       
   598         /**
       
   599          * For knowing if there are modifications to entries.
       
   600          */
       
   601         RArray<TInt> iProfileModifs;
       
   602 
       
   603         /**
       
   604          * For knowing if there are modifications to entries.
       
   605          */
       
   606         RArray<TInt> iCodecModifs;
       
   607 
       
   608         /**
       
   609          * Current editable profileID in array of profiles.
       
   610          */
       
   611         TInt iProfileID;
       
   612 
       
   613         /**
       
   614          * Array for service provider settings.
       
   615          */
       
   616         RPointerArray<CDMVoIPSPSettings> iSPSettings;
       
   617     };
       
   618 
       
   619 #endif // __NSMLDMVOIPADAPTER_H__
       
   620 
       
   621 // End of File.