summaryrefslogtreecommitdiffstats
path: root/cython/imobiledevice.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'cython/imobiledevice.pyx')
-rw-r--r--cython/imobiledevice.pyx15
1 files changed, 10 insertions, 5 deletions
diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx
index bc861b3..8da2296 100644
--- a/cython/imobiledevice.pyx
+++ b/cython/imobiledevice.pyx
@@ -38,8 +38,12 @@ cdef extern from "libimobiledevice/libimobiledevice.h":
IDEVICE_E_UNKNOWN_ERROR = -2
IDEVICE_E_NO_DEVICE = -3
IDEVICE_E_NOT_ENOUGH_DATA = -4
- IDEVICE_E_BAD_HEADER = -5
IDEVICE_E_SSL_ERROR = -6
+ IDEVICE_E_TIMEOUT = -7
+ cdef enum idevice_options:
+ IDEVICE_LOOKUP_USBMUX = 1 << 1
+ IDEVICE_LOOKUP_NETWORK = 1 << 2
+ IDEVICE_LOOKUP_PREFER_NETWORK = 1 << 3
ctypedef void (*idevice_event_cb_t) (const_idevice_event_t event, void *user_data)
cdef extern idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data)
cdef extern idevice_error_t idevice_event_unsubscribe()
@@ -47,6 +51,7 @@ cdef extern from "libimobiledevice/libimobiledevice.h":
idevice_error_t idevice_device_list_free(char **devices)
void idevice_set_debug_level(int level)
idevice_error_t idevice_new(idevice_t *device, char *udid)
+ idevice_error_t idevice_new_with_options(idevice_t *device, const char *udid, idevice_options options);
idevice_error_t idevice_free(idevice_t device)
idevice_error_t idevice_get_udid(idevice_t device, char** udid)
idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle)
@@ -64,8 +69,8 @@ cdef class iDeviceError(BaseError):
IDEVICE_E_UNKNOWN_ERROR: 'Unknown error',
IDEVICE_E_NO_DEVICE: 'No device',
IDEVICE_E_NOT_ENOUGH_DATA: 'Not enough data',
- IDEVICE_E_BAD_HEADER: 'Bad header',
- IDEVICE_E_SSL_ERROR: 'SSL Error'
+ IDEVICE_E_SSL_ERROR: 'SSL Error',
+ IDEVICE_E_TIMEOUT: 'Connection timeout'
}
BaseError.__init__(self, *args, **kwargs)
@@ -89,7 +94,7 @@ cdef class iDeviceEvent:
def __get__(self):
return self._c_event.conn_type
-cdef void idevice_event_cb(const_idevice_event_t c_event, void *user_data) with gil:
+cdef void idevice_event_cb(const_idevice_event_t c_event, void *user_data) noexcept:
cdef iDeviceEvent event = iDeviceEvent.__new__(iDeviceEvent)
event._c_event = c_event
(<object>user_data)(event)
@@ -171,7 +176,7 @@ from libc.stdlib cimport *
cdef class iDevice(Base):
def __cinit__(self, object udid=None, *args, **kwargs):
cdef char* c_udid = NULL
- if isinstance(udid, basestring):
+ if isinstance(udid, (str, bytes)):
c_udid = <bytes>udid
elif udid is not None:
raise TypeError("iDevice's constructor takes a string or None as the udid argument")