1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     pl_PedometerApi.h
4 
5   Copyright (C)2009-2012 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: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_PL_CTR_PL_PEDOMETER_API_H_
17 #define NN_PL_CTR_PL_PEDOMETER_API_H_
18 
19 #include <nn/Result.h>
20 #include <nn/types.h>
21 #include <nn/fnd.h>
22 
23 #ifdef __cplusplus
24 
25 namespace nn {
26 namespace pl {
27 namespace CTR {
28 
29 namespace detail{
30     typedef enum _IPCPortType
31     {
32         PORT_PEDOMETER = 0,
33         PORT_PEDOMETER_HID,
34         PORT_PEDOMETER_SYS,
35         NUM_OF_IPC_PORTS
36     } IPCPortType;
37 
38 }
39 
40 const char  PORT_NAME_PEDOMETER[] = "ptm:pdm";
41 const char  PORT_NAME_PEDOMETER_HID[] = "ptm:pdmh";
42 const char  PORT_NAME_PEDOMETER_SYS[] = "ptm:pdms";
43 
44 
45 /* Please see man pages for details
46 
47 
48 */
49 
50 const s32 MAX_MONTHDAYS = 31; //
51 const s32 DAYHOURS = 24; //
52 const s32 NUM_FREESPACE = 2; //
53 const s32 NUM_MONTHHISTORIES = 12 * 10; //
54 const s32 MAX_MONTHHISTORIES = NUM_MONTHHISTORIES + NUM_FREESPACE; //
55 const s32 NUM_MONTHHISTORYENTRIES = MAX_MONTHDAYS * DAYHOURS; //
56 const u16 INVALID_COUNTER = 0xffff; //
57 
58 /* Please see man pages for details
59 
60 
61 
62 */
63 struct PedometerMonthHeader
64 {
65     u16 unusedCounter; //
66     s16 year;          //
67     s16 month;         //
68 };
69 
70 /* Please see man pages for details
71 
72 
73 
74 */
75 struct PedometerHistoryHeader
76 {
77     s32 version;                                        //
78     u32 totalStepCount;                                 //
79     nn::fnd::DateTime startRecordTime;                  //
80     PedometerMonthHeader monthInfo[MAX_MONTHHISTORIES]; //
81     NN_PADDING4;
82 };
83 
84 /* Please see man pages for details
85 
86 */
87 typedef u16 PedometerMonthData[NUM_MONTHHISTORYENTRIES];
88 
89 /* Please see man pages for details
90 
91 */
92 typedef PedometerMonthData PedometerHistoryData[MAX_MONTHHISTORIES];
93 
94 /*
95 
96 */
97 enum Description
98 {
99     DESCRIPTION_PEDOMETER_IS_WRITING = 1 //
100 };
101 
102 /* Please see man pages for details
103 
104 
105 */
106     NN_DEFINE_RESULT_CONST(
107         ResultIsWriting,
108         Result::LEVEL_STATUS, Result::SUMMARY_NOTHING_HAPPENED, Result::MODULE_NN_PTM, DESCRIPTION_PEDOMETER_IS_WRITING
109     );
110 
111 
112 
113 /* Please see man pages for details
114 
115 */
116 struct PedometerEntry
117 {
118   s16 year;
119   s16 month;
120 };
121 
122 /* Please see man pages for details
123 
124 
125 
126 */
127 bool GetPedometerState();
128 
129 /* Please see man pages for details
130 
131 
132 
133 */
134 s8 GetStepHistoryEntry(PedometerEntry* pEntry);
135 
136 /* Please see man pages for details
137 
138 
139 
140 
141 
142 */
143 void GetStepHistory( u16 pStepCounts[], s32 numHours, nn::fnd::DateTime start );
144 
145 /* Please see man pages for details
146 
147 
148 
149 */
150 u32 GetTotalStepCount();
151 
152 /* Please see man pages for details
153 
154 
155 
156 
157 
158 
159 
160 
161 */
162 nn::Result GetStepHistoryAll( PedometerHistoryHeader& header, PedometerHistoryData& data );
163 
164 /*
165 
166 */
167 
168 } // namespace CTR {
169 } // namespace pl {
170 } // namespace nn {
171 
172 #endif
173 
174 #endif //   #ifndef NN_PL_CTR_PL_PEDOMETER_API_H_
175