1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     hid_Api.h
4 
5   Copyright (C)2009 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_HID_CTR_HID_API_H_
17 #define NN_HID_CTR_HID_API_H_
18 
19 /*! @file
20     @brief      HID ライブラリの初期化、終了を行う API です。
21 */
22 
23 #include <nn/Result.h>
24 #include <nn/types.h>
25 #include <nn/hid/CTR/hid_Pad.h>
26 #include <nn/hid/CTR/hid_TouchPanel.h>
27 #include <nn/hid/CTR/hid_Accelerometer.h>
28 #include <nn/hid/CTR/hid_Gyroscope.h>
29 #include <nn/hid/CTR/hid_DebugPad.h>
30 
31 namespace nn {
32 namespace hid {
33 namespace CTR {
34 
35 namespace detail{
36     typedef enum _IPCPortType
37     {
38         PORT_SPVR = 0,
39         PORT_USER,
40         NUM_OF_IPC_PORTS
41     } IPCPortType;
42 }
43 
44 namespace{
45     const char *const PORT_NAME_SPVR = "hid:SPVR";
46     const char *const PORT_NAME_USER = "hid:USER";
47 }
48 
49 
50 /*!
51   @name     Initialize/Finalize
52 
53   @{
54 */
55 
56 /*!
57 @brief        HID ライブラリの初期化を行い、サンプリングデータを読み込める状態にします。
58 
59     システムで確保されたメモリが、入力バッファとしてアプリケーションのメモリ空間に 4KB 割り付けられます。<BR>
60     このアドレスは、アプリケーションが使用するヒープの領域と被ることはありません。<BR>
61     もうすでに nn::hid::CTR::Initialize() が呼ばれている場合はなにも行なわずエラーを返します。
62 
63     @return     関数の実行結果を返します。以下に挙げる Result を返します。
64     @retval     ResultSuccess                処理に成功しました。
65     @retval     MakeResultAlreadyInitialized 既に初期化済みです。
66 
67 */
68 nn::Result    Initialize( );
69 
70 /*!
71 @brief        HID ライブラリを終了します。
72 
73 @return       なし。
74 
75 */
76 void          Finalize( );
77 
78 /*!
79   @}
80 */
81 
82 /*!
83 @brief        Pad クラスの参照を取得します。
84 
85               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
86 
87 @return       Pad クラスの参照を返します。
88 
89 */
90 Pad&          GetPad( );
91 
92 /*!
93 @brief        TouchPanel クラスの参照を取得します。
94 
95               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
96 
97 @return       TouchPanel クラスの参照を返します。
98 
99 */
100 TouchPanel&   GetTouchPanel();
101 
102 /*!
103 @brief        Accelerometer クラスの参照を取得します。
104 
105               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
106 
107 @return       Accelerometer クラスの参照を返します。
108 
109 */
110 Accelerometer& GetAccelerometer();
111 /*!
112 @brief        Gyroscope クラスの参照を取得します。
113 
114               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
115 
116 @return       Gyroscope クラスの参照を返します。
117 
118 */
119 Gyroscope&    GetGyroscope();
120 
121 
122 /*!
123 @brief        DebugPad クラスの参照を取得します。
124 
125               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
126 
127 @return       DebugPad クラスの参照を返します。
128 
129 */
130 DebugPad&      GetDebugPad();
131 
132 } // namespace CTR {
133 } // namespace hid {
134 } // namespace nn {
135 
136 
137 
138 #endif //   #ifndef NN_HID_CTR_HID_API_H_
139