// Copyright Epic Games, Inc. All Rights Reserved.
// This file is automatically generated. Changes to this file may be overwritten.
namespace Epic.OnlineServices.RTC
{
public sealed partial class RTCInterface : Handle
{
public RTCInterface()
{
}
public RTCInterface(System.IntPtr innerHandle) : base(innerHandle)
{
}
///
/// The most recent version of the API.
///
public const int AddnotifydisconnectedApiLatest = 1;
///
/// The most recent version of the API.
///
public const int AddnotifyparticipantstatuschangedApiLatest = 1;
///
/// The most recent version of the API.
///
public const int BlockparticipantApiLatest = 1;
///
/// The most recent version of the API.
///
public const int JoinroomApiLatest = 1;
///
/// The most recent version of the API.
///
public const int LeaveroomApiLatest = 1;
///
/// The most recent version of the struct.
///
public const int ParticipantmetadataApiLatest = 1;
public const int ParticipantmetadataKeyMaxcharcount = 256;
public const int ParticipantmetadataValueMaxcharcount = 256;
///
/// Register to receive notifications when disconnected from the room. If the returned NotificationId is valid, you must call
/// when you no longer wish to have your CompletionDelegate called.
///
/// This function will always return when used with lobby RTC room. To be notified of the connection
/// status of a Lobby-managed RTC room, use the function instead.
///
///
///
/// Arbitrary data that is passed back in the CompletionDelegate
/// 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 AddNotifyDisconnected(AddNotifyDisconnectedOptions options, object clientData, OnDisconnectedCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnDisconnectedCallbackInternal(OnDisconnectedCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
var funcResult = Bindings.EOS_RTC_AddNotifyDisconnected(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);
return funcResult;
}
///
/// Register to receive notifications when a participant's status changes (e.g: join or leave the room). If the returned NotificationId is valid, you must call
/// when you no longer wish to have your CompletionDelegate called.
///
/// If you register to this notification before joining a room, you will receive a notification for every member already in the room when you join said room.
/// This allows you to know who is already in the room when you join.
///
/// To be used effectively with a Lobby-managed RTC room, this should be registered during the or completion
/// callbacks when the ResultCode is . If this notification is registered after that point, it is possible to miss notifications for
/// already-existing room participants.
///
///
///
/// Arbitrary data that is passed back in the CompletionDelegate
/// The callback to be fired when a presence change occurs
///
/// Notification ID representing the registered callback if successful, an invalid NotificationId if not
/// @note This notification is also raised when the local user joins the room, but NOT when the local user leaves the room.
///
public ulong AddNotifyParticipantStatusChanged(AddNotifyParticipantStatusChangedOptions options, object clientData, OnParticipantStatusChangedCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnParticipantStatusChangedCallbackInternal(OnParticipantStatusChangedCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
var funcResult = Bindings.EOS_RTC_AddNotifyParticipantStatusChanged(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);
return funcResult;
}
///
/// Use this function to block a participant already connected to the room. After blocking them no media will be sent or received between
/// that user and the local user. This method can be used after receiving the OnParticipantStatusChanged notification.
///
/// structure containing the parameters for the operation.
/// Arbitrary data that is passed back in the CompletionDelegate
/// a callback that is fired when the async operation completes, either successfully or in error
///
/// if the operation succeeded
/// if any of the parameters are incorrect
/// if either the local user or specified participant are not in the specified room
///
public void BlockParticipant(BlockParticipantOptions options, object clientData, OnBlockParticipantCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnBlockParticipantCallbackInternal(OnBlockParticipantCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_RTC_BlockParticipant(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Get a handle to the Audio interface
/// eos_rtc_audio.h
/// eos_rtc_audio_types.h
///
///
/// handle
///
public RTCAudio.RTCAudioInterface GetAudioInterface()
{
var funcResult = Bindings.EOS_RTC_GetAudioInterface(InnerHandle);
RTCAudio.RTCAudioInterface funcResultReturn;
Helper.TryMarshalGet(funcResult, out funcResultReturn);
return funcResultReturn;
}
///
/// Use this function to join a room.
///
/// This function does not need to called for the Lobby RTC Room system; doing so will return . The lobby system will
/// automatically join and leave RTC Rooms for all lobbies that have RTC rooms enabled.
///
/// structure containing the parameters for the operation.
/// Arbitrary data that is passed back in the CompletionDelegate
/// a callback that is fired when the async operation completes, either successfully or in error
public void JoinRoom(JoinRoomOptions options, object clientData, OnJoinRoomCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnJoinRoomCallbackInternal(OnJoinRoomCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_RTC_JoinRoom(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Use this function to leave a room and clean up all the resources associated with it. This function has to always be called when the
/// room is abandoned even if the user is already disconnected for other reasons.
///
/// This function does not need to called for the Lobby RTC Room system; doing so will return . The lobby system will
/// automatically join and leave RTC Rooms for all lobbies that have RTC rooms enabled.
///
/// structure containing the parameters for the operation.
/// Arbitrary data that is passed back in the CompletionDelegate
/// a callback that is fired when the async operation completes, either successfully or in error
///
/// if the operation succeeded
/// if any of the parameters are incorrect
/// if not in the specified room
///
public void LeaveRoom(LeaveRoomOptions options, object clientData, OnLeaveRoomCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnLeaveRoomCallbackInternal(OnLeaveRoomCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_RTC_LeaveRoom(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Unregister a previously bound notification handler from receiving room disconnection notifications
///
/// The Notification ID representing the registered callback
public void RemoveNotifyDisconnected(ulong notificationId)
{
Helper.TryRemoveCallbackByNotificationId(notificationId);
Bindings.EOS_RTC_RemoveNotifyDisconnected(InnerHandle, notificationId);
}
///
/// Unregister a previously bound notification handler from receiving participant status change notifications
///
/// The Notification ID representing the registered callback
public void RemoveNotifyParticipantStatusChanged(ulong notificationId)
{
Helper.TryRemoveCallbackByNotificationId(notificationId);
Bindings.EOS_RTC_RemoveNotifyParticipantStatusChanged(InnerHandle, notificationId);
}
[MonoPInvokeCallback(typeof(OnBlockParticipantCallbackInternal))]
internal static void OnBlockParticipantCallbackInternalImplementation(System.IntPtr data)
{
OnBlockParticipantCallback callback;
BlockParticipantCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnDisconnectedCallbackInternal))]
internal static void OnDisconnectedCallbackInternalImplementation(System.IntPtr data)
{
OnDisconnectedCallback callback;
DisconnectedCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnJoinRoomCallbackInternal))]
internal static void OnJoinRoomCallbackInternalImplementation(System.IntPtr data)
{
OnJoinRoomCallback callback;
JoinRoomCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnLeaveRoomCallbackInternal))]
internal static void OnLeaveRoomCallbackInternalImplementation(System.IntPtr data)
{
OnLeaveRoomCallback callback;
LeaveRoomCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnParticipantStatusChangedCallbackInternal))]
internal static void OnParticipantStatusChangedCallbackInternalImplementation(System.IntPtr data)
{
OnParticipantStatusChangedCallback callback;
ParticipantStatusChangedCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
}
}