summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-02-27 15:09:04 +0100
committerGravatar Martin Szulecki2013-02-27 15:09:04 +0100
commit12754fa1c93d810f408b2de291b44e39eaee7ee5 (patch)
tree8335afd95f9f672656027e9d04a2b4b91e1ce34e
parent86cc3f0d16643a04e40c14de3f8b7aab2222b3fc (diff)
downloadlibimobiledevice-12754fa1c93d810f408b2de291b44e39eaee7ee5.tar.gz
libimobiledevice-12754fa1c93d810f408b2de291b44e39eaee7ee5.tar.bz2
cython: Add support for receive_with_timeout() method on PropertyListService
-rw-r--r--cython/imobiledevice.pxd2
-rw-r--r--cython/imobiledevice.pyx17
2 files changed, 19 insertions, 0 deletions
diff --git a/cython/imobiledevice.pxd b/cython/imobiledevice.pxd
index cd17061..a614124 100644
--- a/cython/imobiledevice.pxd
+++ b/cython/imobiledevice.pxd
@@ -51,8 +51,10 @@ cdef class BaseService(Base):
cdef class PropertyListService(BaseService):
cpdef send(self, plist.Node node)
cpdef object receive(self)
+ cpdef object receive_with_timeout(self, int timeout_ms)
cdef int16_t _send(self, plist.plist_t node)
cdef int16_t _receive(self, plist.plist_t* c_node)
+ cdef int16_t _receive_with_timeout(self, plist.plist_t* c_node, int timeout_ms)
cdef extern from "libimobiledevice/lockdown.h":
cdef struct lockdownd_client_private:
diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx
index 9d2e13d..cdb9978 100644
--- a/cython/imobiledevice.pyx
+++ b/cython/imobiledevice.pyx
@@ -210,12 +210,29 @@ cdef class PropertyListService(BaseService):
plist.plist_free(c_node)
raise
+ cpdef object receive_with_timeout(self, int timeout_ms):
+ cdef:
+ plist.plist_t c_node = NULL
+ int16_t err
+ err = self._receive_with_timeout(&c_node, timeout_ms)
+ 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 int16_t _send(self, plist.plist_t node):
raise NotImplementedError("send is not implemented")
cdef int16_t _receive(self, plist.plist_t* c_node):
raise NotImplementedError("receive is not implemented")
+ cdef int16_t _receive_with_timeout(self, plist.plist_t* c_node, int timeout_ms):
+ raise NotImplementedError("receive_with_timeout is not implemented")
+
cdef class DeviceLinkService(PropertyListService):
pass