/*---------------------------------------------------------------------------* Project: Horizon File: applet.h Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 48673 $ *---------------------------------------------------------------------------*/ #ifndef NN_SAMPLE_DEMOS_DEMO1_APPLET_H_ #define NN_SAMPLE_DEMOS_DEMO1_APPLET_H_ #include #include class TransitionHandler { public: typedef void (*TRANSITION_CALLBACK)(); public: TransitionHandler() {} ~TransitionHandler() {} /* Please see man pages for details */ static void Initialize(); /* Please see man pages for details */ static void Finalize(); /* Please see man pages for details */ static void EnableSleep(); /* Please see man pages for details */ static void DisableSleep(); /* Please see man pages for details */ static void Process(); /* Please see man pages for details */ static bool IsExitRequired(); /* Please see man pages for details */ static void Lock(); /* Please see man pages for details */ static bool TryLock(); /* Please see man pages for details */ static void Unlock(); /* Please see man pages for details */ static void LockForSleep(); /* Please see man pages for details */ static bool TryLockForSleep(); /* Please see man pages for details */ static void UnlockForSleep(); /* Please see man pages for details */ static void SetPrepareSleepCallback(TRANSITION_CALLBACK f) { s_PrepareSleepCallback = f; } /* Please see man pages for details */ static void SetAfterSleepCallback(TRANSITION_CALLBACK f) { s_AfterSleepCallback = f; } /* Please see man pages for details */ static void SetPrepareHomeButtonCallback(TRANSITION_CALLBACK f) { s_PrepareHomeButtonCallback = f; } /* Please see man pages for details */ static void SetAfterHomeButtonCallback(TRANSITION_CALLBACK f) { s_AfterHomeButtonCallback = f; } /* Please see man pages for details */ static void SetPreparePowerButtonCallback(TRANSITION_CALLBACK f) { s_PreparePowerButtonCallback = f; } private: /* Please see man pages for details */ static AppletQueryReply SleepQueryCallback( uptr arg ); /* Please see man pages for details */ static void AwakeCallback( uptr arg ); private: static bool s_IsExitRequired; // Flag to enable LCD after waiting for one-frame worth of rendering after recovering from sleep static volatile bool s_IsAfterWakeUp; // Event used for Sleep Mode static nn::os::LightEvent s_AwakeEvent; // CriticalSection used for mutual exclusion related to transitions and Sleep Mode static nn::os::CriticalSection s_CriticalSection; static nn::os::CriticalSection s_CriticalSectionForSleep; // Process before sleep transition static TRANSITION_CALLBACK s_PrepareSleepCallback; // Process after recovery from sleep static TRANSITION_CALLBACK s_AfterSleepCallback; // Process before HOME Menu transition static TRANSITION_CALLBACK s_PrepareHomeButtonCallback; // Process after return from HOME Menu. static TRANSITION_CALLBACK s_AfterHomeButtonCallback; // Process before display of POWER Menu static TRANSITION_CALLBACK s_PreparePowerButtonCallback; }; #endif // NN_SAMPLE_DEMOS_DEMO1_APPLET_H_