1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     ptm_Api.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: 34180 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_PTM_CTR_PTM_API_H_
17 #define NN_PTM_CTR_PTM_API_H_
18 
19 #include <nn/Handle.h>
20 #include <nn/Result.h>
21 #include <nn/types.h>
22 #include <nn/fnd.h>
23 
24 namespace nn {
25 namespace ptm {
26 namespace CTR {
27 
28     /*!
29     @brief      PTM ライブラリの初期化を行います。
30 
31     @return     通常失敗することはあり得ません。ResultSuccess が返ります。
32     */
33     Result Initialize();
34 
35     /*!
36     @brief      PTM ライブラリを終了します。
37 
38     @return     通常失敗することはあり得ません。ResultSuccess が返ります。
39     */
40     Result Finalize();
41 
42     /*!
43         @name アラーム関連
44         @{
45     */
46 
47     /*!
48         @brief アラームの通知取得用のイベントを登録します。
49 
50         @param[in]  event       アラーム通知用のイベントを指定します。
51         @return                 必ず ResultSuccess を返します。
52     */
53     Result RegisterAlarmEvent(nn::os::Event &event);
54 
55     /*!
56         @brief  アラームをセットします
57 
58         @param[in]  datetime    アラームの時刻を指定します
59 
60         @return     関数の実行結果を返します。以下に挙げる Result を返します。
61         @retval     ResultSuccess               処理に成功しました。
62         @retval     ResultNotRegistered         @ref nn::ptm::CTR::RegisterAlarmEvent が実行されていません。
63         @retval     ResultInvalidAlarm          指定している年月日が範囲外です。
64         @retval     ResultOverWriteAlarm        既に設定されていました。
65     */
66     Result SetRtcAlarm(nn::fnd::DateTime datetime);
67 
68     /*!
69         @brief 設定したアラームの時刻を取得します。
70         @param[out] pDatetime   取得した時刻を入れるアドレスを指定します。
71         @return     関数の実行結果を返します。以下に挙げる Result を返します。
72         @retval     ResultSuccess               処理に成功しました。
73         @retval     ResultNoAlarm               アラームが設定されていません。
74 
75         @ref SetRtcAlarm で設定した時刻を取得します。
76 
77         既に時刻が通知されている場合、アラームが設定されていない場合には @ref nn::ptm::ResultNoAlarm が返ります。
78         このとき pDatetime には値は入りません。
79     */
80     Result GetRtcAlarm(nn::fnd::DateTime *pDatetime);
81 
82     /*!
83         @brief      設定したアラームをキャンセルします。
84         @return     関数の実行結果を返します。以下に挙げる Result を返します。
85         @retval     ResultSuccess               処理に成功しました。
86         @retval     ResultNoAlarm               アラームが設定されていません。
87 
88         既に時刻が通知されている場合、アラームが設定されていない場合には @ref nn::ptm::ResultNoAlarm が返ります。
89     */
90     Result CancelRtcAlarm();
91 
92     /*!
93         @}
94     */
95 
96     /*!
97         @name 本体状態
98         @{
99     */
100 
101     /*!
102         @brief  電源アダプタの状態を表します。
103     */
104     enum AdapterState
105     {
106         ADAPTERSTATE_NOCONNECTED,       //!< アダプタは接続されていません。
107         ADAPTERSTATE_CONNECTED          //!< アダプタは接続されています。
108     };
109 
110     /*!
111         @brief  バッテリの充電状態を表します
112     */
113     enum BatteryChargeState
114     {
115         BATTERYCHARGESTATE_NOCHARGING,   //!< 充電中ではありません。
116         BATTERYCHARGESTATE_CHARGING      //!< 充電中です。
117     };
118 
119     /*!
120         @brief  バッテリの残量をレベルで表します。
121     */
122     enum BatteryLevel
123     {
124         BATTERYLEVEL_0,                 //!<  0%
125         BATTERYLEVEL_1,                 //!<  1% ~   5%
126         BATTERYLEVEL_2,                 //!<  6% ~  10%
127         BATTERYLEVEL_3,                 //!< 11% ~  30%
128         BATTERYLEVEL_4,                 //!< 31% ~  60%
129         BATTERYLEVEL_5,                 //!< 61% ~ 100%
130 
131         BATTERYLEVEL_MIN = BATTERYLEVEL_0,  //!< バッテリレベルの最小値です。
132         BATTERYLEVEL_MAX = BATTERYLEVEL_5   //!< バッテリレベルの最大値です。
133     };
134 
135     /*!
136         :private
137 
138         @brief  本体識別情報を表します。
139     */
140     enum HardwareType
141     {
142         HARDWARE_TYPE_DEVICE,           //!< 実機
143         HARDWARE_TYPE_BOARD,            //!< TSボード
144         HARDWARE_TYPE_DEBUGGER          //!< デバッガ
145     };
146 
147     /*!
148         @brief  電源アダプタの状態を取得します。
149 
150         @return 電源アダプタの状態を返します。
151     */
152     AdapterState    GetAdapterState();
153 
154     /*!
155         @brief  バッテリの残量をレベルで取得します。
156 
157         @return バッテリ残量のレベルを返します。
158     */
159     BatteryLevel    GetBatteryLevel();
160 
161     /*!
162         @brief  バッテリの充電状態を取得します。
163 
164         @return バッテリの充電状態を返します。
165     */
166     BatteryChargeState GetBatteryChargeState();
167 
168     /*!
169         @}
170     */
171 } // end of namespace CTR
172 } // end of namespace ptm
173 } // end of namespace nn
174 
175 
176 #endif  // ifndef NN_PTM_CTR_PTM_API_H_
177