voipplugins/voipadapters/cpvoipadapter/inc/CWPVoIPAdapter.h
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2002-2009 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:  Realizes VoIP provisioning adapter. The VoIP adapter 
       
    15 *                handles VoIP settings and stores them in 
       
    16 *                CWPVoIPItem instances.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef CWPVOIPADAPTER_H
       
    22 #define CWPVOIPADAPTER_H
       
    23 
       
    24 #include <CWPAdapter.h>
       
    25 #include <MWPContextExtension.h>
       
    26 
       
    27 class CWPCharacteristic;
       
    28 class CWPVoIPItem;
       
    29 class CWPVoIPCodec;
       
    30 
       
    31 /**
       
    32  *  Realizes VoIP provisioning adapter.
       
    33  *  VoIP adapter handles VoIP settings and stores them via RCSE.DLL 
       
    34  *  and serviceprovidersettings.dll.
       
    35  *
       
    36  *  @lib CWPVoIPAdapter.lib
       
    37  *  @since Series60 3.0.
       
    38  */
       
    39 class CWPVoIPAdapter :  public CWPAdapter, public MWPContextExtension
       
    40     {
       
    41     #ifdef _DEBUG
       
    42     /**
       
    43      * Friend class for unit testing.
       
    44      */
       
    45      friend class UT_CWPVoIPAdapter;
       
    46     #endif
       
    47 
       
    48 public:  // Constructor and destructor
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      */
       
    53     static CWPVoIPAdapter* NewL();
       
    54 
       
    55     /**
       
    56      * Destructor.
       
    57      */
       
    58     virtual ~CWPVoIPAdapter();
       
    59 
       
    60 public:
       
    61 
       
    62 // from base class CWPAdapter
       
    63 
       
    64     /**
       
    65      * Gets the saving information from the
       
    66      * adapter that has saved settings.
       
    67      *
       
    68      * @since S60 3.2
       
    69      * @param TInt aIndex. Index of the previously saved item.
       
    70      * @param aSavingInfo Saving information (APPID, APPREF, settings ID).
       
    71      */
       
    72     void GetSavingInfoL( TInt aIndex, 
       
    73         RPointerArray<HBufC8>& aSavingInfo );
       
    74 
       
    75     /**
       
    76      * Returns the number of the summary lines to be shown in 
       
    77      * BIO control.
       
    78      *
       
    79      * @since S60 v3.0
       
    80      * @return TInt. Quantity of items (SIP profiles).
       
    81      */
       
    82     TInt ItemCount() const;
       
    83 
       
    84     /**
       
    85      * Getter for the summary text of the SIP item (SIP profile) 
       
    86      * located in the array. Text is shown to the user in 
       
    87      * opened configuration message.
       
    88      *
       
    89      * @since S60 v3.0
       
    90      * @param TInt aIndex. Location of the SIP item.
       
    91      * @return TDesC16&. Summary title.
       
    92      */
       
    93     const TDesC16& SummaryTitle( TInt /*aIndex*/ ) const;
       
    94 
       
    95     /**
       
    96      * Getter for the summary text of the VoIP item (VoIP settings) 
       
    97      * located in the array. Text is shown to the user in 
       
    98      * opened configuration message.
       
    99      *
       
   100      * @since S60 v3.0
       
   101      * @param TInt aIndex. Location of the SIPVoIP item.
       
   102      * @return TDesC16&. Summary text.
       
   103      */
       
   104     const TDesC16& SummaryText( TInt aIndex ) const;
       
   105 
       
   106     /**
       
   107      * Saves VoIP item (VoIP settings) located in array.
       
   108      *
       
   109      * @since S60 v3.0
       
   110      * @param TInt aIndex. Location of the VoIP item to be saved.
       
   111      */
       
   112     void SaveL( TInt aIndex );
       
   113 
       
   114     /**
       
   115      * Query if the VoIP item on place pointed by parameter can 
       
   116      * be set as default.
       
   117      *
       
   118      * @since S60 v3.0
       
   119      * @param TInt aIndex. Not used.
       
   120      * @return False since defaultness is not supported.
       
   121      */
       
   122     TBool CanSetAsDefault( TInt /*aIndex*/ ) const;
       
   123 
       
   124     /**
       
   125      * Sets the VoIP item on place pointed by parameter as default.
       
   126      * 
       
   127      * @since S60 v3.0
       
   128      * @param TInt aIndex. Location of the VoIP item to be queried.
       
   129      */
       
   130     void  SetAsDefaultL( TInt aIndex );
       
   131 
       
   132     /**
       
   133      * Query for the detail information about the VoIP settings. 
       
   134      * MWPPairVisitor is used for retrieving the details of a single 
       
   135      * setting entry. This is not supported feature as in the other 
       
   136      * adapters in the framework.
       
   137      *
       
   138      * @since S60 v3.0
       
   139      * @param TInt aItem.
       
   140      * @param MWPPairVisitor aVisitor.
       
   141      * @return TInt. 
       
   142      */
       
   143     TInt DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/ );
       
   144 
       
   145     /**
       
   146      * Visit method. Visits the adapter. Adapter then checks from the 
       
   147      * aCharacteristic if the data is targetet to it and acts according to
       
   148      * that.
       
   149      *
       
   150      * @since S60 v3.0
       
   151      * @param CWPCharacteristic& aCharacteristic.
       
   152      */
       
   153     void VisitL( CWPCharacteristic& aCharacteristic );		
       
   154 
       
   155     /**
       
   156      * Visit method. Visits the adapter. Methods set the iAppId value.
       
   157      *
       
   158      * @since S60 v3.0
       
   159      * @param CWPParameter& aParameter.
       
   160      */
       
   161     void VisitL( CWPParameter& aParameter );		
       
   162 
       
   163     /**
       
   164      * Visit method. For linking VoiceMailBox settings to a certain IAP.
       
   165      * @since S60 v3.2
       
   166      * @param CWPCharacteristic& aLink.
       
   167      */
       
   168     void VisitLinkL( CWPCharacteristic& aLink );
       
   169 
       
   170     /**
       
   171      * Informs the adapters of the saved settings.
       
   172      *
       
   173      * @since S60 v3.0
       
   174      * @param TDesC8& aAppIdOfSavingItem. UID of the adapter component. 
       
   175      * @param HBufC8& aAppRef. APPREF of the saved settings.
       
   176      * @param TAny& aStorageIdValue. Value that identifies the settings in
       
   177      *        its storage.
       
   178      * @param TBool aIsLastOfItsType. If the settings saved is the last of
       
   179      *        its kind, the value of the parameter is ETrue (or 1, because
       
   180      *        the TBool type does not work correctly via interface class 
       
   181      *        definition (based on information from MVC documentation).
       
   182      */
       
   183     void SettingsSavedL (const TDesC8& aAppIdOfSavingItem,
       
   184         const TDesC8& aAppRef, const TDesC8& aStorageIdValue );
       
   185 
       
   186     /**
       
   187      * Lets the adapters know when the saving has been finalized in 
       
   188      * viewpoint of the provisioning framework. The adapters can make 
       
   189      * finalization of saving the settings after receiving this call.
       
   190      *
       
   191      * @since S60 v3.0
       
   192      */
       
   193     void SavingFinalizedL();
       
   194 
       
   195     /**
       
   196      * Returns a pointer to a context extension.
       
   197      * @param aExtension Contains a pointer to MWPContextExtension 
       
   198      * if supported
       
   199      * @return KErrNotSupported if not supported, KErrNone otherwise
       
   200      */
       
   201     TInt ContextExtension(MWPContextExtension*& aExtension);
       
   202 
       
   203 // from base class MWPContextExtension
       
   204 
       
   205     /**
       
   206      * Returns the data used for saving.
       
   207      * @param aIndex The index of the data
       
   208      * @return The data. Ownership is transferred.
       
   209      */
       
   210     const TDesC8& SaveDataL(TInt aIndex) const;
       
   211 
       
   212     /**
       
   213      * Deletes a saved item.
       
   214      * @param aSaveData The data used for saving
       
   215      */
       
   216     void DeleteL(const TDesC8& aSaveData);
       
   217 
       
   218     /**
       
   219      * Returns the UID of the adapter.
       
   220      * @return UID
       
   221      */
       
   222     TUint32 Uid() const;
       
   223 
       
   224 private:
       
   225 
       
   226     /**
       
   227      * C++ default constructor.
       
   228      */
       
   229     CWPVoIPAdapter();
       
   230 
       
   231     /**
       
   232      * By default Symbian 2nd phase constructor is private.
       
   233      */
       
   234     void ConstructL();
       
   235 
       
   236 private: // New functions
       
   237 
       
   238     /**
       
   239      * Converts descriptor to integer.
       
   240      * @since Series60 3.2
       
   241      * @param aDescValue Descriptor data.
       
   242      * @param aIntValue Refenced integer value.
       
   243      * @return KErrNone if converting is done.
       
   244      */
       
   245     TInt DescToInt( HBufC8* aDescValue, TInt& aIntValue ) const;
       
   246 
       
   247     /**
       
   248      * Gets IAP ID according to WAP ID.
       
   249      * @since Series60 3.2
       
   250      * @param aWapId WAP ID of access point.
       
   251      * @return IAP ID of access point
       
   252      */
       
   253     TUint32 IapIdFromWapIdL( TUint32 aWapId );
       
   254 
       
   255 private: // Data
       
   256 
       
   257     /*
       
   258      * Holds the received VoIP item data.
       
   259      * Own.
       
   260      */
       
   261     RPointerArray<CWPVoIPItem> iDatas;
       
   262 
       
   263     /*
       
   264      * Current VoIP setting data.
       
   265      * Own.
       
   266      */
       
   267     CWPVoIPItem* iCurrentVoIPItem;
       
   268 
       
   269     /*
       
   270      * The application id of the current characteristic.
       
   271      */
       
   272     TPtrC iAppID;
       
   273 
       
   274     /*
       
   275      * Title for VoIP settings. Value read from the resource file 
       
   276      * in initiation phase. 
       
   277      * Own.
       
   278      */
       
   279     HBufC*  iTitle;
       
   280 
       
   281     /*
       
   282      * Holds the value of current characteristic type (state).
       
   283      */
       
   284     TUint iCurrentCharacteristic;
       
   285 
       
   286     /*
       
   287      * Holds the parameters of the currently handled codec item.
       
   288      * Own.
       
   289      */
       
   290     CWPVoIPCodec* iCurrentCodec;
       
   291 
       
   292     /*
       
   293      * Descriptor containing uids of the saved items (as TUint32).
       
   294      */
       
   295     mutable HBufC8* iUids;
       
   296 
       
   297     /*
       
   298      * Booleans for telling if certain settings can be set.
       
   299      */
       
   300     TBool iSetCodec;
       
   301     TBool iSetVoipUris;
       
   302 
       
   303     /*
       
   304      * Flag telling if feature manager has been initialized.
       
   305      */
       
   306     TBool iFeatMgrInitialized;
       
   307     };
       
   308 
       
   309 #endif      // CWPVOIPADAPTER_H
       
   310 
       
   311 // End of File