Beispiel #1
0
            public override void WriteCompleted(MonoMac.IOBluetooth.IOBluetoothRFCOMMChannel rfcommChannel, IntPtr refcon, MonoMac.IOKit.IOReturn error)
            {
                var completionSourceHandle = GCHandle.FromIntPtr(refcon);
                var completionSource       = (TaskCompletionSource <IOBluetoothRFCOMMChannel>)completionSourceHandle.Target;

                completionSourceHandle.Free();
                if (error == IOReturn.Success)
                {
                    completionSource.TrySetResult(rfcommChannel);
                }
                else
                {
                    completionSource.TrySetException(error.ToNSErrorException());
                }
            }
Beispiel #2
0
            public override void Opened(MonoMac.IOBluetooth.IOBluetoothRFCOMMChannel rfcommChannel, MonoMac.IOKit.IOReturn error)
            {
                EventHandler <MonoMac.IOKit.IOReturnEventArgs> handler = opened;

                if (handler != null)
                {
                    var args = new MonoMac.IOKit.IOReturnEventArgs(error);
                    handler(rfcommChannel, args);
                }
            }