ncdengine/inc/ncdpurchasedetails.h
changeset 0 ba25891c3a9e
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:   Definition of MNcdPurchaseDetails
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_NCD_PURCHASE_DETAILS_H
       
    20 #define M_NCD_PURCHASE_DETAILS_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <bamdesca.h>
       
    24 #include "ncditempurpose.h"
       
    25 
       
    26 class MNcdPurchaseDownloadInfo;
       
    27 class MNcdPurchaseInstallInfo;
       
    28 
       
    29 /**
       
    30  *  Purchase details.
       
    31  *
       
    32  *  
       
    33  */
       
    34 class MNcdPurchaseDetails
       
    35     {
       
    36 
       
    37 public:
       
    38 
       
    39     virtual ~MNcdPurchaseDetails()
       
    40         {
       
    41         }
       
    42 
       
    43     /**
       
    44      * State of the purchase.
       
    45      *
       
    46      * 
       
    47      */
       
    48     enum TState
       
    49         {
       
    50 
       
    51         /** Payment made, but not downloaded nor installed. */
       
    52         EStatePurchased,
       
    53 
       
    54         /** Payment made and content downloaded, but not installed. */
       
    55         EStateDownloaded,
       
    56 
       
    57         /** Payment made, content downloaded and installed. */
       
    58         EStateInstalled
       
    59  
       
    60         };
       
    61 
       
    62     /**
       
    63      * Type of the purchased item.
       
    64      */
       
    65     enum TItemType
       
    66         {
       
    67         
       
    68         /** Item has unknown type. */
       
    69         EUnknown = 0,
       
    70 
       
    71         /** This is item. */
       
    72         EItem = 1,
       
    73 
       
    74         /** This is folder. */
       
    75         EFolder = 2
       
    76         
       
    77         };
       
    78 
       
    79     
       
    80     /**
       
    81      * Additional attributes
       
    82      *
       
    83      * These are retrieved with AttributeString and AttributeInt32
       
    84      *
       
    85      * Adding new attributes does not cause a binary break but removing
       
    86      * does
       
    87      *
       
    88      */
       
    89     enum TPurchaseAttribute
       
    90         {
       
    91         /** 
       
    92          * Content UID received in a protocol response
       
    93          * 
       
    94          * Type: Int32
       
    95          */
       
    96         EPurchaseAttributeContentUid = 0,
       
    97         
       
    98         /**
       
    99          * Content MIME type received in a protocol response
       
   100          * 
       
   101          * Type: String
       
   102          */
       
   103         EPurchaseAttributeContentMimeType,
       
   104 
       
   105         /**
       
   106          * Internal attribute value, DO NOT USE
       
   107          *
       
   108          * @note Add new attributes before this
       
   109          */
       
   110         EPurchaseAttributeInternal
       
   111         };
       
   112     
       
   113     /**
       
   114      * Get purchase state.
       
   115      *
       
   116      * @note When an item has been installed, its state will remain
       
   117      * as EStateInstalled in the purhcase detail even if the content 
       
   118      * was uninstalled.
       
   119      *
       
   120      * 
       
   121      * @return Current state of the purchase.
       
   122      */
       
   123     virtual TState State() const = 0;
       
   124 
       
   125     /**
       
   126      * Get client UID.
       
   127      *
       
   128      * 
       
   129      * @return Client UID.
       
   130      */
       
   131     virtual TUid ClientUid() const = 0;
       
   132     
       
   133     /**
       
   134      * Get namespace.
       
   135      *
       
   136      * 
       
   137      * @return Namespace.
       
   138      */
       
   139     virtual const TDesC& Namespace() const = 0;
       
   140     
       
   141     /**
       
   142      * Get entity ID.
       
   143      *
       
   144      * 
       
   145      * @return Entity ID.
       
   146      */
       
   147     virtual const TDesC& EntityId() const = 0;
       
   148     
       
   149     /**
       
   150      * Get item name.
       
   151      *
       
   152      * 
       
   153      * @return Item name.
       
   154      */
       
   155     virtual const TDesC& ItemName() const = 0;
       
   156 
       
   157     /**
       
   158      * Get item purpose.
       
   159      *
       
   160      * 
       
   161      * @return Item purpose. Bit field of TNcdItemPurpose flags.
       
   162      * @see TNcdItemPurpose
       
   163      */
       
   164     virtual TUint ItemPurpose() const = 0;
       
   165     
       
   166     /**
       
   167      * Get catalog source name.
       
   168      *
       
   169      * 
       
   170      * @return Catalog source name.
       
   171      */
       
   172     virtual const TDesC& CatalogSourceName() const = 0;
       
   173     
       
   174     /**
       
   175      * Get download infos.
       
   176      *
       
   177      * @note Only valid for purchases in EStatePurchased state.
       
   178      *
       
   179      * 
       
   180      * @return Download infos.
       
   181      */
       
   182     virtual TArray< MNcdPurchaseDownloadInfo* > DownloadInfoL() const = 0;
       
   183     
       
   184     /**
       
   185      * Get purchase option ID.
       
   186      *
       
   187      * 
       
   188      * @return Purchase option ID.
       
   189      */
       
   190     virtual const TDesC& PurchaseOptionId() const = 0;
       
   191     
       
   192     /**
       
   193      * Get purchase option name.
       
   194      *
       
   195      * 
       
   196      * @return Purchase option name.
       
   197      */
       
   198     virtual const TDesC& PurchaseOptionName() const = 0;
       
   199     
       
   200     /**
       
   201      * Get purchase option price.
       
   202      *
       
   203      * 
       
   204      * @return Purchase option price.
       
   205      */
       
   206     virtual const TDesC& PurchaseOptionPrice() const = 0;
       
   207     
       
   208     /**
       
   209      * Get final price.
       
   210      *
       
   211      * 
       
   212      * @return Final price.
       
   213      */
       
   214     virtual const TDesC& FinalPrice() const = 0;
       
   215     
       
   216     /**
       
   217      * Get payment method name.
       
   218      *
       
   219      * 
       
   220      * @return Payment method name.
       
   221      */
       
   222     virtual const TDesC& PaymentMethodName() const = 0;
       
   223     
       
   224     /**
       
   225      * Get time of purchase.
       
   226      * The time is universal time, not local time.
       
   227      * 
       
   228      * @return Purchase time.
       
   229      */
       
   230     virtual TTime PurchaseTime() const = 0;
       
   231     
       
   232     /**
       
   233      * Get file name(s) of the downloaded file(s).
       
   234      *
       
   235      * @note Only valid for purchases in EStateDownloaded state.
       
   236      *
       
   237      * 
       
   238      * @return Array of file names.
       
   239      */
       
   240     virtual const MDesCArray& DownloadedFiles() const = 0;
       
   241     
       
   242     /**
       
   243      * Get file installation infos.
       
   244      *
       
   245      * @note Only valid for purchases in EStateInstalled state.
       
   246      *
       
   247      * 
       
   248      * @return File installation info array.
       
   249      */
       
   250     virtual TArray< MNcdPurchaseInstallInfo* > InstallInfoL() const = 0;
       
   251 
       
   252     /**
       
   253      * Get icon.
       
   254      *
       
   255      * 
       
   256      * @return Icon data.
       
   257      */
       
   258     virtual const TDesC8& Icon() const = 0;
       
   259     
       
   260     /**
       
   261      * Checks whether this purchase detail has an icon.
       
   262      *
       
   263      * @note This flag's intention is to indicate whether this purchase detail has
       
   264      * an icon saved in the purhcase history. This does not indicate whether the
       
   265      * actual icon data has been loaded or not.
       
   266      * 
       
   267      * @return ETrue if icon is available, EFalse if not.
       
   268      */
       
   269     virtual TBool HasIcon() const = 0;
       
   270     
       
   271     /**
       
   272      * Get access point used in download process.
       
   273      *
       
   274      * 
       
   275      * @return Access point.
       
   276      */
       
   277     virtual const TDesC& DownloadAccessPoint() const = 0;
       
   278     
       
   279     /**
       
   280      * Get description.
       
   281      *
       
   282      * 
       
   283      * @return Description.
       
   284      */
       
   285     virtual const TDesC& Description() const = 0;
       
   286 
       
   287     /**
       
   288      * Get version.
       
   289      *
       
   290      * 
       
   291      * @return Version.
       
   292      */
       
   293     virtual const TDesC& Version() const = 0;
       
   294 
       
   295     /**
       
   296      * Get server URI.
       
   297      *
       
   298      * 
       
   299      * @return Server URI.
       
   300      */
       
   301     virtual const TDesC& ServerUri() const = 0;
       
   302 
       
   303     /**
       
   304      * Get item type.
       
   305      *
       
   306      * 
       
   307      * @return Item type.
       
   308      */
       
   309     virtual TItemType ItemType() const = 0;
       
   310     
       
   311     /**
       
   312      * Get the total size of the content of the item.
       
   313      *
       
   314      * 
       
   315      * @return The size, or 0 if not defined.
       
   316      */
       
   317     virtual TInt TotalContentSize() const = 0;
       
   318     
       
   319     /**
       
   320      * Getter for origin node id.
       
   321      *
       
   322      * 
       
   323      * @return The id.
       
   324      */
       
   325     virtual const TDesC& OriginNodeId() const = 0;
       
   326 
       
   327     /**
       
   328      * Getter for the time of last operation that has been directed 
       
   329      * to the purchase item. The time is an universal time.
       
   330      *
       
   331      * 
       
   332      * @return TTime Universal time of the last operation.
       
   333      */
       
   334     virtual TTime LastOperationTime() const = 0;
       
   335     
       
   336     /**
       
   337      * Getter for the last operation error code that has been set
       
   338      * by the NCD Engine during operations or by the user of the API.  
       
   339      *
       
   340      * @note The state gives the current state of the purchase details.
       
   341      * If the error code is KErrNone, then the state of the purchase detail
       
   342      * describes the state after a successfull operation.
       
   343      * If the error code differs from KErrNone, then an error has occurred
       
   344      * during an operation. The error code and the state can be used together 
       
   345      * to conclude what kind of operation failed. 
       
   346      * If the state is EStatePurchased after an error occurred, 
       
   347      * then there are two possibilities:
       
   348      * either a purchase operation has failed or a download operation has failed.
       
   349      * If the state is EStateDownloaded after an error occurred, then install operation 
       
   350      * has failed.
       
   351      * If the state is EStateInstalled, then installing has succesfully completed 
       
   352      * and the error code should be KErrNone. If EStateInstalled is given with some 
       
   353      * other error code, this means that the installation was success
       
   354      * but some repository information could not be set correctly.
       
   355      * 
       
   356      *
       
   357      * @return TInt Error code of the last operation.
       
   358      */
       
   359     virtual TInt LastOperationErrorCode() const = 0;
       
   360         
       
   361 
       
   362     /**
       
   363      * String attribute getter
       
   364      *
       
   365      * @param aAttribute Attribute
       
   366      * @return Parameter string or KNullDesC if not set
       
   367      *     
       
   368      * @panic ENcdPanicIndexOutOfRange if aAttribute is invalid
       
   369      * @panic ENcdPanicInvalidArgument if the attribute type is not string
       
   370      */
       
   371     virtual const TDesC& AttributeString( 
       
   372         TPurchaseAttribute aAttribute ) const = 0;
       
   373 
       
   374     
       
   375     /**
       
   376      * Integer attribute getter
       
   377      *
       
   378      * @param aAttribute Attribute
       
   379      * @return Parameter integer or 0 if not set
       
   380      *
       
   381      * @panic ENcdPanicIndexOutOfRange if aAttribute is invalid
       
   382      * @panic ENcdPanicInvalidArgument if the attribute type is not TInt32
       
   383      */
       
   384     virtual TInt32 AttributeInt32( 
       
   385         TPurchaseAttribute aAttribute ) const = 0;
       
   386     
       
   387     };
       
   388 
       
   389 #endif // M_NCD_PURCHASE_DETAILS_H