NativeBindings
Native bindings for the MLWebRTC.DataChannel class.
Inherits from:
MagicLeapNativeBindings
Public Methods
MLResult.Code MLWebRTCDataChannelCreate
Creates a data channel.
public MLResult.Code MLWebRTCDataChannelCreate(
ulong connectionHandle,
string label,
out ulong dataChannelHandle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | connectionHandle | The connection to associate the data channel with. |
string | label | The label to give the data channel. |
out ulong | dataChannelHandle | The handle of the data channel after it is created. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.
MLResult.Code MLWebRTCDataChannelDestroy
Destroys a data channel.
public MLResult.Code MLWebRTCDataChannelDestroy(
ulong connectionHandle,
ulong dataChannelHandle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | connectionHandle | The handle of the associated connection. |
ulong | dataChannelHandle | The handle of the data channel. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.
MLResult.Code MLWebRTCDataChannelGetLabel
Gets the label of a data channel, call MLWebRTCDataChannelReleaseLabelMemory after.
public MLResult.Code MLWebRTCDataChannelGetLabel(
ulong dataChannelHandle,
out IntPtr label
)
Parameters
Type | Name | Description |
---|---|---|
ulong | dataChannelHandle | The handle of the data channel. |
out IntPtr | label | Pointer to the unmanaged label string. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.
MLResult.Code MLWebRTCDataChannelIsOpen
Gets if a data channel is open.
public MLResult.Code MLWebRTCDataChannelIsOpen(
ulong dataChannelHandle,
out bool isOpen
)
Parameters
Type | Name | Description |
---|---|---|
ulong | dataChannelHandle | The handle of the data channel. |
out bool | isOpen | True if the data channel is open. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.
MLResult.Code MLWebRTCDataChannelReleaseLabelMemory
Releases the memory created when calling MLWebRTCDataChannelGetLabel.
public MLResult.Code MLWebRTCDataChannelReleaseLabelMemory(
ulong dataChannelHandle,
IntPtr label
)
Parameters
Type | Name | Description |
---|---|---|
ulong | dataChannelHandle | The handle of the data channel. |
IntPtr | label | Pointer to the unmanaged label string. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.
MLResult.Code MLWebRTCDataChannelSendMessage
Sends a message to a data channel.
public MLResult.Code MLWebRTCDataChannelSendMessage(
ulong dataChannelHandle,
in MLWebRTCDataChannelMessage message
)
Parameters
Type | Name | Description |
---|---|---|
ulong | dataChannelHandle | The handle of the data channel. |
in MLWebRTCDataChannelMessage | message | Native message object to send to the data channel. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.
MLResult.Code MLWebRTCDataChannelSetEventCallbacks
Sets the callbacks for a data channel.
public MLResult.Code MLWebRTCDataChannelSetEventCallbacks(
ulong dataChannelHandle,
in MLWebRTCDataChannelEventCallbacks callbacks
)
Parameters
Type | Name | Description |
---|---|---|
ulong | dataChannelHandle | The handle of the data channel. |
in MLWebRTCDataChannelEventCallbacks | callbacks | Native callbacks object to set the data channel with. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.
delegate void OnClosedDelegate
A delegate that describes the requirements of the OnClosed callback.
public delegate void OnClosedDelegate(
IntPtr context
)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | context | Pointer to a context object. |
delegate void OnMessageDelegate
A delegate that describes the requirements of the OnMessage callback.
public delegate void OnMessageDelegate(
in MLWebRTCDataChannelMessage message,
IntPtr context
)
Parameters
Type | Name | Description |
---|---|---|
in MLWebRTCDataChannelMessage | message | The native message object received. |
IntPtr | context | Pointer to a context object. |
delegate void OnOpenedDelegate
A delegate that describes the requirements of the OnOpened callback.
public delegate void OnOpenedDelegate(
IntPtr context
)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | context | Pointer to a context object. |
MLResult.Code SendMessageToDataChannel
Sends a string message to a data channel.
public static MLResult.Code SendMessageToDataChannel(
MLWebRTC.DataChannel dataChannel,
string message
)
Parameters
Type | Name | Description |
---|---|---|
MLWebRTC.DataChannel | dataChannel | Data channel to send the message to. |
string | message | The string to send. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.
MLResult.Code SendMessageToDataChannel< T >
Sends a string message to a data channel.
public static MLResult.Code SendMessageToDataChannel< T >(
MLWebRTC.DataChannel dataChannel,
T [] message
)
Parameters
Type | Name | Description |
---|---|---|
MLWebRTC.DataChannel | dataChannel | Data channel to send the message to. |
T [] | message | The byte array to send. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.
MLResult.Code SetCallbacks
Sets the callbacks of a data channel.
public static MLResult.Code SetCallbacks(
MLWebRTC.DataChannel dataChannel
)
Parameters
Type | Name | Description |
---|---|---|
MLWebRTC.DataChannel | dataChannel | The data channel to reference for the callbacks. |
Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.