summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/atmodem/atmodem.c15
-rw-r--r--src/call-barring.c68
-rw-r--r--src/call-forwarding.c56
-rw-r--r--src/call-meter.c54
-rw-r--r--src/call-settings.c62
-rw-r--r--src/dbus-gsm.c60
-rw-r--r--src/dbus-gsm.h61
-rw-r--r--src/network.c14
-rw-r--r--src/ofono.h10
-rw-r--r--src/phonebook.c2
-rw-r--r--src/sms.c32
-rw-r--r--src/ussd.c28
-rw-r--r--src/voicecall.c126
13 files changed, 301 insertions, 287 deletions
diff --git a/drivers/atmodem/atmodem.c b/drivers/atmodem/atmodem.c
index 41e63b4a..4e3e5544 100644
--- a/drivers/atmodem/atmodem.c
+++ b/drivers/atmodem/atmodem.c
@@ -42,6 +42,11 @@
static GSList *g_sessions = NULL;
static GSList *g_pending = NULL;
+DBusMessage *__ofono_error_invalid_args(DBusMessage *msg);
+DBusMessage *__ofono_error_invalid_format(DBusMessage *msg);
+DBusMessage *__ofono_error_failed(DBusMessage *msg);
+DBusMessage *__ofono_error_not_found(DBusMessage *msg);
+
static void modem_list(char ***modems)
{
GSList *l;
@@ -388,7 +393,7 @@ out:
if (at)
at_destroy(at);
- reply = dbus_gsm_failed(msg);
+ reply = __ofono_error_failed(msg);
g_dbus_send_message(conn, reply);
}
@@ -403,12 +408,12 @@ static DBusMessage *manager_create(DBusConnection *conn, DBusMessage *msg,
DBUS_TYPE_STRING, &target,
DBUS_TYPE_STRING, &driver,
DBUS_TYPE_INVALID))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
io = modem_session_create(target, create_cb, msg, msg_destroy);
if (!io)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
dbus_message_ref(msg);
@@ -426,7 +431,7 @@ static DBusMessage *manager_destroy(DBusConnection *conn, DBusMessage *msg,
if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
for (l = g_sessions; l; l = l->next) {
struct at_data *at = l->data;
@@ -451,7 +456,7 @@ static DBusMessage *manager_destroy(DBusConnection *conn, DBusMessage *msg,
return dbus_message_new_method_return(msg);
}
- return dbus_gsm_not_found(msg);
+ return __ofono_error_not_found(msg);
}
static DBusMessage *manager_get_properties(DBusConnection *conn,
diff --git a/src/call-barring.c b/src/call-barring.c
index 1f42605d..ec0ae222 100644
--- a/src/call-barring.c
+++ b/src/call-barring.c
@@ -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,
- dbus_gsm_failed(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,
- dbus_gsm_failed(cb->pending));
+ __ofono_error_failed(cb->pending));
return;
}
@@ -378,7 +378,7 @@ static gboolean cb_ss_control(struct ofono_modem *modem,
int i;
if (cb->pending) {
- reply = dbus_gsm_busy(msg);
+ reply = __ofono_error_busy(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -423,7 +423,7 @@ static gboolean cb_ss_control(struct ofono_modem *modem,
}
if (!operation) {
- reply = dbus_gsm_not_implemented(msg);
+ reply = __ofono_error_not_implemented(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -478,7 +478,7 @@ static gboolean cb_ss_control(struct ofono_modem *modem,
return TRUE;
bad_format:
- reply = dbus_gsm_invalid_format(msg);
+ reply = __ofono_error_invalid_format(msg);
g_dbus_send_message(conn, reply);
return TRUE;
}
@@ -492,7 +492,7 @@ static void cb_set_passwd_callback(const struct ofono_error *error, void *data)
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
reply = dbus_message_new_method_return(cb->pending);
else {
- reply = dbus_gsm_failed(cb->pending);
+ reply = __ofono_error_failed(cb->pending);
ofono_debug("Changing Call Barring password via SS failed");
}
@@ -509,7 +509,7 @@ static gboolean cb_ss_passwd(struct ofono_modem *modem, const char *sc,
const char *fac;
if (cb->pending) {
- reply = dbus_gsm_busy(msg);
+ reply = __ofono_error_busy(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -536,7 +536,7 @@ static gboolean cb_ss_passwd(struct ofono_modem *modem, const char *sc,
return TRUE;
bad_format:
- reply = dbus_gsm_invalid_format(msg);
+ reply = __ofono_error_invalid_format(msg);
g_dbus_send_message(conn, reply);
return TRUE;
}
@@ -705,10 +705,10 @@ static DBusMessage *cb_get_properties(DBusConnection *conn, DBusMessage *msg,
struct call_barring_data *cb = modem->call_barring;
if (cb->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!cb->ops->query)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
cb->pending = dbus_message_ref(msg);
@@ -735,7 +735,7 @@ static void set_query_lock_callback(const struct ofono_error *error,
cb->flags &= ~CALL_BARRING_FLAG_CACHED;
dbus_gsm_pending_reply(&cb->pending,
- dbus_gsm_failed(cb->pending));
+ __ofono_error_failed(cb->pending));
return;
}
@@ -771,7 +771,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,
- dbus_gsm_failed(cb->pending));
+ __ofono_error_failed(cb->pending));
return;
}
@@ -865,43 +865,43 @@ static DBusMessage *cb_set_property(DBusConnection *conn, DBusMessage *msg,
int mode;
if (cb->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!dbus_message_iter_init(msg, &iter))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &name);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_recurse(&iter, &var);
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
dbus_message_iter_get_basic(&var, &value);
if (!cb_lock_property_lookup(name, value, BEARER_CLASS_VOICE,
&lock, &cls, &mode))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
if (dbus_message_iter_next(&iter)) {
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &passwd);
if (!is_valid_pin(passwd))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
}
if (!cb->ops->set)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
cb_set_query_bounds(cb, cb_locks[lock].fac, FALSE);
@@ -920,7 +920,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,
- dbus_gsm_failed(cb->pending));
+ __ofono_error_failed(cb->pending));
return;
}
@@ -937,20 +937,20 @@ static DBusMessage *cb_disable_all(DBusConnection *conn, DBusMessage *msg,
const char *passwd = "";
if (cb->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!dbus_message_iter_init(msg, &iter))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &passwd);
if (!is_valid_pin(passwd))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
if (!cb->ops->set)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
cb_set_query_bounds(cb, fac, FALSE);
@@ -988,29 +988,29 @@ static DBusMessage *cb_set_passwd(DBusConnection *conn, DBusMessage *msg,
const char *old_passwd, *new_passwd;
if (cb->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!dbus_message_iter_init(msg, &iter))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &old_passwd);
if (!is_valid_pin(old_passwd))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &new_passwd);
if (!is_valid_pin(new_passwd))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
if (!cb->ops->set_passwd)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
cb->pending = dbus_message_ref(msg);
cb->ops->set_passwd(modem, "AB", old_passwd, new_passwd,
diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 1be280b7..77008236 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -450,10 +450,10 @@ static DBusMessage *cf_get_properties(DBusConnection *conn, DBusMessage *msg,
return cf_get_properties_reply(msg, cf);
if (!cf->ops->query)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (cf->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
cf->pending = dbus_message_ref(msg);
cf->query_next = 0;
@@ -529,7 +529,7 @@ static void set_query_cf_callback(const struct ofono_error *error, int total,
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
ofono_error("Setting succeeded, but query failed");
cf->flags &= ~CALL_FORWARDING_FLAG_CACHED;
- reply = dbus_gsm_failed(cf->pending);
+ reply = __ofono_error_failed(cf->pending);
dbus_gsm_pending_reply(&cf->pending, reply);
return;
}
@@ -568,7 +568,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,
- dbus_gsm_failed(cf->pending));
+ __ofono_error_failed(cf->pending));
return;
}
@@ -585,10 +585,10 @@ static DBusMessage *set_property_request(struct ofono_modem *modem,
struct call_forwarding_data *cf = modem->call_forwarding;
if (ph->number[0] != '\0' && cf->ops->registration == NULL)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (ph->number[0] == '\0' && cf->ops->erasure == NULL)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
cf->pending = dbus_message_ref(msg);
cf->query_next = type;
@@ -618,19 +618,19 @@ static DBusMessage *cf_set_property(DBusConnection *conn, DBusMessage *msg,
int type;
if (cf->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!dbus_message_iter_init(msg, &iter))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &property);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_recurse(&iter, &var);
@@ -642,19 +642,19 @@ static DBusMessage *cf_set_property(DBusConnection *conn, DBusMessage *msg,
type = CALL_FORWARDING_TYPE_NO_REPLY;
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_UINT16)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&var, &timeout);
if (timeout < 1 || timeout > 30)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
l = g_slist_find_custom(cf->cf_conditions[type],
GINT_TO_POINTER(cls),
cf_condition_find_with_cls);
if (!l)
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
c = l->data;
@@ -669,12 +669,12 @@ static DBusMessage *cf_set_property(DBusConnection *conn, DBusMessage *msg,
ph.type = 129;
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&var, &number);
if (strlen(number) > 0 && !valid_phone_number_format(number))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
if (number[0] != '\0')
string_to_phone_number(number, &ph);
@@ -685,7 +685,7 @@ static DBusMessage *cf_set_property(DBusConnection *conn, DBusMessage *msg,
timeout);
}
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
}
static void disable_conditional_callback(const struct ofono_error *error,
@@ -698,7 +698,7 @@ static void disable_conditional_callback(const struct ofono_error *error,
ofono_debug("Error occurred during conditional erasure");
dbus_gsm_pending_reply(&cf->pending,
- dbus_gsm_failed(cf->pending));
+ __ofono_error_failed(cf->pending));
return;
}
@@ -717,7 +717,7 @@ static void disable_all_callback(const struct ofono_error *error, void *data)
ofono_debug("Error occurred during erasure of all");
dbus_gsm_pending_reply(&cf->pending,
- dbus_gsm_failed(cf->pending));
+ __ofono_error_failed(cf->pending));
return;
}
@@ -736,21 +736,21 @@ static DBusMessage *cf_disable_all(DBusConnection *conn, DBusMessage *msg,
int type;
if (cf->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!cf->ops->erasure)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &strtype,
DBUS_TYPE_INVALID) == FALSE)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (!strcmp(strtype, "all") || !strcmp(strtype, ""))
type = CALL_FORWARDING_TYPE_ALL;
else if (!strcmp(strtype, "conditional"))
type = CALL_FORWARDING_TYPE_ALL_CONDITIONAL;
else
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
cf->pending = dbus_message_ref(msg);
@@ -864,7 +864,7 @@ static void ss_set_query_cf_callback(const struct ofono_error *error, int total,
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
ofono_error("Setting succeeded, but query failed");
cf->flags &= ~CALL_FORWARDING_FLAG_CACHED;
- reply = dbus_gsm_failed(cf->pending);
+ reply = __ofono_error_failed(cf->pending);
dbus_gsm_pending_reply(&cf->pending, reply);
return;
}
@@ -908,7 +908,7 @@ static void cf_ss_control_callback(const struct ofono_error *error, void *data)
ofono_debug("Error occurred during cf ss control set/erasure");
dbus_gsm_pending_reply(&cf->pending,
- dbus_gsm_failed(cf->pending));
+ __ofono_error_failed(cf->pending));
g_free(cf->ss_req);
cf->ss_req = NULL;
return;
@@ -937,7 +937,7 @@ static gboolean cf_ss_control(struct ofono_modem *modem,
return FALSE;
if (cf->pending) {
- reply = dbus_gsm_busy(msg);
+ reply = __ofono_error_busy(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -1035,7 +1035,7 @@ static gboolean cf_ss_control(struct ofono_modem *modem,
}
if (!operation) {
- reply = dbus_gsm_not_implemented(msg);
+ reply = __ofono_error_not_implemented(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -1044,7 +1044,7 @@ static gboolean cf_ss_control(struct ofono_modem *modem,
cf->ss_req = g_try_new0(struct cf_ss_request, 1);
if (!cf->ss_req) {
- reply = dbus_gsm_failed(msg);
+ reply = __ofono_error_failed(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -1106,7 +1106,7 @@ static gboolean cf_ss_control(struct ofono_modem *modem,
return TRUE;
error:
- reply = dbus_gsm_invalid_format(msg);
+ reply = __ofono_error_invalid_format(msg);
g_dbus_send_message(conn, reply);
return TRUE;
}
diff --git a/src/call-meter.c b/src/call-meter.c
index ca4d6371..64f6489b 100644
--- a/src/call-meter.c
+++ b/src/call-meter.c
@@ -322,7 +322,7 @@ static DBusMessage *cm_get_properties(DBusConnection *conn, DBusMessage *msg,
struct call_meter_data *cm = modem->call_meter;
if (cm->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
cm->pending = dbus_message_ref(msg);
@@ -355,7 +355,7 @@ 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,
- dbus_gsm_failed(cm->pending));
+ __ofono_error_failed(cm->pending));
return;
}
@@ -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,
- dbus_gsm_failed(cm->pending));
+ __ofono_error_failed(cm->pending));
return;
}
@@ -389,7 +389,7 @@ static DBusMessage *prop_set_acm_max(DBusMessage *msg, struct ofono_modem *modem
dbus_uint32_t value;
if (!cm->ops->acm_max_set)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
dbus_message_iter_get_basic(dbus_value, &value);
@@ -417,7 +417,7 @@ static void set_puct_query_callback(const struct ofono_error *error,
cm->flags &= ~CALL_METER_FLAG_CACHED;
dbus_gsm_pending_reply(&cm->pending,
- dbus_gsm_failed(cm->pending));
+ __ofono_error_failed(cm->pending));
return;
}
@@ -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,
- dbus_gsm_failed(cm->pending));
+ __ofono_error_failed(cm->pending));
return;
}
@@ -463,7 +463,7 @@ static void set_puct_initial_query_callback(const struct ofono_error *error,
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
dbus_gsm_pending_reply(&cm->pending,
- dbus_gsm_failed(cm->pending));
+ __ofono_error_failed(cm->pending));
return;
}
@@ -495,12 +495,12 @@ static DBusMessage *prop_set_ppu(DBusMessage *msg, struct ofono_modem *modem,
double ppu;
if (!cm->ops->puct_set || !cm->ops->puct_query)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
dbus_message_iter_get_basic(var, &ppu);
if (ppu < 0.0)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
cm->pending = dbus_message_ref(msg);
@@ -521,12 +521,12 @@ static DBusMessage *prop_set_cur(DBusMessage *msg, struct ofono_modem *modem,
const char *value;
if (!cm->ops->puct_set || !cm->ops->puct_query)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
dbus_message_iter_get_basic(var, &value);
if (strlen(value) > 3)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
cm->pending = dbus_message_ref(msg);
@@ -565,45 +565,45 @@ static DBusMessage *cm_set_property(DBusConnection *conn, DBusMessage *msg,
struct call_meter_property *property;
if (cm->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!dbus_message_iter_init(msg, &iter))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &name);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_recurse(&iter, &var);
if (!dbus_message_iter_next(&iter))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &passwd);
if (!is_valid_pin(passwd))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
for (property = cm_properties; property->name; property++) {
if (strcmp(name, property->name))
continue;
if (dbus_message_iter_get_arg_type(&var) != property->type)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
return property->set(msg, modem, &var, passwd);
}
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
}
static void reset_acm_query_callback(const struct ofono_error *error, int value,
@@ -622,7 +622,7 @@ 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,
- dbus_gsm_failed(cm->pending));
+ __ofono_error_failed(cm->pending));
return;
}
@@ -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,
- dbus_gsm_failed(cm->pending));
+ __ofono_error_failed(cm->pending));
return;
}
@@ -657,21 +657,21 @@ static DBusMessage *cm_acm_reset(DBusConnection *conn, DBusMessage *msg,
const char *pin2;
if (cm->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!dbus_message_iter_init(msg, &iter))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &pin2);
if (!is_valid_pin(pin2))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
if (!cm->ops->acm_reset)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
cm->pending = dbus_message_ref(msg);
diff --git a/src/call-settings.c b/src/call-settings.c
index d17f9257..8e8d425a 100644
--- a/src/call-settings.c
+++ b/src/call-settings.c
@@ -350,7 +350,7 @@ static void cw_ss_query_callback(const struct ofono_error *error, int status,
cs->flags &= ~CALL_SETTINGS_FLAG_CACHED;
dbus_gsm_pending_reply(&cs->pending,
- dbus_gsm_failed(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,
- dbus_gsm_failed(cs->pending));
+ __ofono_error_failed(cs->pending));
return;
}
@@ -395,7 +395,7 @@ static gboolean cw_ss_control(struct ofono_modem *modem,
return FALSE;
if (cs->pending) {
- reply = dbus_gsm_busy(msg);
+ reply = __ofono_error_busy(msg);
goto error;
}
@@ -404,7 +404,7 @@ static gboolean cw_ss_control(struct ofono_modem *modem,
if ((type == SS_CONTROL_TYPE_QUERY && !cs->ops->cw_query) ||
(type != SS_CONTROL_TYPE_QUERY && !cs->ops->cw_set)) {
- reply = dbus_gsm_not_implemented(msg);
+ reply = __ofono_error_not_implemented(msg);
goto error;
}
@@ -456,7 +456,7 @@ static gboolean cw_ss_control(struct ofono_modem *modem,
return TRUE;
bad_format:
- reply = dbus_gsm_invalid_format(msg);
+ reply = __ofono_error_invalid_format(msg);
error:
g_dbus_send_message(conn, reply);
return TRUE;
@@ -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,
- dbus_gsm_failed(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,
default:
dbus_gsm_pending_reply(&cs->pending,
- dbus_gsm_failed(cs->pending));
+ __ofono_error_failed(cs->pending));
ofono_error("Unknown type during COLR/COLP/CLIP ss");
return;
};
@@ -556,7 +556,7 @@ static gboolean clip_colp_colr_ss(struct ofono_modem *modem,
return FALSE;
if (cs->pending) {
- DBusMessage *reply = dbus_gsm_busy(msg);
+ DBusMessage *reply = __ofono_error_busy(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -576,14 +576,14 @@ static gboolean clip_colp_colr_ss(struct ofono_modem *modem,
if (type != SS_CONTROL_TYPE_QUERY || strlen(sia) || strlen(sib) ||
strlen(sic) || strlen(dn)) {
- DBusMessage *reply = dbus_gsm_invalid_format(msg);
+ DBusMessage *reply = __ofono_error_invalid_format(msg);
g_dbus_send_message(conn, reply);
return TRUE;
}
if (!query_op) {
- DBusMessage *reply = dbus_gsm_not_implemented(msg);
+ DBusMessage *reply = __ofono_error_not_implemented(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -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,
- dbus_gsm_failed(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,
- dbus_gsm_failed(cs->pending));
+ __ofono_error_failed(cs->pending));
return;
}
@@ -681,7 +681,7 @@ static gboolean clir_ss_control(struct ofono_modem *modem,
return FALSE;
if (cs->pending) {
- DBusMessage *reply = dbus_gsm_busy(msg);
+ DBusMessage *reply = __ofono_error_busy(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -693,7 +693,7 @@ static gboolean clir_ss_control(struct ofono_modem *modem,
return FALSE;
if (strlen(sia) || strlen(sib) || strlen(sic) || strlen(dn)) {
- DBusMessage *reply = dbus_gsm_invalid_format(msg);
+ DBusMessage *reply = __ofono_error_invalid_format(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -701,7 +701,7 @@ static gboolean clir_ss_control(struct ofono_modem *modem,
if ((type == SS_CONTROL_TYPE_QUERY && !cs->ops->clir_query) ||
(type != SS_CONTROL_TYPE_QUERY && !cs->ops->clir_set)) {
- DBusMessage *reply = dbus_gsm_not_implemented(msg);
+ DBusMessage *reply = __ofono_error_not_implemented(msg);
g_dbus_send_message(conn, reply);
return TRUE;
@@ -965,7 +965,7 @@ static DBusMessage *cs_get_properties(DBusConnection *conn, DBusMessage *msg,
struct call_settings_data *cs = modem->call_settings;
if (cs->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (cs->flags & CALL_SETTINGS_FLAG_CACHED)
return generate_get_properties_reply(modem, msg);
@@ -994,7 +994,7 @@ static void clir_set_query_callback(const struct ofono_error *error,
cs->flags &= ~CALL_SETTINGS_FLAG_CACHED;
- reply = dbus_gsm_failed(cs->pending);
+ reply = __ofono_error_failed(cs->pending);
dbus_gsm_pending_reply(&cs->pending, reply);
return;
}
@@ -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,
- dbus_gsm_failed(cs->pending));
+ __ofono_error_failed(cs->pending));
return;
}
@@ -1030,7 +1030,7 @@ static DBusMessage *set_clir(DBusMessage *msg, struct ofono_modem *modem,
int clir = -1;
if (cs->ops->clir_set == NULL)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (!strcmp(setting, "default"))
clir = 0;
@@ -1040,7 +1040,7 @@ static DBusMessage *set_clir(DBusMessage *msg, struct ofono_modem *modem,
clir = 2;
if (clir == -1)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
cs->pending = dbus_message_ref(msg);
@@ -1061,7 +1061,7 @@ 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,
- dbus_gsm_failed(cs->pending));
+ __ofono_error_failed(cs->pending));
return;
}
@@ -1080,7 +1080,7 @@ static void cw_set_callback(const struct ofono_error *error, void *data)
ofono_debug("Error occurred during CW set");
dbus_gsm_pending_reply(&cs->pending,
- dbus_gsm_failed(cs->pending));
+ __ofono_error_failed(cs->pending));
return;
}
@@ -1096,14 +1096,14 @@ static DBusMessage *set_cw_req(DBusMessage *msg, struct ofono_modem *modem,
int cw;
if (cs->ops->cw_set == NULL)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (!strcmp(setting, "enabled"))
cw = 1;
else if (!strcmp(setting, "disabled"))
cw = 0;
else
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
cs->pending = dbus_message_ref(msg);
@@ -1149,19 +1149,19 @@ static DBusMessage *cs_set_property(DBusConnection *conn, DBusMessage *msg,
int cls;
if (cs->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!dbus_message_iter_init(msg, &iter))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &property);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_recurse(&iter, &var);
@@ -1169,7 +1169,7 @@ static DBusMessage *cs_set_property(DBusConnection *conn, DBusMessage *msg,
const char *setting;
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
dbus_message_iter_get_basic(&var, &setting);
@@ -1178,14 +1178,14 @@ static DBusMessage *cs_set_property(DBusConnection *conn, DBusMessage *msg,
const char *setting;
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
dbus_message_iter_get_basic(&var, &setting);
return set_cw_req(msg, modem, setting, cls);
}
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
}
static GDBusMethodTable cs_methods[] = {
diff --git a/src/dbus-gsm.c b/src/dbus-gsm.c
index 54b72e1b..b4de133e 100644
--- a/src/dbus-gsm.c
+++ b/src/dbus-gsm.c
@@ -31,6 +31,7 @@
#include "dbus-gsm.h"
+#define DBUS_GSM_ERROR_INTERFACE "org.ofono.Error"
static DBusConnection *g_connection;
@@ -167,6 +168,65 @@ int dbus_gsm_signal_array_property_changed(DBusConnection *conn,
return g_dbus_send_message(conn, signal);
}
+DBusMessage *__ofono_error_invalid_args(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE
+ ".InvalidArguments",
+ "Invalid arguments in method call");
+}
+
+DBusMessage *__ofono_error_invalid_format(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE
+ ".InvalidFormat",
+ "Argument format is not recognized");
+}
+
+DBusMessage *__ofono_error_not_implemented(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE
+ ".NotImplemented",
+ "Implementation not provided");
+}
+
+DBusMessage *__ofono_error_failed(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".Failed",
+ "Operation failed");
+}
+
+DBusMessage *__ofono_error_busy(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".InProgress",
+ "Operation already in progress");
+}
+
+DBusMessage *__ofono_error_not_found(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".NotFound",
+ "Object is not found or not valid for this operation");
+}
+
+DBusMessage *__ofono_error_not_active(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".NotActive",
+ "Operation is not active or in progress");
+}
+
+DBusMessage *__ofono_error_not_supported(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE
+ ".NotSupported",
+ "Operation is not supported by the"
+ " network / modem");
+}
+
+DBusMessage *__ofono_error_timed_out(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".Timedout",
+ "Operation failure due to timeout");
+}
+
DBusConnection *ofono_dbus_get_connection()
{
return g_connection;
diff --git a/src/dbus-gsm.h b/src/dbus-gsm.h
index c12157e1..c24b52cb 100644
--- a/src/dbus-gsm.h
+++ b/src/dbus-gsm.h
@@ -51,67 +51,6 @@ int dbus_gsm_signal_array_property_changed(DBusConnection *conn,
const char *name, int type,
void *value);
-#define DBUS_GSM_ERROR_INTERFACE "org.ofono.Error"
-
-static inline DBusMessage *dbus_gsm_invalid_args(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE
- ".InvalidArguments",
- "Invalid arguments in method call");
-}
-
-static inline DBusMessage *dbus_gsm_invalid_format(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE
- ".InvalidFormat",
- "Argument format is not recognized");
-}
-
-static inline DBusMessage *dbus_gsm_not_implemented(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE
- ".NotImplemented",
- "Implementation not provided");
-}
-
-static inline DBusMessage *dbus_gsm_failed(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".Failed",
- "Operation failed");
-}
-
-static inline DBusMessage *dbus_gsm_busy(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".InProgress",
- "Operation already in progress");
-}
-
-static inline DBusMessage *dbus_gsm_not_found(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".NotFound",
- "Object is not found or not valid for this operation");
-}
-
-static inline DBusMessage *dbus_gsm_not_active(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".NotActive",
- "Operation is not active or in progress");
-}
-
-static inline DBusMessage *dbus_gsm_not_supported(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE
- ".NotSupported",
- "Operation is not supported by the"
- " network / modem");
-}
-
-static inline DBusMessage *dbus_gsm_timed_out(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, DBUS_GSM_ERROR_INTERFACE ".Timedout",
- "Operation failure due to timeout");
-}
-
static inline void dbus_gsm_pending_reply(DBusMessage **msg, DBusMessage *reply)
{
DBusConnection *conn = ofono_dbus_get_connection();
diff --git a/src/network.c b/src/network.c
index 68316f93..77a80e0c 100644
--- a/src/network.c
+++ b/src/network.c
@@ -163,7 +163,7 @@ static void register_callback(const struct ofono_error *error, void *data)
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
reply = dbus_message_new_method_return(netreg->pending);
else
- reply = dbus_gsm_failed(netreg->pending);
+ reply = __ofono_error_failed(netreg->pending);
g_dbus_send_message(conn, reply);
@@ -555,10 +555,10 @@ static DBusMessage *network_operator_register(DBusConnection *conn,
struct network_registration_data *netreg = op->modem->network_registration;
if (netreg->flags & NETWORK_REGISTRATION_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (netreg->ops->register_manual == NULL)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
netreg->flags |= NETWORK_REGISTRATION_FLAG_PENDING;
netreg->pending = dbus_message_ref(msg);
@@ -756,10 +756,10 @@ static DBusMessage *network_register(DBusConnection *conn,
struct network_registration_data *netreg = modem->network_registration;
if (netreg->flags & NETWORK_REGISTRATION_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (netreg->ops->register_auto == NULL)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
netreg->flags |= NETWORK_REGISTRATION_FLAG_PENDING;
netreg->pending = dbus_message_ref(msg);
@@ -776,10 +776,10 @@ static DBusMessage *network_deregister(DBusConnection *conn,
struct network_registration_data *netreg = modem->network_registration;
if (netreg->flags & NETWORK_REGISTRATION_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (netreg->ops->deregister == NULL)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
netreg->flags |= NETWORK_REGISTRATION_FLAG_PENDING;
netreg->pending = dbus_message_ref(msg);
diff --git a/src/ofono.h b/src/ofono.h
index f4d632f8..0087d3a2 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -40,6 +40,16 @@ void __ofono_toggle_debug(void);
int __ofono_dbus_init(DBusConnection *conn);
void __ofono_dbus_cleanup(void);
+DBusMessage *__ofono_error_invalid_args(DBusMessage *msg);
+DBusMessage *__ofono_error_invalid_format(DBusMessage *msg);
+DBusMessage *__ofono_error_not_implemented(DBusMessage *msg);
+DBusMessage *__ofono_error_failed(DBusMessage *msg);
+DBusMessage *__ofono_error_busy(DBusMessage *msg);
+DBusMessage *__ofono_error_not_found(DBusMessage *msg);
+DBusMessage *__ofono_error_not_active(DBusMessage *msg);
+DBusMessage *__ofono_error_not_supported(DBusMessage *msg);
+DBusMessage *__ofono_error_timed_out(DBusMessage *msg);
+
#include <ofono/plugin.h>
int __ofono_plugin_init(const char *pattern, const char *exclude);
diff --git a/src/phonebook.c b/src/phonebook.c
index 71e2270c..618b733c 100644
--- a/src/phonebook.c
+++ b/src/phonebook.c
@@ -468,7 +468,7 @@ static DBusMessage *import_entries(DBusConnection *conn, DBusMessage *msg,
DBusMessage *reply;
if (phonebook->pending) {
- reply = dbus_gsm_busy(phonebook->pending);
+ reply = __ofono_error_busy(phonebook->pending);
g_dbus_send_message(conn, reply);
return NULL;
}
diff --git a/src/sms.c b/src/sms.c
index a8dbb717..0c71ef47 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -180,10 +180,10 @@ static DBusMessage *sms_get_properties(DBusConnection *conn,
struct sms_manager_data *sms = modem->sms_manager;
if (sms->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!sms->ops->sca_query)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (sms->flags & SMS_MANAGER_FLAG_CACHED)
return generate_get_properties_reply(modem, msg);
@@ -206,7 +206,7 @@ static void sca_set_query_callback(const struct ofono_error *error,
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
ofono_error("Set SCA succeeded, but query failed");
sms->flags &= ~SMS_MANAGER_FLAG_CACHED;
- reply = dbus_gsm_failed(sms->pending);
+ reply = __ofono_error_failed(sms->pending);
dbus_gsm_pending_reply(&sms->pending, reply);
return;
}
@@ -225,7 +225,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,
- dbus_gsm_failed(sms->pending));
+ __ofono_error_failed(sms->pending));
return;
}
@@ -242,19 +242,19 @@ static DBusMessage *sms_set_property(DBusConnection *conn, DBusMessage *msg,
const char *property;
if (sms->pending)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!dbus_message_iter_init(msg, &iter))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &property);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_recurse(&iter, &var);
@@ -263,15 +263,15 @@ static DBusMessage *sms_set_property(DBusConnection *conn, DBusMessage *msg,
struct ofono_phone_number sca;
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&var, &value);
if (strlen(value) == 0 || !valid_phone_number_format(value))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
if (!sms->ops->sca_set)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
string_to_phone_number(value, &sca);
@@ -281,7 +281,7 @@ static DBusMessage *sms_set_property(DBusConnection *conn, DBusMessage *msg,
return NULL;
}
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
}
static void tx_finished(const struct ofono_error *error, int mr, void *data)
@@ -398,11 +398,11 @@ static DBusMessage *sms_send_message(DBusConnection *conn, DBusMessage *msg,
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
&tos, &num_to, DBUS_TYPE_STRING, &text,
DBUS_TYPE_INVALID))
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (num_to == 0) {
dbus_free_string_array(tos);
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
}
ofono_debug("Got %d recipients", num_to);
@@ -412,14 +412,14 @@ static DBusMessage *sms_send_message(DBusConnection *conn, DBusMessage *msg,
continue;
dbus_free_string_array(tos);
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
}
msg_list = sms_text_prepare(text, 0, TRUE, &ref_offset);
if (!msg_list) {
dbus_free_string_array(tos);
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
}
for (i = 0; i < num_to; i++) {
diff --git a/src/ussd.c b/src/ussd.c
index 9970473c..5334240e 100644
--- a/src/ussd.c
+++ b/src/ussd.c
@@ -280,7 +280,7 @@ static gboolean recognized_passwd_change_string(struct ofono_modem *modem,
/* If SIC & SID don't match, then we just bail out here */
if (strcmp(sic, sid)) {
DBusConnection *conn = ofono_dbus_get_connection();
- DBusMessage *reply = dbus_gsm_invalid_format(msg);
+ DBusMessage *reply = __ofono_error_invalid_format(msg);
g_dbus_send_message(conn, reply);
return TRUE;
}
@@ -370,13 +370,13 @@ void ofono_ussd_notify(struct ofono_modem *modem, int status, const char *str)
if (status == USSD_STATUS_NOT_SUPPORTED) {
ussd->state = USSD_STATE_IDLE;
- reply = dbus_gsm_not_supported(ussd->pending);
+ reply = __ofono_error_not_supported(ussd->pending);
goto out;
}
if (status == USSD_STATUS_TIMED_OUT) {
ussd->state = USSD_STATE_IDLE;
- reply = dbus_gsm_timed_out(ussd->pending);
+ reply = __ofono_error_timed_out(ussd->pending);
goto out;
}
@@ -437,7 +437,7 @@ static void ussd_callback(const struct ofono_error *error, void *data)
return;
}
- reply = dbus_gsm_failed(ussd->pending);
+ reply = __ofono_error_failed(ussd->pending);
g_dbus_send_message(conn, reply);
@@ -453,17 +453,17 @@ static DBusMessage *ussd_initiate(DBusConnection *conn, DBusMessage *msg,
const char *str;
if (ussd->flags & USSD_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (ussd->state == USSD_STATE_ACTIVE)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str,
DBUS_TYPE_INVALID) == FALSE)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (strlen(str) == 0)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
ofono_debug("checking if this is a recognized control string");
if (recognized_control_string(modem, str, msg))
@@ -471,12 +471,12 @@ static DBusMessage *ussd_initiate(DBusConnection *conn, DBusMessage *msg,
ofono_debug("No.., checking if this is a USSD string");
if (!valid_ussd_string(str))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
ofono_debug("OK, running USSD request");
if (!ussd->ops->request)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
ussd->flags |= USSD_FLAG_PENDING;
ussd->pending = dbus_message_ref(msg);
@@ -505,7 +505,7 @@ static void ussd_cancel_callback(const struct ofono_error *error, void *data)
reply = dbus_message_new_method_return(ussd->pending);
} else
- reply = dbus_gsm_failed(ussd->pending);
+ reply = __ofono_error_failed(ussd->pending);
dbus_gsm_pending_reply(&ussd->pending, reply);
}
@@ -517,13 +517,13 @@ static DBusMessage *ussd_cancel(DBusConnection *conn, DBusMessage *msg,
struct ussd_data *ussd = modem->ussd;
if (ussd->flags & USSD_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (ussd->state == USSD_STATE_IDLE)
- return dbus_gsm_not_active(msg);
+ return __ofono_error_not_active(msg);
if (!ussd->ops->cancel)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
ussd->flags |= USSD_FLAG_PENDING;
ussd->pending = dbus_message_ref(msg);
diff --git a/src/voicecall.c b/src/voicecall.c
index d1cc2c7f..6ebd61d5 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -197,13 +197,13 @@ static DBusMessage *voicecall_busy(DBusConnection *conn,
if (call->status != CALL_STATUS_INCOMING &&
call->status != CALL_STATUS_WAITING)
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!voicecalls->ops->set_udub)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (voicecalls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
voicecalls->flags |= VOICECALLS_FLAG_PENDING;
voicecalls->pending = dbus_message_ref(msg);
@@ -226,20 +226,20 @@ static DBusMessage *voicecall_deflect(DBusConnection *conn,
if (call->status != CALL_STATUS_INCOMING &&
call->status != CALL_STATUS_WAITING)
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!voicecalls->ops->deflect)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (voicecalls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &number,
DBUS_TYPE_INVALID) == FALSE)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (!valid_phone_number_format(number))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
voicecalls->flags |= VOICECALLS_FLAG_PENDING;
voicecalls->pending = dbus_message_ref(msg);
@@ -260,13 +260,13 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,
struct ofono_call *call = v->call;
if (call->status == CALL_STATUS_DISCONNECTED)
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!voicecalls->ops->release_specific)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (voicecalls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
voicecalls->flags |= VOICECALLS_FLAG_PENDING;
voicecalls->pending = dbus_message_ref(msg);
@@ -286,13 +286,13 @@ static DBusMessage *voicecall_answer(DBusConnection *conn,
struct ofono_call *call = v->call;
if (call->status != CALL_STATUS_INCOMING)
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!voicecalls->ops->answer)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (voicecalls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
voicecalls->flags |= VOICECALLS_FLAG_PENDING;
voicecalls->pending = dbus_message_ref(msg);
@@ -740,18 +740,18 @@ static DBusMessage *manager_dial(DBusConnection *conn,
enum ofono_clir_option clir;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (g_slist_length(calls->call_list) >= MAX_VOICE_CALLS)
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &number,
DBUS_TYPE_STRING, &clirstr,
DBUS_TYPE_INVALID) == FALSE)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (!valid_phone_number_format(number))
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
if (strlen(clirstr) == 0 || !strcmp(clirstr, "default"))
clir = OFONO_CLIR_OPTION_DEFAULT;
@@ -760,14 +760,14 @@ static DBusMessage *manager_dial(DBusConnection *conn,
else if (!strcmp(clirstr, "enabled"))
clir = OFONO_CLIR_OPTION_INVOCATION;
else
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
if (!calls->ops->dial)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (voicecalls_have_active(calls) &&
voicecalls_have_held(calls))
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
calls->flags |= VOICECALLS_FLAG_PENDING;
calls->pending = dbus_message_ref(msg);
@@ -789,7 +789,7 @@ static DBusMessage *manager_transfer(DBusConnection *conn,
int numheld;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
numactive = voicecalls_num_active(calls);
@@ -802,10 +802,10 @@ static DBusMessage *manager_transfer(DBusConnection *conn,
numheld = voicecalls_num_held(calls);
if ((numactive != 1) && (numheld != 1))
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!calls->ops->transfer)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
calls->flags |= VOICECALLS_FLAG_PENDING;
calls->pending = dbus_message_ref(msg);
@@ -822,13 +822,13 @@ static DBusMessage *manager_swap_calls(DBusConnection *conn,
struct voicecalls_data *calls = modem->voicecalls;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (voicecalls_have_waiting(calls))
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!calls->ops->hold_all_active)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
calls->flags |= VOICECALLS_FLAG_PENDING;
calls->pending = dbus_message_ref(msg);
@@ -845,13 +845,13 @@ static DBusMessage *manager_release_and_answer(DBusConnection *conn,
struct voicecalls_data *calls = modem->voicecalls;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!voicecalls_have_active(calls) || !voicecalls_have_waiting(calls))
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!calls->ops->release_all_active)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
calls->flags |= VOICECALLS_FLAG_PENDING;
calls->pending = dbus_message_ref(msg);
@@ -868,14 +868,14 @@ static DBusMessage *manager_hold_and_answer(DBusConnection *conn,
struct voicecalls_data *calls = modem->voicecalls;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (voicecalls_have_active(calls) && voicecalls_have_held(calls) &&
voicecalls_have_waiting(calls))
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!calls->ops->hold_all_active)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
calls->flags |= VOICECALLS_FLAG_PENDING;
calls->pending = dbus_message_ref(msg);
@@ -892,10 +892,10 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn,
struct voicecalls_data *calls = modem->voicecalls;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!calls->ops->release_specific)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (g_slist_length(calls->call_list) == 0) {
DBusMessage *reply = dbus_message_new_method_return(msg);
@@ -924,22 +924,22 @@ static DBusMessage *multiparty_private_chat(DBusConnection *conn,
GSList *l;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &callpath,
DBUS_TYPE_INVALID) == FALSE)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
if (strlen(callpath) == 0 || strlen(callpath) > MAX_DBUS_PATH_LEN)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
c = strrchr(callpath, '/');
if (!c || strncmp(modem->path, callpath, c-callpath))
- return dbus_gsm_not_found(msg);
+ return __ofono_error_not_found(msg);
if (!sscanf(c, "/voicecall%2u", &id))
- return dbus_gsm_not_found(msg);
+ return __ofono_error_not_found(msg);
for (l = calls->multiparty_list; l; l = l->next) {
struct voicecall *v = l->data;
@@ -948,17 +948,17 @@ static DBusMessage *multiparty_private_chat(DBusConnection *conn,
}
if (!l)
- return dbus_gsm_not_found(msg);
+ return __ofono_error_not_found(msg);
/* If we found id on the list of multiparty calls, then by definition
* the multiparty call exists. Only thing to check is whether we have
* held calls
*/
if (voicecalls_have_held(calls))
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!calls->ops->private_chat)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
calls->flags |= VOICECALLS_FLAG_PENDING;
calls->pending = dbus_message_ref(msg);
@@ -975,13 +975,13 @@ static DBusMessage *multiparty_create(DBusConnection *conn,
struct voicecalls_data *calls = modem->voicecalls;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!voicecalls_have_held(calls) || !voicecalls_have_active(calls))
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (!calls->ops->create_multiparty)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
calls->flags |= VOICECALLS_FLAG_PENDING;
calls->pending = dbus_message_ref(msg);
@@ -998,16 +998,16 @@ static DBusMessage *multiparty_hangup(DBusConnection *conn,
struct voicecalls_data *calls = modem->voicecalls;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!calls->ops->release_specific)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (!calls->ops->release_all_held)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (!calls->ops->release_all_active)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
if (g_slist_length(calls->multiparty_list) == 0) {
DBusMessage *reply = dbus_message_new_method_return(msg);
@@ -1057,23 +1057,23 @@ static DBusMessage *manager_tone(DBusConnection *conn,
int i, len;
if (calls->flags & VOICECALLS_FLAG_PENDING)
- return dbus_gsm_busy(msg);
+ return __ofono_error_busy(msg);
if (!calls->ops->send_tones)
- return dbus_gsm_not_implemented(msg);
+ return __ofono_error_not_implemented(msg);
/* Send DTMFs only if we have at least one connected call */
if (!voicecalls_have_connected(calls))
- return dbus_gsm_failed(msg);
+ return __ofono_error_failed(msg);
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &in_tones,
DBUS_TYPE_INVALID) == FALSE)
- return dbus_gsm_invalid_args(msg);
+ return __ofono_error_invalid_args(msg);
len = strlen(in_tones);
if (len == 0)
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
tones = g_ascii_strup(in_tones, len);
@@ -1085,7 +1085,7 @@ static DBusMessage *manager_tone(DBusConnection *conn,
continue;
g_free(tones);
- return dbus_gsm_invalid_format(msg);
+ return __ofono_error_invalid_format(msg);
}
calls->flags |= VOICECALLS_FLAG_PENDING;
@@ -1347,7 +1347,7 @@ static void generic_callback(const struct ofono_error *error, void *data)
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
reply = dbus_message_new_method_return(calls->pending);
else
- reply = dbus_gsm_failed(calls->pending);
+ reply = __ofono_error_failed(calls->pending);
g_dbus_send_message(conn, reply);
@@ -1434,7 +1434,7 @@ static void dial_callback(const struct ofono_error *error, void *data)
return;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
- reply = dbus_gsm_failed(calls->pending);
+ reply = __ofono_error_failed(calls->pending);
g_dbus_send_message(conn, reply);
goto out;
@@ -1459,7 +1459,7 @@ static void dial_callback(const struct ofono_error *error, void *data)
call = synthesize_outgoing_call(modem, calls->pending);
if (!call) {
- reply = dbus_gsm_failed(calls->pending);
+ reply = __ofono_error_failed(calls->pending);
g_dbus_send_message(conn, reply);
goto out;
@@ -1468,7 +1468,7 @@ static void dial_callback(const struct ofono_error *error, void *data)
v = voicecall_create(modem, call);
if (!v) {
- reply = dbus_gsm_failed(calls->pending);
+ reply = __ofono_error_failed(calls->pending);
g_dbus_send_message(conn, reply);
goto out;
@@ -1545,7 +1545,7 @@ static void multiparty_create_callback(const struct ofono_error *error, void *da
return;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
- reply = dbus_gsm_failed(calls->pending);
+ reply = __ofono_error_failed(calls->pending);
goto out;
}
@@ -1570,7 +1570,7 @@ static void multiparty_create_callback(const struct ofono_error *error, void *da
ofono_error("Created multiparty call, but size is less than 2"
" panic!");
- reply = dbus_gsm_failed(calls->pending);
+ reply = __ofono_error_failed(calls->pending);
} else {
reply = dbus_message_new_method_return(calls->pending);
@@ -1610,7 +1610,7 @@ static void private_chat_callback(const struct ofono_error *error, void *data)
return;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
- reply = dbus_gsm_failed(calls->pending);
+ reply = __ofono_error_failed(calls->pending);
goto out;
}