idevice_error_t idevice_get_device_list (char ***devices, int *count)
我如何在idevice_get_device_list
char ***devices
的含义是什么?
我如何创建变量并将其传递给***devices
?
请举例说明使用此功能......
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.
答案 0 :(得分:1)
似乎idevice_get_device_list
获取指向char**
类型变量的指针,并将其设置为指向类型char*
的值数组,也就是字符串。它还需要一个指向int
类型变量的指针,并将其设置为该数组中的字符串数。
char **device_list;
int count;
idevice_error_t status = idevice_get_device_list(&device_list, &count);
/* check status for error conditions here */
for (int i = 0; i < count; ++i) {
printf("Device %d: %s\n", i, device_list[i]);
}