mirror of git://git.sysmocom.de/ofono
atutil: Add destroy notify to sim_state_query
This commit is contained in:
parent
ab6be24c58
commit
fb92db81d4
|
@ -45,6 +45,7 @@ struct at_util_sim_state_query {
|
||||||
guint num_times;
|
guint num_times;
|
||||||
at_util_sim_inserted_cb_t cb;
|
at_util_sim_inserted_cb_t cb;
|
||||||
void *userdata;
|
void *userdata;
|
||||||
|
GDestroyNotify destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
static gboolean cpin_check(gpointer userdata);
|
static gboolean cpin_check(gpointer userdata);
|
||||||
|
@ -574,7 +575,8 @@ static gboolean cpin_check(gpointer userdata)
|
||||||
struct at_util_sim_state_query *at_util_sim_state_query_new(GAtChat *chat,
|
struct at_util_sim_state_query *at_util_sim_state_query_new(GAtChat *chat,
|
||||||
guint interval, guint num_times,
|
guint interval, guint num_times,
|
||||||
at_util_sim_inserted_cb_t cb,
|
at_util_sim_inserted_cb_t cb,
|
||||||
void *userdata)
|
void *userdata,
|
||||||
|
GDestroyNotify destroy)
|
||||||
{
|
{
|
||||||
struct at_util_sim_state_query *req;
|
struct at_util_sim_state_query *req;
|
||||||
|
|
||||||
|
@ -585,6 +587,7 @@ struct at_util_sim_state_query *at_util_sim_state_query_new(GAtChat *chat,
|
||||||
req->num_times = num_times;
|
req->num_times = num_times;
|
||||||
req->cb = cb;
|
req->cb = cb;
|
||||||
req->userdata = userdata;
|
req->userdata = userdata;
|
||||||
|
req->destroy = destroy;
|
||||||
|
|
||||||
cpin_check(req);
|
cpin_check(req);
|
||||||
|
|
||||||
|
@ -599,5 +602,8 @@ void at_util_sim_state_query_free(struct at_util_sim_state_query *req)
|
||||||
if (req->cpin_poll_source > 0)
|
if (req->cpin_poll_source > 0)
|
||||||
g_source_remove(req->cpin_poll_source);
|
g_source_remove(req->cpin_poll_source);
|
||||||
|
|
||||||
|
if (req->destroy)
|
||||||
|
req->destroy(req->userdata);
|
||||||
|
|
||||||
g_free(req);
|
g_free(req);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,8 @@ gboolean at_util_parse_attr(GAtResult *result, const char *prefix,
|
||||||
struct at_util_sim_state_query *at_util_sim_state_query_new(GAtChat *chat,
|
struct at_util_sim_state_query *at_util_sim_state_query_new(GAtChat *chat,
|
||||||
guint interval, guint num_times,
|
guint interval, guint num_times,
|
||||||
at_util_sim_inserted_cb_t cb,
|
at_util_sim_inserted_cb_t cb,
|
||||||
void *userdata);
|
void *userdata,
|
||||||
|
GDestroyNotify destroy);
|
||||||
void at_util_sim_state_query_free(struct at_util_sim_state_query *req);
|
void at_util_sim_state_query_free(struct at_util_sim_state_query *req);
|
||||||
|
|
||||||
struct cb_data {
|
struct cb_data {
|
||||||
|
|
Loading…
Reference in New Issue