libctru  v1.6.0
Data Structures | Macros | Enumerations | Functions
frd.h File Reference

Friend Services. More...

#include <3ds/mii.h>

Go to the source code of this file.

Data Structures

struct  FriendKey
 Friend key data. More...
 
struct  TitleData
 Friend Title data. More...
 
struct  FriendProfile
 Friend profile data. More...
 
struct  GameDescription
 Game Description structure. More...
 
struct  NotificationEvent
 Friend Notification Event structure. More...
 

Macros

#define FRIEND_SCREEN_NAME_SIZE   0xB
 11-byte UTF-16 screen name
 
#define FRIEND_COMMENT_SIZE   0x21
 33-byte UTF-16 comment
 
#define FRIEND_LIST_SIZE   0x64
 100 (Max number of friends)
 

Enumerations

enum  NotificationTypes {
  USER_WENT_ONLINE = 1,
  USER_WENT_OFFLINE,
  FRIEND_WENT_ONLINE,
  FRIEND_UPDATED_PRESENCE,
  FRIEND_UPDATED_MII,
  FRIEND_UPDATED_PROFILE,
  FRIEND_WENT_OFFLINE,
  FRIEND_REGISTERED_USER,
  FRIEND_SENT_INVITATION
}
 Enum to use with FRD_GetNotificationEvent. More...
 

Functions

Result frdInit (void)
 Initializes FRD service.
 
void frdExit (void)
 Exists FRD.
 
HandlefrdGetSessionHandle (void)
 Get FRD handle.
 
Result FRDU_HasLoggedIn (bool *state)
 Gets the login status of the current user. More...
 
Result FRDU_IsOnline (bool *state)
 Gets the online status of the current user. More...
 
Result FRD_Logout (void)
 Logs out of Nintendo's friend server.
 
Result FRD_Login (Handle event)
 Log in to Nintendo's friend server. More...
 
Result FRD_GetMyFriendKey (FriendKey *key)
 Gets the current user's friend key. More...
 
Result FRD_GetMyPreference (bool *isPublicMode, bool *isShowGameName, bool *isShowPlayedGame)
 Gets the current user's privacy information. More...
 
Result FRD_GetMyProfile (FriendProfile *profile)
 Gets the current user's profile information. More...
 
Result FRD_GetMyScreenName (char *name, size_t max_size)
 Gets the current user's screen name. More...
 
Result FRD_GetMyMii (MiiData *mii)
 Gets the current user's Mii data. More...
 
Result FRD_GetMyPlayingGame (u64 *titleId)
 Gets the current user's playing game. More...
 
Result FRD_GetMyFavoriteGame (u64 *titleId)
 Gets the current user's favourite game. More...
 
Result FRD_GetMyComment (char *comment, size_t max_size)
 Gets the current user's comment on their friend profile. More...
 
Result FRD_GetFriendKeyList (FriendKey *friendKeyList, u32 *num, u32 offset, u32 size)
 Gets the current user's friend key list. More...
 
Result FRD_GetFriendMii (MiiData *miiDataList, const FriendKey *friendKeyList, size_t size)
 Gets the current user's friends' Mii data. More...
 
Result FRD_GetFriendProfile (FriendProfile *profile, const FriendKey *friendKeyList, size_t size)
 Get the current user's friends' profile data. More...
 
Result FRD_GetFriendPlayingGame (GameDescription *desc, const FriendKey *friendKeyList, size_t size)
 Get the current user's friends' playing game. More...
 
Result FRD_GetFriendFavouriteGame (GameDescription *desc, const FriendKey *friendKeyList, u32 count)
 Get the current user's friends' favourite game. More...
 
Result FRD_IsInFriendList (FriendKey *friendKeyList, bool *isFromList)
 Gets whether a friend key is included in the current user's friend list. More...
 
Result FRD_UpdateGameModeDescription (const char *desc)
 Updates the game mode description string. More...
 
Result FRD_AttachToEventNotification (Handle event)
 Event which is signaled when friend login states change. More...
 
Result FRD_GetEventNotification (NotificationEvent *event, u32 count, u32 *recievedNotifCount)
 Get Latest Event Notification. More...
 
