upnpsettings/upnpsettingsengine/inc/upnpsettingsengine.h
changeset 0 7f85d04be362
child 38 5360b7ddc251
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2006-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:      Settings Engine class definition
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef __UPNPSETTINGSENGINE_H__
       
    24 #define __UPNPSETTINGSENGINE_H__
       
    25 
       
    26 // INCLUDE FILES
       
    27 
       
    28 #include <e32base.h>    // CBase
       
    29 #include <e32std.h>     // TBuf
       
    30 
       
    31 // CONSTANTS
       
    32 const TInt KMaxFriendlyNameLength( 64 );
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CRepository;
       
    36 class CUpnpSettings;
       
    37 class CUpnpMediaServerSettings;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 /**
       
    41  *  Settings engine class for UPnP Home Connect Application
       
    42  *  @lib upnpapplicationengine.lib
       
    43  *  @since S60 3.1
       
    44  */
       
    45 class CUPnPSettingsEngine : public CBase
       
    46     {
       
    47 public: // Constructors and destructor
       
    48 
       
    49     /**
       
    50      * Two-phased constructor.
       
    51      */
       
    52     IMPORT_C static CUPnPSettingsEngine* NewL();
       
    53 
       
    54     /**
       
    55      * Two-phased constructor.
       
    56      */
       
    57     IMPORT_C static CUPnPSettingsEngine* NewLC();
       
    58 
       
    59     /**
       
    60      * Destructor.
       
    61      */
       
    62     IMPORT_C virtual ~CUPnPSettingsEngine();
       
    63         
       
    64         
       
    65 public: // new functions
       
    66 
       
    67     /**
       
    68      * Sets friendly name
       
    69      * @since S60 3.1
       
    70      * @param aFriendlyName, reference containing the new friendly name
       
    71      * @return TInt,  indicates the success of the call
       
    72      */
       
    73     IMPORT_C TInt SetLocalFriendlyName( 
       
    74         const TDesC8& aFriendlyName ) const;
       
    75 
       
    76     /**
       
    77      * Gets friendly name
       
    78      * @since S60 3.1
       
    79      * @param aFriendlyName, reference where name is updated
       
    80      * @return TInt, indicates the success of the call
       
    81      */
       
    82     IMPORT_C TInt GetLocalFriendlyName( 
       
    83         TDes8& aFriendlyName ) const;
       
    84 
       
    85 
       
    86     /**
       
    87      * Sets selected Access point
       
    88      * @since S60 3.1
       
    89      * @param aIAP, the IAP id
       
    90      * @return TInt, TInt indicates the success of the call
       
    91      */
       
    92     IMPORT_C TInt SetAccessPoint( const TInt aIAP );
       
    93         
       
    94         
       
    95     /**
       
    96      * Gets Access Point information
       
    97      * @since S60 3.1
       
    98      * @param aIAP, reference where IAP id is put
       
    99      * @return TInt, indicates the success of the call
       
   100      */
       
   101     IMPORT_C TInt GetAccessPoint( TInt& aIAP );
       
   102         
       
   103         
       
   104     /**
       
   105      * Sets selected Access point setting
       
   106      * @since S60 3.1
       
   107      * @param aIAPSetting, the IAP setting
       
   108      * @return TInt, TInt indicates the success of the call
       
   109      */
       
   110     IMPORT_C TInt SetAccessPointSetting( const TInt aIAPSetting );
       
   111         
       
   112         
       
   113     /**
       
   114      * Gets Access Point setting
       
   115      * @since S60 3.1
       
   116      * @param aIAPSetting, reference to access point setting
       
   117      * @return TInt, indicates the success of the call
       
   118      */
       
   119     IMPORT_C TInt GetAccessPointSetting( TInt& aIAPSetting );
       
   120         
       
   121         
       
   122     /**
       
   123      * Sets selected wap access point id
       
   124      * @since S60 3.1
       
   125      * @param aWapId, the wap access point id
       
   126      * @return TInt, TInt indicates the success of the call
       
   127      */
       
   128     IMPORT_C TInt SetWapId( const TInt aWapId );
       
   129         
       
   130         
       
   131     /**
       
   132      * Gets selected wap access point id
       
   133      * @since S60 3.1
       
   134      * @param aWapId, reference to wap access point id
       
   135      * @return TInt, TInt indicates the success of the call
       
   136      */
       
   137     IMPORT_C TInt GetWapId( TInt& aWapId );
       
   138 
       
   139     /**
       
   140      * Gets information if this is the first start of home network
       
   141      * @since S60 3.1
       
   142      * @param aFirstStart, reference to first start information
       
   143      * @return TInt, TInt indicates the success of the call
       
   144      */
       
   145     IMPORT_C TInt GetFirstStart( TInt& aFirstStart );
       
   146 
       
   147     /**
       
   148      * Sets information if this is the first start of home network
       
   149      * @since S60 3.1
       
   150      * @param const aFirstStart, the new first start value
       
   151      * @return TInt, TInt indicates the success of the call
       
   152      */
       
   153     IMPORT_C TInt SetFirstStart( const TInt aFirstStart );
       
   154         
       
   155     /**
       
   156      * Sets the mandatory manufacturer settings to media server
       
   157      * @since S60 3.1
       
   158      * @return TInt, TInt indicates the success of the call
       
   159      */
       
   160     IMPORT_C TInt SetManufacturerParamsL() const;
       
   161 
       
   162     /**
       
   163      * Gets the drive for the copy operation
       
   164      * @since S60 3.2
       
   165      * @param aDrive, reference to copy location drive
       
   166      */
       
   167     IMPORT_C void GetCopyLocationDriveL( TDriveNumber& aDrive ) const;
       
   168 
       
   169     /**
       
   170      * Gets the location for the copy operation
       
   171      * @since S60 3.2
       
   172      * @param aLocation, path for copy location
       
   173      * @param aIsPhoneMemory, tells if used location is internal phone memory
       
   174      */
       
   175     IMPORT_C void GetCopyLocationL( TDes& aLocation, 
       
   176                                     TBool& aIsPhoneMemory ) const;
       
   177 
       
   178     /**
       
   179      * Sets the location of the copy operation
       
   180      * @since S60 3.2
       
   181      * @param aDrive The drive number of the new location 
       
   182      * as defined in TDriveNumber.
       
   183      * @return TInt, TInt indicates the success of the call
       
   184      */
       
   185     IMPORT_C TInt SetCopyLocationL( const TDriveNumber aDrive ) const;
       
   186 
       
   187     /**
       
   188      * Get the name of the current IAP if it is set and is not always ask
       
   189      * @since S60 5.1
       
   190      * @param aIapId, iap id
       
   191      * @return HBufC, iap name. Ownership is transferred to the caller
       
   192      * if IAP is set to None
       
   193      */
       
   194     IMPORT_C static HBufC* GetCurrentIapNameL( TInt aIapId );
       
   195     
       
   196     /**
       
   197      * Static helper method to validate iap by id.
       
   198      * 
       
   199      * @since S60 5.1
       
   200      * @param aIapId, Id of the iap to be validated.
       
   201      * @return ETrue if given iap id is valid. EFalse otherwise.
       
   202      */
       
   203     IMPORT_C static TBool IsAccessPointValidL( TInt aIapId );
       
   204         
       
   205     /**
       
   206      * Static helper method to retrieve info of access points into given
       
   207      * arrays.
       
   208      * 
       
   209      * @since S60 5.1
       
   210      * @param aNameArray,  array contains the iap names
       
   211      * @param aIapIdArr, Array for iap ids.
       
   212      */
       
   213     IMPORT_C static void GetWLANAccessPointsL( CDesCArray* aNameArray,
       
   214                                                RArray<TInt64>& aIapIdArr );
       
   215     
       
   216     /**
       
   217      * Static helper method to create the iap editing window
       
   218      * arrays.
       
   219      * 
       
   220      * @since S60 5.1
       
   221      * @param none
       
   222      */        
       
   223     IMPORT_C static void CreateAccessPointL();
       
   224     
       
   225 private:
       
   226 
       
   227     /**
       
   228      * C++ default constructor.
       
   229      */
       
   230     CUPnPSettingsEngine();
       
   231 
       
   232     /**
       
   233      * By default Symbian 2nd phase constructor is private.
       
   234      */
       
   235     void ConstructL();
       
   236 
       
   237     /**
       
   238      * Reads device model, it is in form "Nokia xxxx"
       
   239      * Note: Does not return correct value in subcon R&D builds
       
   240      * @since S60 3.1
       
   241      * @param aModel Device model
       
   242      * @return TInt, TInt indicates the success of the call
       
   243      */
       
   244     TInt ReadDeviceModelL( TDes8& aModel ) const;
       
   245 
       
   246     /**
       
   247      * Gets friendly name, internal version
       
   248      * @since S60 3.1
       
   249      * @param aFriendlyName, reference where name is updated
       
   250      * @return TInt, indicates the success of the call
       
   251      */
       
   252     TInt GetLocalFriendlyNameL( 
       
   253         TDes8& aFriendlyName ) const;
       
   254 
       
   255     /**
       
   256      * Initializes a property if property has not yet been set
       
   257      * @since S60 3.1
       
   258      * @param aSettings, MediaServer settings 
       
   259      * @param aKey, Propery's id
       
   260      * @param aValue, New propery's value
       
   261      */
       
   262     void InitializePropertyL( 
       
   263         CUpnpMediaServerSettings& aSettings, 
       
   264         TInt aKey, 
       
   265         const TDesC8& aValue ) const;
       
   266     
       
   267     /**
       
   268      * Helper method to validate wlan access points.
       
   269      * 
       
   270      * @since S60 5.1
       
   271      * @param aIapId, Id of the iap to be validated.
       
   272      * @return ETrue if given iap is found from the comms db and
       
   273      * id is valid. EFalse otherwise.
       
   274      */
       
   275     static TBool IsWLANAccessPointValidL( TUint32 aIapId );
       
   276 
       
   277 private:    // data
       
   278 
       
   279     // Central Repository
       
   280     CRepository*                    iRepository;
       
   281     // Repository for upnp settings
       
   282     CUpnpSettings*                  iUpnpRepository;
       
   283     
       
   284     };
       
   285 
       
   286 #endif  // __UPNPSETTINGSENGINE_H__
       
   287 
       
   288 // End of file