/*---------------------------------------------------------------------------* Project: Horizon File: applet_Wrapper.h Copyright (C)2010 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: 26466 $ *---------------------------------------------------------------------------*/ #ifndef NN_APPLET_CTR_APPLET_WRAPPER_H_ #define NN_APPLET_CTR_APPLET_WRAPPER_H_ #include #include #include #include #include namespace nn { namespace applet { namespace CTR { namespace detail { AppletWakeupState WaitForStarting( AppletId* pSenderId=NULL, u8* pParam=NULL, size_t paramSize=0, s32* pReadLen=NULL, nn::Handle *pHandle=NULL, nn::fnd::TimeSpan span=NN_APPLET_WAIT_INFINITE ); AppletWakeupState ProcessHomeButtonIfPrepared(void); } } } } namespace nn { namespace applet { namespace CTR { /*! @name ホームボタン @{ */ /*! @brief ホームボタンの状態を取得します。 nn::applet::CTR::HOME_BUTTON_NONE, HOME_BUTTON_SINGLE_PRESSED, HOME_BUTTON_DOUBLE_PRESSED のいずれかを返します。 nn::applet::CTR::HOME_BUTTON_NONE 以外の状態のときには アプリケーションで必要な処理を行った後に、 PrepareToJumpToHomeMenu(), JumpToHomeMenu() を呼んで WaitForStarting() で起動待ちを行うか、 JumpToHomeMenuIfPrepared() を呼んでください。 JumpToHomeMenuIfPrepared() は PrepareToJumpToHomeMenu(), JumpToHomeMenu() を呼んで WaitForStarting() で起動待ちを行う という一連の流れを内部で行っています。 @return 状態を返します。 */ AppletHomeButtonState GetHomeButtonState(void); /*! @brief ホームボタンの状態をクリアします。 */ void ClearHomeButtonState(void); /*! @} */ /*! @name ホームメニュー @{ */ /*! @brief ホームボタン処理を行います。 GetHomeButtonState() でホームボタンの状態を調べ、 必要なら PrepareToJumpToHomeMenu()、JumpToHomeMenu() を呼び出して WaitForStarting() で起動待ちを行うという一連の動作をまとめて行います。 返り値は、WaitForStarting() の値をそのまま返しています。 nn::applet::CTR::WAKEUP_BY_CANCEL の場合は速やかにアプリケーションを終了させてください。 それ以外の返り値の場合は通常再開してください。 @return 起床した原因を返します。 */ inline AppletWakeupState ProcessHomeButtonIfPrepared(void) { return detail::ProcessHomeButtonIfPrepared(); } /*! @} */ /*! @name スリープ @{ */ /*! @brief スリープ通知状態を取得します。 nn::applet::CTR::NOTIFY_NONE, NOTIFY_SLEEP_QUERY, NOTIFY_SLEEP_ACCEPT, NOTIFY_SLEEP_REJECT, NOTIFY_SLEEP, NOTIFY_AWAKE のいずれかを返します。 スリープ問い合わせのコールバックが呼ばれ、"保留"(nn::applet::CTR::REPLY_LATER) を返した後は nn::applet::CTR::NOTIFY_QUERY となっています。 このときには、速やかに ReplySleepQuery() で返答するようにしてください。 @return 状態を返します。 */ AppletSleepNotificationState GetSleepNotificationState(void); /*! @brief スリープ通知状態をクリアします。 GetSleepNotificationState() で取得できる状態が、 nn::applet::CTR::NOTIFY_NONE となります。 システムでは、この状態を用いて何かの動作を行っていませんので、 どのようなタイミングで状態を変更しても問題はありません。 */ void ClearSleepNotificationState(void); /*! @brief スリープ問い合わせへの返答を行います。 この関数は、スリープ問い合わせのコールバック (SetSleepQueryCallback() で設定します) で、"保留"(nn::CTR::applet::REPLY_LATER) を返した後に 問い合わせの返答を行うために使用してください。 @param[in] reply 返答 */ void ReplySleepQuery( AppletQueryReply reply ); /*! @} */ /*! @name コールバック設定 @{ */ /*! @brief ホームボタン検出コールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetHomeButtonCallback( AppletHomeButtonCallback callback, uptr arg=0 ); /*! @brief メッセージ受け取りコールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetReceiveMessageCallback( AppletMessageCallback callback, uptr arg=0 ); /*! @brief 電源ボタン検出コールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetPowerButtonCallback( AppletPowerButtonCallback callback, uptr arg=0 ); /*! :private @brief 共有メモリ要求受け取りコールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetRequestMemoryCallback( AppletRequestMemoryCallback callback, uptr arg=0 ); /*! :private @brief 共有メモリ解放コールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetReleaseMemoryCallback( AppletReleaseMemoryCallback callback, uptr arg=0 ); /*! :private @brief DSP スリープコールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetDspSleepCallback( AppletDspSleepCallback callback, uptr arg=0 ); /*! :private @brief DSP スリープ復帰コールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetDspWakeUpCallback( AppletDspWakeUpCallback callback, uptr arg=0 ); /*! @brief スリープ問い合わせコールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetSleepQueryCallback( AppletSleepQueryCallback callback, uptr arg=0 ); /*! @brief スリープコールバックを設定します。 この関数は廃止される予定です。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetSleepCallback( AppletSleepCallback callback, uptr arg=0 ); /*! @brief スリープ復帰コールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetAwakeCallback( AppletAwakeCallback callback, uptr arg=0 ); /*! @brief シャットダウン通知コールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetShutdownCallback( AppletShutdownCallback callback, uptr arg=0 ); /*! @brief アプレット終了時コールバックを設定します。 @param[in] callback コールバック @param[in] arg コールバックへの引数 */ void SetCloseAppletCallback( AppletCloseAppletCallback callback, uptr arg=0 ); /*! @} */ /*! @name 動作制御 @{ */ /*! @brief 自身の開始イベントが来るのを待ちます。 開始のイベントを受け取るまでこの関数から戻ります。 関数から戻る際には、AppletWakeupState 列挙型の値が返りますが、その値によって 以降の動作(通常再開するとか、アプリケーションを終了するとか)を決定する必要があります。 nn::applet::CTR::WAKEUP_BY_CANCEL を受け取った場合、速やかにアプリケーションを 終了させてください。 アプリケーションでは、それ以外は通常再開してください。 @param[out] pSenderId イベント送信元の アプレットID @param[out] pParam パラメータバッファ @param[in] paramSize パラメータバッファサイズ @param[out] pReadLen 読み込みサイズ @param[out] pHandle ハンドラ @param[in] timeout タイムアウト時間 @return 状態を返します。 */ inline AppletWakeupState WaitForStarting( AppletId* pSenderId=NULL, u8* pParam=NULL, size_t paramSize=0, s32* pReadLen=NULL, nn::Handle *pHandle=NULL, nn::fnd::TimeSpan timeout=NN_APPLET_WAIT_INFINITE ) { return detail::WaitForStarting( pSenderId, pParam, paramSize, pReadLen, pHandle, timeout ); } /*! @} */ } } } #include NN_EXTERN_C inline AppletHomeButtonState nnappletGetHomeButtonState(void) { return nn::applet::CTR::GetHomeButtonState(); } NN_EXTERN_C inline void nnappletClearHomeButtonState(void) { nn::applet::CTR::ClearHomeButtonState(); } NN_EXTERN_C inline AppletWakeupState nnappletWaitForStarting( AppletId* pSenderId=NULL, u8* pParam=NULL, size_t paramSize=0, s32* pReadLen=NULL, nn::Handle *pHandle=NULL ) { return nn::applet::CTR::WaitForStarting( pSenderId, pParam, paramSize, pReadLen, pHandle ); } NN_EXTERN_C inline AppletWakeupState nnappletProcessHomeButtonIfPrepared(void) { return nn::applet::CTR::ProcessHomeButtonIfPrepared(); } #endif // ifndef NN_APPLET_CTR_APPLET_WRAPPER_H_