1 /*---------------------------------------------------------------------------*
2 
3 Copyright (C) 2013-2014 Nintendo. All rights reserved.
4 
5 These coded instructions, statements, and computer programs contain
6 proprietary information of Nintendo of America Inc. and/or Nintendo
7 Company Ltd., and are protected by Federal copyright law.  They may
8 not be disclosed to third parties or copied or duplicated in any form,
9 in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 
13 #ifndef NN_EC_DOWNLOAD_CATALOG_H_
14 #define NN_EC_DOWNLOAD_CATALOG_H_
15 
16 #include <nn/ec/ec_Catalog.h>
17 #include <nn/ec/ec_Query.h>
18 
19 namespace nn { namespace ec {
20 
21 //! @addtogroup nn_ec_class
22 //! @{
23 
24 /*!
25 @brief Class for handling a download catalog.
26 
27 @see        <a class="el" href="../../Doc/EcdkProgrammingManual/contents/Pages/Page_48711722.html#PageId_48924983">Programming Manual</a>
28 */
29 class DownloadCatalog : public Catalog
30 {
31 public:
32     NN_EC_DECLARE_ACCESSOR;
33     NN_EC_DECLARE_IMPL;
34 
35 public:
36     /*!
37 @brief      The maximum number of items you want to get.
38     */
39     static const u32 ITEM_NUM_MAX = 100;
40 
41 public:
42     /*!
43 @brief Instantiates the object.
44     */
45     DownloadCatalog();
46 
47     /*!
48 @brief Destroys the object.
49     */
50     ~DownloadCatalog();
51 
52     /*!
53 @brief Gets a list of downloadable content that can be redownloaded.
54 
55 This function calls <tt>@ref Clear</tt> before retrieving the list. @n
56 The reference counters of previously retrieved items are decremented by 1, so make note of the persistence of items retrieved with <tt>@ref GetItem</tt>.
57 
58 The following information cannot be obtained for items obtained by this function.
59 
60 @li Sales status.
61 @li Price.
62 
63 This function blocks because it involves communication.
64 
65 @param[in] pQuery  Specifies the query. @n
66 Specify <tt>NULL</tt> if you are not using a query. @n
67 Values other than <tt>@ref Query::Select</tt> are ignored.
68 @param[in] startIndex  Specifies the start position.
69 @param[in] num  Specifies the number of items to retrieve. @n
70 The maximum number that can be specified is <tt>@ref ITEM_NUM_MAX</tt>.
71 
72 @return The result of processing.
73 
74 @retval Result::IsSuccess Indicates success.
75 @retval ResultNotInitialized  Indicates that the library is not initialized.
76 @retval     ResultNotLoggedIn       Not logged in to the eShop server.
77 @retval ResultInvalidArgument  Indicates that an argument is invalid.
78 @retval     ResultOutOfMemory       Insufficient memory.
79 @retval     ResultNotConnected      Not connected to the Internet.
80 @retval     ResultCanceled          The communication process was canceled.
81 @retval     ResultExcluded          The EC applet is running.
82 @retval     ResultResponseError     A response error occurred.
83 @retval     ResultCurlError         A communication error occurred.
84 @retval     ResultServerError       A server error occurred.
85 @retval     Other                  Sometime an error generated by <tt>@ref Login</tt> is returned.
86     */
87     nn::Result RetrieveAocs(const Query* pQuery, u32 startIndex, u32 num);
88 
89     /*!
90 @brief Gets the total number of items that can be retrieved.
91 
92 The value returned by this function does not depend on the number of items to retrieve as specified in <tt>RetrieveAocs</tt>.
93 
94 You must call <tt>RetrieveAocs</tt> before calling this function. @n
95 This function returns <tt>0</tt> if an item list could not be retrieved with <tt>RetrieveAocs</tt>.
96 
97 @return Returns the total number of retrievable items.
98     */
99     u32 GetTotal() const;
100 
101 private:
102     //
103     Impl* CreateImpl(u32 num);
104 };
105 
106 //! @}
107 
108 }} // namespace nn::ec
109 
110 #endif // NN_EC_DOWNLOAD_CATALOG_H_
111