cancel
Showing results for 
Search instead for 
Did you mean: 

Not getting expected status from Friend->GetPresence()

Fredrum
Expert Protege

Hello,

we are not getting the result returned that we would have expected from a GetFriendStatus command that the programmer has made for Unreal.
This has been made into an unreal node that gets triggered manually for now for testing.
I have tested with both players running different online accounts on two computers simultaneously.
Both have got through the checks and are otherwise listed correctly from the same function, for example I get the correct friend names.

The ones I was expecting True from but are getting a False are:
(I didn't try Presence.bIsPlaying)
OculusFriend.bIsPlayingSameGame = Presence.bIsPlayingThisGame;
OculusFriend.bIsJoinable = Presence.bIsJoinable;

Here's a larger snippet from the code:
// Now that we are sure that everything worked, try to actually get the FriendList
TArray<TSharedRef<FOnlineFriend>> FriendList;
FriendInterface->GetFriendsList(LocalUserNum, ListName, FriendList);

// Iterate over the FriendList and fill in all Data into our Dummy Struct
for (TSharedRef<FOnlineFriend> Friend : FriendList)
{
// Get Presence State
FOnlineUserPresence Presence = Friend->GetPresence();
// Dummy Array Entry
FOculusFriend OculusFriend;

OculusFriend.DisplayName = Friend->GetDisplayName();
OculusFriend.RealName = Friend->GetRealName();
OculusFriend.StatusString = Presence.Status.StatusStr;
OculusFriend.bIsOnline = Presence.bIsOnline;
OculusFriend.bIsPlaying = Presence.bIsPlaying;
OculusFriend.bIsPlayingSameGame = Presence.bIsPlayingThisGame;
OculusFriend.bIsJoinable = Presence.bIsJoinable;
OculusFriend.bHasVoiceSupport = Presence.bHasVoiceSupport;
OculusFriend.PresenceState = (EOnlinePresenceState::Type)(int32)Presence.Status.State;
OculusFriend.UniqueNetID = Friend->GetUserId();

OculusFriendList.Add(OculusFriend);
}

Like I said, the 
Friend->GetDisplayName();
and
Presence.bIsOnline;
works so at least partially this is working.

Is there anyone that knows what's up or can verify that this should be working?
Is there anything else in particular that I am expected to do to flip these to True?

Cheers
Fredrik


4 REPLIES 4

eXifreXi
Explorer
(Person who implemented this)

Just to add some context. The code above uses Epic's FriendInterface, which can be implemented by each Subsystem.
Using it to retrieve the Friendlist works fine, so I assume you peeps actually implemented that part.
Now I know that most, if not all, of these variables work for Steam Subsystem, so it's not Epic's code that fails here.
I haven't looked into your Subsystem to see if you actually fill them, cause I sadly don't have the time for that.

Would be nice, if one of your SubsystemPlugin coders could check if this data can somehow be queried and set properly.

Kind regards,
Cedric Neukirchen

PS: Here is the full code of aboves snippet:

void UGetFriendListCallbackProxy::Activate()
{
if (PlayerControllerWeakPtr.IsValid())
{
IOnlineFriendsPtr FriendInterface = Online::GetFriendsInterface();

if (FriendInterface.IsValid())
{
const ULocalPlayer* LocalPlayer = PlayerControllerWeakPtr->GetLocalPlayer();

// Request the FriendList from the FriendInterface.
FriendInterface->ReadFriendsList(LocalPlayer->GetControllerId(), FriendListTypeToString(FriendListType), OnReadFriendsCompleteDelegate);
return;
}
}

TArray<FOculusFriend> FriendList;
OnFailure.Broadcast(FriendList);
}

// Called once the async call completes
void UGetFriendListCallbackProxy::OnGetFriendListComplete(int32 LocalUserNum, bool bWasSuccessful, const FString& ListName, const FString& ErrorStr)
{
TArray<FOculusFriend> OculusFriendList;

if (bWasSuccessful)
{
IOnlineFriendsPtr FriendInterface = Online::GetFriendsInterface();

if (FriendInterface.IsValid())
{
// Now that we are sure that everything worked, try to actually get the FriendList
TArray<TSharedRef<FOnlineFriend>> FriendList;
FriendInterface->GetFriendsList(LocalUserNum, ListName, FriendList);

// Iterate over the FriendList and fill in all Data into our Dummy Struct
for (TSharedRef<FOnlineFriend> Friend : FriendList)
{
// Get Presence State
FOnlineUserPresence Presence = Friend->GetPresence();

// Dummy Array Entry
FOculusFriend OculusFriend;

OculusFriend.DisplayName = Friend->GetDisplayName();
OculusFriend.RealName = Friend->GetRealName();
OculusFriend.StatusString = Presence.Status.StatusStr;
OculusFriend.bIsOnline = Presence.bIsOnline;
OculusFriend.bIsPlaying = Presence.bIsPlaying;
OculusFriend.bIsPlayingSameGame = Presence.bIsPlayingThisGame;
OculusFriend.bIsJoinable = Presence.bIsJoinable;
OculusFriend.bHasVoiceSupport = Presence.bHasVoiceSupport;
OculusFriend.PresenceState = (EOnlinePresenceState::Type)(int32)Presence.Status.State;
OculusFriend.UniqueNetID = Friend->GetUserId();

OculusFriendList.Add(OculusFriend);
}

OnSuccess.Broadcast(OculusFriendList);
return;
}
}

OnFailure.Broadcast(OculusFriendList);
}
Code is placed in a simple 'UOnlineBlueprintCallProxyBase' child, which Epic uses to create async blueprint nodes.
You also used them before for your custom create and find session nodes. Rest of the class code isn't really relevant.

The 'FOculusFriend' struct is custom and used to exposed the data to Blueprints.

Fredrum
Expert Protege
Hi
Hi   @imperativity,

is there any chance of getting someone from Oculus to confirm if this should be expected to work or not?
And if it is, what might it be that we have missed?

Cheers
Fredrik

eXifreXi
Explorer
To speed this up a bit, here is what you guys are saving:

for (size_t FriendIndex = 0; FriendIndex < UserNum; ++FriendIndex)
{
auto Friend = ovr_UserArray_GetElement(UserArray, FriendIndex);
auto FriendId = ovr_User_GetID(Friend);
auto FriendDisplayName = ovr_User_GetOculusID(Friend);
auto FriendPresenceStatus = ovr_User_GetPresenceStatus(Friend);
auto FriendInviteToken = ovr_User_GetInviteToken(Friend);
FString FriendInviteTokenString(UTF8_TO_TCHAR((FriendInviteToken != nullptr) ? FriendInviteToken : ""));
TSharedRef<FOnlineOculusFriend> OnlineFriend(new FOnlineOculusFriend(FriendId, FriendDisplayName, Friend
PresenceStatus, FriendInviteTokenString));
OutList.Add(FriendId, OnlineFriend);
}
So you are filling in the Precense here:

auto FriendPresenceStatus = ovr_User_GetPresenceStatus(Friend);
While "ovr_User_GetPresenceStatus" only returns "Online" "Offline" and "Unknown" and sets "bIsOnline" like this in the Struct Constructor:

Presence.bIsOnline = FriendPresenceStatus == ovrUserPresenceStatus_Online;

So tl;dr, you peeps aren't setting any of the Presence struct data, despite the bIsOnline.

If there is more data existing, please let me know how to access it, then I add this myself.

Fredrum
Expert Protege

Thanks for getting the confirmation.
It helps knowing that it shouldn't be expected to work yet. (maybe this should be tagged in the documentation somewhere?)
Cheers, Fred