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.
Handle * | frdGetSessionHandle (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 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

  event | Event signaled when friend is registered.
  principalId | PrincipalId of the friend to add.

## FRD_AttachToEventNotification()

Result FRD_AttachToEventNotification | ( | Handle | event | ) |

Event which is signaled when friend login states change.

Parameters

  event | event which will be signaled.

## FRD_FriendCodeToPrincipalId()

Result FRD_FriendCodeToPrincipalId | ( | u64 | friendCode,
|  | u32 * | principalId
| ) |  |

Returns the principal ID using the given friend code.

Parameters

  friendCode | The friend code being used.
  principalId | Pointer to write the principal ID to.

## FRD_GetEventNotification()

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

Get Latest Event Notification.

Parameters

  event | Pointer to write recieved notification event struct to.
  count | Number of events
  recievedNotifCount | Number of notification reccieved.

## FRD_GetFriendFavouriteGame()

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

Get the current user's friends' favourite game.

Parameters

  desc | Pointer to write Game Description data to.
  friendKeyList | Pointer to FriendKeys,
  count | Number Of FriendKeys.

## FRD_GetFriendKeyList()

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

Gets the current user's friend key list.

Parameters

  friendKeyList | Pointer to write the friend key list to.
  num | Stores the number of friend keys obtained.
  offset | The index of the friend key to start with.
  size | Size 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

  miiDataList | Pointer to write Mii data to.
  friendKeyList | Pointer to FriendKeys.
  size | Number of Friendkeys.

## FRD_GetFriendPlayingGame()

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

Get the current user's friends' playing game.

Parameters

  desc | Pointer to write Game Description data to.
  friendKeyList | Pointer to FriendKeys,
  size | Number Of FriendKeys.

## FRD_GetFriendProfile()

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

Get the current user's friends' profile data.

Parameters

  profile | Pointer to write profile data to.
  friendKeyList | Pointer to FriendKeys.
  size | Number of FriendKeys.

## FRD_GetMyComment()

Result FRD_GetMyComment | ( | char * | comment,
|  | size_t | max_size
| ) |  |

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

Parameters

  comment | Pointer to write the current user's comment to.
  max_size | Max size of the comment.

## FRD_GetMyFavoriteGame()

Result FRD_GetMyFavoriteGame | ( | u64 * | titleId | ) |

Gets the current user's favourite game.

Parameters

  titleId | Pointer 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

  key | Pointer to write the current user's friend key to.

## FRD_GetMyMii()

Result FRD_GetMyMii | ( | MiiData * | mii | ) |

Gets the current user's Mii data.

Parameters

  mii | Pointer to write the current user's mii data to.

## FRD_GetMyPlayingGame()

Result FRD_GetMyPlayingGame | ( | u64 * | titleId | ) |

Gets the current user's playing game.

Parameters

  titleId | Pointer 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

  isPublicMode | Determines whether friends are notified of the current user's online status.
  isShowGameName | Determines whether friends are notified of the application that the current user is running.
  isShowPlayedGame | Determiens whether to display the current user's game history.

## FRD_GetMyProfile()

Result FRD_GetMyProfile | ( | FriendProfile * | profile | ) |

Gets the current user's profile information.

Parameters

  profile | Pointer 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

  name | Pointer to write the current user's screen name to.
  max_size | Max 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

  friendKeyList | Pointer to a list of friend keys.
  isFromList | Pointer to a write the friendship status to.

## FRD_IsValidFriendCode()

Result FRD_IsValidFriendCode | ( | u64 | friendCode,
|  | bool * | isValid
| ) |  |

Checks if the friend code is valid.

Parameters

  friendCode | The friend code being used.
  isValid | Pointer to write the validity of the friend code to.

## FRD_Login()

Result FRD_Login | ( | Handle | event | ) |

Log in to Nintendo's friend server.

Parameters

  event | Event 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

  principalId | The principal ID being used.
  friendCode | Pointer to write the friend code to.

## FRD_RemoveFriend()

Result FRD_RemoveFriend | ( | u32 | principalId,
|  | u64 | localFriendCode
| ) |  |

Remove a Friend.

Parameters

  principalId | PrinipalId of the friend code to remove.
  localFriendCode | LocalFriendCode of the friend code to remove.

## FRD_SetClientSdkVersion()

Result FRD_SetClientSdkVersion | ( | u32 | sdkVer | ) |

Sets the Friend API to use a specific SDK version.

Parameters

  sdkVer | The SDK version needed to be used.

## FRD_UpdateGameModeDescription()

Result FRD_UpdateGameModeDescription | ( | const char * | desc | ) |

Updates the game mode description string.

Parameters

  desc | Pointer to write the game mode description to.

## FRDU_HasLoggedIn()

Result FRDU_HasLoggedIn | ( | bool * | state | ) |

Gets the login status of the current user.

Parameters

  state | Pointer 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

  state | Pointer to write the current user's online status to.