Result FRD_PrincipalIdToFriendCode (u32 principalId, u64 *friendCode)
 Returns the friend code using the given principal ID. More...
 
Result FRD_FriendCodeToPrincipalId (u64 friendCode, u32 *principalId)
 Returns the principal ID using the given friend code. More...
 
Result FRD_IsValidFriendCode (u64 friendCode, bool *isValid)
 Checks if the friend code is valid. More...
 
Result FRD_SetClientSdkVersion (u32 sdkVer)
 Sets the Friend API to use a specific SDK version. More...
 
Result FRD_AddFriendOnline (Handle event, u32 principalId)
 Add a Friend online. More...
 
Result FRD_RemoveFriend (u32 principalId, u64 localFriendCode)
 Remove a Friend. More...
 

Detailed Description

Friend Services.

Enumeration Type Documentation

◆ NotificationTypes

Enum to use with FRD_GetNotificationEvent.

Enumerator
USER_WENT_ONLINE 

Self went online.

USER_WENT_OFFLINE 

Self went offline.

FRIEND_WENT_ONLINE 

Friend Went Online.

FRIEND_UPDATED_PRESENCE 

Friend Presence changed.

FRIEND_UPDATED_MII 

Friend Mii changed.

FRIEND_UPDATED_PROFILE 

Friend Profile changed.

FRIEND_WENT_OFFLINE 

Friend went offline.

FRIEND_REGISTERED_USER 

Friend registered self as friend.

FRIEND_SENT_INVITATION 

Friend Sent invitation.

Function Documentation

◆ FRD_AddFriendOnline()

Result FRD_AddFriendOnline ( Handle  event,
u32  principalId 
)

Add a Friend online.

Parameters
eventEvent signaled when friend is registered.
principalIdPrincipalId of the friend to add.

◆ FRD_AttachToEventNotification()

Result FRD_AttachToEventNotification ( Handle  event)

Event which is signaled when friend login states change.

Parameters
eventevent which will be signaled.

◆ FRD_FriendCodeToPrincipalId()

Result FRD_FriendCodeToPrincipalId ( u64  friendCode,
u32 principalId 
)

Returns the principal ID using the given friend code.

Parameters
friendCodeThe friend code being used.
principalIdPointer to write the principal ID to.

◆ FRD_GetEventNotification()

Result FRD_GetEventNotification ( NotificationEvent event,
u32  count,
u32 recievedNotifCount 
)

Get Latest Event Notification.

Parameters
eventPointer to write recieved notification event struct to.
countNumber of events
recievedNotifCountNumber of notification reccieved.

◆ FRD_GetFriendFavouriteGame()

Result FRD_GetFriendFavouriteGame ( GameDescription desc,
const FriendKey friendKeyList,
u32  count 
)

Get the current user's friends' favourite game.

Parameters
descPointer to write Game Description data to.
friendKeyListPointer to FriendKeys,
countNumber Of FriendKeys.

◆ FRD_GetFriendKeyList()

Result FRD_GetFriendKeyList ( FriendKey friendKeyList,
u32 num,
u32  offset,
u32  size 
)

Gets the current user's friend key list.

Parameters
friendKeyListPointer to write the friend key list to.
numStores the number of friend keys obtained.
offsetThe index of the friend key to start with.
sizeSize of the friend key list. (FRIEND_LIST_SIZE)

◆ FRD_GetFriendMii()

Result FRD_GetFriendMii ( MiiData miiDataList,
const FriendKey friendKeyList,
size_t  size 
)

Gets the current user's friends' Mii data.

Parameters
miiDataListPointer to write Mii data to.
friendKeyListPointer to FriendKeys.
sizeNumber of Friendkeys.

◆ FRD_GetFriendPlayingGame()

Result FRD_GetFriendPlayingGame ( GameDescription desc,
const FriendKey friendKeyList,
size_t  size 
)

Get the current user's friends' playing game.

Parameters
descPointer to write Game Description data to.
friendKeyListPointer to FriendKeys,
sizeNumber Of FriendKeys.

◆ FRD_GetFriendProfile()

Result FRD_GetFriendProfile ( FriendProfile profile,
const FriendKey friendKeyList,
size_t  size 
)

