applicationmanagement/server/inc/AMDownloaddb.h
changeset 0 3ce708148e4d
child 57 6757f1e2efd2
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 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:  Implementation of applicationmanagement components
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __AMDownloaddb_H
       
    20 #define __AMDownloaddb_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <d32dbms.h>
       
    27 #include <f32file.h>
       
    28 #include <SyncMLDef.h>
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // null final result value
       
    33 const TInt KAMNullResult = 0;
       
    34 
       
    35 // Database name & location
       
    36 const TInt KAMDownloaddbDrive = EDriveC;
       
    37 const TUid KAMPolicyUID =
       
    38     {
       
    39     0x1020781C
       
    40     };
       
    41 const TInt KAMMaxPkgURLLength( 2048);
       
    42 const TInt KAMMaxPkgNameLength( 80);
       
    43 const TInt KAMMaxPkgVersionLength( 80);
       
    44 
       
    45 _LIT( KDBMSSecureID, "secure[1020781C]" );
       
    46 
       
    47 _LIT( KAMDownloaddbName, "c:TARMAppMgmtDownloadDB.db" );
       
    48 
       
    49 // Table and column names
       
    50 _LIT( KTableAMMgmtObject, "AMMgmtObject" );
       
    51 
       
    52 _LIT(NCol1, "Id");
       
    53 _LIT(NCol2, "LUID");
       
    54 _LIT(NCol3, "Result");
       
    55 _LIT(NCol4, "TargetURI");
       
    56 _LIT(NCol5, "IAPId");
       
    57 
       
    58 class CAMDbItem : public CBase
       
    59     {
       
    60 public:
       
    61     static CAMDbItem* NewL();
       
    62     ~CAMDbItem();
       
    63 
       
    64     TInt id;
       
    65     TUint32 iLUID;
       
    66     TInt iResult;
       
    67 
       
    68     HBufC8* iTargetURI;
       
    69 
       
    70     TUint32 iapid;
       
    71 
       
    72     };
       
    73 
       
    74 // CLASS DECLARATION
       
    75 
       
    76 /**
       
    77  *  CAMDownloaddb provides an interface for accessing AM database.
       
    78  *  
       
    79  *  @lib AMadapter.lib
       
    80  *  
       
    81  */
       
    82 class CAMDownloaddb : public CBase
       
    83     {
       
    84 
       
    85 public:
       
    86 
       
    87     /**
       
    88      * Two-phased constructor.
       
    89      * @return A pointer to the newly created instance.
       
    90      */
       
    91     static CAMDownloaddb* NewL();
       
    92 
       
    93     /**
       
    94      * Two-phased constructor. Pushes the pointer onto the CleanupStack.
       
    95      * @return A pointer to the newly created instance.
       
    96      */
       
    97     static CAMDownloaddb* NewLC();
       
    98 
       
    99     /**
       
   100      * Destructor.
       
   101      */
       
   102     virtual ~CAMDownloaddb();
       
   103 
       
   104     void CreateTableL(RDbDatabase& aDatabase);
       
   105 
       
   106     void CreateandOpenL(TParse& name);
       
   107 
       
   108     TBool DeleteFromDatabaseL(TUint32 aLUID);
       
   109 
       
   110     void SaveToDatabaseL(TInt& aIndex, TUint32 aLuid, TInt aResult,
       
   111             const TDesC8& aTargetURI, TUint32 aIapid);
       
   112 
       
   113     void ReadItemsL(RPointerArray<CAMDbItem>& aItemArray, TDesC& aQueryBuffer);
       
   114 
       
   115     void ReadDbItemsL(RPointerArray<CAMDbItem>& aItemArray);
       
   116 
       
   117     void GetEntryForLUIDL(RPointerArray<CAMDbItem>& aItemArray, TDesC& aValue);
       
   118 
       
   119     /**
       
   120      * Second phase construction.
       
   121      */
       
   122     void ConstructL();
       
   123 
       
   124     /**
       
   125      * Constructor.
       
   126      */
       
   127     CAMDownloaddb();
       
   128 
       
   129 private:
       
   130 
       
   131     RDbNamedDatabase iDatabase;
       
   132     RFs iFsSession;
       
   133     RDbs iRdbSession;
       
   134 
       
   135     RDbTable iAMObjectTable;
       
   136     CDbColSet* iColSet;
       
   137     RDbView iView;
       
   138 
       
   139     };
       
   140 
       
   141 #endif // __AMDownloaddb_H   
       
   142 // End of File