/// <summary>
        /// Creates a new <see cref="CompanionProxyClientHandle"/> 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 CompanionProxyClientHandle DangerousCreate(System.IntPtr unsafeHandle, bool ownsHandle)
        {
            CompanionProxyClientHandle safeHandle = new CompanionProxyClientHandle(ownsHandle);

            safeHandle.SetHandle(unsafeHandle);
            return(safeHandle);
        }
Example #2
0
        /// <summary>
        /// Receives a plist from the service.
        /// </summary>
        /// <param name="client">
        /// The companion_proxy client
        /// </param>
        /// <param name="plist">
        /// The plist to store the received data
        /// </param>
        /// <returns>
        /// COMPANION_PROXY_E_SUCCESS on success,
        /// COMPANION_PROXY_E_INVALID_ARG when client or plist is NULL
        /// </returns>
        public virtual CompanionProxyError companion_proxy_receive(CompanionProxyClientHandle client, out PlistHandle plist)
        {
            CompanionProxyError returnValue;

            returnValue = CompanionProxyNativeMethods.companion_proxy_receive(client, out plist);
            plist.Api   = this.Parent;
            return(returnValue);
        }
Example #3
0
        /// <summary>
        /// Returns a value for the given key.
        /// </summary>
        /// <param name="client">
        /// The companion_proxy client
        /// </param>
        /// <param name="companion_udid">
        /// UDID of the (paired) companion device
        /// </param>
        /// <param name="key">
        /// The key to retrieve the value for
        /// </param>
        /// <returns>
        /// COMPANION_PROXY_E_SUCCESS on success,
        /// COMPANION_PROXY_E_INVALID_ARG when client or paired_devices is invalid,
        /// COMPANION_PROXY_E_UNSUPPORTED_KEY if the companion device doesn't support the given key,
        /// or a COMPANION_PROXY_E_* error code otherwise.
        /// </returns>
        /// <remarks>
        /// The device closes the connection after sending the reply.
        /// </remarks>
        public virtual CompanionProxyError companion_proxy_get_value_from_registry(CompanionProxyClientHandle client, string companionUdid, string key, out PlistHandle value)
        {
            CompanionProxyError returnValue;

            returnValue = CompanionProxyNativeMethods.companion_proxy_get_value_from_registry(client, companionUdid, key, out value);
            value.Api   = this.Parent;
            return(returnValue);
        }
Example #4
0
        /// <summary>
        /// Retrieves a list of paired devices.
        /// </summary>
        /// <param name="client">
        /// The companion_proxy client
        /// </param>
        /// <param name="devices">
        /// Point that will receive a PLIST_ARRAY with paired device UDIDs
        /// </param>
        /// <returns>
        /// COMPANION_PROXY_E_SUCCESS on success,
        /// COMPANION_PROXY_E_NO_DEVICES if no devices are paired,
        /// or a COMPANION_PROXY_E_* error code otherwise.
        /// </returns>
        /// <remarks>
        /// The device closes the connection after sending the reply.
        /// </remarks>
        public virtual CompanionProxyError companion_proxy_get_device_registry(CompanionProxyClientHandle client, out PlistHandle pairedDevices)
        {
            CompanionProxyError returnValue;

            returnValue       = CompanionProxyNativeMethods.companion_proxy_get_device_registry(client, out pairedDevices);
            pairedDevices.Api = this.Parent;
            return(returnValue);
        }
Example #5
0
 public static extern CompanionProxyError companion_proxy_start_listening_for_devices(CompanionProxyClientHandle client, CompanionProxyDeviceEventCallBack callback, System.IntPtr userdata);
Example #6
0
 public static extern CompanionProxyError companion_proxy_get_device_registry(CompanionProxyClientHandle client, out PlistHandle pairedDevices);
Example #7
0
 public static extern CompanionProxyError companion_proxy_receive(CompanionProxyClientHandle client, out PlistHandle plist);
Example #8
0
 public static extern CompanionProxyError companion_proxy_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out CompanionProxyClientHandle client);
