diff --git a/src/call-barring.c b/src/call-barring.c index b67ca0ca..4ae758ae 100644 --- a/src/call-barring.c +++ b/src/call-barring.c @@ -278,7 +278,7 @@ static void generate_ss_query_reply(struct ofono_modem *modem) dbus_message_iter_close_container(&iter, &variant); - dbus_gsm_pending_reply(&cb->pending, reply); + __ofono_dbus_pending_reply(&cb->pending, reply); } static void cb_ss_query_next_lock_callback(const struct ofono_error *error, @@ -294,7 +294,7 @@ static void cb_ss_query_next_lock_callback(const struct ofono_error *error, cb->flags &= ~CALL_BARRING_FLAG_CACHED; - dbus_gsm_pending_reply(&cb->pending, + __ofono_dbus_pending_reply(&cb->pending, __ofono_error_failed(cb->pending)); return; } @@ -333,7 +333,7 @@ static void cb_ss_set_lock_callback(const struct ofono_error *error, if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Enabling/disabling Call Barring via SS failed"); - dbus_gsm_pending_reply(&cb->pending, + __ofono_dbus_pending_reply(&cb->pending, __ofono_error_failed(cb->pending)); return; } @@ -497,7 +497,7 @@ static void cb_set_passwd_callback(const struct ofono_error *error, void *data) ofono_debug("Changing Call Barring password via SS failed"); } - dbus_gsm_pending_reply(&cb->pending, reply); + __ofono_dbus_pending_reply(&cb->pending, reply); } static gboolean cb_ss_passwd(struct ofono_modem *modem, const char *sc, @@ -663,7 +663,7 @@ static void cb_get_properties_reply(struct ofono_modem *modem, int mask) dbus_message_iter_close_container(&iter, &dict); - dbus_gsm_pending_reply(&cb->pending, reply); + __ofono_dbus_pending_reply(&cb->pending, reply); } static void get_query_lock_callback(const struct ofono_error *error, @@ -736,7 +736,7 @@ static void set_query_lock_callback(const struct ofono_error *error, cb->flags &= ~CALL_BARRING_FLAG_CACHED; - dbus_gsm_pending_reply(&cb->pending, + __ofono_dbus_pending_reply(&cb->pending, __ofono_error_failed(cb->pending)); return; } @@ -749,7 +749,7 @@ static void set_query_lock_callback(const struct ofono_error *error, return; } - dbus_gsm_pending_reply(&cb->pending, + __ofono_dbus_pending_reply(&cb->pending, dbus_message_new_method_return(cb->pending)); update_barrings(modem, BEARER_CLASS_VOICE); } @@ -772,7 +772,7 @@ static void set_lock_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Enabling/disabling a lock failed"); - dbus_gsm_pending_reply(&cb->pending, + __ofono_dbus_pending_reply(&cb->pending, __ofono_error_failed(cb->pending)); return; } @@ -921,7 +921,7 @@ static void disable_all_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Disabling all barring failed"); - dbus_gsm_pending_reply(&cb->pending, + __ofono_dbus_pending_reply(&cb->pending, __ofono_error_failed(cb->pending)); return; } diff --git a/src/call-forwarding.c b/src/call-forwarding.c index 0a9f9ed4..bb310804 100644 --- a/src/call-forwarding.c +++ b/src/call-forwarding.c @@ -421,7 +421,7 @@ static void get_query_cf_callback(const struct ofono_error *error, int total, if (cf->query_next == CALL_FORWARDING_TYPE_NOT_REACHABLE) { DBusMessage *reply = cf_get_properties_reply(cf->pending, cf); - dbus_gsm_pending_reply(&cf->pending, reply); + __ofono_dbus_pending_reply(&cf->pending, reply); return; } @@ -530,13 +530,13 @@ static void set_query_cf_callback(const struct ofono_error *error, int total, ofono_error("Setting succeeded, but query failed"); cf->flags &= ~CALL_FORWARDING_FLAG_CACHED; reply = __ofono_error_failed(cf->pending); - dbus_gsm_pending_reply(&cf->pending, reply); + __ofono_dbus_pending_reply(&cf->pending, reply); return; } if (cf->query_next == cf->query_end) { reply = dbus_message_new_method_return(cf->pending); - dbus_gsm_pending_reply(&cf->pending, reply); + __ofono_dbus_pending_reply(&cf->pending, reply); } else { cf->query_next++; g_timeout_add(0, set_query_next_cf_cond, modem); @@ -567,7 +567,7 @@ static void set_property_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Error occurred during set/erasure"); - dbus_gsm_pending_reply(&cf->pending, + __ofono_dbus_pending_reply(&cf->pending, __ofono_error_failed(cf->pending)); return; } @@ -697,7 +697,7 @@ static void disable_conditional_callback(const struct ofono_error *error, if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Error occurred during conditional erasure"); - dbus_gsm_pending_reply(&cf->pending, + __ofono_dbus_pending_reply(&cf->pending, __ofono_error_failed(cf->pending)); return; } @@ -716,7 +716,7 @@ static void disable_all_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Error occurred during erasure of all"); - dbus_gsm_pending_reply(&cf->pending, + __ofono_dbus_pending_reply(&cf->pending, __ofono_error_failed(cf->pending)); return; } @@ -865,7 +865,7 @@ static void ss_set_query_cf_callback(const struct ofono_error *error, int total, ofono_error("Setting succeeded, but query failed"); cf->flags &= ~CALL_FORWARDING_FLAG_CACHED; reply = __ofono_error_failed(cf->pending); - dbus_gsm_pending_reply(&cf->pending, reply); + __ofono_dbus_pending_reply(&cf->pending, reply); return; } @@ -877,7 +877,7 @@ static void ss_set_query_cf_callback(const struct ofono_error *error, int total, if (cf->query_next == cf->query_end) { reply = cf_ss_control_reply(modem, cf->ss_req); - dbus_gsm_pending_reply(&cf->pending, reply); + __ofono_dbus_pending_reply(&cf->pending, reply); g_free(cf->ss_req); cf->ss_req = NULL; } else { @@ -907,7 +907,7 @@ static void cf_ss_control_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Error occurred during cf ss control set/erasure"); - dbus_gsm_pending_reply(&cf->pending, + __ofono_dbus_pending_reply(&cf->pending, __ofono_error_failed(cf->pending)); g_free(cf->ss_req); cf->ss_req = NULL; diff --git a/src/call-meter.c b/src/call-meter.c index 1d93cc0f..e160e923 100644 --- a/src/call-meter.c +++ b/src/call-meter.c @@ -196,7 +196,7 @@ static void cm_get_properties_reply(struct ofono_modem *modem) dbus_message_iter_close_container(&iter, &dict); - dbus_gsm_pending_reply(&cm->pending, reply); + __ofono_dbus_pending_reply(&cm->pending, reply); } static void query_call_meter_callback(const struct ofono_error *error, int value, @@ -355,13 +355,13 @@ static void set_acm_max_query_callback(const struct ofono_error *error, int valu cm->flags &= ~CALL_METER_FLAG_CACHED; - dbus_gsm_pending_reply(&cm->pending, + __ofono_dbus_pending_reply(&cm->pending, __ofono_error_failed(cm->pending)); return; } reply = dbus_message_new_method_return(cm->pending); - dbus_gsm_pending_reply(&cm->pending, reply); + __ofono_dbus_pending_reply(&cm->pending, reply); set_acm_max(modem, value); } @@ -373,7 +373,7 @@ static void set_acm_max_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Setting acm_max failed"); - dbus_gsm_pending_reply(&cm->pending, + __ofono_dbus_pending_reply(&cm->pending, __ofono_error_failed(cm->pending)); return; } @@ -417,13 +417,13 @@ static void set_puct_query_callback(const struct ofono_error *error, cm->flags &= ~CALL_METER_FLAG_CACHED; - dbus_gsm_pending_reply(&cm->pending, + __ofono_dbus_pending_reply(&cm->pending, __ofono_error_failed(cm->pending)); return; } reply = dbus_message_new_method_return(cm->pending); - dbus_gsm_pending_reply(&cm->pending, reply); + __ofono_dbus_pending_reply(&cm->pending, reply); set_currency(modem, currency); set_ppu(modem, ppu); @@ -436,7 +436,7 @@ static void set_puct_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("setting puct failed"); - dbus_gsm_pending_reply(&cm->pending, + __ofono_dbus_pending_reply(&cm->pending, __ofono_error_failed(cm->pending)); return; } @@ -463,7 +463,7 @@ static void set_puct_initial_query_callback(const struct ofono_error *error, return; if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { - dbus_gsm_pending_reply(&cm->pending, + __ofono_dbus_pending_reply(&cm->pending, __ofono_error_failed(cm->pending)); return; } @@ -622,13 +622,13 @@ static void reset_acm_query_callback(const struct ofono_error *error, int value, cm->flags &= ~CALL_METER_FLAG_CACHED; - dbus_gsm_pending_reply(&cm->pending, + __ofono_dbus_pending_reply(&cm->pending, __ofono_error_failed(cm->pending)); return; } reply = dbus_message_new_method_return(cm->pending); - dbus_gsm_pending_reply(&cm->pending, reply); + __ofono_dbus_pending_reply(&cm->pending, reply); set_acm(modem, value); } @@ -640,7 +640,7 @@ static void acm_reset_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("reseting acm failed"); - dbus_gsm_pending_reply(&cm->pending, + __ofono_dbus_pending_reply(&cm->pending, __ofono_error_failed(cm->pending)); return; } diff --git a/src/call-settings.c b/src/call-settings.c index 1368f1db..ce511d54 100644 --- a/src/call-settings.c +++ b/src/call-settings.c @@ -337,7 +337,7 @@ static void generate_cw_ss_query_reply(struct ofono_modem *modem) dbus_message_iter_close_container(&iter, &var); - dbus_gsm_pending_reply(&cs->pending, reply); + __ofono_dbus_pending_reply(&cs->pending, reply); } static void cw_ss_query_callback(const struct ofono_error *error, int status, @@ -350,7 +350,7 @@ static void cw_ss_query_callback(const struct ofono_error *error, int status, ofono_debug("setting CW via SS failed"); cs->flags &= ~CALL_SETTINGS_FLAG_CACHED; - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, __ofono_error_failed(cs->pending)); return; @@ -368,7 +368,7 @@ static void cw_ss_set_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("setting CW via SS failed"); - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, __ofono_error_failed(cs->pending)); return; @@ -494,7 +494,7 @@ static void generate_ss_query_reply(struct ofono_modem *modem, dbus_message_iter_close_container(&iter, &var); - dbus_gsm_pending_reply(&cs->pending, reply); + __ofono_dbus_pending_reply(&cs->pending, reply); } static void clip_colp_colr_ss_query_cb(const struct ofono_error *error, @@ -507,7 +507,7 @@ static void clip_colp_colr_ss_query_cb(const struct ofono_error *error, if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Error occurred during ss control query"); - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, __ofono_error_failed(cs->pending)); return; @@ -533,7 +533,7 @@ static void clip_colp_colr_ss_query_cb(const struct ofono_error *error, break; default: - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, __ofono_error_failed(cs->pending)); ofono_error("Unknown type during COLR/COLP/CLIP ss"); return; @@ -608,7 +608,7 @@ static void clir_ss_query_callback(const struct ofono_error *error, if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("setting clir via SS failed"); - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, __ofono_error_failed(cs->pending)); return; @@ -657,7 +657,7 @@ static void clir_ss_set_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("setting clir via SS failed"); - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, __ofono_error_failed(cs->pending)); return; @@ -829,7 +829,7 @@ out: if (cs->pending) { DBusMessage *reply = generate_get_properties_reply(modem, cs->pending); - dbus_gsm_pending_reply(&cs->pending, reply); + __ofono_dbus_pending_reply(&cs->pending, reply); } } @@ -843,7 +843,7 @@ static gboolean query_clir(gpointer user) DBusMessage *reply = generate_get_properties_reply(modem, cs->pending); - dbus_gsm_pending_reply(&cs->pending, reply); + __ofono_dbus_pending_reply(&cs->pending, reply); } return FALSE; @@ -996,12 +996,12 @@ static void clir_set_query_callback(const struct ofono_error *error, cs->flags &= ~CALL_SETTINGS_FLAG_CACHED; reply = __ofono_error_failed(cs->pending); - dbus_gsm_pending_reply(&cs->pending, reply); + __ofono_dbus_pending_reply(&cs->pending, reply); return; } reply = dbus_message_new_method_return(cs->pending); - dbus_gsm_pending_reply(&cs->pending, reply); + __ofono_dbus_pending_reply(&cs->pending, reply); set_clir_override(modem, override_setting); set_clir_network(modem, network_setting); @@ -1014,7 +1014,7 @@ static void clir_set_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("setting clir failed"); - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, __ofono_error_failed(cs->pending)); return; @@ -1061,12 +1061,12 @@ static void cw_set_query_callback(const struct ofono_error *error, int status, cs->flags &= ~CALL_SETTINGS_FLAG_CACHED; - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, __ofono_error_failed(cs->pending)); return; } - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, dbus_message_new_method_return(cs->pending)); set_cw(modem, status, BEARER_CLASS_VOICE); @@ -1080,7 +1080,7 @@ static void cw_set_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Error occurred during CW set"); - dbus_gsm_pending_reply(&cs->pending, + __ofono_dbus_pending_reply(&cs->pending, __ofono_error_failed(cs->pending)); return; diff --git a/src/dbus-gsm.c b/src/dbus-gsm.c index b132bfac..10174718 100644 --- a/src/dbus-gsm.c +++ b/src/dbus-gsm.c @@ -227,6 +227,16 @@ DBusMessage *__ofono_error_timed_out(DBusMessage *msg) "Operation failure due to timeout"); } +void __ofono_dbus_pending_reply(DBusMessage **msg, DBusMessage *reply) +{ + DBusConnection *conn = ofono_dbus_get_connection(); + + g_dbus_send_message(conn, reply); + + dbus_message_unref(*msg); + *msg = NULL; +} + DBusConnection *ofono_dbus_get_connection() { return g_connection; diff --git a/src/dbus-gsm.h b/src/dbus-gsm.h index a1c60179..b3d03c01 100644 --- a/src/dbus-gsm.h +++ b/src/dbus-gsm.h @@ -24,12 +24,3 @@ #define MAX_DBUS_PATH_LEN 64 -static inline void dbus_gsm_pending_reply(DBusMessage **msg, DBusMessage *reply) -{ - DBusConnection *conn = ofono_dbus_get_connection(); - - g_dbus_send_message(conn, reply); - - dbus_message_unref(*msg); - *msg = NULL; -} diff --git a/src/ofono.h b/src/ofono.h index 0087d3a2..9197337f 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -50,6 +50,8 @@ DBusMessage *__ofono_error_not_active(DBusMessage *msg); DBusMessage *__ofono_error_not_supported(DBusMessage *msg); DBusMessage *__ofono_error_timed_out(DBusMessage *msg); +void __ofono_dbus_pending_reply(DBusMessage **msg, DBusMessage *reply); + #include int __ofono_plugin_init(const char *pattern, const char *exclude); diff --git a/src/phonebook.c b/src/phonebook.c index 618b733c..a1143bdd 100644 --- a/src/phonebook.c +++ b/src/phonebook.c @@ -456,7 +456,7 @@ static void export_phonebook(struct ofono_modem *modem) return; } - dbus_gsm_pending_reply(&phonebook->pending, reply); + __ofono_dbus_pending_reply(&phonebook->pending, reply); phonebook->flags |= PHONEBOOK_FLAG_CACHED; } diff --git a/src/sms.c b/src/sms.c index 1b412a26..b1bd1296 100644 --- a/src/sms.c +++ b/src/sms.c @@ -169,7 +169,7 @@ out: if (sms->pending) { DBusMessage *reply = generate_get_properties_reply(modem, sms->pending); - dbus_gsm_pending_reply(&sms->pending, reply); + __ofono_dbus_pending_reply(&sms->pending, reply); } } @@ -207,14 +207,14 @@ static void sca_set_query_callback(const struct ofono_error *error, ofono_error("Set SCA succeeded, but query failed"); sms->flags &= ~SMS_MANAGER_FLAG_CACHED; reply = __ofono_error_failed(sms->pending); - dbus_gsm_pending_reply(&sms->pending, reply); + __ofono_dbus_pending_reply(&sms->pending, reply); return; } set_sca(modem, sca); reply = dbus_message_new_method_return(sms->pending); - dbus_gsm_pending_reply(&sms->pending, reply); + __ofono_dbus_pending_reply(&sms->pending, reply); } static void sca_set_callback(const struct ofono_error *error, void *data) @@ -224,7 +224,7 @@ static void sca_set_callback(const struct ofono_error *error, void *data) if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Setting SCA failed"); - dbus_gsm_pending_reply(&sms->pending, + __ofono_dbus_pending_reply(&sms->pending, __ofono_error_failed(sms->pending)); return; } diff --git a/src/ussd.c b/src/ussd.c index 5334240e..cbd49ba5 100644 --- a/src/ussd.c +++ b/src/ussd.c @@ -507,7 +507,7 @@ static void ussd_cancel_callback(const struct ofono_error *error, void *data) } else reply = __ofono_error_failed(ussd->pending); - dbus_gsm_pending_reply(&ussd->pending, reply); + __ofono_dbus_pending_reply(&ussd->pending, reply); } static DBusMessage *ussd_cancel(DBusConnection *conn, DBusMessage *msg,