libnx  v4.6.0
friends.h
1 /**
2  * @file friend.h
3  * @brief Friends (friend:*) service IPC wrapper.
4  * @author yellows8
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 #include "../kernel/event.h"
10 #include "../services/applet.h"
11 #include "../services/acc.h"
12 #include "../sf/service.h"
13 
14 typedef enum {
15  FriendsServiceType_User = 0, ///< Initializes friend:u
16  FriendsServiceType_Viewer = 1, ///< Initializes friend:v
17  FriendsServiceType_Manager = 2, ///< Initializes friend:m
18  FriendsServiceType_System = 3, ///< Initializes friend:s
19  FriendsServiceType_Administrator = 4, ///< Initializes friend:a
20 } FriendsServiceType;
21 
22 /// InAppScreenName
23 typedef struct {
24  char name[0x40]; ///< UTF-8 string, NUL-terminated.
25  u64 languageCode; ///< LanguageCode, see set.h.
27 
28 /// FriendInvitationGameModeDescription
29 typedef struct {
30  u8 unk_x0[0xc00]; ///< Unknown.
32 
33 /// FriendInvitationId
34 typedef struct {
35  u64 id; ///< Id.
37 
38 /// FriendInvitationGroupId
39 typedef struct {
40  u64 id; ///< Id.
42 
43 /// FriendsUserSetting
44 typedef struct {
45  AccountUid uid; ///< User ID
46  u32 presence_permission; ///< Presence permission
47  u32 play_log_permission; ///< Play log permission
49  char friend_code[0x20]; ///< Friend Code
51  u8 unk_x48[0x7C8]; ///< Unknown
53 
54 /// Initialize friends
55 Result friendsInitialize(FriendsServiceType service_type);
56 
57 /// Exit friends
58 void friendsExit(void);
59 
60 /// Gets the Service object for the friends service session.
61 Service* friendsGetServiceSession(void);
62 
63 /// Gets the Service object for the actual IFriendsService service session.
64 Service* friendsGetServiceSession_IFriendsService(void);
65 
66 /**
67  * @brief Gets the \ref FriendsUserSetting details
68  * @param[in] uid \ref User AccountUid.
69  * @param[out] user_setting \ref FriendsUserSetting
70  */
71 Result friendsGetUserSetting(AccountUid uid, FriendsUserSetting *user_setting);
72 
73 /**
74  * @brief Gets an Event which is signaled when data is available with \ref friendsTryPopFriendInvitationNotificationInfo.
75  * @note This is a wrapper for \ref appletGetFriendInvitationStorageChannelEvent, see that for the usage requirements.
76  * @note The Event must be closed by the user once finished with it.
77  * @param[out] out_event Output Event with autoclear=false.
78  */
79 NX_INLINE Result friendsGetFriendInvitationNotificationEvent(Event *out_event) {
81 }
82 
83 /**
84  * @brief Uses \ref appletTryPopFromFriendInvitationStorageChannel then reads the data from there into the output params.
85  * @note This is a wrapper for \ref appletTryPopFromFriendInvitationStorageChannel, see that for the usage requirements.
86  * @param[out] uid \ref AccountUid. Optional, can be NULL.
87  * @param[out] buffer Output buffer.
88  * @param[out] size Output buffer size.
89  * @param[out] out_size Size of the data which was written into the output buffer. Optional, can be NULL.
90  */
91 Result friendsTryPopFriendInvitationNotificationInfo(AccountUid *uid, void* buffer, u64 size, u64 *out_size);
Result appletGetFriendInvitationStorageChannelEvent(Event *out_event)
Gets an Event which is signaled when a new storage is available with appletTryPopFromFriendInvitation...
Account UserId.
Definition: acc.h:25
Kernel-mode event structure.
Definition: event.h:13
FriendInvitationGameModeDescription.
Definition: friends.h:29
FriendInvitationGroupId.
Definition: friends.h:39
u64 id
Id.
Definition: friends.h:40
FriendInvitationId.
Definition: friends.h:34
u64 id
Id.
Definition: friends.h:35
InAppScreenName.
Definition: friends.h:23
u64 languageCode
LanguageCode, see set.h.
Definition: friends.h:25
FriendsUserSetting.
Definition: friends.h:44
AccountUid uid
User ID.
Definition: friends.h:45
u64 friend_code_next_issuable_time
Unknown.
Definition: friends.h:50
u32 presence_permission
Presence permission.
Definition: friends.h:46
u64 friend_request_reception
Unknown.
Definition: friends.h:48
u32 play_log_permission
Play log permission.
Definition: friends.h:47
Service object structure.
Definition: service.h:14
#define NX_INLINE
Flags a function as (always) inline.
Definition: types.h:86
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
u32 Result
Function error code result type.
Definition: types.h:44
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21