omacpadapters/cpdestinationnwadapter/inc/cwpdestinationnwadapter.h
changeset 67 fdbfe0a95492
equal deleted inserted replaced
62:03849bd79877 67:fdbfe0a95492
       
     1 /*
       
     2 * Copyright (c) 2007-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:   Handles destination network provisioning.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CWPDESTINATIONNWADAPTER_H
       
    21 #define CWPDESTINATIONNWADAPTER_H
       
    22 
       
    23 #include <CWPAdapter.h>
       
    24 #include <MWPContextExtension.h>
       
    25 
       
    26 #include "cwpdestinationnwitem.h"
       
    27 
       
    28 class CWPCharacteristic;
       
    29 
       
    30 /**
       
    31  *  Realizes destination network provisioning adapter.
       
    32  *
       
    33  *  Destination network adapter handles destination network provisioning and
       
    34  *  stores them via Connection Method Manager API.
       
    35  *
       
    36  *  @lib cwpdestinationnwadapter.lib
       
    37  *  @since S60 v3.2.
       
    38  */
       
    39 class CWPDestinationNwAdapter : public CWPAdapter, public MWPContextExtension
       
    40     {
       
    41     /**
       
    42      * Friend class for unit testing - uncomment when running tests.
       
    43      */
       
    44     //friend class UT_wpdestinationnwadapter;
       
    45 
       
    46 public:
       
    47 
       
    48     static CWPDestinationNwAdapter* NewL();
       
    49 
       
    50     virtual ~CWPDestinationNwAdapter();
       
    51 
       
    52     /**
       
    53      * Converts given 8-bit descriptor to TUint32.
       
    54      *
       
    55      * @since S60 v3.2.
       
    56      * @param aDes Descriptor to be converted.
       
    57      * @return Unsigned 32-bit integer.
       
    58      */
       
    59     TUint32 CWPDestinationNwAdapter::Des8ToUint32L( const TDesC8& aDes );
       
    60 
       
    61 // from base class CWPAdapter
       
    62 
       
    63     /**
       
    64      * From CWPAdapter.
       
    65      * Checks the number of settings items.
       
    66      *
       
    67      * @since S60 v3.2.
       
    68      * @return Quantity of items (always one).
       
    69      */
       
    70     TInt ItemCount() const;
       
    71 
       
    72     /**
       
    73      * From CWPAdapter.
       
    74      * Getter for the summary title of Destination network settings. The text
       
    75      * is shown to the user in an opened configuration message.
       
    76      *
       
    77      * @since S60 v3.2.
       
    78      * @param aIndex Location of the settings item. Not used.
       
    79      * @return Summary title.
       
    80      */
       
    81     const TDesC16& SummaryTitle( TInt aIndex ) const;
       
    82 
       
    83     /**
       
    84      * From CWPAdapter.
       
    85      * Getter for the summary text of Destination network settings. The text
       
    86      * is shown to the user in opened configuration message.
       
    87      *
       
    88      * @since S60 v3.2.
       
    89      * @param aIndex Location of the settings item.
       
    90      * @return Summary text.
       
    91      */
       
    92     const TDesC16& SummaryText( TInt aIndex ) const;
       
    93 
       
    94     /**
       
    95      * From CWPAdapter.
       
    96      * Saves a destination network.
       
    97      *
       
    98      * @since S60 v3.2.
       
    99      * @param aIndex Location of the settings item.
       
   100      */
       
   101     void SaveL( TInt aIndex );
       
   102 
       
   103     /**
       
   104      * From CWPAdapter.
       
   105      * Returns EFalse since a destination cannot be set as default.
       
   106      *
       
   107      * @since S60 v3.2.
       
   108      * @param aIndex Location of the settings item to be queried. Not used.
       
   109      * @return Information whether these settings can be set as default.
       
   110      */
       
   111     TBool CanSetAsDefault( TInt /*aIndex*/ ) const;
       
   112 
       
   113     /**
       
   114      * From CWPAdapter.
       
   115      * Adapter sets the settings as default. Not supported.
       
   116      *
       
   117      * @since S60 v3.2.
       
   118      * @param aIndex Location of the settings item to be set as default.
       
   119      */
       
   120     inline void SetAsDefaultL( TInt /*aIndex*/ );
       
   121 
       
   122     /**
       
   123      * From CWPAdapter.
       
   124      * Query for detailed information about the destination network.
       
   125      * This is not supported feature as in other adapters in the framework.
       
   126      * Always returns KErrNotSupported.
       
   127      *
       
   128      * @since S60 v3.2.
       
   129      * @param aItem Not used but here because of inheritance.
       
   130      * @param aVisitor Object for retrieveing details of a setting entry.
       
   131      *                 Not used.
       
   132      * @return KErrNotSupported if not supported.
       
   133      */
       
   134     TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor );
       
   135 
       
   136     /**
       
   137      * From CWPAdapter.
       
   138      * Visit method. Visits the adapter. Adapter checks from 
       
   139      * aCharacteristic if the data is targeted to it and acts according to
       
   140      * that.
       
   141      *
       
   142      * @since S60 v3.2.
       
   143      * @param aCharacteristic The characteristic found.
       
   144      */
       
   145     void VisitL( CWPCharacteristic& aCharacteristic );        
       
   146 
       
   147     /**
       
   148      * From CWPAdapter.
       
   149      * Visit method. Visits the adapter. Method sets parameter values to
       
   150      * destination network settings item.
       
   151      *
       
   152      * @since S60 v3.2.
       
   153      * @param aParameter The parameter found.
       
   154      */
       
   155     void VisitL( CWPParameter& aParameter );        
       
   156 
       
   157     /**
       
   158      * From CWPAdapter.
       
   159      * Visit method. Used for linking settings to NAPDEF definition.
       
   160      *
       
   161      * @since S60 v3.2.
       
   162      * @param aLink Link to the characteristic.
       
   163      */
       
   164     void VisitLinkL( CWPCharacteristic& aLink );
       
   165 
       
   166     /**
       
   167      * From CWPAdapter.
       
   168      * Gets the saving information from the adapter that has saved settings.
       
   169      *
       
   170      * @since S60 v3.2.
       
   171      * @param aIndex Index of the previously saved item.
       
   172      * @param aSavingInfo Saving info.
       
   173      */
       
   174     void GetSavingInfoL( TInt aIndex, RPointerArray<HBufC8>& aSavingInfo );
       
   175 
       
   176     /**
       
   177      * From CWPAdapter.
       
   178      * Informs the adapters of the saved settings.
       
   179      * Not used.
       
   180      *
       
   181      * @since S60 v3.2.
       
   182      * @param aAppIdOfSavingItem UID of the adapter component. 
       
   183      * @param aAppRef APPREF of the saved settings.
       
   184      * @param aStorageIdValue Value that identifies the settings in its
       
   185      *        storage.
       
   186      */
       
   187     inline void SettingsSavedL( const TDesC8& /*aAppIdOfSavingItem*/,
       
   188         const TDesC8& /*aAppRef*/, const TDesC8& /*aStorageIdValue*/ );
       
   189 
       
   190     /**
       
   191      * From CWPAdapter.
       
   192      * Lets the adapters know when the saving has been finalized in 
       
   193      * viewpoint of the provisioning framework. The adapters can make 
       
   194      * finalization of saving the settings after receiving this call.
       
   195      * Not used.
       
   196      *
       
   197      * @since S60 v3.2.
       
   198      */
       
   199     inline void SavingFinalizedL();
       
   200 
       
   201 // from base class MWPContextExtension
       
   202 
       
   203     /**
       
   204      * From MWPContextExtension.
       
   205      * Returns a pointer to a context extension.
       
   206      *
       
   207      * @since S60 v3.2.
       
   208      * @param aExtension Contains a pointer to MWPContextExtension if
       
   209      *                   supported.
       
   210      * @return KErrNotSupported if not supported, otherwise KErrNone.
       
   211      */
       
   212     TInt ContextExtension( MWPContextExtension*& aExtension );
       
   213 
       
   214     /**
       
   215      * From MWPContextExtension.
       
   216      * Returns the data used for saving.
       
   217      *
       
   218      * @since S60 v3.2.
       
   219      * @param aIndex The index of the data.
       
   220      * @return The data; ownership is transferred.
       
   221      */
       
   222     const TDesC8& SaveDataL( TInt aIndex ) const;
       
   223 
       
   224     /**
       
   225      * From MWPContextExtension.
       
   226      * Deletes a saved destination network.
       
   227      *
       
   228      * @since S60 v3.2.
       
   229      * @param aSaveData The data used for saving.
       
   230      */
       
   231     void DeleteL( const TDesC8& aSaveData );
       
   232 
       
   233     /**
       
   234      * From MWPContextExtension.
       
   235      * Returns the UID of the adapter.
       
   236      *
       
   237      * @since S60 v3.2.
       
   238      * @return UID of the adapter.
       
   239      */
       
   240     TUint32 Uid() const;
       
   241 
       
   242 private:
       
   243 
       
   244     CWPDestinationNwAdapter();
       
   245 
       
   246     void ConstructL();
       
   247 
       
   248 private: // data
       
   249 
       
   250     /**
       
   251      * Application ID of the current characteristic.
       
   252      */
       
   253     TPtrC iAppId;
       
   254 
       
   255     /**
       
   256      * Title for destination network. Value read from the resource file 
       
   257      * in initiation phase.
       
   258      * Own.
       
   259      */
       
   260     HBufC16* iDefaultTitle;
       
   261 
       
   262     /**
       
   263      * Name for destination network. Value read from the resource file 
       
   264      * in initiation phase.
       
   265      * Own.
       
   266      */
       
   267     HBufC16* iDefaultName;
       
   268 
       
   269     /**
       
   270      * Destination network item.
       
   271      * Own.
       
   272      */
       
   273     CWPDestinationNwItem* iCurrentItem;
       
   274 
       
   275     /**
       
   276      * Destination Network items.
       
   277      */
       
   278     RPointerArray<CWPDestinationNwItem> iItems;
       
   279     };
       
   280 
       
   281 #include "cwpdestinationnwadapter.inl"
       
   282 
       
   283 #endif // CWPDESTINATIONNWADAPTER_H