// Copyright Epic Games, Inc. All Rights Reserved.
// This file is automatically generated. Changes to this file may be overwritten.
namespace Epic.OnlineServices.Presence
{
public sealed partial class PresenceInterface : Handle
{
public PresenceInterface()
{
}
public PresenceInterface(System.IntPtr innerHandle) : base(innerHandle)
{
}
///
/// The most recent version of the API.
///
public const int AddnotifyjoingameacceptedApiLatest = 2;
public const int AddnotifyonpresencechangedApiLatest = 1;
public const int CopypresenceApiLatest = 2;
public const int CreatepresencemodificationApiLatest = 1;
///
/// The maximum allowed length a data's key may be. This value is subject to change and data structures should be designed to allow for greater numbers than this.
///
public const int DataMaxKeyLength = 64;
///
/// The maximum of allowed individual pieces of data a user may have. This value is subject to change and data structures should be designed to allow for greater
/// numbers than this.
///
public const int DataMaxKeys = 32;
///
/// The maximum allowed length a data's value may be. This value is subject to change and data structures should be designed to allow for greater numbers than this.
///
public const int DataMaxValueLength = 255;
public const int DatarecordApiLatest = 1;
///
/// DEPRECATED! Use instead.
///
public const int DeletedataApiLatest = PresenceModification.PresencemodificationDeletedataApiLatest;
public const int GetjoininfoApiLatest = 1;
public const int HaspresenceApiLatest = 1;
public const int InfoApiLatest = 2;
public const int QuerypresenceApiLatest = 1;
///
/// The maximum allowed length a user's rich text string may be. This value is subject to change and data structures should be designed to allow for greater numbers
/// than this.
///
public const int RichTextMaxValueLength = 255;
///
/// DEPRECATED! Use instead.
///
public const int SetdataApiLatest = PresenceModification.PresencemodificationSetdataApiLatest;
public const int SetpresenceApiLatest = 1;
///
/// DEPRECATED! Use instead.
///
public const int SetrawrichtextApiLatest = PresenceModification.PresencemodificationSetrawrichtextApiLatest;
///
/// DEPRECATED! Use instead.
///
public const int SetstatusApiLatest = PresenceModification.PresencemodificationSetstatusApiLatest;
///
/// Register to receive notifications when a user accepts a join game option via the social overlay.
/// @note must call RemoveNotifyJoinGameAccepted to remove the notification
///
/// Structure containing information about the request.
/// Arbitrary data that is passed back to you in the CompletionDelegate.
/// A callback that is fired when a a notification is received.
///
/// handle representing the registered callback
///
public ulong AddNotifyJoinGameAccepted(AddNotifyJoinGameAcceptedOptions options, object clientData, OnJoinGameAcceptedCallback notificationFn)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var notificationFnInternal = new OnJoinGameAcceptedCallbackInternal(OnJoinGameAcceptedCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, notificationFn, notificationFnInternal);
var funcResult = Bindings.EOS_Presence_AddNotifyJoinGameAccepted(InnerHandle, optionsAddress, clientDataAddress, notificationFnInternal);
Helper.TryMarshalDispose(ref optionsAddress);
Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);
return funcResult;
}
///
/// Register to receive notifications when presence changes. If the returned NotificationId is valid, you must call RemoveNotifyOnPresenceChanged when you no longer wish to
/// have your NotificationHandler called
///
///
///
/// Data the is returned to when NotificationHandler is invoked
/// The callback to be fired when a presence change occurs
///
/// Notification ID representing the registered callback if successful, an invalid NotificationId if not
///
public ulong AddNotifyOnPresenceChanged(AddNotifyOnPresenceChangedOptions options, object clientData, OnPresenceChangedCallback notificationHandler)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var notificationHandlerInternal = new OnPresenceChangedCallbackInternal(OnPresenceChangedCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, notificationHandler, notificationHandlerInternal);
var funcResult = Bindings.EOS_Presence_AddNotifyOnPresenceChanged(InnerHandle, optionsAddress, clientDataAddress, notificationHandlerInternal);
Helper.TryMarshalDispose(ref optionsAddress);
Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);
return funcResult;
}
///
/// Get a user's cached presence object. If successful, this data must be released by calling
///
///
/// Object containing properties related to who is requesting presence and for what user
/// A pointer to a pointer of Presence Info. If the returned result is success, this will be set to data that must be later released, otherwise this will be set to NULL
///
/// Success if we have cached data, or an error result if the request was invalid or we do not have cached data.
///
public Result CopyPresence(CopyPresenceOptions options, out Info outPresence)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var outPresenceAddress = System.IntPtr.Zero;
var funcResult = Bindings.EOS_Presence_CopyPresence(InnerHandle, optionsAddress, ref outPresenceAddress);
Helper.TryMarshalDispose(ref optionsAddress);
if (Helper.TryMarshalGet(outPresenceAddress, out outPresence))
{
Bindings.EOS_Presence_Info_Release(outPresenceAddress);
}
return funcResult;
}
///
/// Creates a presence modification handle. This handle can used to add multiple changes to your presence that can be applied with .
/// The resulting handle must be released by calling once it has been passed to .
///
///
///
///
///
///
///
/// Object containing properties related to the user modifying their presence
/// Pointer to a Presence Modification Handle to be set if successful
///
/// Success if we successfully created the Presence Modification Handle pointed at in OutPresenceModificationHandle, or an error result if the input data was invalid
///
public Result CreatePresenceModification(CreatePresenceModificationOptions options, out PresenceModification outPresenceModificationHandle)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var outPresenceModificationHandleAddress = System.IntPtr.Zero;
var funcResult = Bindings.EOS_Presence_CreatePresenceModification(InnerHandle, optionsAddress, ref outPresenceModificationHandleAddress);
Helper.TryMarshalDispose(ref optionsAddress);
Helper.TryMarshalGet(outPresenceModificationHandleAddress, out outPresenceModificationHandle);
return funcResult;
}
///
/// Gets a join info custom game-data string for a specific user. This is a helper function for reading the presence data related to how a user can be joined.
/// Its meaning is entirely application dependent.
///
/// This value will be valid only after a QueryPresence call has successfully completed.
///
///
/// Object containing an associated user
/// The buffer into which the character data should be written. The buffer must be long enough to hold a string of .
///
/// Used as an input to define the OutBuffer length.
/// The input buffer should include enough space to be null-terminated.
/// When the function returns, this parameter will be filled with the length of the string copied into OutBuffer.
///
///
/// An that indicates whether the location string was copied into the OutBuffer.
/// if the information is available and passed out in OutBuffer
/// if you pass a null pointer for the out parameter
/// if there is user or the location string was not found.
/// - The OutBuffer is not large enough to receive the location string. InOutBufferLength contains the required minimum length to perform the operation successfully.
///
public Result GetJoinInfo(GetJoinInfoOptions options, out string outBuffer)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
System.IntPtr outBufferAddress = System.IntPtr.Zero;
int inOutBufferLength = PresenceModification.PresencemodificationJoininfoMaxLength + 1;
Helper.TryMarshalAllocate(ref outBufferAddress, inOutBufferLength);
var funcResult = Bindings.EOS_Presence_GetJoinInfo(InnerHandle, optionsAddress, outBufferAddress, ref inOutBufferLength);
Helper.TryMarshalDispose(ref optionsAddress);
Helper.TryMarshalGet(outBufferAddress, out outBuffer);
Helper.TryMarshalDispose(ref outBufferAddress);
return funcResult;
}
///
/// Check if we already have presence for a user
///
/// Object containing properties related to who is requesting presence and for what user
///
/// true if we have presence for the requested user, or false if the request was invalid or we do not have cached data
///
public bool HasPresence(HasPresenceOptions options)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var funcResult = Bindings.EOS_Presence_HasPresence(InnerHandle, optionsAddress);
Helper.TryMarshalDispose(ref optionsAddress);
bool funcResultReturn;
Helper.TryMarshalGet(funcResult, out funcResultReturn);
return funcResultReturn;
}
///
/// Query a user's presence. This must complete successfully before CopyPresence will have valid results. If HasPresence returns true for a remote
/// user, this does not need to be called.
///
/// Object containing properties related to who is querying presence and for what user
/// Optional pointer to help track this request, that is returned in the completion callback
/// Pointer to a function that handles receiving the completion information
public void QueryPresence(QueryPresenceOptions options, object clientData, OnQueryPresenceCompleteCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnQueryPresenceCompleteCallbackInternal(OnQueryPresenceCompleteCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Presence_QueryPresence(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Unregister from receiving notifications when a user accepts a join game option via the social overlay.
///
/// Handle representing the registered callback
public void RemoveNotifyJoinGameAccepted(ulong inId)
{
Helper.TryRemoveCallbackByNotificationId(inId);
Bindings.EOS_Presence_RemoveNotifyJoinGameAccepted(InnerHandle, inId);
}
///
/// Unregister a previously bound notification handler from receiving presence update notifications
///
/// The Notification ID representing the registered callback
public void RemoveNotifyOnPresenceChanged(ulong notificationId)
{
Helper.TryRemoveCallbackByNotificationId(notificationId);
Bindings.EOS_Presence_RemoveNotifyOnPresenceChanged(InnerHandle, notificationId);
}
///
/// Sets your new presence with the data applied to a PresenceModificationHandle. The PresenceModificationHandle can be released safely after calling this function.
///
///
///
/// Object containing a PresenceModificationHandle and associated user data
/// Optional pointer to help track this request, that is returned in the completion callback
/// Pointer to a function that handles receiving the completion information
public void SetPresence(SetPresenceOptions options, object clientData, SetPresenceCompleteCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new SetPresenceCompleteCallbackInternal(SetPresenceCompleteCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Presence_SetPresence(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
[MonoPInvokeCallback(typeof(OnJoinGameAcceptedCallbackInternal))]
internal static void OnJoinGameAcceptedCallbackInternalImplementation(System.IntPtr data)
{
OnJoinGameAcceptedCallback callback;
JoinGameAcceptedCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnPresenceChangedCallbackInternal))]
internal static void OnPresenceChangedCallbackInternalImplementation(System.IntPtr data)
{
OnPresenceChangedCallback callback;
PresenceChangedCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnQueryPresenceCompleteCallbackInternal))]
internal static void OnQueryPresenceCompleteCallbackInternalImplementation(System.IntPtr data)
{
OnQueryPresenceCompleteCallback callback;
QueryPresenceCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(SetPresenceCompleteCallbackInternal))]
internal static void SetPresenceCompleteCallbackInternalImplementation(System.IntPtr data)
{
SetPresenceCompleteCallback callback;
SetPresenceCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
}
}