1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     applet_Wrapper.h
4 
5   Copyright (C)2010 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 36009 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_APPLET_CTR_APPLET_WRAPPER_H_
17 #define NN_APPLET_CTR_APPLET_WRAPPER_H_
18 
19 #include <nn/os.h>
20 #include <nn/applet/CTR/applet_Parameters.h>
21 #include <nn/applet/CTR/applet_API.h>
22 #include <nn/applet/CTR/applet_Gfx.h>
23 
24 namespace nn {
25 namespace applet {
26 namespace CTR {
27 namespace detail {
28 
29     AppletWakeupState WaitForStarting( AppletId* pSenderId=NULL, u8* pParam=NULL, size_t paramSize=0, s32* pReadLen=NULL,
30                                        nn::Handle *pHandle=NULL, nn::fnd::TimeSpan span=NN_APPLET_WAIT_INFINITE );
31     bool ProcessHomeButton(void);
32 }
33 }
34 }
35 }
36 
37 namespace nn {
38 namespace applet {
39 namespace CTR {
40     /* Please see man pages for details
41 
42 
43      */
44     /* Please see man pages for details
45 
46 
47      */
48     AppletHomeButtonState GetHomeButtonState(void);
49 
50     /* Please see man pages for details
51 
52     */
53     void ClearHomeButtonState(void);
54 
55     // Internal functions (non-public)
56     bool IsExpectedToJumpToHomeMenu(void);
57     // Internal functions (non-public)
58     void SetExpectationToJumpToHomeMenu( bool sw );
59 
60     /* Please see man pages for details
61 
62 
63     */
64     bool IsExpectedToProcessHomeButton(void);
65     /*
66 
67 */
68 
69     /* Please see man pages for details
70 
71 
72      */
73     /* Please see man pages for details
74 
75 
76      */
ProcessHomeButton(void)77     inline bool ProcessHomeButton(void)
78     {
79         return detail::ProcessHomeButton();
80     }
81     /* Please see man pages for details
82 
83      */
84     void ProcessHomeButtonAndWait();
85 
86     // ↓This function uses old notation. Instead, use the ProcessHomeButton function.
87     //   (The original version was retained for compatibility)
ProcessHomeButtonIfPrepared(void)88     inline bool ProcessHomeButtonIfPrepared(void)
89     {
90         return detail::ProcessHomeButton();
91     }
92     /*
93 
94 */
95 
96     /* Please see man pages for details
97 
98 
99      */
100     /* Please see man pages for details
101 
102 
103      */
104     bool ProcessPowerButton(void);
105 
106     /* Please see man pages for details
107 
108      */
109     void ProcessPowerButtonAndWait();
110     /*
111 
112 */
113 
114     /* Please see man pages for details
115 
116 
117      */
118     /* Please see man pages for details
119 
120 
121      */
122     bool IsExpectedToReplySleepQuery(void);
123 
124     /* Please see man pages for details
125 
126 
127      */
128     void ReplySleepQuery( AppletQueryReply reply );
129     /*
130 
131 */
132 
133 
134     /* Please see man pages for details
135 
136 
137      */
138     /* Please see man pages for details
139 
140 
141 
142      */
143     void SetHomeButtonCallback( AppletHomeButtonCallback callback, uptr arg=0 );
144 
145     /* Please see man pages for details
146 
147 
148 
149      */
150     void SetReceiveMessageCallback( AppletMessageCallback callback, uptr arg=0 );
151 
152     /* Please see man pages for details
153 
154 
155 
156      */
157     void SetPowerButtonCallback( AppletPowerButtonCallback callback, uptr arg=0 );
158 
159     /* Please see man pages for details
160 
161 
162 
163      */
164     void SetRequestMemoryCallback( AppletRequestMemoryCallback callback, uptr arg=0 );
165     /* Please see man pages for details
166 
167 
168 
169      */
170     void SetReleaseMemoryCallback( AppletReleaseMemoryCallback callback, uptr arg=0 );
171 
172     /* Please see man pages for details
173 
174 
175 
176      */
177     void SetDspSleepCallback( AppletDspSleepCallback callback, uptr arg=0 );
178     /* Please see man pages for details
179 
180 
181 
182      */
183     void SetDspWakeUpCallback( AppletDspWakeUpCallback callback, uptr arg=0 );
184 
185     /* Please see man pages for details
186 
187 
188 
189      */
190     void SetSleepQueryCallback( AppletSleepQueryCallback callback, uptr arg=0 );
191     /* Please see man pages for details
192 
193 
194 
195      */
196     void SetSleepCanceledCallback( AppletSleepCanceledCallback callback, uptr arg=0 );
197     /* Please see man pages for details
198 
199 
200 
201      */
202     void SetAwakeCallback( AppletAwakeCallback callback, uptr arg=0 );
203 
204     /* Please see man pages for details
205 
206 
207 
208      */
209     void SetShutdownCallback( AppletShutdownCallback callback, uptr arg=0 );
210 
211     /* Please see man pages for details
212 
213 
214 
215      */
216     void SetCloseAppletCallback( AppletCloseAppletCallback callback, uptr arg=0 );
217 
218     /* Please see man pages for details
219 
220 
221 
222      */
223     void SetTransitionCallback( AppletTransitionCallback callback, uptr arg=0 );
224 
225     /* Please see man pages for details
226 
227 
228 
229      */
230     void SetCloseCallback( AppletCloseCallback callback, uptr arg=0 );
231 
232     /*
233 
234 */
235 
236     /* Please see man pages for details
237 
238 
239      */
240     /* Please see man pages for details
241 
242 
243 
244 
245 
246 
247 
248 
249 
250 
251      */
252     inline AppletWakeupState WaitForStarting( AppletId* pSenderId=NULL, u8* pParam=NULL, size_t paramSize=0, s32* pReadLen=NULL,
253                                               nn::Handle *pHandle=NULL, nn::fnd::TimeSpan timeout=NN_APPLET_WAIT_INFINITE )
254     {
255         return detail::WaitForStarting( pSenderId, pParam, paramSize, pReadLen, pHandle, timeout );
256     }
257     /*
258 
259 */
260 
261     /* Please see man pages for details
262 
263 
264      */
265     bool IsAppletPreloaded( AppletId id );
266     void WaitForAppletPreloaded( AppletId id );
267     /*
268 
269 */
270 
271     /* Please see man pages for details
272 
273 
274      */
275     /* Please see man pages for details
276 
277 
278      */
279     void EnableSleep( bool isSleepCheck=nn::applet::CTR::SLEEP_IF_SHELL_CLOSED );
280 
281     /* Please see man pages for details
282 
283 
284 
285      */
286     void DisableSleep( bool isReplyReject=nn::applet::CTR::REPLY_REJECT_IF_LATER );
287 
288     /* Please see man pages for details
289 
290 
291 
292 
293 
294 
295      */
296     bool IsEnableSleep();
297     /*
298 
299 */
300 }
301 }
302 }
303 
304 #include <nn/util/detail/util_CLibImpl.h>
nnappletGetHomeButtonState(void)305 NN_EXTERN_C inline AppletHomeButtonState nnappletGetHomeButtonState(void)
306 {
307     return nn::applet::CTR::GetHomeButtonState();
308 }
nnappletClearHomeButtonState(void)309 NN_EXTERN_C inline void nnappletClearHomeButtonState(void)
310 {
311     nn::applet::CTR::ClearHomeButtonState();
312 }
313 
314 NN_EXTERN_C inline AppletWakeupState nnappletWaitForStarting( AppletId* pSenderId=NULL, u8* pParam=NULL, size_t paramSize=0, s32* pReadLen=NULL, nn::Handle *pHandle=NULL )
315 {
316     return nn::applet::CTR::WaitForStarting( pSenderId, pParam, paramSize, pReadLen, pHandle );
317 }
nnappletProcessHomeButton(void)318 NN_EXTERN_C inline bool nnappletProcessHomeButton(void)
319 {
320     return nn::applet::CTR::ProcessHomeButton();
321 }
322 
323 #endif  // ifndef NN_APPLET_CTR_APPLET_WRAPPER_H_
324