ncdengine/engine/accesspointmanager/inc/catalogsaccesspointmanagerimpl.h
changeset 0 ba25891c3a9e
child 25 7333d7932ef7
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     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:   Class CCatalogsAccessPointManager declation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CATALOGSACCESSPOINTMANAGERIMPL_H
       
    20 #define C_CATALOGSACCESSPOINTMANAGERIMPL_H
       
    21 
       
    22 #include <e32def.h>
       
    23 #include <ApAccessPointItem.h>
       
    24 #include "catalogsaccesspointmanager.h"
       
    25 #include "catalogsaccesspointobserver.h"
       
    26 
       
    27 class CCatalogsAccessPointFilterSettings;
       
    28 class CCatalogsAccessPointSettings;
       
    29 class CCatalogsAccessPoint;
       
    30 class CCatalogsClientAccessPointData;
       
    31 class MNcdStorageManager;
       
    32 class CNcdNodeManager;
       
    33 class CNcdGeneralManager;
       
    34 
       
    35 class CCatalogsAccessPointManager: public CBase,
       
    36                                    public MCatalogsAccessPointManager,
       
    37                                    public MCatalogsAccessPointObserver
       
    38 {
       
    39 public:
       
    40     static CCatalogsAccessPointManager* NewL(
       
    41         CNcdGeneralManager& aGeneralManager );
       
    42         
       
    43     ~CCatalogsAccessPointManager();
       
    44     
       
    45 
       
    46 public: // from MCatalogsAccessPointManager
       
    47 
       
    48     /**
       
    49      * @see MCatalogsAccessPointManager::SetFixedApL.
       
    50      */
       
    51     virtual void SetFixedApL( const RPointerArray<CNcdKeyValuePair>& aApDetails ); 
       
    52     
       
    53     /**
       
    54      * @see MCatalogsAccessPointManager::GetFixedApL
       
    55      */
       
    56     virtual void GetFixedApL( TUint32& aAccessPointId );
       
    57 
       
    58     /**
       
    59      * @see MCatalogsAccessPointManager::ParseAccessPointDataFromClientConfL.
       
    60      */
       
    61     virtual void ParseAccessPointDataFromClientConfL(
       
    62         const MNcdConfigurationProtocolClientConfiguration& aConfiguration,
       
    63         const TUid& aClientUid, 
       
    64         TBool aIgnoreFixedAp, 
       
    65         RArray<TUint32>* aCreatedAps );
       
    66         
       
    67         
       
    68     /**
       
    69      * @see MCatalogsAccessPointManager::AccessPointIdL.
       
    70      */
       
    71     TInt AccessPointIdL(
       
    72         const TDesC& aNameSpace,
       
    73         const MCatalogsAccessPointManager::TAction& aAction, const TUid& aClientUid,
       
    74         TUint32& aAccessPointId);
       
    75         
       
    76     /**
       
    77      * @see MCatalogsAccessPointManager::AccessPointIdL.
       
    78      */
       
    79     TInt AccessPointIdL(
       
    80         const TDesC& aNameSpace, const TDesC& aCatalogId,
       
    81         const MCatalogsAccessPointManager::TAction& aAction, const TUid& aClientUid,
       
    82         TUint32& aAccessPointId);
       
    83         
       
    84     /**
       
    85      * @see MCatalogsAccessPointManager
       
    86      */
       
    87     TInt AccessPointIdL(
       
    88         const CNcdNodeIdentifier& aNodeIdentifier,
       
    89         const MCatalogsAccessPointManager::TAction& aAction, const TUid& aClientUid,
       
    90         TUint32& aAccessPointId);
       
    91 
       
    92     static void RemoveApFromCommsDatabaseL( const TUint32& aId );
       
    93     
       
    94 public: // From MCatalogsAccessPointObserver
       
    95 
       
    96     void HandleAccessPointEventL( 
       
    97         const TCatalogsConnectionMethod& aAp,
       
    98         const TCatalogsAccessPointEvent& aEvent );
       
    99 
       
   100 
       
   101 private:
       
   102 
       
   103     CCatalogsAccessPointManager(
       
   104         CNcdGeneralManager& aGeneralManager );
       
   105     
       
   106     void ConstructL();
       
   107 
       
   108     /**
       
   109      * Finds the access point settings for the given node from the
       
   110      * given access point data. NOTE! The node represented by the given
       
   111      * identifier must exist, otherwise the function leaves.
       
   112      *
       
   113      * @param aNodeIdentifier The node identifier.
       
   114      * @param aAction The action type.
       
   115      * @param aAccessPointData The data to search from.
       
   116      * @return The access point or NULL if not found.
       
   117      */    
       
   118     CCatalogsAccessPoint* FindAccessPointL(
       
   119         const CNcdNodeIdentifier& aNodeIdentifier,
       
   120         const MCatalogsAccessPointManager::TAction& aAction,
       
   121         const CCatalogsClientAccessPointData& aAccessPointData );
       
   122 
       
   123     
       
   124     /**
       
   125      * Maps the access point for given namespace and action.
       
   126      *
       
   127      * @param aNameSpace Namespace of the content source.
       
   128      * @param aAction The action.
       
   129      * @param aApId The access point id obtained from client configuration.
       
   130      * @param aClientUid Uid of the client.
       
   131      */
       
   132     void MapAccessPointL(
       
   133         const TDesC& aNameSpace, const TAction& aAction,
       
   134         const TDesC& aApId );
       
   135         
       
   136     /**
       
   137      * Maps an access point for the given namespace, ID and action.
       
   138      *
       
   139      * @param aNameSpace Namespace of the catalog.
       
   140      * @param aCatalogId ID of the catalog.
       
   141      * @param aAction The action.
       
   142      * @param aApId The access point ID obtained from client configuration.
       
   143      * @param aClientUid Uid of the client.
       
   144      */
       
   145     void MapAccessPointL(
       
   146         const TDesC& aNameSpace, const TDesC& aCatalogId, const TAction& aAction,
       
   147         const TDesC& aApId );
       
   148         
       
   149     /**
       
   150      * Create accesspoint to commsDB if corresponding accesspoint does not exist.
       
   151      * Add the given access point to access point datas of the given client.
       
   152      * 
       
   153      * @param aSettings The access point settings.
       
   154      * @param aClientUid Uid of the client.
       
   155      */
       
   156     void CreateAccessPointL( CCatalogsAccessPoint* aSettings );
       
   157     
       
   158     /**
       
   159      * Creates the access point to commsDB if corresponding access point does not exist.
       
   160      * Sets the id of the access point in commsDB to aSettings object.
       
   161      *
       
   162      * @param aSettings The access point settings.
       
   163      */
       
   164     void CreateAccessPointL( CCatalogsAccessPoint& aSettings );
       
   165     
       
   166     /**
       
   167      * Removes the client's accesspoint settings from the comms database.
       
   168      * 
       
   169      * @param aClientUid UID of the client.
       
   170      * @param aAddShutdownOperation If true, a shutdown operation is
       
   171      * created if removing the accesspoint fails that will try to remove it
       
   172      * later
       
   173      */
       
   174     void RemoveAccessPointsFromCommsDbL(
       
   175         TBool aAddShutdownOperation );
       
   176     
       
   177     /**
       
   178      * Creates the access points from the client configuration.
       
   179      *
       
   180      * @param aDetail The detail of which id is "accessPoints".
       
   181      * @param aClientUid The Uid of the owner of the access points.
       
   182      */
       
   183     void CreateAccessPointsFromClientConfL(
       
   184         const MNcdConfigurationProtocolDetail& aDetail, 
       
   185         RArray<TUint32>* aCreatedAps );
       
   186     /**
       
   187      * Removes client's access point datas from the internal data structures and
       
   188      * from the comms database.
       
   189      *
       
   190      */
       
   191     void RemoveAccessPointsL();
       
   192         
       
   193     
       
   194     HBufC16* ReadText16L( CApAccessPointItem* aItem, const TApMember& aApMember );
       
   195 
       
   196     HBufC8* ReadText8L( CApAccessPointItem* aItem, const TApMember& aApMember );
       
   197     
       
   198     TBool MatchInCommsDbL( const CCatalogsAccessPointSettings& aSettings, TUint32& aId );
       
   199 
       
   200     void CreateApToCommsDBL( const CCatalogsAccessPoint& aSettings, TUint32& aId );
       
   201 
       
   202     TBool ValidateAccessPointL( CCatalogsAccessPoint* aAccessPoint ); 
       
   203 
       
   204     void LoadFromStorageL();
       
   205 
       
   206     void SaveToStorageL();
       
   207     
       
   208         
       
   209     TBool MatchingSettingsL(const CCatalogsAccessPointSettings& aSettings, CApAccessPointItem& aItem);
       
   210     
       
   211     void SetApDetailL( CCatalogsAccessPoint& aAp, const TDesC& aKey, const TDesC& aValue );
       
   212 
       
   213     TInt GetAccessPoint( 
       
   214         CCatalogsAccessPoint*& aAccessPoint,
       
   215         CCatalogsClientAccessPointData*& aApData );
       
   216 
       
   217     TInt ValidateOrCreateAccessPointL(
       
   218         CCatalogsAccessPoint* aAccessPoint,
       
   219         TUint32& aAccessPointId );
       
   220 
       
   221     void DestructL();
       
   222 
       
   223 private:
       
   224     
       
   225     CNcdGeneralManager& iGeneralManager;
       
   226     // Storage manager is used to load and to save data from
       
   227     // databases.
       
   228     MNcdStorageManager& iStorageManager;
       
   229     
       
   230     CNcdNodeManager& iNodeManager;
       
   231 
       
   232     CCatalogsClientAccessPointData* iClientAccessPointData;
       
   233     
       
   234     CCatalogsAccessPoint* iFixedAp;
       
   235     TBool iCheckAp;
       
   236 };
       
   237 
       
   238 #endif