1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     friends_Types.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: 35843 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_FRIENDS_CTR_FRIENDS_TYPES_H_
17 #define NN_FRIENDS_CTR_FRIENDS_TYPES_H_
18 
19 #include <nn/types.h>
20 #include <nn/fnd.h>
21 
22 /* Please see man pages for details
23 
24 
25 */
26 
27 #define NN_FRIENDS_INVALID_PRINCIPAL_ID             (0)     //
28 #define NN_FRIENDS_INVALID_LOCAL_FRIEND_CODE        (0ULL)  //
29 
30 #define NN_FRIENDS_SCREEN_NAME_SIZE                 (11)    //
31 #define NN_FRIENDS_MODE_DESCRIPTION_SIZE            (128)   //
32 #define NN_FRIENDS_MII_SIZE                         (96)    //
33 #define NN_FRIENDS_APPLICATION_ARG_SIZE             (20)
34 #define NN_FRIENDS_FRIEND_LIST_SIZE                 (100)   //
35 
36 #define NN_FRIENDS_INVALID_GAME_ID                   (0)
37 
38 /* Please see man pages for details
39 
40 */
41 enum nnfriendsPlatformCode
42 {
43     NN_FRIENDS_PLATFORM_CTR = 2        //
44 };
45 typedef enum nnfriendsPlatformCode nnfriendsPlatformCode;
46 
47 /* Please see man pages for details
48 
49 */
50 enum nnfriendsAttributeFlag
51 {
52     NN_FRIENDS_ATTRIBUTE_FLAG_ESTABLISHED           = 1 << 0,   //
53     NN_FRIENDS_ATTRIBUTE_FLAG_REMOTE_ACCESSIBLE     = 1 << 1    //
54 };
55 typedef enum nnfriendsAttributeFlag nnfriendsAttributeFlag;
56 
57 /* Please see man pages for details
58 
59 */
60 enum nnfriendsNotificationType
61 {
62     NN_FRIENDS_NOTIFICATION_NONE = 0,                   //
63     NN_FRIENDS_NOTIFICATION_ONLINE,                     //
64     NN_FRIENDS_NOTIFICATION_OFFLINE,                    //
65     NN_FRIENDS_NOTIFICATION_FRIEND_ONLINE,              //
66     NN_FRIENDS_NOTIFICATION_FRIEND_PRESENCE,            //
67     NN_FRIENDS_NOTIFICATION_FRIEND_MII,                 //
68     NN_FRIENDS_NOTIFICATION_FRIEND_PROFILE,             //
69     NN_FRIENDS_NOTIFICATION_FRIEND_OFFLINE,             //
70     NN_FRIENDS_NOTIFICATION_BECOME_FRIEND,              //
71     NN_FRIENDS_NOTIFICATION_INVITATION                  //
72 };
73 typedef enum nnfriendsNotificationType nnfriendsNotificationType;
74 
75 /* Please see man pages for details
76 
77 */
78 enum nnfriendsNotificationMask
79 {
80     NN_FRIENDS_NOTIFICATION_MASK_ONLINE                  = 1 << 0,                                                  //
81     NN_FRIENDS_NOTIFICATION_MASK_OFFLINE                 = 1 << 1,                                                  //
82     NN_FRIENDS_NOTIFICATION_MASK_FRIEND_ONLINE           = 1 << 2,                                                  //
83     NN_FRIENDS_NOTIFICATION_MASK_FRIEND_PRESENCE         = 1 << 3,                                                  //
84     NN_FRIENDS_NOTIFICATION_MASK_FRIEND_MII              = 1 << 4,                                                  //
85     NN_FRIENDS_NOTIFICATION_MASK_FRIEND_PROFILE          = 1 << 5,                                                  //
86     NN_FRIENDS_NOTIFICATION_MASK_FRIEND_OFFLINE          = 1 << 6,                                                  //
87     NN_FRIENDS_NOTIFICATION_MASK_BECOME_FRIEND           = 1 << 7,                                                  //
88     NN_FRIENDS_NOTIFICATION_MASK_INVITATION              = 1 << 8,                                                  //
89 
90     NN_FRIENDS_NOTIFICATION_MASK_DEFAULT                 = NN_FRIENDS_NOTIFICATION_MASK_ONLINE          |
91                                                            NN_FRIENDS_NOTIFICATION_MASK_OFFLINE         |
92                                                            NN_FRIENDS_NOTIFICATION_MASK_FRIEND_ONLINE   |
93                                                            NN_FRIENDS_NOTIFICATION_MASK_FRIEND_MII      |
94                                                            NN_FRIENDS_NOTIFICATION_MASK_FRIEND_PROFILE  |
95                                                            NN_FRIENDS_NOTIFICATION_MASK_FRIEND_OFFLINE  |
96                                                            NN_FRIENDS_NOTIFICATION_MASK_BECOME_FRIEND               //
97 };
98 typedef enum nnfriendsNotificationMask nnfriendsNotificationMask;
99 
100 enum nnfriendsFontRegion
101 {
102     NN_FRIENDS_FONT_REGION_JP_US_EU,
103     NN_FRIENDS_FONT_REGION_CHINA,
104     NN_FRIENDS_FONT_REGION_KOREA,
105     NN_FRIENDS_FONT_REGION_TAIWAN,
106 
107     NN_FRIENDS_FONT_REGION_UNKNOWN = 255
108 };
109 typedef enum nnfriendsFontRegion nnfriendsFontRegion;
110 
111 /////////////////////////////////////////////////////////////////////////
112 
113 /* Please see man pages for details */
114 typedef u32 nnfriendsPrincipalId;
115 /* Please see man pages for details */
116 typedef u64 nnfriendsLocalFriendCode;
117 
118 /* Please see man pages for details
119 
120 */
121 struct nnfriendsFriendKey
122 {
123     nnfriendsPrincipalId     principalId;           //
124     NN_PADDING4;                                    //
125     nnfriendsLocalFriendCode localFriendCode;       //
126 
127 #ifdef __cplusplus
initializennfriendsFriendKey128     inline void initialize()
129     {
130         this->principalId     = NN_FRIENDS_INVALID_PRINCIPAL_ID;
131         this->localFriendCode = NN_FRIENDS_INVALID_LOCAL_FRIEND_CODE;
132     }
133 
initializennfriendsFriendKey134     inline void initialize( nnfriendsPrincipalId principalId )
135     {
136         this->principalId     = principalId;
137         this->localFriendCode = NN_FRIENDS_INVALID_LOCAL_FRIEND_CODE;
138     }
139 
initializennfriendsFriendKey140     inline void initialize( nnfriendsLocalFriendCode localFriendCode )
141     {
142         this->principalId     = NN_FRIENDS_INVALID_PRINCIPAL_ID;
143         this->localFriendCode = localFriendCode;
144     }
145 
initializennfriendsFriendKey146     inline void initialize( nnfriendsPrincipalId principalId, nnfriendsLocalFriendCode localFriendCode )
147     {
148         this->principalId     = principalId;
149         this->localFriendCode = localFriendCode;
150     }
151 
nnfriendsFriendKeynnfriendsFriendKey152     inline nnfriendsFriendKey() {}
nnfriendsFriendKeynnfriendsFriendKey153     inline nnfriendsFriendKey( nnfriendsPrincipalId     principalId )     { initialize(principalId);     }
nnfriendsFriendKeynnfriendsFriendKey154     inline nnfriendsFriendKey( nnfriendsLocalFriendCode localFriendCode ) { initialize(localFriendCode); }
nnfriendsFriendKeynnfriendsFriendKey155     inline nnfriendsFriendKey( nnfriendsPrincipalId principalId, nnfriendsLocalFriendCode localFriendCode ) { initialize(principalId, localFriendCode); }
156 #endif
157 };
158 typedef struct nnfriendsFriendKey nnfriendsFriendKey;
159 
160 /* Please see man pages for details
161 
162 */
163 struct nnfriendsProfile
164 {
165     u8 region;      //
166     u8 country;     //
167     u8 area;        //
168     u8 language;    //
169     u8 platform;    //
170     NN_PADDING3;    //
171 };
172 typedef struct nnfriendsProfile nnfriendsProfile;
173 
174 /* Please see man pages for details
175 
176 
177 
178 */
179 struct nnfriendsMiiData
180 {
181     union {
182         u8  data[NN_FRIENDS_MII_SIZE];                      //
183         u32 value32[NN_FRIENDS_MII_SIZE / sizeof(u32)];     //
184     };
185 };
186 typedef struct nnfriendsMiiData nnfriendsMiiData;
187 
188 /* Please see man pages for details
189 
190 
191 
192 */
193 struct nnfriendsGameMode
194 {
195     u32                  joinAvailabilityFlag;                              //
196     u32                  matchmakeSystemType;                               //
197     u32                  joinGameId;                                        //
198     u32                  joinGameMode;                                      //
199     nnfriendsPrincipalId ownerPrincipalId;                                  //
200     u32                  joinGroupId;                                       //
201     u8                   applicationArg[NN_FRIENDS_APPLICATION_ARG_SIZE];   //
202 };
203 typedef struct nnfriendsGameMode nnfriendsGameMode;
204 
205 /* Please see man pages for details
206 
207 */
208 struct nnfriendsMyPresence
209 {
210     nnfriendsGameMode gameMode;                                             //
211     char16            modeDescription[NN_FRIENDS_MODE_DESCRIPTION_SIZE];    //
212 };
213 typedef struct nnfriendsMyPresence nnfriendsMyPresence;
214 
215 /* Please see man pages for details
216 
217 */
218 struct nnfriendsFriendPresence
219 {
220     nnfriendsGameMode gameMode;         //
221     bool              isOnline;         //
222     bool              isInvitingMe;     //
223     bool              isValid;          //
224     NN_PADDING1;                        //
225 };
226 typedef struct nnfriendsFriendPresence nnfriendsFriendPresence;
227 
228 /* Please see man pages for details
229 
230 */
231 struct nnfriendsEventNotification
232 {
233     u8                 type;            //
234     NN_PADDING3;                        //
235     NN_PADDING4;                        //
236     nnfriendsFriendKey friendKey;       //
237 };
238 typedef struct nnfriendsEventNotification nnfriendsEventNotification;
239 
240 /*
241 
242 */
243 
244 #ifdef __cplusplus
245 
246 namespace nn {
247 namespace friends {
248 namespace CTR {
249 
250     namespace detail {
251 
252     } // end of namespace detail
253 
254     /* Please see man pages for details */
255     typedef ::nnfriendsPrincipalId                    PrincipalId;
256     /* Please see man pages for details */
257     typedef ::nnfriendsLocalFriendCode                LocalFriendCode;
258 
259     static const PrincipalId     INVALID_PRINCIPAL_ID         = NN_FRIENDS_INVALID_PRINCIPAL_ID;            //
260     static const LocalFriendCode INVALID_LOCAL_FRIEND_CODE    = NN_FRIENDS_INVALID_LOCAL_FRIEND_CODE;       //
261 
262     static const u32 SCREEN_NAME_SIZE         = NN_FRIENDS_SCREEN_NAME_SIZE;        //
263     static const u32 MODE_DESCRIPTION_SIZE    = NN_FRIENDS_MODE_DESCRIPTION_SIZE;   //
264     static const u32 MII_SIZE                 = NN_FRIENDS_MII_SIZE;                //
265     static const u32 APPLICATION_ARG_SIZE     = NN_FRIENDS_APPLICATION_ARG_SIZE;
266     static const u32 FRIEND_LIST_SIZE         = NN_FRIENDS_FRIEND_LIST_SIZE;        //
267 
268     static const u32 INVALID_GAME_ID          = NN_FRIENDS_INVALID_GAME_ID;
269 
270     /////////////////////////////////////////////////////////////////////////
271 
272     /* Please see man pages for details
273 
274     */
275     enum PlatformCode
276     {
277         PLATFORM_CTR = 2        //
278     };
279     typedef enum PlatformCode PlatformCode;
280 
281     /* Please see man pages for details
282 
283     */
284     enum AttributeFlag
285     {
286         ATTRIBUTE_FLAG_ESTABLISHED          = 1 << 0,   //
287         ATTRIBUTE_FLAG_REMOTE_ACCESSIBLE    = 1 << 1    //
288     };
289     typedef enum AttributeFlag AttributeFlag;
290 
291     /* Please see man pages for details
292 
293     */
294     enum NotificationType
295     {
296         NOTIFICATION_NONE = 0,                  //
297         NOTIFICATION_ONLINE,                    //
298         NOTIFICATION_OFFLINE,                   //
299         NOTIFICATION_FRIEND_ONLINE,             //
300         NOTIFICATION_FRIEND_PRESENCE,           //
301         NOTIFICATION_FRIEND_MII,                //
302         NOTIFICATION_FRIEND_PROFILE,            //
303         NOTIFICATION_FRIEND_OFFLINE,            //
304         NOTIFICATION_BECOME_FRIEND,             //
305         NOTIFICATION_INVITATION                 //
306     };
307     typedef enum NotificationType NotificationType;
308 
309     /* Please see man pages for details
310 
311     */
312     enum NotificationMask
313     {
314         NOTIFICATION_MASK_ONLINE                  = 1 << 0,                                         //
315         NOTIFICATION_MASK_OFFLINE                 = 1 << 1,                                         //
316         NOTIFICATION_MASK_FRIEND_ONLINE           = 1 << 2,                                         //
317         NOTIFICATION_MASK_FRIEND_PRESENCE         = 1 << 3,                                         //
318         NOTIFICATION_MASK_FRIEND_MII              = 1 << 4,                                         //
319         NOTIFICATION_MASK_FRIEND_PROFILE          = 1 << 5,                                         //
320         NOTIFICATION_MASK_FRIEND_OFFLINE          = 1 << 6,                                         //
321         NOTIFICATION_MASK_BECOME_FRIEND           = 1 << 7,                                         //
322         NOTIFICATION_MASK_INVITATION              = 1 << 8,                                         //
323 
324         NOTIFICATION_MASK_DEFAULT                 = NOTIFICATION_MASK_ONLINE          |
325                                                     NOTIFICATION_MASK_OFFLINE         |
326                                                     NOTIFICATION_MASK_FRIEND_ONLINE   |
327                                                     NOTIFICATION_MASK_FRIEND_MII      |
328                                                     NOTIFICATION_MASK_FRIEND_PROFILE  |
329                                                     NOTIFICATION_MASK_FRIEND_OFFLINE  |
330                                                     NOTIFICATION_MASK_BECOME_FRIEND                 //
331     };
332     typedef enum NotificationMask NotificationMask;
333 
334     enum FontRegion
335     {
336         FONT_REGION_JP_US_EU,
337         FONT_REGION_CHINA,
338         FONT_REGION_KOREA,
339         FONT_REGION_TAIWAN,
340 
341         FONT_REGION_UNKNOWN = 255
342     };
343     typedef enum FontRegion FontRegion;
344 
345     /* Please see man pages for details */
346     typedef ::nnfriendsFriendKey               FriendKey;
347     /* Please see man pages for details */
348     typedef ::nnfriendsProfile                 Profile;
349     /* Please see man pages for details
350 
351                */
352     typedef ::nnfriendsMiiData                 MiiData;
353 
354     /* Please see man pages for details
355 
356 
357     */
358     typedef ::nnfriendsGameMode                GameMode;
359     /* Please see man pages for details */
360     typedef ::nnfriendsMyPresence              MyPresence;
361     /* Please see man pages for details */
362     typedef ::nnfriendsFriendPresence          FriendPresence;
363 
364     /* Please see man pages for details */
365     typedef ::nnfriendsEventNotification       EventNotification;
366 
367 } // end of namespace CTR
368 } // end of namespace friends
369 } // end of namespace nn
370 
371 #endif // __cplusplus
372 
373 #endif  // NN_FRIENDS_CTR_FRIENDS_TYPES_H_
374