diff options
| author | 2010-03-31 14:19:38 -0500 | |
|---|---|---|
| committer | 2012-03-20 23:25:55 +0100 | |
| commit | 23954a2b28e6f763a83524a85ead4716620ee7cc (patch) | |
| tree | 33a4a940c26d7b7a228400ffcf6abbc0435958ae /cython/imobiledevice.pyx | |
| parent | 7b4cb7fb2f1b1ed29f3bc97a9bcae5fc2a89fe95 (diff) | |
| download | libimobiledevice-23954a2b28e6f763a83524a85ead4716620ee7cc.tar.gz libimobiledevice-23954a2b28e6f763a83524a85ead4716620ee7cc.tar.bz2 | |
Added all remaining classes from libimobiledevice.
Diffstat (limited to 'cython/imobiledevice.pyx')
| -rw-r--r-- | cython/imobiledevice.pyx | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx index ecf94e1..b7ec87b 100644 --- a/cython/imobiledevice.pyx +++ b/cython/imobiledevice.pyx | |||
| @@ -48,6 +48,11 @@ cdef extern from "libimobiledevice/libimobiledevice.h": | |||
| 48 | idevice_error_t idevice_free(idevice_t device) | 48 | idevice_error_t idevice_free(idevice_t device) |
| 49 | idevice_error_t idevice_get_uuid(idevice_t device, char** uuid) | 49 | idevice_error_t idevice_get_uuid(idevice_t device, char** uuid) |
| 50 | idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle) | 50 | idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle) |
| 51 | idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connection_t *connection) | ||
| 52 | idevice_error_t idevice_disconnect(idevice_connection_t connection) | ||
| 53 | idevice_error_t idevice_connection_send(idevice_connection_t connection, char *data, uint32_t len, uint32_t *sent_bytes) | ||
| 54 | idevice_error_t idevice_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) | ||
| 55 | idevice_error_t idevice_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes) | ||
| 51 | 56 | ||
| 52 | cdef class iDeviceError(BaseError): | 57 | cdef class iDeviceError(BaseError): |
| 53 | def __init__(self, *args, **kwargs): | 58 | def __init__(self, *args, **kwargs): |
| @@ -99,6 +104,18 @@ cpdef get_device_list(): | |||
| 99 | if err: raise err | 104 | if err: raise err |
| 100 | return result | 105 | return result |
| 101 | 106 | ||
| 107 | cdef class iDeviceConnection(Base): | ||
| 108 | def __init__(self, *args, **kwargs): | ||
| 109 | raise TypeError("iDeviceConnection cannot be instantiated. Please use iDevice.connect()") | ||
| 110 | |||
| 111 | cpdef disconnect(self): | ||
| 112 | cdef idevice_error_t err | ||
| 113 | err = idevice_disconnect(self._c_connection) | ||
| 114 | self.handle_error(err) | ||
| 115 | |||
| 116 | cdef inline BaseError _error(self, int16_t ret): | ||
| 117 | return iDeviceError(ret) | ||
| 118 | |||
| 102 | cdef class iDevice(Base): | 119 | cdef class iDevice(Base): |
| 103 | def __cinit__(self, uuid=None, *args, **kwargs): | 120 | def __cinit__(self, uuid=None, *args, **kwargs): |
| 104 | cdef: | 121 | cdef: |
| @@ -116,6 +133,14 @@ cdef class iDevice(Base): | |||
| 116 | cdef inline BaseError _error(self, int16_t ret): | 133 | cdef inline BaseError _error(self, int16_t ret): |
| 117 | return iDeviceError(ret) | 134 | return iDeviceError(ret) |
| 118 | 135 | ||
| 136 | cpdef iDeviceConnection connect(self, uint16_t port): | ||
| 137 | cdef: | ||
| 138 | idevice_error_t err | ||
| 139 | iDeviceConnection conn = iDeviceConnection.__new__(iDeviceConnection) | ||
| 140 | err = idevice_connect(self._c_dev, port, &conn._c_connection) | ||
| 141 | self.handle_error(err) | ||
| 142 | return conn | ||
| 143 | |||
| 119 | property uuid: | 144 | property uuid: |
| 120 | def __get__(self): | 145 | def __get__(self): |
| 121 | cdef: | 146 | cdef: |
| @@ -131,9 +156,9 @@ cdef class iDevice(Base): | |||
| 131 | return handle | 156 | return handle |
| 132 | 157 | ||
| 133 | cdef extern from "libimobiledevice/lockdown.h": | 158 | cdef extern from "libimobiledevice/lockdown.h": |
| 134 | cdef struct lockdownd_client_int: | 159 | cdef struct lockdownd_client_private: |
| 135 | pass | 160 | pass |
| 136 | ctypedef lockdownd_client_int *lockdownd_client_t | 161 | ctypedef lockdownd_client_private *lockdownd_client_t |
| 137 | ctypedef enum lockdownd_error_t: | 162 | ctypedef enum lockdownd_error_t: |
| 138 | LOCKDOWN_E_SUCCESS = 0 | 163 | LOCKDOWN_E_SUCCESS = 0 |
| 139 | LOCKDOWN_E_INVALID_ARG = -1 | 164 | LOCKDOWN_E_INVALID_ARG = -1 |
| @@ -166,7 +191,7 @@ cdef class LockdownError(BaseError): | |||
| 166 | LOCKDOWN_E_SUCCESS: "Success", | 191 | LOCKDOWN_E_SUCCESS: "Success", |
| 167 | LOCKDOWN_E_INVALID_ARG: "Invalid argument", | 192 | LOCKDOWN_E_INVALID_ARG: "Invalid argument", |
| 168 | LOCKDOWN_E_INVALID_CONF: "Invalid configuration", | 193 | LOCKDOWN_E_INVALID_CONF: "Invalid configuration", |
| 169 | LOCKDOWN_E_PLIST_ERROR: "PList error", | 194 | LOCKDOWN_E_PLIST_ERROR: "Property list error", |
| 170 | LOCKDOWN_E_PAIRING_FAILED: "Pairing failed", | 195 | LOCKDOWN_E_PAIRING_FAILED: "Pairing failed", |
| 171 | LOCKDOWN_E_SSL_ERROR: "SSL error", | 196 | LOCKDOWN_E_SSL_ERROR: "SSL error", |
| 172 | LOCKDOWN_E_DICT_ERROR: "Dict error", | 197 | LOCKDOWN_E_DICT_ERROR: "Dict error", |
| @@ -213,9 +238,16 @@ cdef class LockdownClient(Base): | |||
| 213 | cpdef goodbye(self): | 238 | cpdef goodbye(self): |
| 214 | pass | 239 | pass |
| 215 | 240 | ||
| 241 | cdef extern from *: | ||
| 242 | ctypedef char* const_char_ptr "const char*" | ||
| 243 | |||
| 216 | include "property_list_client.pxi" | 244 | include "property_list_client.pxi" |
| 217 | include "mobilesync.pxi" | 245 | include "mobilesync.pxi" |
| 218 | include "notification_proxy.pxi" | 246 | include "notification_proxy.pxi" |
| 219 | include "sbservices.pxi" | 247 | include "sbservices.pxi" |
| 220 | include "mobilebackup.pxi" | 248 | include "mobilebackup.pxi" |
| 221 | include "afc.pxi" | 249 | include "afc.pxi" |
| 250 | include "file_relay.pxi" | ||
| 251 | include "screenshotr.pxi" | ||
| 252 | include "installation_proxy.pxi" | ||
| 253 | include "mobile_image_mounter.pxi" | ||