Get the current user's friends' profile data.

Parameters
profilePointer to write profile data to.
friendKeyListPointer to FriendKeys.
sizeNumber of FriendKeys.

◆ FRD_GetMyComment()

Result FRD_GetMyComment ( char *  comment,
size_t  max_size 
)

Gets the current user's comment on their friend profile.

Parameters
commentPointer to write the current user's comment to.
max_sizeMax size of the comment.

◆ FRD_GetMyFavoriteGame()

Result FRD_GetMyFavoriteGame ( u64 titleId)

Gets the current user's favourite game.

Parameters
titleIdPointer to write the title ID of current user's favourite game to.

◆ FRD_GetMyFriendKey()

Result FRD_GetMyFriendKey ( FriendKey key)

Gets the current user's friend key.

Parameters
keyPointer to write the current user's friend key to.

◆ FRD_GetMyMii()

Result FRD_GetMyMii ( MiiData mii)

Gets the current user's Mii data.

Parameters
miiPointer to write the current user's mii data to.

◆ FRD_GetMyPlayingGame()

Result FRD_GetMyPlayingGame ( u64 titleId)

Gets the current user's playing game.

Parameters
titleIdPointer to write the current user's playing game to.

◆ FRD_GetMyPreference()

Result FRD_GetMyPreference ( bool *  isPublicMode,
bool *  isShowGameName,
bool *  isShowPlayedGame 
)

Gets the current user's privacy information.

Parameters
isPublicModeDetermines whether friends are notified of the current user's online status.
isShowGameNameDetermines whether friends are notified of the application that the current user is running.
isShowPlayedGameDetermiens whether to display the current user's game history.

◆ FRD_GetMyProfile()

Result FRD_GetMyProfile ( FriendProfile profile)

Gets the current user's profile information.

Parameters
profilePointer to write the current user's profile information to.

◆ FRD_GetMyScreenName()

Result FRD_GetMyScreenName ( char *  name,
size_t  max_size 
)

Gets the current user's screen name.

Parameters
namePointer to write the current user's screen name to.
max_sizeMax size of the screen name.

◆ FRD_IsInFriendList()

Result FRD_IsInFriendList ( FriendKey friendKeyList,
bool *  isFromList 
)

Gets whether a friend key is included in the current user's friend list.

Parameters
friendKeyListPointer to a list of friend keys.
isFromListPointer to a write the friendship status to.

◆ FRD_IsValidFriendCode()

Result FRD_IsValidFriendCode ( u64  friendCode,
bool *  isValid 
)

Checks if the friend code is valid.

Parameters
friendCodeThe friend code being used.
isValidPointer to write the validity of the friend code to.

◆ FRD_Login()

Result FRD_Login ( Handle  event)

Log in to Nintendo's friend server.

Parameters
eventEvent to signal when Login is done.

◆ FRD_PrincipalIdToFriendCode()

Result FRD_PrincipalIdToFriendCode ( u32  principalId,
u64 friendCode 
)

Returns the friend code using the given principal ID.

Parameters
principalIdThe principal ID being used.
friendCodePointer to write the friend code to.

◆ FRD_RemoveFriend()

Result FRD_RemoveFriend ( u32  principalId,
u64  localFriendCode 
)

Remove a Friend.

Parameters
principalIdPrinipalId of the friend code to remove.
localFriendCodeLocalFriendCode of the friend code to remove.

◆ FRD_SetClientSdkVersion()

Result FRD_SetClientSdkVersion ( u32  sdkVer)

Sets the Friend API to use a specific SDK version.

Parameters
sdkVerThe SDK version needed to be used.

◆ FRD_UpdateGameModeDescription()

Result FRD_UpdateGameModeDescription ( const char *  desc)

Updates the game mode description string.

Parameters
descPointer to write the game mode description to.

◆ FRDU_HasLoggedIn()

Result FRDU_HasLoggedIn ( bool *  state)

Gets the login status of the current user.

Parameters
statePointer to write the current user's login status to.

◆ FRDU_IsOnline()

Result FRDU_IsOnline ( bool *  state)

Gets the online status of the current user.

Parameters
statePointer to write the current user's online status to.