summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cython/afc.pxi6
-rw-r--r--cython/file_relay.pxi6
-rw-r--r--cython/imobiledevice.pxd11
-rw-r--r--cython/imobiledevice.pyx4
-rw-r--r--cython/installation_proxy.pxi6
-rw-r--r--cython/lockdown.pxi39
-rw-r--r--cython/mobile_image_mounter.pxi6
-rw-r--r--cython/mobilebackup.pxi65
-rw-r--r--cython/mobilesync.pxi13
-rw-r--r--cython/notification_proxy.pxi6
-rw-r--r--cython/sbservices.pxi16
-rw-r--r--cython/screenshotr.pxi6
12 files changed, 137 insertions, 47 deletions
diff --git a/cython/afc.pxi b/cython/afc.pxi
index 0383471..2608ee6 100644
--- a/cython/afc.pxi
+++ b/cython/afc.pxi
@@ -46,7 +46,7 @@ cdef extern from "libimobiledevice/afc.h":
AFC_LOCK_EX = 2 | 4
AFC_LOCK_UN = 8 | 4
- afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t *client)
+ afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, afc_client_t *client)
afc_error_t afc_client_free(afc_client_t client)
afc_error_t afc_get_device_info(afc_client_t client, char ***infos)
afc_error_t afc_read_directory(afc_client_t client, char *dir, char ***list)
@@ -153,8 +153,8 @@ cdef class AfcClient(BaseService):
__service_name__ = "com.apple.afc"
cdef afc_client_t _c_client
- def __cinit__(self, iDevice device not None, int port, *args, **kwargs):
- self.handle_error(afc_client_new(device._c_dev, port, &(self._c_client)))
+ def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs):
+ self.handle_error(afc_client_new(device._c_dev, descriptor._c_service_descriptor, &(self._c_client)))
def __dealloc__(self):
cdef afc_error_t err
diff --git a/cython/file_relay.pxi b/cython/file_relay.pxi
index 450b030..ec4942e 100644
--- a/cython/file_relay.pxi
+++ b/cython/file_relay.pxi
@@ -13,7 +13,7 @@ cdef extern from "libimobiledevice/file_relay.h":
FILE_RELAY_E_STAGING_EMPTY = -5
FILE_RELAY_E_UNKNOWN_ERROR = -256
- file_relay_error_t file_relay_client_new(idevice_t device, uint16_t port, file_relay_client_t *client)
+ file_relay_error_t file_relay_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, file_relay_client_t *client)
file_relay_error_t file_relay_client_free(file_relay_client_t client)
file_relay_error_t file_relay_request_sources(file_relay_client_t client, const_sources_t sources, idevice_connection_t *connection)
@@ -37,8 +37,8 @@ cdef class FileRelayClient(PropertyListService):
__service_name__ = "com.apple.mobile.file_relay"
cdef file_relay_client_t _c_client
- def __cinit__(self, iDevice device not None, int port, *args, **kwargs):
- self.handle_error(file_relay_client_new(device._c_dev, port, &self._c_client))
+ def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs):
+ self.handle_error(file_relay_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client))
def __dealloc__(self):
cdef file_relay_error_t err
diff --git a/cython/imobiledevice.pxd b/cython/imobiledevice.pxd
index a614124..94c3f01 100644
--- a/cython/imobiledevice.pxd
+++ b/cython/imobiledevice.pxd
@@ -12,7 +12,7 @@ cdef class BaseError(Exception):
cdef class Base:
cdef inline int handle_error(self, int16_t ret) except -1
- cdef inline BaseError _error(self, int16_t ret)
+ cdef BaseError _error(self, int16_t ret)
cdef class iDeviceError(BaseError): pass
@@ -66,12 +66,19 @@ cdef extern from "libimobiledevice/lockdown.h":
char *host_id
char *root_certificate
ctypedef lockdownd_pair_record *lockdownd_pair_record_t
+ cdef struct lockdownd_service_descriptor:
+ uint16_t port
+ uint8_t ssl_enabled
+ ctypedef lockdownd_service_descriptor *lockdownd_service_descriptor_t
cdef class LockdownError(BaseError): pass
cdef class LockdownPairRecord:
cdef lockdownd_pair_record_t _c_record
+cdef class LockdownServiceDescriptor:
+ cdef lockdownd_service_descriptor_t _c_service_descriptor
+
cdef class LockdownClient(PropertyListService):
cdef lockdownd_client_t _c_client
cdef readonly iDevice device
@@ -80,7 +87,7 @@ cdef class LockdownClient(PropertyListService):
cpdef plist.Node get_value(self, bytes domain=*, bytes key=*)
cpdef set_value(self, bytes domain, bytes key, object value)
cpdef remove_value(self, bytes domain, bytes key)
- cpdef uint16_t start_service(self, object service)
+ cpdef object start_service(self, object service)
cpdef object get_service_client(self, object service_class)
cpdef tuple start_session(self, bytes host_id)
cpdef stop_session(self, bytes session_id)
diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx
index cdb9978..de59456 100644
--- a/cython/imobiledevice.pyx
+++ b/cython/imobiledevice.pyx
@@ -130,7 +130,7 @@ cdef class iDeviceConnection(Base):
err = idevice_disconnect(self._c_connection)
self.handle_error(err)
- cdef inline BaseError _error(self, int16_t ret):
+ cdef BaseError _error(self, int16_t ret):
return iDeviceError(ret)
from libc.stdlib cimport *
@@ -148,7 +148,7 @@ cdef class iDevice(Base):
if self._c_dev is not NULL:
self.handle_error(idevice_free(self._c_dev))
- cdef inline BaseError _error(self, int16_t ret):
+ cdef BaseError _error(self, int16_t ret):
return iDeviceError(ret)
cpdef iDeviceConnection connect(self, uint16_t port):
diff --git a/cython/installation_proxy.pxi b/cython/installation_proxy.pxi
index 3dfb0b1..ff541df 100644
--- a/cython/installation_proxy.pxi
+++ b/cython/installation_proxy.pxi
@@ -13,7 +13,7 @@ cdef extern from "libimobiledevice/installation_proxy.h":
INSTPROXY_E_OP_FAILED = -5
INSTPROXY_E_UNKNOWN_ERROR = -256
- instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, instproxy_client_t *client)
+ instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, instproxy_client_t *client)
instproxy_error_t instproxy_client_free(instproxy_client_t client)
instproxy_error_t instproxy_browse(instproxy_client_t client, plist.plist_t client_options, plist.plist_t *result)
@@ -46,11 +46,11 @@ cdef class InstallationProxyClient(PropertyListService):
__service_name__ = "com.apple.mobile.installation_proxy"
cdef instproxy_client_t _c_client
- def __cinit__(self, iDevice device not None, int port, *args, **kwargs):
+ def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs):
cdef:
iDevice dev = device
instproxy_error_t err
- err = instproxy_client_new(dev._c_dev, port, &self._c_client)
+ err = instproxy_client_new(dev._c_dev, descriptor._c_service_descriptor, &self._c_client)
self.handle_error(err)
def __dealloc__(self):
diff --git a/cython/lockdown.pxi b/cython/lockdown.pxi
index b5207e8..6fbe0e6 100644
--- a/cython/lockdown.pxi
+++ b/cython/lockdown.pxi
@@ -29,7 +29,7 @@ cdef extern from "libimobiledevice/lockdown.h":
lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, char *domain, char *key, plist.plist_t *value)
lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, char *domain, char *key, plist.plist_t value)
lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, char *domain, char *key)
- lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, char *service, uint16_t *port)
+ lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, char *identifier, lockdownd_service_descriptor_t *service)
lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, char *host_id, char **session_id, int *ssl_enabled)
lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, char *session_id)
lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist.plist_t plist)
@@ -43,6 +43,7 @@ cdef extern from "libimobiledevice/lockdown.h":
lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client)
lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count)
lockdownd_error_t lockdownd_data_classes_free(char **classes)
+ lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service)
cdef class LockdownError(BaseError):
def __init__(self, *args, **kwargs):
@@ -89,6 +90,21 @@ cdef class LockdownPairRecord:
cdef bytes result = self._c_record.root_certificate
return result
+cdef class LockdownServiceDescriptor:
+ #def __cinit__(self, uint16_t port, uint8_t ssl_enabled, *args, **kwargs):
+ def __dealloc__(self):
+ cdef lockdownd_error_t err
+ if self._c_service_descriptor is not NULL:
+ err = lockdownd_service_descriptor_free(self._c_service_descriptor)
+ self._c_service_descriptor = NULL
+ self.handle_error(err)
+ property port:
+ def __get__(self):
+ return self._c_service_descriptor.port
+ property ssl_enabled:
+ def __get__(self):
+ return self._c_service_descriptor.ssl_enabled
+
cdef class LockdownClient(PropertyListService):
def __cinit__(self, iDevice device not None, bytes label=b'', bint handshake=True, *args, **kwargs):
cdef:
@@ -162,10 +178,11 @@ cdef class LockdownClient(PropertyListService):
cpdef remove_value(self, bytes domain, bytes key):
self.handle_error(lockdownd_remove_value(self._c_client, domain, key))
- cpdef uint16_t start_service(self, object service):
+ cpdef object start_service(self, object service):
cdef:
char* c_service_name = NULL
- uint16_t port = 0
+ lockdownd_service_descriptor_t c_descriptor = NULL
+ LockdownServiceDescriptor result
if issubclass(service, BaseService) and \
service.__service_name__ is not None \
@@ -177,24 +194,26 @@ cdef class LockdownClient(PropertyListService):
raise TypeError("LockdownClient.start_service() takes a BaseService or string as its first argument")
try:
- self.handle_error(lockdownd_start_service(self._c_client, c_service_name, &port))
-
- return port
+ self.handle_error(lockdownd_start_service(self._c_client, c_service_name, &c_descriptor))
+
+ result = LockdownServiceDescriptor.__new__(LockdownServiceDescriptor)
+ result._c_service_descriptor = c_descriptor
+
+ return result
except BaseError, e:
raise
cpdef object get_service_client(self, object service_class):
cdef:
- uint16_t port = 0
- object result
+ LockdownServiceDescriptor descriptor
if not hasattr(service_class, '__service_name__') and \
not service_class.__service_name__ is not None \
and not isinstance(service_class.__service_name__, basestring):
raise TypeError("LockdownClient.get_service_client() takes a BaseService as its first argument")
- port = self.start_service(service_class)
- return service_class(self.device, port)
+ descriptor = self.start_service(service_class)
+ return service_class(self.device, descriptor)
cpdef tuple start_session(self, bytes host_id):
cdef:
diff --git a/cython/mobile_image_mounter.pxi b/cython/mobile_image_mounter.pxi
index bf304d4..a23a59b 100644
--- a/cython/mobile_image_mounter.pxi
+++ b/cython/mobile_image_mounter.pxi
@@ -10,7 +10,7 @@ cdef extern from "libimobiledevice/mobile_image_mounter.h":
MOBILE_IMAGE_MOUNTER_E_CONN_FAILED = -3
MOBILE_IMAGE_MOUNTER_E_UNKNOWN_ERROR = -256
- mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, uint16_t port, mobile_image_mounter_client_t *client)
+ mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t descriptor, mobile_image_mounter_client_t *client)
mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_client_t client)
mobile_image_mounter_error_t mobile_image_mounter_lookup_image(mobile_image_mounter_client_t client, char *image_type, plist.plist_t *result)
mobile_image_mounter_error_t mobile_image_mounter_mount_image(mobile_image_mounter_client_t client, char *image_path, char *image_signature, uint16_t signature_length, char *image_type, plist.plist_t *result)
@@ -31,8 +31,8 @@ cdef class MobileImageMounterClient(PropertyListService):
__service_name__ = "com.apple.mobile.mobile_image_mounter"
cdef mobile_image_mounter_client_t _c_client
- def __cinit__(self, iDevice device not None, int port, *args, **kwargs):
- self.handle_error(mobile_image_mounter_new(device._c_dev, port, &self._c_client))
+ def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs):
+ self.handle_error(mobile_image_mounter_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client))
def __dealloc__(self):
cdef mobile_image_mounter_error_t err
diff --git a/cython/mobilebackup.pxi b/cython/mobilebackup.pxi
index 4f07683..5a6fea6 100644
--- a/cython/mobilebackup.pxi
+++ b/cython/mobilebackup.pxi
@@ -9,12 +9,25 @@ cdef extern from "libimobiledevice/mobilebackup.h":
MOBILEBACKUP_E_PLIST_ERROR = -2
MOBILEBACKUP_E_MUX_ERROR = -3
MOBILEBACKUP_E_BAD_VERSION = -4
+ MOBILEBACKUP_E_REPLY_NOT_OK = -5
MOBILEBACKUP_E_UNKNOWN_ERROR = -256
- mobilebackup_error_t mobilebackup_client_new(idevice_t device, uint16_t port, mobilebackup_client_t * client)
+ ctypedef enum mobilebackup_flags_t:
+ MB_RESTORE_NOTIFY_SPRINGBOARD = (1 << 0)
+ MB_RESTORE_PRESERVE_SETTINGS = (1 << 1)
+ MB_RESTORE_PRESERVE_CAMERA_ROLL = (1 << 2)
+
+ mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, mobilebackup_client_t * client)
mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client)
mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist.plist_t *plist)
mobilebackup_error_t mobilebackup_send(mobilebackup_client_t client, plist.plist_t plist)
+ mobilebackup_error_t mobilebackup_request_backup(mobilebackup_client_t client, plist.plist_t backup_manifest, char *base_path, char *proto_version)
+ mobilebackup_error_t mobilebackup_send_backup_file_received(mobilebackup_client_t client)
+ mobilebackup_error_t mobilebackup_request_restore(mobilebackup_client_t client, plist.plist_t backup_manifest, mobilebackup_flags_t flags, char *proto_version)
+ mobilebackup_error_t mobilebackup_receive_restore_file_received(mobilebackup_client_t client, plist.plist_t *result)
+ mobilebackup_error_t mobilebackup_receive_restore_application_received(mobilebackup_client_t client, plist.plist_t *result)
+ mobilebackup_error_t mobilebackup_send_restore_complete(mobilebackup_client_t client)
+ mobilebackup_error_t mobilebackup_send_error(mobilebackup_client_t client, char *reason)
cdef class MobileBackupError(BaseError):
def __init__(self, *args, **kwargs):
@@ -24,6 +37,7 @@ cdef class MobileBackupError(BaseError):
MOBILEBACKUP_E_PLIST_ERROR: "Property list error",
MOBILEBACKUP_E_MUX_ERROR: "MUX error",
MOBILEBACKUP_E_BAD_VERSION: "Bad version",
+ MOBILEBACKUP_E_REPLY_NOT_OK: "Reply not OK",
MOBILEBACKUP_E_UNKNOWN_ERROR: "Unknown error"
}
BaseError.__init__(self, *args, **kwargs)
@@ -32,8 +46,8 @@ cdef class MobileBackupClient(PropertyListService):
__service_name__ = "com.apple.mobilebackup"
cdef mobilebackup_client_t _c_client
- def __cinit__(self, iDevice device not None, int port, *args, **kwargs):
- self.handle_error(mobilebackup_client_new(device._c_dev, port, &self._c_client))
+ def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs):
+ self.handle_error(mobilebackup_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client))
def __dealloc__(self):
cdef mobilebackup_error_t err
@@ -41,11 +55,52 @@ cdef class MobileBackupClient(PropertyListService):
err = mobilebackup_client_free(self._c_client)
self.handle_error(err)
+ cdef inline BaseError _error(self, int16_t ret):
+ return MobileBackupError(ret)
+
cdef inline int16_t _send(self, plist.plist_t node):
return mobilebackup_send(self._c_client, node)
cdef inline int16_t _receive(self, plist.plist_t* node):
return mobilebackup_receive(self._c_client, node)
- cdef inline BaseError _error(self, int16_t ret):
- return MobileBackupError(ret)
+ cdef request_backup(self, plist.Node backup_manifest, bytes base_path, bytes proto_version):
+ self.handle_error(mobilebackup_request_backup(self._c_client, backup_manifest._c_node, base_path, proto_version))
+
+ cdef send_backup_file_received(self):
+ self.handle_error(mobilebackup_send_backup_file_received(self._c_client))
+
+ cdef request_restore(self, plist.Node backup_manifest, int flags, proto_version):
+ self.handle_error(mobilebackup_request_restore(self._c_client, backup_manifest._c_node, <mobilebackup_flags_t>flags, proto_version))
+
+ cpdef plist.Node receive_restore_file_received(self):
+ cdef:
+ plist.plist_t c_node = NULL
+ mobilebackup_error_t err
+ err = mobilebackup_receive_restore_file_received(self._c_client, &c_node)
+ try:
+ self.handle_error(err)
+ return plist.plist_t_to_node(c_node)
+ except BaseError, e:
+ if c_node != NULL:
+ plist.plist_free(c_node)
+ raise
+
+ cpdef plist.Node receive_restore_application_received(self):
+ cdef:
+ plist.plist_t c_node = NULL
+ mobilebackup_error_t err
+ err = mobilebackup_receive_restore_application_received(self._c_client, &c_node)
+ try:
+ self.handle_error(err)
+ return plist.plist_t_to_node(c_node)
+ except BaseError, e:
+ if c_node != NULL:
+ plist.plist_free(c_node)
+ raise
+
+ cdef send_restore_complete(self):
+ self.handle_error(mobilebackup_send_restore_complete(self._c_client))
+
+ cdef send_error(self, bytes reason):
+ self.handle_error(mobilebackup_send_error(self._c_client, reason))
diff --git a/cython/mobilesync.pxi b/cython/mobilesync.pxi
index e610191..ba9d585 100644
--- a/cython/mobilesync.pxi
+++ b/cython/mobilesync.pxi
@@ -24,12 +24,12 @@ cdef extern from "libimobiledevice/mobilesync.h":
char *host_anchor
ctypedef mobilesync_anchors *mobilesync_anchors_t
- mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client)
+ mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilesync_client_t * client)
mobilesync_error_t mobilesync_client_free(mobilesync_client_t client)
mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist.plist_t *plist)
mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist.plist_t plist)
- mobilesync_error_t mobilesync_start(mobilesync_client_t client, char *data_class, mobilesync_anchors_t anchors, uint64_t computer_data_class_version, mobilesync_sync_type_t *sync_type, uint64_t *device_data_class_version)
+ mobilesync_error_t mobilesync_start(mobilesync_client_t client, char *data_class, mobilesync_anchors_t anchors, uint64_t computer_data_class_version, mobilesync_sync_type_t *sync_type, uint64_t *device_data_class_version, char** error_description)
mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, char* reason)
mobilesync_error_t mobilesync_finish(mobilesync_client_t client)
@@ -73,8 +73,8 @@ cdef class MobileSyncClient(DeviceLinkService):
__service_name__ = "com.apple.mobilesync"
cdef mobilesync_client_t _c_client
- def __cinit__(self, iDevice device not None, int port, *args, **kwargs):
- self.handle_error(mobilesync_client_new(device._c_dev, port, &(self._c_client)))
+ def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs):
+ self.handle_error(mobilesync_client_new(device._c_dev, descriptor._c_service_descriptor, &(self._c_client)))
def __dealloc__(self):
cdef mobilesync_error_t err
@@ -88,6 +88,7 @@ cdef class MobileSyncClient(DeviceLinkService):
mobilesync_sync_type_t sync_type
uint64_t computer_data_class_version = 1
uint64_t device_data_class_version
+ char* error_description = NULL
if device_anchor is None:
anchors = mobilesync_anchors_new(NULL, host_anchor)
@@ -95,8 +96,8 @@ cdef class MobileSyncClient(DeviceLinkService):
anchors = mobilesync_anchors_new(device_anchor, host_anchor)
try:
- self.handle_error(mobilesync_start(self._c_client, data_class, anchors, computer_data_class_version, &sync_type, &device_data_class_version))
- return (sync_type, <bint>computer_data_class_version, <bint>device_data_class_version)
+ self.handle_error(mobilesync_start(self._c_client, data_class, anchors, computer_data_class_version, &sync_type, &device_data_class_version, &error_description))
+ return (sync_type, <bint>computer_data_class_version, <bint>device_data_class_version, <bytes>error_description)
except Exception, e:
raise
finally:
diff --git a/cython/notification_proxy.pxi b/cython/notification_proxy.pxi
index 07a72d9..4ffbf07 100644
--- a/cython/notification_proxy.pxi
+++ b/cython/notification_proxy.pxi
@@ -9,7 +9,7 @@ cdef extern from "libimobiledevice/notification_proxy.h":
NP_E_CONN_FAILED = -3
NP_E_UNKNOWN_ERROR = -256
ctypedef void (*np_notify_cb_t) (const_char_ptr notification, void *userdata)
- np_error_t np_client_new(idevice_t device, uint16_t port, np_client_t *client)
+ np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, np_client_t *client)
np_error_t np_client_free(np_client_t client)
np_error_t np_post_notification(np_client_t client, char *notification)
np_error_t np_observe_notification(np_client_t client, char *notification)
@@ -88,8 +88,8 @@ cdef class NotificationProxyClient(PropertyListService):
__service_name__ = "com.apple.mobile.notification_proxy"
cdef np_client_t _c_client
- def __cinit__(self, iDevice device not None, int port, *args, **kwargs):
- self.handle_error(np_client_new(device._c_dev, port, &self._c_client))
+ def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs):
+ self.handle_error(np_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client))
def __dealloc__(self):
cdef np_error_t err
diff --git a/cython/sbservices.pxi b/cython/sbservices.pxi
index e826b2a..8ff2595 100644
--- a/cython/sbservices.pxi
+++ b/cython/sbservices.pxi
@@ -8,7 +8,7 @@ cdef extern from "libimobiledevice/sbservices.h":
SBSERVICES_E_PLIST_ERROR = -2
SBSERVICES_E_CONN_FAILED = -3
SBSERVICES_E_UNKNOWN_ERROR = -256
- sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client)
+ sbservices_error_t sbservices_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, sbservices_client_t *client)
sbservices_error_t sbservices_client_free(sbservices_client_t client)
sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist.plist_t *state, char *format_version)
sbservices_error_t sbservices_set_icon_state(sbservices_client_t client, plist.plist_t newstate)
@@ -28,9 +28,11 @@ cdef class SpringboardServicesError(BaseError):
cdef class SpringboardServicesClient(PropertyListService):
__service_name__ = "com.apple.springboardservices"
cdef sbservices_client_t _c_client
+ cdef char* format_version
- def __cinit__(self, iDevice device not None, int port, *args, **kwargs):
- self.handle_error(sbservices_client_new(device._c_dev, port, &self._c_client))
+ def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs):
+ self.handle_error(sbservices_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client))
+ self.format_version = "2"
def __dealloc__(self):
if self._c_client is not NULL:
@@ -40,12 +42,18 @@ cdef class SpringboardServicesClient(PropertyListService):
cdef inline BaseError _error(self, int16_t ret):
return SpringboardServicesError(ret)
+ property format_version:
+ def __get__(self):
+ return <bytes>self.format_version
+ def __set__(self, char* newversion):
+ self.format_version = newversion
+
property icon_state:
def __get__(self):
cdef:
plist.plist_t c_node = NULL
sbservices_error_t err
- err = sbservices_get_icon_state(self._c_client, &c_node, NULL)
+ err = sbservices_get_icon_state(self._c_client, &c_node, self.format_version)
try:
self.handle_error(err)
diff --git a/cython/screenshotr.pxi b/cython/screenshotr.pxi
index a53fab2..2b2d53d 100644
--- a/cython/screenshotr.pxi
+++ b/cython/screenshotr.pxi
@@ -11,7 +11,7 @@ cdef extern from "libimobiledevice/screenshotr.h":
SCREENSHOTR_E_BAD_VERSION = -4
SCREENSHOTR_E_UNKNOWN_ERROR = -256
- screenshotr_error_t screenshotr_client_new(idevice_t device, uint16_t port, screenshotr_client_t * client)
+ screenshotr_error_t screenshotr_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, screenshotr_client_t * client)
screenshotr_error_t screenshotr_client_free(screenshotr_client_t client)
screenshotr_error_t screenshotr_take_screenshot(screenshotr_client_t client, char **imgdata, uint64_t *imgsize)
@@ -31,8 +31,8 @@ cdef class ScreenshotrClient(DeviceLinkService):
__service_name__ = "com.apple.mobile.screenshotr"
cdef screenshotr_client_t _c_client
- def __cinit__(self, iDevice device not None, int port, *args, **kwargs):
- self.handle_error(screenshotr_client_new(device._c_dev, port, &self._c_client))
+ def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs):
+ self.handle_error(screenshotr_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client))
def __dealloc__(self):
cdef screenshotr_error_t err