remotemgmt_plat/adaptive_history_list_api/inc/ahlegenericapi.h
changeset 72 8ee66fcd0a7c
parent 68 415c00f1675d
equal deleted inserted replaced
68:415c00f1675d 72:8ee66fcd0a7c
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  API ddefinition for generic clients and SDK.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MAHLEGENERICAPI_H
       
    19 #define MAHLEGENERICAPI_H
       
    20 
       
    21 #include <badesca.h>
       
    22 #include <ahlegeneric.h>
       
    23 
       
    24 class MAHLEObserver;
       
    25 
       
    26 class MAHLEGenericAPI
       
    27     {
       
    28     public:
       
    29 
       
    30         /**
       
    31         * Destructor.
       
    32         */
       
    33         inline virtual ~MAHLEGenericAPI();
       
    34 
       
    35         /**
       
    36         * Check if the client has been connected to the server
       
    37         *
       
    38         * @return ETrue if connected, otherwise EFalse
       
    39         */
       
    40         virtual TBool IsConnected() = 0;
       
    41 
       
    42         /**
       
    43         * Set client observer
       
    44         *
       
    45         * @param aObserver client observer
       
    46         */
       
    47         virtual void SetObserverL(const MAHLEObserver* aObserver) = 0;
       
    48 
       
    49         /**
       
    50         * Cancel client observer
       
    51         */
       
    52         virtual void CancelObserver() = 0;
       
    53 
       
    54         /**
       
    55         * Engine reconfiguration.
       
    56         * New storage sizes have to be explicitly specified.
       
    57         *
       
    58         * @param aPrimarySize New primary storage size.
       
    59         * @param aSecondarySize New secondary storage size.
       
    60         * @param aAdaptationSpeed New adaptation speed.
       
    61         * @returns KErrNone if ok, otherwise an error code. Returns KErrInUse
       
    62         *          if AHLE server is busy (e.g. reading or writing file) and
       
    63         *          KErrArgument if one of parameters is out of range.
       
    64         */
       
    65         virtual TInt Reconfigure(
       
    66                 TUint aPrimarySize,
       
    67                 TUint aSecondarySize,
       
    68                 TReal32 aAdaptationSpeed) = 0;
       
    69 
       
    70         /**
       
    71         * Current engine configuration.
       
    72         *
       
    73         * @param aPrimarySize Current primary storage size.
       
    74         * @param aSecondarySize Current secondary storage size.
       
    75         * @param aAdaptationSpeed Current adaptation speed.
       
    76         */
       
    77         virtual TInt GetConfiguration(
       
    78                 TUint& aPrimarySize,
       
    79                 TUint& aSecondarySize,
       
    80                 TReal32& aAdaptationSpeed) = 0;
       
    81 
       
    82         /**
       
    83         * Logging new access synchronously.
       
    84         *
       
    85         * @param aItem Access descriptor, key value in adaptive list
       
    86         * @param aName Name descriptor (defaults to empty string).
       
    87         * @param aWeight Weight of an item (defaults to 1).
       
    88         * @returns KErrNone if ok, otherwise an error code. Returns KErrInUse
       
    89         *          if AHLE server is in use (e.g. reading or writing file) and
       
    90         *          KErrArgument if size of one of parameters is out of range.
       
    91         */
       
    92         virtual TInt NewAccess(
       
    93                 const TDesC& aItem,
       
    94                 const TDesC& aName = KAHLEItemDefaultName,
       
    95                 TReal32 aWeight = KAHLEDefaultWeight) = 0;
       
    96 
       
    97         /**
       
    98         * Logging new access asynchronously.
       
    99         *
       
   100         * @param aStatus Asychronous request status.
       
   101         * @param aItem Access descriptor, key value in adaptive list
       
   102         * @param aName Name descriptor (defaults to empty string).
       
   103         * @param aWeight Weight of an item (defaults to 1).
       
   104         */
       
   105         virtual void NewAccessL(
       
   106                 TRequestStatus& aStatus,
       
   107                 const TDesC& aItem,
       
   108                 const TDesC& aName = KAHLEItemDefaultName,
       
   109                 TReal32 aWeight = KAHLEDefaultWeight) = 0;
       
   110 
       
   111         /**
       
   112         * Get adaptive list synchronously.
       
   113         *
       
   114         * @param aItems Descriptor array containing items in ranked order.
       
   115         * @param aNames Descriptor array containing aItems names
       
   116         * @param aSize Maximum length of returned list
       
   117         * @param aMatch Substring to match beginnings of adaptive list items
       
   118         *        (optional, default is to match everything). Matching is case
       
   119         *        sensitive.
       
   120         * @returns KErrNone if ok, otherwise an error code. Returns KErrInUse
       
   121         *          if AHLE server is busy (e.g. reading or writing file) and
       
   122         *          KErrArgument if aMatch is to long.
       
   123         */
       
   124         virtual TInt AdaptiveListL(
       
   125                 CDesCArray&  aItems,
       
   126                 CDesCArray&  aNames,
       
   127                 const TUint  aSize,
       
   128                 const TDesC& aMatch = KAHLENoMatch) = 0;
       
   129 
       
   130         /**
       
   131         * Get adaptive list asynchronously.
       
   132         *
       
   133         * @param aStatus Asynchronous request status.
       
   134         * @param aItems Descriptor array containing items in ranked order.
       
   135         * @param aNames Descriptor array containing aItems names
       
   136         * @param aSize Maximum length of returned list
       
   137         * @param aMatch Substring to match beginnings of adaptive list items
       
   138         *        (optional, default is to match everything). Matching is case
       
   139         *        sensitive.
       
   140         */
       
   141         virtual void AdaptiveListL(
       
   142                 TRequestStatus& aStatus,
       
   143                 CDesCArray& aItems,
       
   144                 CDesCArray& aNames,
       
   145                 const TUint aSize,
       
   146                 const TDesC& aMatch = KAHLENoMatch) = 0;
       
   147 
       
   148         /**
       
   149         * Remove item synchronously.
       
   150         *
       
   151         * @param aItem Item to be removed
       
   152         * @returns KErrNone if ok, otherwise an error code. Returns KErrInUse
       
   153         *          if AHLE server is busy (e.g. reading or writing file)
       
   154         *          and KErrArgument if size of parameter is out of range.
       
   155         */
       
   156         virtual TInt Remove(const TDesC& aItem) = 0;
       
   157 
       
   158         /**
       
   159         * Remove item asynchronously.
       
   160         *
       
   161         * @param aStatus Request status (in asynchronous versions)
       
   162         * @param aItem Item to be removed
       
   163         */
       
   164         virtual void RemoveL(TRequestStatus& aStatus, const TDesC& aItem) = 0;
       
   165 
       
   166         /**
       
   167         * Remove items synchronously.
       
   168         *
       
   169         * @param aItems Items to be removed
       
   170         * @returns KErrNone if ok, otherwise an error code. Returns KErrInUse
       
   171         *          if AHLE server is busy (e.g. reading or writing file) and
       
   172         *          KErrArgument if table is empty or one of items in table is
       
   173         *          empty.
       
   174         */
       
   175         virtual TInt RemoveL(const CDesCArray& aItems) = 0;
       
   176 
       
   177         /**
       
   178         * Remove items asynchronously.
       
   179         *
       
   180         * @param aStatus Request status
       
   181         * @param aItems Items to be removed
       
   182         */
       
   183         virtual void RemoveL(
       
   184                 TRequestStatus& aStatus,
       
   185                 const CDesCArray& aItems) = 0;
       
   186 
       
   187         /**
       
   188         * Remove matching items synchronously.
       
   189         *
       
   190         * @param aMatch Match for items to be removed. Matching is case
       
   191         *        sensitive.
       
   192         * @returns The number of removed items, or otherwise an error code.
       
   193         *          Returns KErrInUse if AHLE server is busy (e.g. reading or
       
   194         *          writing file) and KErrArgument if match is to long.
       
   195         */
       
   196         virtual TInt RemoveMatching(const TDesC& aMatch) = 0;
       
   197 
       
   198         /**
       
   199         * Remove matching items asynchronously.
       
   200         *
       
   201         * @param aStatus Request status
       
   202         * @param aMatch Match for items to be removed. Matching is case
       
   203         *        sensitive.
       
   204         */
       
   205         virtual void RemoveMatchingL(
       
   206                 TRequestStatus& aStatus,
       
   207                 const TDesC& aMatch) = 0;
       
   208 
       
   209         /**
       
   210         * Rename item synchronously
       
   211         *
       
   212         * @param aItem Item to be renamed
       
   213         * @param aNewName New name for the item.
       
   214         * @returns KErrNone if ok, otherwise an error code. Returns KErrInUse
       
   215         *          if AHLE server is busy (e.g. reading or writing file)
       
   216         *          and KErrArgument if size of one of parameters is to long.
       
   217         */
       
   218         virtual TInt RenameL(const TDesC& aItem, const TDesC& aNewName) = 0;
       
   219 
       
   220         /**
       
   221         * Rename item asynchronously
       
   222         *
       
   223         * @param aItem Item to be renamed
       
   224         * @param aNewName New name for the item.
       
   225         */
       
   226         virtual void RenameL(
       
   227                 TRequestStatus& aStatus,
       
   228                 const TDesC& aItem,
       
   229                 const TDesC& aNewName) = 0;
       
   230 
       
   231         /**
       
   232         * Clear all adaptive list items synchronously
       
   233         *
       
   234         * @returns KErrNone if ok, otherwise an error code.
       
   235         *          Returns KErrInUse if AHLE server is busy
       
   236         *          (e.g. reading or writing file).
       
   237         */
       
   238         virtual TInt Clear() = 0;
       
   239 
       
   240         /**
       
   241         * Clear all adaptive list items asynchronously
       
   242         *
       
   243         * @param aStatus Request status
       
   244         */
       
   245         virtual void Clear(TRequestStatus& aStatus) = 0;
       
   246 
       
   247         /**
       
   248         * Flush cached items to persistent storage synchronously
       
   249         *
       
   250         * @returns KErrNone if ok, otherwise an error code.
       
   251         *          Returns KErrInUse if AHLE server is busy
       
   252         *          (e.g. reading or writing file).
       
   253         */
       
   254         virtual TInt Flush() = 0;
       
   255 
       
   256         /**
       
   257         * Flush cached items to persistent storage asynchronously
       
   258         *
       
   259         * @param aStatus Request status
       
   260         * @returns KErrNone if ok, otherwise an error code.
       
   261         *          Returns KErrInUse if AHLE server is busy
       
   262         *          (e.g. reading or writing file).
       
   263         */
       
   264         virtual void Flush(TRequestStatus& aStatus) = 0;
       
   265 
       
   266         /**
       
   267         * Sorts items by their weights.
       
   268         * @param aItems Descriptor array containing items to be sorted.
       
   269         * @param aItemsSorted Array containing those indexes of items from
       
   270         *        aItems array that are also found from Adaptive History List
       
   271         *        Engine ordered by their weight
       
   272         *        (in Adaptive History List Engine).
       
   273         * @param aSortOrder Sorting items order (ascending or descending)
       
   274         * @return KErrNone if ok, otherwise an error code.
       
   275         */
       
   276         virtual TInt OrderByWeightL(
       
   277                 const CDesCArray& aItems,
       
   278                 RArray<TInt>& aItemsSorted,
       
   279                 TAHLESortOrder aSortOrder = EAHLEAscending) = 0;
       
   280     };
       
   281 
       
   282 #include <ahlegenericapi.inl>
       
   283 
       
   284 /**
       
   285 * AHLE Client API constructor
       
   286 * @param aDatabaseName Name of the database.
       
   287 * @return MAHLEGenericAPI pointer to AHLE Client API
       
   288 */
       
   289 IMPORT_C MAHLEGenericAPI* NewAHLEClientL(const TDesC& aDatabaseName);
       
   290 
       
   291 #endif      // MAHLEGENERICAPI_H
       
   292 
       
   293 // End of File