Example #9
0
 public static extern CompanionProxyError companion_proxy_start_forwarding_service_port(CompanionProxyClientHandle client, ushort remotePort, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string serviceName, ref ushort forwardPort, PlistHandle options);
Example #10
0
 /// <summary>
 /// Stop forwarding a service port between companion device and idevice.
 /// </summary>
 /// <param name="client">
 /// The companion_proxy client
 /// </param>
 /// <param name="remote_port">
 /// remote port
 /// </param>
 /// <returns>
 /// COMPANION_PROXY_E_SUCCESS on success,
 /// or a COMPANION_PROXY_E_* error code otherwise.
 /// </returns>
 public virtual CompanionProxyError companion_proxy_stop_forwarding_service_port(CompanionProxyClientHandle client, ushort remotePort)
 {
     return(CompanionProxyNativeMethods.companion_proxy_stop_forwarding_service_port(client, remotePort));
 }
Example #11
0
 /// <summary>
 /// Start forwarding a service port on the companion device to a port on the idevice.
 /// </summary>
 /// <param name="client">
 /// The companion_proxy client
 /// </param>
 /// <param name="remote_port">
 /// remote port
 /// </param>
 /// <param name="service_name">
 /// The name of the service that shall be forwarded
 /// </param>
 /// <param name="forward_port">
 /// Pointer that will receive the newly-assigned port accessible via USB/Network on the idevice
 /// </param>
 /// <param name="options">
 /// PLIST_DICT with additional options. Currently known are
 /// IsServiceLowPriority (boolean) and PreferWifi (boolean).
 /// </param>
 /// <returns>
 /// COMPANION_PROXY_E_SUCCESS on success,
 /// or a COMPANION_PROXY_E_* error code otherwise.
 /// </returns>
 public virtual CompanionProxyError companion_proxy_start_forwarding_service_port(CompanionProxyClientHandle client, ushort remotePort, string serviceName, ref ushort forwardPort, PlistHandle options)
 {
     return(CompanionProxyNativeMethods.companion_proxy_start_forwarding_service_port(client, remotePort, serviceName, ref forwardPort, options));
 }
Example #12
0
 /// <summary>
 /// Stops listening for paired devices
 /// </summary>
 /// <param name="client">
 /// The companion_proxy client
 /// </param>
 /// <returns>
 /// COMPANION_PROXY_E_SUCCESS on success,
 /// or a COMPANION_PROXY_E_* error code otherwise.
 /// </returns>
 public virtual CompanionProxyError companion_proxy_stop_listening_for_devices(CompanionProxyClientHandle client)
 {
     return(CompanionProxyNativeMethods.companion_proxy_stop_listening_for_devices(client));
 }
Example #13
0
 /// <summary>
 /// Starts listening for paired devices.
 /// </summary>
 /// <param name="client">
 /// The companion_proxy client
 /// </param>
 /// <param name="callback">
 /// Callback function that will be called when a new device is detected
 /// </param>
 /// <param name="userdata">
 /// Pointer that that will be passed to the callback function
 /// </param>
 /// <returns>
 /// COMPANION_PROXY_E_SUCCESS on success,
 /// or a COMPANION_PROXY_E_* error code otherwise.
 /// </returns>
 /// <remarks>
 /// The event parameter that gets passed to the callback function is
 /// freed internally after returning from the callback. The consumer needs
 /// to make a copy if required.
 /// </remarks>
 public virtual CompanionProxyError companion_proxy_start_listening_for_devices(CompanionProxyClientHandle client, CompanionProxyDeviceEventCallBack callback, System.IntPtr userdata)
 {
     return(CompanionProxyNativeMethods.companion_proxy_start_listening_for_devices(client, callback, userdata));
 }
Example #14
0
 public static extern CompanionProxyError companion_proxy_stop_listening_for_devices(CompanionProxyClientHandle client);
