// 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 = 3; 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 = 3; /// /// The presence key used to specify the local platform's presence string on platforms that use tokenized presence. /// For use with . /// /// /// public static readonly Utf8String KeyPlatformPresence = "EOS_PlatformPresence"; 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. /// 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(ref AddNotifyJoinGameAcceptedOptions options, object clientData, OnJoinGameAcceptedCallback notificationFn) { AddNotifyJoinGameAcceptedOptionsInternal optionsInternal = new AddNotifyJoinGameAcceptedOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var notificationFnInternal = new OnJoinGameAcceptedCallbackInternal(OnJoinGameAcceptedCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, notificationFn, notificationFnInternal); var funcResult = Bindings.EOS_Presence_AddNotifyJoinGameAccepted(InnerHandle, ref optionsInternal, clientDataAddress, notificationFnInternal); Helper.Dispose(ref optionsInternal); Helper.AssignNotificationIdToCallback(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(ref AddNotifyOnPresenceChangedOptions options, object clientData, OnPresenceChangedCallback notificationHandler) { AddNotifyOnPresenceChangedOptionsInternal optionsInternal = new AddNotifyOnPresenceChangedOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var notificationHandlerInternal = new OnPresenceChangedCallbackInternal(OnPresenceChangedCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, notificationHandler, notificationHandlerInternal); var funcResult = Bindings.EOS_Presence_AddNotifyOnPresenceChanged(InnerHandle, ref optionsInternal, clientDataAddress, notificationHandlerInternal); Helper.Dispose(ref optionsInternal); Helper.AssignNotificationIdToCallback(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 /// /// 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(ref CopyPresenceOptions options, out Info? outPresence) { CopyPresenceOptionsInternal optionsInternal = new CopyPresenceOptionsInternal(); optionsInternal.Set(ref options); var outPresenceAddress = System.IntPtr.Zero; var funcResult = Bindings.EOS_Presence_CopyPresence(InnerHandle, ref optionsInternal, ref outPresenceAddress); Helper.Dispose(ref optionsInternal); Helper.Get(outPresenceAddress, out outPresence); if (outPresence != null) { 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(ref CreatePresenceModificationOptions options, out PresenceModification outPresenceModificationHandle) { CreatePresenceModificationOptionsInternal optionsInternal = new CreatePresenceModificationOptionsInternal(); optionsInternal.Set(ref options); var outPresenceModificationHandleAddress = System.IntPtr.Zero; var funcResult = Bindings.EOS_Presence_CreatePresenceModification(InnerHandle, ref optionsInternal, ref outPresenceModificationHandleAddress); Helper.Dispose(ref optionsInternal); Helper.Get(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(ref GetJoinInfoOptions options, out Utf8String outBuffer) { GetJoinInfoOptionsInternal optionsInternal = new GetJoinInfoOptionsInternal(); optionsInternal.Set(ref options); int inOutBufferLength = PresenceModification.PresencemodificationJoininfoMaxLength + 1; System.IntPtr outBufferAddress = Helper.AddAllocation(inOutBufferLength); var funcResult = Bindings.EOS_Presence_GetJoinInfo(InnerHandle, ref optionsInternal, outBufferAddress, ref inOutBufferLength); Helper.Dispose(ref optionsInternal); Helper.Get(outBufferAddress, out outBuffer); Helper.Dispose(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 /// /// if we have presence for the requested user, or if the request was invalid or we do not have cached data /// public bool HasPresence(ref HasPresenceOptions options) { HasPresenceOptionsInternal optionsInternal = new HasPresenceOptionsInternal(); optionsInternal.Set(ref options); var funcResult = Bindings.EOS_Presence_HasPresence(InnerHandle, ref optionsInternal); Helper.Dispose(ref optionsInternal); bool funcResultReturn; Helper.Get(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(ref QueryPresenceOptions options, object clientData, OnQueryPresenceCompleteCallback completionDelegate) { QueryPresenceOptionsInternal optionsInternal = new QueryPresenceOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var completionDelegateInternal = new OnQueryPresenceCompleteCallbackInternal(OnQueryPresenceCompleteCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, completionDelegate, completionDelegateInternal); Bindings.EOS_Presence_QueryPresence(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal); Helper.Dispose(ref optionsInternal); } /// /// 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) { Bindings.EOS_Presence_RemoveNotifyJoinGameAccepted(InnerHandle, inId); Helper.RemoveCallbackByNotificationId(inId); } /// /// Unregister a previously bound notification handler from receiving presence update notifications /// /// The Notification ID representing the registered callback public void RemoveNotifyOnPresenceChanged(ulong notificationId) { Bindings.EOS_Presence_RemoveNotifyOnPresenceChanged(InnerHandle, notificationId); Helper.RemoveCallbackByNotificationId(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(ref SetPresenceOptions options, object clientData, SetPresenceCompleteCallback completionDelegate) { SetPresenceOptionsInternal optionsInternal = new SetPresenceOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var completionDelegateInternal = new SetPresenceCompleteCallbackInternal(SetPresenceCompleteCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, completionDelegate, completionDelegateInternal); Bindings.EOS_Presence_SetPresence(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal); Helper.Dispose(ref optionsInternal); } [MonoPInvokeCallback(typeof(OnJoinGameAcceptedCallbackInternal))] internal static void OnJoinGameAcceptedCallbackInternalImplementation(ref JoinGameAcceptedCallbackInfoInternal data) { OnJoinGameAcceptedCallback callback; JoinGameAcceptedCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(OnPresenceChangedCallbackInternal))] internal static void OnPresenceChangedCallbackInternalImplementation(ref PresenceChangedCallbackInfoInternal data) { OnPresenceChangedCallback callback; PresenceChangedCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(OnQueryPresenceCompleteCallbackInternal))] internal static void OnQueryPresenceCompleteCallbackInternalImplementation(ref QueryPresenceCallbackInfoInternal data) { OnQueryPresenceCompleteCallback callback; QueryPresenceCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(SetPresenceCompleteCallbackInternal))] internal static void SetPresenceCompleteCallbackInternalImplementation(ref SetPresenceCallbackInfoInternal data) { SetPresenceCompleteCallback callback; SetPresenceCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } } }