1 /*--------------------------------------------------------------------------*
2 
3 Copyright (C) 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_BOSS_BOSS_TITLE_H_
14 #define NN_BOSS_BOSS_TITLE_H_
15 
16 
17 #include <nn/Result.h>
18 #include <nn/boss/boss_Result.h>
19 #include <nn/boss/boss_Types.h>
20 
21 #ifdef __cplusplus
22 
23 namespace nn {
24 namespace boss {
25 
26 /*!
27 @addtogroup  nn_boss_api
28   @{
29 */
30 
31 /*!
32 @brief  Represents titles that use BOSS.
33 */
34 class Title {
35 public:
36 /*!
37 @brief  Instantiates an object. Uses the title that initialized this instance, and the logged-in account at the time of the call.
38 */
39     explicit Title( void );
40 
41 /*!
42 @brief  Destroys the object.
43 */
44     virtual ~Title( void );
45 
46 /*!
47 @brief  Changes the account the instance covers. Specifies the slot number of the account to change.
48 
49 @param[in] slotNo  Specifies a slot in the target account. (A value of <tt>0</tt> specifies the current account.)
50 @return  Returns the execution result of the function. Returns one of the following <tt>Result</tt> values.
51 @retval Result::IsSuccess  Indicates success.
52 @retval ResultInvalidParameter();  Indicates that an invalid slot number was specified in the parameter.
53 */
54     nn::Result ChangeAccount( u8 slotNo );
55 
56 
57 /*!
58 @brief  Sets the new arrival flag for the title to <tt>false</tt>.
59 
60 If for any reason the new arrival flag is set back to <tt>true</tt> after this function is called, new data for the title is received.
61 */
62     void SetNewArrivalFlagOff(void);
63 
64 
65 /*!
66 @brief  Gets the new arrival flag for the title.
67 
68 If the function returns <tt>true</tt>, new data for the title has been received.
69 
70 @return  Returns the new arrival flag for the title. (Returns <tt>false</tt> if there is no title information.)
71 */
72     bool GetNewArrivalFlag( void ) const;
73 
74 
75 /*!
76 @brief  Sets the <tt>OptOut</tt> flag of the title.
77 
78 The act of enabling this flag (setting it to <tt>true</tt>) is called "notification opt-out." This setting causes notifications for the title to not be received.
79 The act of disabling this flag (setting it to <tt>false</tt>) is called "notification opt-in." This setting causes notifications for the title to be received.
80 Notifications for a title are received if this flag has never been set. (The default value of this flag is <tt>false</tt>.)
81 
82 The value of the <tt>OptOut</tt> flag is recorded in a database for managing title information on the system.
83 Registering an NBDL task for a title is a trigger for the creation of a new database and the addition of a title entry to the database.
84 (If this is the first time an NBDL task has been registered for an account on the system, a new database is created and a new entry for the title is added.
85 After that, new title entries are added when NBDL tasks are registered for those new titles.)
86 As a result, this function returns either the <tt>@ref ResultRecordNotExist</tt> error or the <tt>@ref ResultDbNotExist</tt> error if called on a title for which no NBDL tasks have ever been registered.
87 (The title entry for a title is removed from the database if you delete the title in Download Management. This function returns an error if called on that title.)
88 Only use this function on titles for which an NBDL task has been registered.
89 
90 @param[in] flag  Specifies the <tt>OptOut</tt> flag. If <tt>true</tt>, notifications for the corresponding title are not received.
91 @return  Returns the execution result of the function. Returns one of the following <tt>Result</tt> values.
92 @retval Result::IsSuccess  Successfully set.
93 @retval ResultRecordNotExist  The specified title information does not exist.
94 @retval ResultDbNotExist  There is no database for managing the title information.
95 
96 */
97     nn::Result SetOptoutFlag(bool flag);
98 
99 /*!
100 @brief  Gets the <tt>OptOut</tt> flag for the title.
101 
102 If the <tt>OptOut</tt> flag is set to <tt>true</tt>, notifications for that title are not received when they are sent out.
103 This is disabled if the flag is set to <tt>false</tt>. Notifications associated with the title in question are received.
104 Notifications for a title are received if this flag has never been set. (The default value of this flag is <tt>false</tt>.)
105 
106 The value of the <tt>OptOut</tt> flag is recorded in a database for managing title information on the system.
107 For more information, see the <tt>@ref SetOptoutFlag</tt> reference material.
108 As explained in the API reference, this function cannot be used on titles for which there are no entries in the database (such as titles for which no NBDL tasks have been registered).
109 If you call this function on such titles, it returns <tt>false</tt> and you cannot get the value of the <tt>OptOut</tt> flag.
110 (A BOSS library error log may also be output.)
111 Only use this function on titles for which an NBDL task has been registered.
112 
113 @return  Returns the <tt>OptOut</tt> flag value. (Returns <tt>false</tt> if there is no title information.)
114 */
115     bool GetOptoutFlag( void ) const;
116 
117 /*!
118 @deprecated  This API function is outdated. Do not use.
119 */
120     explicit Title( AccountID accountId, TitleID titleId);
121 
122 protected:
123 /*!
124 @brief  Specifies the account ID.
125 */
126     AccountID m_accountId;
127     u8 padding[4];
128 
129 /*!
130 @brief  Specifies the title ID.
131 */
132     TitleID m_titleId;
133 }; //end of class
134 
135 //! @}
136 
137 } // end of namespace boss
138 } // end of namespace nn
139 
140 #endif // __cplusplus
141 
142 #endif /* NN_BOSS_BOSS_TITLE_H_ */
143