/// <summary> /// Creates a new <see cref="UsbmuxdSubscriptionContextHandle"/> from a <see cref="IntPtr"/>. /// </summary> /// <param name="unsafeHandle"> /// The underlying <see cref="IntPtr"/> /// </param> /// <param name="ownsHandle"> /// <see langword="true"/> to reliably release the handle during the finalization phase; <see langword="false"/> to prevent reliable release (not recommended). /// </param> /// <returns> /// </returns> public static UsbmuxdSubscriptionContextHandle DangerousCreate(System.IntPtr unsafeHandle, bool ownsHandle) { UsbmuxdSubscriptionContextHandle safeHandle = new UsbmuxdSubscriptionContextHandle(ownsHandle); safeHandle.SetHandle(unsafeHandle); return(safeHandle); }
/// <summary> /// Subscribe a callback function to be called upon device add/remove events. /// This method can be called multiple times to register multiple callbacks /// since every subscription will have its own context (returned in the /// first parameter). /// </summary> /// <param name="context"> /// A pointer to a usbmuxd_subscription_context_t that will be /// set upon creation of the subscription. The returned context must be /// passed to usbmuxd_events_unsubscribe() to unsubscribe the callback. /// </param> /// <param name="callback"> /// A callback function that is executed when an event occurs. /// </param> /// <param name="user_data"> /// Custom data passed on to the callback function. The data /// needs to be kept available until the callback function is unsubscribed. /// </param> /// <returns> /// 0 on success or a negative errno value. /// </returns> public virtual int usbmuxd_events_subscribe(out UsbmuxdSubscriptionContextHandle context, UsbmuxdEventCallBack callback, System.IntPtr userData) { int returnValue; returnValue = UsbmuxdNativeMethods.usbmuxd_events_subscribe(out context, callback, userData); context.Api = this.Parent; return(returnValue); }
/// <summary> /// Creates a new <see cref="UsbmuxdSubscriptionContextHandle"/> from a <see cref="IntPtr"/>. /// </summary> /// <param name="unsafeHandle"> /// The underlying <see cref="IntPtr"/> /// </param> /// <returns> /// </returns> public static UsbmuxdSubscriptionContextHandle DangerousCreate(System.IntPtr unsafeHandle) { return(UsbmuxdSubscriptionContextHandle.DangerousCreate(unsafeHandle, true)); }
public object MarshalNativeToManaged(System.IntPtr nativeData) { return(UsbmuxdSubscriptionContextHandle.DangerousCreate(nativeData, false)); }
/// <summary> /// Unsubscribe callback function /// </summary> /// <param name="context"> /// A valid context as returned from usbmuxd_events_subscribe(). /// </param> /// <returns> /// 0 on success or a negative errno value. /// </returns> public virtual int usbmuxd_events_unsubscribe(UsbmuxdSubscriptionContextHandle context) { return(UsbmuxdNativeMethods.usbmuxd_events_unsubscribe(context)); }
public static extern int usbmuxd_events_unsubscribe(UsbmuxdSubscriptionContextHandle context);
public static extern int usbmuxd_events_subscribe(out UsbmuxdSubscriptionContextHandle context, UsbmuxdEventCallBack callback, System.IntPtr userData);