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: 25279 $
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  PORT_NAME_SPVR[] = "hid:SPVR";
46     const char  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       処理の結果が返ってきます。
64               <BR> 注意 ) ここに記載されたエラーコードは変更する可能性があります。<BR>
65                 LEVEL_SUCCESS:SUMMARY_SUCCESS:MODULE_COMMON:DESCRIPTION_SUCCESS ・・・ 成功しました。<BR>
66                 LEVEL_USAGE:SUMMARY_INVALID_STATE:MODULE_NN_HID:DESCRIPTION_ALREADY_INITIALIZED ・・・すでに 初期化済みです。<BR>
67 
68 */
69 nn::Result    Initialize( );
70 
71 /*!
72 @brief        HID ライブラリを終了します。
73 
74 @return       なし。
75 
76 */
77 void          Finalize( );
78 
79 /*!
80   @}
81 */
82 
83 /*!
84 @brief        Pad クラスの参照を取得します。
85 
86               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
87 
88 @return       Pad クラスの参照を返します。
89 
90 */
91 Pad&          GetPad( );
92 
93 /*!
94 @brief        TouchPanel クラスの参照を取得します。
95 
96               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
97 
98 @return       TouchPanel クラスの参照を返します。
99 
100 */
101 TouchPanel&   GetTouchPanel();
102 
103 /*!
104 @brief        Accelerometer クラスの参照を取得します。
105 
106               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
107 
108 @return       Accelerometer クラスの参照を返します。
109 
110 */
111 Accelerometer& GetAccelerometer();
112 /*!
113 @brief        Gyroscope クラスの参照を取得します。
114 
115               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
116 
117 @return       Gyroscope クラスの参照を返します。
118 
119 */
120 Gyroscope&    GetGyroscope();
121 
122 
123 /*!
124 @brief        DebugPad クラスの参照を取得します。
125 
126               @ref nn::hid::CTR::Initialize( ) で初期化した後に使用できます。
127 
128 @return       DebugPad クラスの参照を返します。
129 
130 */
131 DebugPad&      GetDebugPad();
132 
133 } // namespace CTR {
134 } // namespace hid {
135 } // namespace nn {
136 
137 
138 
139 #endif //   #ifndef NN_HID_CTR_HID_API_H_
140