|
libimobiledevice 1.1.1
|
Device/Connection handling and communication. More...
Data Structures | |
| struct | idevice_event_t |
| Provides information about the occured event. More... | |
Typedefs | |
| typedef int16_t | idevice_error_t |
| Represents an error code. | |
| typedef idevice_private * | idevice_t |
| The device handle. | |
| typedef idevice_connection_private * | idevice_connection_t |
| The connection handle. | |
| typedef void(* | idevice_event_cb_t )(const idevice_event_t *event, void *user_data) |
| Callback to notifiy if a device was added or removed. | |
Enumerations | |
| enum | idevice_event_type { IDEVICE_DEVICE_ADD = 1, IDEVICE_DEVICE_REMOVE } |
The event type for device add or removal. | |
Functions | |
| void | idevice_set_debug_level (int level) |
| Sets the level of debugging. | |
| idevice_error_t | idevice_event_subscribe (idevice_event_cb_t callback, void *user_data) |
| Register a callback function that will be called when device add/remove events occur. | |
| idevice_error_t | idevice_event_unsubscribe () |
| Release the event callback function that has been registered with idevice_event_subscribe(). | |
| idevice_error_t | idevice_get_device_list (char ***devices, int *count) |
| Get a list of currently available devices. | |
| idevice_error_t | idevice_device_list_free (char **devices) |
| Free a list of device uuids. | |
| idevice_error_t | idevice_new (idevice_t *device, const char *uuid) |
| Creates an idevice_t structure for the device specified by uuid, if the device is available. | |
| idevice_error_t | idevice_free (idevice_t device) |
| Cleans up an idevice structure, then frees the structure itself. | |
| idevice_error_t | idevice_connect (idevice_t device, uint16_t port, idevice_connection_t *connection) |
| Set up a connection to the given device. | |
| idevice_error_t | idevice_disconnect (idevice_connection_t connection) |
| Disconnect from the device and clean up the connection structure. | |
| idevice_error_t | idevice_connection_send (idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes) |
| Send data to a device via the given connection. | |
| idevice_error_t | idevice_connection_receive_timeout (idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) |
| Receive data from a device via the given connection. | |
| idevice_error_t | idevice_connection_receive (idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes) |
| Receive data from a device via the given connection. | |
| idevice_error_t | idevice_get_handle (idevice_t device, uint32_t *handle) |
| Gets the handle of the device. | |
| idevice_error_t | idevice_get_uuid (idevice_t device, char **uuid) |
| Gets the unique id for the device. | |
Error Codes | |
| #define | IDEVICE_E_SUCCESS 0 |
| #define | IDEVICE_E_INVALID_ARG -1 |
| #define | IDEVICE_E_UNKNOWN_ERROR -2 |
| #define | IDEVICE_E_NO_DEVICE -3 |
| #define | IDEVICE_E_NOT_ENOUGH_DATA -4 |
| #define | IDEVICE_E_BAD_HEADER -5 |
| #define | IDEVICE_E_SSL_ERROR -6 |
Device/Connection handling and communication.
The connection handle.
| typedef int16_t idevice_error_t |
Represents an error code.
| typedef void(* idevice_event_cb_t)(const idevice_event_t *event, void *user_data) |
Callback to notifiy if a device was added or removed.
| typedef idevice_private* idevice_t |
The device handle.
| idevice_error_t idevice_connect | ( | idevice_t | device, |
| uint16_t | port, | ||
| idevice_connection_t * | connection | ||
| ) |
Set up a connection to the given device.
| device | The device to connect to. |
| port | The destination port to connect to. |
| connection | Pointer to an idevice_connection_t that will be filled with the necessary data of the connection. |
| idevice_error_t idevice_connection_receive | ( | idevice_connection_t | connection, |
| char * | data, | ||
| uint32_t | len, | ||
| uint32_t * | recv_bytes | ||
| ) |
Receive data from a device via the given connection.
This function is like idevice_connection_receive_timeout, but with a predefined reasonable timeout.
| connection | The connection to receive data from. |
| data | Buffer that will be filled with the received data. This buffer has to be large enough to hold len bytes. |
| len | Buffer size or number of bytes to receive. |
| recv_bytes | Number of bytes actually received. |
| idevice_error_t idevice_connection_receive_timeout | ( | idevice_connection_t | connection, |
| char * | data, | ||
| uint32_t | len, | ||
| uint32_t * | recv_bytes, | ||
| unsigned int | timeout | ||
| ) |
Receive data from a device via the given connection.
This function will return after the given timeout even if no data has been received.
| connection | The connection to receive data from. |
| data | Buffer that will be filled with the received data. This buffer has to be large enough to hold len bytes. |
| len | Buffer size or number of bytes to receive. |
| recv_bytes | Number of bytes actually received. |
| timeout | Timeout in milliseconds after which this function should return even if no data has been received. |
| idevice_error_t idevice_connection_send | ( | idevice_connection_t | connection, |
| const char * | data, | ||
| uint32_t | len, | ||
| uint32_t * | sent_bytes | ||
| ) |
Send data to a device via the given connection.
| connection | The connection to send data over. |
| data | Buffer with data to send. |
| len | Size of the buffer to send. |
| sent_bytes | Pointer to an uint32_t that will be filled with the number of bytes actually sent. |
| idevice_error_t idevice_device_list_free | ( | char ** | devices | ) |
Free a list of device uuids.
| devices | List of uuids to free. |
| idevice_error_t idevice_disconnect | ( | idevice_connection_t | connection | ) |
Disconnect from the device and clean up the connection structure.
| connection | The connection to close. |
| idevice_error_t idevice_event_subscribe | ( | idevice_event_cb_t | callback, |
| void * | user_data | ||
| ) |
Register a callback function that will be called when device add/remove events occur.
| callback | Callback function to call. |
| user_data | Application-specific data passed as parameter to the registered callback function. |
| idevice_error_t idevice_event_unsubscribe | ( | ) |
Release the event callback function that has been registered with idevice_event_subscribe().
| idevice_error_t idevice_free | ( | idevice_t | device | ) |
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.
| device | idevice_t to free. |
| idevice_error_t idevice_get_device_list | ( | char *** | devices, |
| int * | count | ||
| ) |
Get a list of currently available devices.
| devices | List of uuids of devices that are currently available. This list is terminated by a NULL pointer. |
| count | Number of devices found. |
| idevice_error_t idevice_get_handle | ( | idevice_t | device, |
| uint32_t * | handle | ||
| ) |
Gets the handle of the device.
Depends on the connection type.
| idevice_error_t idevice_new | ( | idevice_t * | device, |
| const char * | uuid | ||
| ) |
Creates an idevice_t structure for the device specified by uuid, if the device is available.
| device | Upon calling this function, a pointer to a location of type idevice_t. On successful return, this location will be populated. |
| uuid | The UUID to match. |
| void idevice_set_debug_level | ( | int | level | ) |
Sets the level of debugging.
Currently the only acceptable values are 0 and 1.
| level | Set to 0 for no debugging or 1 for debugging. |
1.7.3