Class iDeviceNativeMethods
Inheritance
Inherited Members
Namespace: iMobileDevice.iDevice
Assembly: iMobileDevice-net.dll
Syntax
public class iDeviceNativeMethods
Methods
idevice_connect(iDeviceHandle, UInt16, out iDeviceConnectionHandle)
Set up a connection to the given device.
Declaration
public static iDeviceError idevice_connect(iDeviceHandle device, ushort port, out iDeviceConnectionHandle connection)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceHandle | device | The device to connect to. |
| System.UInt16 | port | The destination port to connect to. |
| iDeviceConnectionHandle | connection | Pointer to an idevice_connection_t that will be filled with the necessary data of the connection. |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS if ok, otherwise an error code. |
idevice_connection_disable_ssl(iDeviceConnectionHandle)
Disable SSL for the given connection.
Declaration
public static iDeviceError idevice_connection_disable_ssl(iDeviceConnectionHandle connection)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceConnectionHandle | connection | The connection to disable SSL for. |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS on success, IDEVICE_E_INVALID_ARG when connection is NULL. This function also returns IDEVICE_E_SUCCESS when SSL is not enabled and does no further error checking on cleanup. |
idevice_connection_enable_ssl(iDeviceConnectionHandle)
Enables SSL for the given connection.
Declaration
public static iDeviceError idevice_connection_enable_ssl(iDeviceConnectionHandle connection)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceConnectionHandle | connection | The connection to enable SSL for. |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS on success, IDEVICE_E_INVALID_ARG when connection is NULL or connection->ssl_data is non-NULL, or IDEVICE_E_SSL_ERROR when SSL initialization, setup, or handshake fails. |
idevice_connection_get_fd(iDeviceConnectionHandle, ref Int32)
Get the underlying file descriptor for a connection
Declaration
public static iDeviceError idevice_connection_get_fd(iDeviceConnectionHandle connection, ref int fd)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceConnectionHandle | connection | The connection to get fd of |
| System.Int32 | fd | Pointer to an int where the fd is stored |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS if ok, otherwise an error code. |
idevice_connection_receive(iDeviceConnectionHandle, Byte[], UInt32, ref UInt32)
Receive data from a device via the given connection. This function is like idevice_connection_receive_timeout, but with a predefined reasonable timeout.
Declaration
public static iDeviceError idevice_connection_receive(iDeviceConnectionHandle connection, byte[] data, uint len, ref uint recvBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceConnectionHandle | connection | The connection to receive data from. |
| System.Byte[] | data | Buffer that will be filled with the received data. This buffer has to be large enough to hold len bytes. |
| System.UInt32 | len | Buffer size or number of bytes to receive. |
| System.UInt32 | recvBytes |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS if ok, otherwise an error code. |
idevice_connection_receive_timeout(iDeviceConnectionHandle, Byte[], UInt32, ref UInt32, UInt32)
Receive data from a device via the given connection. This function will return after the given timeout even if no data has been received.
Declaration
public static iDeviceError idevice_connection_receive_timeout(iDeviceConnectionHandle connection, byte[] data, uint len, ref uint recvBytes, uint timeout)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceConnectionHandle | connection | The connection to receive data from. |
| System.Byte[] | data | Buffer that will be filled with the received data. This buffer has to be large enough to hold len bytes. |
| System.UInt32 | len | Buffer size or number of bytes to receive. |
| System.UInt32 | recvBytes | |
| System.UInt32 | timeout | Timeout in milliseconds after which this function should return even if no data has been received. |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS if ok, otherwise an error code. |
idevice_connection_send(iDeviceConnectionHandle, Byte[], UInt32, ref UInt32)
Send data to a device via the given connection.
Declaration
public static iDeviceError idevice_connection_send(iDeviceConnectionHandle connection, byte[] data, uint len, ref uint sentBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceConnectionHandle | connection | The connection to send data over. |
| System.Byte[] | data | Buffer with data to send. |
| System.UInt32 | len | Size of the buffer to send. |
| System.UInt32 | sentBytes |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS if ok, otherwise an error code. |
idevice_device_list_free(IntPtr)
Free a list of device udids.
Declaration
public static iDeviceError idevice_device_list_free(IntPtr devices)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | devices | List of udids to free. |
Returns
| Type | Description |
|---|---|
| iDeviceError | Always returnes IDEVICE_E_SUCCESS. |
idevice_disconnect(IntPtr)
Disconnect from the device and clean up the connection structure.
Declaration
public static iDeviceError idevice_disconnect(IntPtr connection)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | connection | The connection to close. |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS if ok, otherwise an error code. |
idevice_event_subscribe(iDeviceEventCallBack, IntPtr)
Register a callback function that will be called when device add/remove events occur.
Declaration
public static iDeviceError idevice_event_subscribe(iDeviceEventCallBack callback, IntPtr userData)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceEventCallBack | callback | Callback function to call. |
| System.IntPtr | userData |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS on success or an error value when an error occured. |
idevice_event_unsubscribe()
Release the event callback function that has been registered with idevice_event_subscribe().
Declaration
public static iDeviceError idevice_event_unsubscribe()
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS on success or an error value when an error occured. |
idevice_free(IntPtr)
Cleans up an idevice structure, then frees the structure itself. This is a library-level function; deals directly with the device to tear down relations, but otherwise is mostly internal.
Declaration
public static iDeviceError idevice_free(IntPtr device)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | device | idevice_t to free. |
Returns
| Type | Description |
|---|---|
| iDeviceError |
idevice_get_device_list(out ReadOnlyCollection<String>, ref Int32)
Declaration
public static iDeviceError idevice_get_device_list(out ReadOnlyCollection<string> devices, ref int count)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.ObjectModel.ReadOnlyCollection<System.String> | devices | |
| System.Int32 | count |
Returns
| Type | Description |
|---|---|
| iDeviceError |
idevice_get_device_list(out IntPtr, ref Int32)
Get a list of currently available devices.
Declaration
public static iDeviceError idevice_get_device_list(out IntPtr devices, ref int count)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | devices | List of udids of devices that are currently available. This list is terminated by a NULL pointer. |
| System.Int32 | count | Number of devices found. |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS on success or an error value when an error occured. |
idevice_get_handle(iDeviceHandle, ref UInt32)
Gets the handle of the device. Depends on the connection type.
Declaration
public static iDeviceError idevice_get_handle(iDeviceHandle device, ref uint handle)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceHandle | device | |
| System.UInt32 | handle |
Returns
| Type | Description |
|---|---|
| iDeviceError |
idevice_get_socket_type(ref Int32)
Gets the socket type (Unix socket or TCP socket) libimobiledevice should use when connecting to usbmuxd.
Declaration
public static iDeviceError idevice_get_socket_type(ref int value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | value | A pointer to an integer which will reveive the current socket type |
Returns
| Type | Description |
|---|---|
| iDeviceError | 0 on success or negative on error |
idevice_get_tcp_endpoint(out IntPtr, ref UInt16)
Gets the TCP endpoint to which libimobiledevice will connect if the socket type is set to SOCKET_TYPE_TCP
Declaration
public static iDeviceError idevice_get_tcp_endpoint(out IntPtr host, ref ushort port)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | host | A pointer which will be set to the hostname or IP address to which to connect. The caller must free this string. |
| System.UInt16 | port | The port to which to connect |
Returns
| Type | Description |
|---|---|
| iDeviceError | 0 on success or negative on error |
idevice_get_tcp_endpoint(out String, ref UInt16)
Declaration
public static iDeviceError idevice_get_tcp_endpoint(out string host, ref ushort port)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | host | |
| System.UInt16 | port |
Returns
| Type | Description |
|---|---|
| iDeviceError |
idevice_get_udid(iDeviceHandle, out IntPtr)
Gets the unique id for the device.
Declaration
public static iDeviceError idevice_get_udid(iDeviceHandle device, out IntPtr udid)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceHandle | device | |
| System.IntPtr | udid |
Returns
| Type | Description |
|---|---|
| iDeviceError |
idevice_get_udid(iDeviceHandle, out String)
Declaration
public static iDeviceError idevice_get_udid(iDeviceHandle device, out string udid)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceHandle | device | |
| System.String | udid |
Returns
| Type | Description |
|---|---|
| iDeviceError |
idevice_new(out iDeviceHandle, String)
Creates an idevice_t structure for the device specified by udid, if the device is available.
Declaration
public static iDeviceError idevice_new(out iDeviceHandle device, string udid)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceHandle | device | Upon calling this function, a pointer to a location of type idevice_t. On successful return, this location will be populated. |
| System.String | udid | The UDID to match. |
Returns
| Type | Description |
|---|---|
| iDeviceError | IDEVICE_E_SUCCESS if ok, otherwise an error code. |
Remarks
The resulting idevice_t structure has to be freed with idevice_free() if it is no longer used.
idevice_set_debug_callback(iDeviceDebugCallBack)
Sets the callback to invoke when writing out debug messages. If this callback is set, messages will be written to this callback instead of the standard output.
Declaration
public static void idevice_set_debug_callback(iDeviceDebugCallBack callback)
Parameters
| Type | Name | Description |
|---|---|---|
| iDeviceDebugCallBack | callback | The callback which will receive the debug messages. Set to NULL to redirect to stdout. |
idevice_set_debug_level(Int32)
Set the level of debugging.
Declaration
public static void idevice_set_debug_level(int level)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | level | Set to 0 for no debug output, 1 to enable basic debug output and 2 to enable full debug output. When set to 2, the values of buffers being sent across the wire are printed out as well, this results in very verbose output. |
idevice_set_socket_type(Int32)
Sets the socket type (Unix socket or TCP socket) libimobiledevice should use when connecting to usbmuxd.
Declaration
public static iDeviceError idevice_set_socket_type(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | value | IDEVICE_SOCKET_TYPE_UNIX or IDEVICE_SOCKET_TYPE_TCP |
Returns
| Type | Description |
|---|---|
| iDeviceError | 0 on success or negative on error |
idevice_set_tcp_endpoint(String, UInt16)
Sets the TCP endpoint to which libimobiledevice will connect if the socket type is set to SOCKET_TYPE_TCP
Declaration
public static iDeviceError idevice_set_tcp_endpoint(string host, ushort port)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | host | The hostname or IP address to which to connect |
| System.UInt16 | port | The port to which to connect. |
Returns
| Type | Description |
|---|---|
| iDeviceError | 0 on success or negative on error |