summaryrefslogtreecommitdiff
path: root/cython/imobiledevice.pxd
blob: 8a7d6b2855c44e661d54e46893bfe50ad15d42a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
cimport plist

include "stdint.pxi"

cdef extern from "pyerrors.h":
    ctypedef class __builtin__.Exception [object PyBaseExceptionObject]:
        pass

cdef class BaseError(Exception):
    cdef dict _lookup_table
    cdef int16_t _c_errcode

cdef class Base:
    cdef inline int handle_error(self, int16_t ret) except -1
    cdef inline BaseError _error(self, int16_t ret)

cdef class iDeviceError(BaseError): pass

cdef extern from "libimobiledevice/libimobiledevice.h":
    cdef struct idevice_int:
        pass
    ctypedef idevice_int* idevice_t
    cdef enum idevice_event_type:
        IDEVICE_DEVICE_ADD = 1,
        IDEVICE_DEVICE_REMOVE
    ctypedef struct idevice_event_t:
        idevice_event_type event
        char *uuid
        int conn_type
    ctypedef idevice_event_t* const_idevice_event_t "const idevice_event_t*"

cdef class iDeviceEvent:
    cdef const_idevice_event_t _c_event

cdef class iDevice(Base):
    cdef idevice_t _c_dev

cdef class LockdownError(BaseError): pass

cdef extern from "libimobiledevice/lockdown.h":
    cdef struct lockdownd_client_int:
        pass
    ctypedef lockdownd_client_int *lockdownd_client_t

cdef class LockdownClient(Base):
    cdef lockdownd_client_t _c_client
    cpdef int start_service(self, service)
    cpdef goodbye(self)

cpdef set_debug_level(int level)
cpdef event_subscribe(object callback)
cpdef event_unsubscribe()
cpdef get_device_list()