4 cdef extern from "../libfreesmartphone/freesmartphone-sim.h":
5 ctypedef void (*FSGSMSIMGetAuthStatusReplyFunc) (gchar *status,
8 ctypedef void (*FSGSMSIMReplyFunc) (GError *error,
10 ctypedef void (*FSGSMSIMGetImsiReplyFunc) (gchar *imsi,
13 gboolean fso_gsm_sim_get_imsi(FreeSmartphone *fs,
14 FSGSMSIMGetImsiReplyFunc cb,
16 gboolean fso_gsm_sim_change_auth_code(FreeSmartphone *fs,
21 gboolean fso_gsm_sim_unlock(FreeSmartphone *fs,
26 gboolean fso_gsm_sim_send_auth_code(FreeSmartphone *fs,
30 gboolean fso_gsm_sim_get_auth_status(FreeSmartphone *fs,
31 FSGSMSIMGetAuthStatusReplyFunc cb,
33 ctypedef void (*FSGSMSIMAuthStatusSignalFunc) (gchar *status,
35 gboolean fso_gsm_sim_auth_status_signal_remove(FreeSmartphone *fs,
36 FSGSMSIMAuthStatusSignalFunc cb,
38 gboolean fso_gsm_sim_auth_status_signal(FreeSmartphone *fs,
39 FSGSMSIMAuthStatusSignalFunc cb,
46 cdef void auth_status_signal(gchar *status, gpointer userdata) with gil:
47 print "SIM auth status signal"
48 reply = <object>userdata
49 reply_cb = reply.get_cb()
50 reply_data = reply.get_data()
51 status_str = PyString_FromStringAndSize(status, strlen(status))
52 reply_cb(reply_data, id, status_str)
55 # PyFreeSmartPhoneSIM class
58 cdef class PyFreeSmartphoneSIM:
59 cdef FreeSmartphone *fs
61 cdef object auth_status
65 def deinitialize(self):
68 def auth_status_signal(self, cb,data=None):
69 self.auth_status = ReplyData(cb,data)
70 Py_INCREF(self.auth_status)
71 return fso_gsm_sim_auth_status_signal(self.fs, &auth_status_signal, <void*>self.auth_status)
73 def auth_status_signal_remove(self):
74 fso_gsm_sim_auth_status_signal_remove(self.fs, &auth_status_signal, <void*>self.auth_status)
75 Py_DECREF(self.auth_status)