protected bool Initialize() { // define the native/managed handler this.connectedHandler = (handle, result, message) => { // create Connection and pass ownership to it var connection = Connection.CreateConnection(handle); if (connection != null) { if (this.Connected != null) { this.Connected(this, connection); } } else { if (this.Failed != null) { this.Failed(this, new FailedEventArgs(result, string.Format("NetworkComponent.Connected(): result: 0x{0} - {1}", result.ToString("X", NumberFormatInfo.InvariantInfo), message))); } else { Plugin.CheckResult(result, "NetworkComponent.Connected()"); } } }; this.connectedCallbackHandle = GCHandle.Alloc(this.connectedHandler); return(true); }
private bool Initialize(Action <CaptureEngine> created, CaptureEngine engine) { this.createdHandler = (handle, result, message) => { this.Handle = handle; if (this.Handle == Plugin.InvalidHandle) { engine.Close(); engine.Dispose(); engine = null; } created(engine); }; this.createdCallbackHandle = GCHandle.Alloc(this.createdHandler); this.startedHandler = this.OnStarted; this.startedCallbackHandle = GCHandle.Alloc(this.startedHandler); this.stoppedHandler = this.OnStopped; this.stoppedCallbackHandle = GCHandle.Alloc(this.stoppedHandler); return(Wrapper.exCreate(false, this.createdHandler) == 0); }
private bool Initialize(uint connectionHandle) { bool returnResult = false; if (connectionHandle != PluginUtils.InvalidHandle) { this.Handle = connectionHandle; this.State = ConnectionState.Connected; thisObject = GCHandle.Alloc(this, GCHandleType.Normal); IntPtr thisObjectPtr = GCHandle.ToIntPtr(this.thisObject); this.disconnectedHandler = new PluginCallbackHandler(Connection_PluginCallbackWrapper.OnDisconnected_Callback); PluginUtils.CheckHResult( Wrapper.exAddDisconnected(this.Handle, this.disconnectedHandler, thisObjectPtr, ref this.disconnectedToken), "Connection.AddDisconnected"); this.dataReceivedHandler = new Wrapper.DataReceivedHandler(Connection_PluginCallbackWrapper.OnDataReceived_Callback); PluginUtils.CheckHResult( Wrapper.exAddReceived(this.Handle, this.dataReceivedHandler, thisObjectPtr, ref this.dataReceivedToken), "Connection.AddRecevied"); returnResult = true; } return(returnResult); }
private bool Initialize(Action <PlaybackEngine> created, PlaybackEngine engine, Connection conneciton) { this.createdHandler = (handle, result, message) => { this.Handle = handle; if (this.Handle != Plugin.InvalidHandle) { this.sizeChangedHandler = OnFrameSizeUpdated; this.sizeChangedCallbackHandle = GCHandle.Alloc(this.sizeChangedHandler); Plugin.CheckResult( Wrapper.exAddSizeChanged(this.Handle, this.sizeChangedHandler, ref this.sizeChangedToken), "PlaybackEngine.AddSizeChanged"); this.sampleUpdatedHandler = OnSampleUpdatedHandler; this.sampleUpdatedCallbackHandle = GCHandle.Alloc(this.sampleUpdatedHandler); Plugin.CheckResult( Wrapper.exAddSampleUpdated(this.Handle, this.sampleUpdatedHandler, ref this.sampleUpdatedToken), "PlaybackEngine.AddSampleUpdated"); } else { engine.Close(); engine.Dispose(); engine = null; } created(engine); }; this.createdCallbackHandle = GCHandle.Alloc(this.createdHandler); return(Wrapper.exCreate(conneciton.Handle, this.createdHandler) == 0); }
protected NetworkComponent() { this.connectedHandler = null; this.connectedCallbackHandle = default(GCHandle); this.disposedValue = false; }
protected bool Initialize() { // define the native/managed handler this.connectedHandler = new PluginCallbackHandler(NetworkComponent_PluginCallbackWrapper.OnConnected_Callback); thisObject = GCHandle.Alloc(this, GCHandleType.Normal); return(true); }
private Connection() { this.Handle = PluginUtils.InvalidHandle; this.State = ConnectionState.Idle; this.disconnectedToken = 0; this.disconnectedHandler = null; this.dataReceivedToken = 0; this.dataReceivedHandler = null; }
private bool Initialize(uint connectionHandle) { bool returnResult = false; if (connectionHandle != Plugin.InvalidHandle) { this.Handle = connectionHandle; this.disconnectedHandler = (handle, result, message) => { if (handle != this.Handle) { return; } if (this.Disconnected != null) { this.Disconnected(this, EventArgs.Empty); } }; this.disconnectedCallbackHandle = GCHandle.Alloc(this.disconnectedHandler); Plugin.CheckResult( Wrapper.exAddDisconnected(this.Handle, this.disconnectedHandler, ref this.disconnectedToken), "Connection.AddDisconnected"); this.dataReceivedHandler = (handle, type, length, buffer) => { if (handle != this.Handle || buffer == IntPtr.Zero) { return; } var packetType = Enum.ToObject(typeof(DataType), type) as DataType?; if (packetType != null && packetType.Value != DataType.Unknown) { if (this.DataReceived == null) { return; } this.DataReceived(this, new DataReceivedArgs(packetType.Value, buffer, length)); } }; this.dataReceivedCallbackHandle = GCHandle.Alloc(this.dataReceivedHandler); Plugin.CheckResult( Wrapper.exAddReceived(this.Handle, this.dataReceivedHandler, ref this.dataReceivedToken), "Connection.AddRecevied"); returnResult = true; } return(returnResult); }
private Connection() { this.Handle = Plugin.InvalidHandle; this.disconnectedToken = 0; this.disconnectedHandler = null; this.disconnectedCallbackHandle = default(GCHandle); this.dataReceivedToken = 0; this.dataReceivedHandler = null; this.dataReceivedCallbackHandle = default(GCHandle); }
private CaptureEngine() { this.Handle = Plugin.InvalidHandle; this.Started = null; this.Stopped = null; this.Closed = null; this.Failed = null; this.createdHandler = null; this.createdCallbackHandle = default(GCHandle); this.startedHandler = null; this.startedCallbackHandle = default(GCHandle); this.stoppedHandler = null; this.stoppedCallbackHandle = default(GCHandle); }
private PlaybackEngine() { this.Handle = Plugin.InvalidHandle; this.Started = null; this.Stopped = null; this.Closed = null; this.Failed = null; this.FrameSizeChanged = null; this.createdHandler = null; this.createdCallbackHandle = default(GCHandle); this.sizeChangedHandler = null; this.sizeChangedCallbackHandle = default(GCHandle); this.sampleUpdatedHandler = null; this.sampleUpdatedCallbackHandle = default(GCHandle); }
internal static extern int exStop(uint captureHandle, [MarshalAs(UnmanagedType.FunctionPtr)] PluginCallbackHandler stoppedCallback);
internal static extern int exAddClosed(uint handle, [MarshalAs(UnmanagedType.FunctionPtr)] PluginCallbackHandler closedCallback, ref UInt64 tokenValue);
internal static extern int exStart(uint captureHandle, uint connectionHandle, bool enableMrc, IntPtr spatialPtr, [MarshalAs(UnmanagedType.FunctionPtr)] PluginCallbackHandler startedCallback);
internal static extern int exCreate(uint connectionHandle, [MarshalAs(UnmanagedType.FunctionPtr)] PluginCallbackHandler createdCallback);
internal static extern int exCreate(bool enableAudio, [MarshalAs(UnmanagedType.FunctionPtr)] PluginCallbackHandler createdCallback);
protected NetworkComponent() { this.connectedHandler = null; this.disposedValue = false; }
internal static extern int exStartListener(ushort port, ref uint listenerHandle, [MarshalAs(UnmanagedType.FunctionPtr)] PluginCallbackHandler StartedHandler, IntPtr senderObject);
internal static extern int exDiscoverConnection(ref uint handle, [MarshalAs(UnmanagedType.FunctionPtr)] PluginCallbackHandler ConnectionOpenedCallback, IntPtr senderObject);
internal static extern long exAddDisconnected(uint handle, [MarshalAs(UnmanagedType.FunctionPtr)] PluginCallbackHandler disconnectedCallback, IntPtr objectPtr, ref UInt64 tokenValue);
internal static extern int exOpenConnection([MarshalAsAttribute(UnmanagedType.LPWStr)] string serverUrl, ref uint handle, [MarshalAs(UnmanagedType.FunctionPtr)] PluginCallbackHandler ConnectionOpenedCallback);