Example #15
0
        /// <summary>
        /// Connects to the companion_proxy service on the specified device.
        /// </summary>
        /// <param name="device">
        /// The device to connect to.
        /// </param>
        /// <param name="service">
        /// The service descriptor returned by lockdownd_start_service.
        /// </param>
        /// <param name="client">
        /// Pointer that will point to a newly allocated
        /// companion_proxy_client_t upon successful return. Must be freed using
        /// companion_proxy_client_free() after use.
        /// </param>
        /// <returns>
        /// COMPANION_PROXY_E_SUCCESS on success, COMPANION_PROXY_E_INVALID_ARG when
        /// the arguments are invalid, or an COMPANION_PROXY_E_* error code otherwise.
        /// </returns>
        public virtual CompanionProxyError companion_proxy_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out CompanionProxyClientHandle client)
        {
            CompanionProxyError returnValue;

            returnValue = CompanionProxyNativeMethods.companion_proxy_client_new(device, service, out client);
            client.Api  = this.Parent;
            return(returnValue);
        }
Example #16
0
 public static extern CompanionProxyError companion_proxy_get_value_from_registry(CompanionProxyClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string companionUdid, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string key, out PlistHandle value);
Example #17
0
        /// <summary>
        /// Starts a new companion_proxy service on the specified device and connects to it.
        /// </summary>
        /// <param name="device">
        /// The device to connect to.
        /// </param>
        /// <param name="client">
        /// Pointer that will point to a newly allocated
        /// companion_proxy_client_t upon successful return. Must be freed using
        /// companion_proxy_client_free() after use.
        /// </param>
        /// <param name="label">
        /// The label to use for communication. Usually the program name.
        /// Pass NULL to disable sending the label in requests to lockdownd.
        /// </param>
        /// <returns>
        /// COMPANION_PROXY_E_SUCCESS on success, or an COMPANION_PROXY_E_* error
        /// code otherwise.
        /// </returns>
        public virtual CompanionProxyError companion_proxy_client_start_service(iDeviceHandle device, out CompanionProxyClientHandle client, string label)
        {
            CompanionProxyError returnValue;

            returnValue = CompanionProxyNativeMethods.companion_proxy_client_start_service(device, out client, label);
            client.Api  = this.Parent;
            return(returnValue);
        }
Example #18
0
 public static extern CompanionProxyError companion_proxy_stop_forwarding_service_port(CompanionProxyClientHandle client, ushort remotePort);
 public object MarshalNativeToManaged(System.IntPtr nativeData)
 {
     return(CompanionProxyClientHandle.DangerousCreate(nativeData, false));
 }
Example #20
0
 public static extern CompanionProxyError companion_proxy_client_start_service(iDeviceHandle device, out CompanionProxyClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string label);
Example #21
0
 public static extern CompanionProxyError companion_proxy_send(CompanionProxyClientHandle client, PlistHandle plist);
 /// <summary>
 /// Creates a new <see cref="CompanionProxyClientHandle"/> from a <see cref="IntPtr"/>.
 /// </summary>
 /// <param name="unsafeHandle">
 /// The underlying <see cref="IntPtr"/>
 /// </param>
 /// <returns>
 /// </returns>
 public static CompanionProxyClientHandle DangerousCreate(System.IntPtr unsafeHandle)
 {
     return(CompanionProxyClientHandle.DangerousCreate(unsafeHandle, true));
 }
Example #23
0
 /// <summary>
 /// Sends a plist to the service.
 /// </summary>
 /// <param name="client">
 /// The companion_proxy client
 /// </param>
 /// <param name="plist">
 /// The plist to send
 /// </param>
 /// <returns>
 /// COMPANION_PROXY_E_SUCCESS on success,
 /// COMPANION_PROXY_E_INVALID_ARG when client or plist is NULL
 /// </returns>
 public virtual CompanionProxyError companion_proxy_send(CompanionProxyClientHandle client, PlistHandle plist)
 {
     return(CompanionProxyNativeMethods.companion_proxy_send(client, plist));
 }