mirror of
https://github.com/sailfishos/ofono
synced 2025-11-23 10:59:46 +08:00
Compare commits
19 Commits
mer/1.23+g
...
mer/1.23+g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80224b283d | ||
|
|
07e07b6ddc | ||
|
|
bd836b4499 | ||
|
|
6c289b1432 | ||
|
|
296e46487f | ||
|
|
09e98234aa | ||
|
|
0f4cdba932 | ||
|
|
870bac93e9 | ||
|
|
246cd4e1d2 | ||
|
|
ca20b65098 | ||
|
|
8e35a047da | ||
|
|
2b4b5a224d | ||
|
|
50a5f2547e | ||
|
|
d682fcd5fe | ||
|
|
5799320480 | ||
|
|
3eea7c868e | ||
|
|
4844fc6cf9 | ||
|
|
6976366051 | ||
|
|
d3d776837b |
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* oFono - Open Source Telephony - RIL-based devices
|
||||
*
|
||||
* Copyright (C) 2016-2020 Jolla Ltd.
|
||||
* Copyright (C) 2016-2021 Jolla Ltd.
|
||||
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -243,6 +243,7 @@ struct ril_data_call *ril_data_call_dup(const struct ril_data_call *call)
|
||||
dc->dnses = g_strdupv(call->dnses);
|
||||
dc->gateways = g_strdupv(call->gateways);
|
||||
dc->addresses = g_strdupv(call->addresses);
|
||||
dc->pcscf = g_strdupv(call->pcscf);
|
||||
return dc;
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -253,8 +254,9 @@ static void ril_data_call_destroy(struct ril_data_call *call)
|
||||
{
|
||||
g_free(call->ifname);
|
||||
g_strfreev(call->dnses);
|
||||
g_strfreev(call->addresses);
|
||||
g_strfreev(call->gateways);
|
||||
g_strfreev(call->addresses);
|
||||
g_strfreev(call->pcscf);
|
||||
}
|
||||
|
||||
void ril_data_call_free(struct ril_data_call *call)
|
||||
@@ -322,8 +324,7 @@ static gboolean ril_data_call_parse_default(struct ril_data_call *call,
|
||||
|
||||
/* RIL_Data_Call_Response_v9 */
|
||||
if (version >= 9) {
|
||||
/* PCSCF */
|
||||
grilio_parser_skip_string(rilp);
|
||||
call->pcscf = grilio_parser_split_utf8(rilp, " ");
|
||||
|
||||
/* RIL_Data_Call_Response_v11 */
|
||||
if (version >= 11) {
|
||||
@@ -354,16 +355,19 @@ static struct ril_data_call *ril_data_call_parse(struct ril_vendor *vendor,
|
||||
|
||||
if (parsed) {
|
||||
DBG("[status=%d,retry=%d,cid=%d,active=%d,type=%s,ifname=%s,"
|
||||
"mtu=%d,address=%s,dns=%s %s,gateways=%s]",
|
||||
"mtu=%d,address=%s,dns=%s %s,gateways=%s,pcscf=%s %s]",
|
||||
call->status, call->retry_time,
|
||||
call->cid, call->active,
|
||||
ril_protocol_from_ofono(call->prot),
|
||||
call->ifname, call->mtu,
|
||||
call->addresses ? call->addresses[0] : NULL,
|
||||
call->dnses ? call->dnses[0] : NULL,
|
||||
call->addresses ? call->addresses[0] : "",
|
||||
call->dnses ? call->dnses[0] : "",
|
||||
(call->dnses && call->dnses[0] &&
|
||||
call->dnses[1]) ? call->dnses[1] : "",
|
||||
call->gateways ? call->gateways[0] : NULL);
|
||||
call->gateways ? call->gateways[0] : "",
|
||||
call->pcscf ? call->pcscf[0] : "",
|
||||
(call->pcscf && call->pcscf[0] &&
|
||||
call->pcscf[1]) ? call->pcscf[1] : "");
|
||||
return call;
|
||||
} else {
|
||||
ril_data_call_free(call);
|
||||
@@ -429,7 +433,8 @@ static gboolean ril_data_call_equal(const struct ril_data_call *c1,
|
||||
!g_strcmp0(c1->ifname, c2->ifname) &&
|
||||
gutil_strv_equal(c1->dnses, c2->dnses) &&
|
||||
gutil_strv_equal(c1->gateways, c2->gateways) &&
|
||||
gutil_strv_equal(c1->addresses, c2->addresses);
|
||||
gutil_strv_equal(c1->addresses, c2->addresses) &&
|
||||
gutil_strv_equal(c1->pcscf, c2->pcscf);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -951,7 +956,8 @@ static gboolean ril_data_call_setup_submit(struct ril_data_request *req)
|
||||
*
|
||||
* Makes little sense but it is what it is.
|
||||
*/
|
||||
tech = priv->network->data.ril_tech;
|
||||
tech = (setup->profile_id == RIL_DATA_PROFILE_IMS) ?
|
||||
RADIO_TECH_LTE : priv->network->data.ril_tech;
|
||||
if (tech > 2) {
|
||||
tech += 2;
|
||||
} else {
|
||||
@@ -1014,10 +1020,22 @@ static struct ril_data_request *ril_data_call_setup_new(struct ril_data *data,
|
||||
g_new0(struct ril_data_request_setup, 1);
|
||||
struct ril_data_request *req = &setup->req;
|
||||
|
||||
setup->profile_id = (priv->use_data_profiles &&
|
||||
context_type == OFONO_GPRS_CONTEXT_TYPE_MMS) ?
|
||||
priv->mms_data_profile_id :
|
||||
RIL_DATA_PROFILE_DEFAULT;
|
||||
setup->profile_id = RIL_DATA_PROFILE_DEFAULT;
|
||||
if (priv->use_data_profiles) {
|
||||
switch (context_type) {
|
||||
case OFONO_GPRS_CONTEXT_TYPE_MMS:
|
||||
setup->profile_id = priv->mms_data_profile_id;
|
||||
break;
|
||||
case OFONO_GPRS_CONTEXT_TYPE_IMS:
|
||||
setup->profile_id = RIL_DATA_PROFILE_IMS;
|
||||
break;
|
||||
case OFONO_GPRS_CONTEXT_TYPE_ANY:
|
||||
case OFONO_GPRS_CONTEXT_TYPE_INTERNET:
|
||||
case OFONO_GPRS_CONTEXT_TYPE_WAP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setup->apn = g_strdup(ctx->apn);
|
||||
setup->username = g_strdup(ctx->username);
|
||||
setup->password = g_strdup(ctx->password);
|
||||
@@ -1196,6 +1214,31 @@ static struct ril_data_request *ril_data_allow_new(struct ril_data *data,
|
||||
return req;
|
||||
}
|
||||
|
||||
static gboolean ril_data_allow_can_submit(struct ril_data *self)
|
||||
{
|
||||
if (self) {
|
||||
switch (self->priv->options.allow_data) {
|
||||
case RIL_ALLOW_DATA_ENABLED:
|
||||
return TRUE;
|
||||
case RIL_ALLOW_DATA_DISABLED:
|
||||
case RIL_ALLOW_DATA_AUTO:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean ril_data_allow_submit_request(struct ril_data *data,
|
||||
gboolean allow)
|
||||
{
|
||||
if (ril_data_allow_can_submit(data)) {
|
||||
ril_data_request_queue(ril_data_allow_new(data, allow));
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* ril_data
|
||||
*==========================================================================*/
|
||||
@@ -1226,6 +1269,22 @@ void ril_data_remove_handler(struct ril_data *self, gulong id)
|
||||
}
|
||||
}
|
||||
|
||||
static void ril_data_imsi_changed(struct ril_sim_settings *settings,
|
||||
void *user_data)
|
||||
{
|
||||
struct ril_data *self = RIL_DATA(user_data);
|
||||
struct ril_data_priv *priv = self->priv;
|
||||
|
||||
if (!settings->imsi) {
|
||||
/*
|
||||
* Most likely, SIM removal. In any case, no data requests
|
||||
* make sense when IMSI is unavailable.
|
||||
*/
|
||||
ril_data_cancel_all_requests(self);
|
||||
}
|
||||
ril_data_manager_check_network_mode(priv->dm);
|
||||
}
|
||||
|
||||
static void ril_data_settings_changed(struct ril_sim_settings *settings,
|
||||
void *user_data)
|
||||
{
|
||||
@@ -1308,7 +1367,7 @@ struct ril_data *ril_data_new(struct ril_data_manager *dm, const char *name,
|
||||
|
||||
priv->settings_event_id[SETTINGS_EVENT_IMSI_CHANGED] =
|
||||
ril_sim_settings_add_imsi_changed_handler(settings,
|
||||
ril_data_settings_changed, self);
|
||||
ril_data_imsi_changed, self);
|
||||
priv->settings_event_id[SETTINGS_EVENT_PREF_MODE] =
|
||||
ril_sim_settings_add_pref_mode_changed_handler(settings,
|
||||
ril_data_settings_changed, self);
|
||||
@@ -1466,10 +1525,8 @@ static void ril_data_disallow(struct ril_data *self)
|
||||
*/
|
||||
ril_data_deactivate_all(self);
|
||||
|
||||
if (priv->options.allow_data == RIL_ALLOW_DATA_ENABLED) {
|
||||
/* Tell rild that the data is now disabled */
|
||||
ril_data_request_queue(ril_data_allow_new(self, FALSE));
|
||||
} else {
|
||||
/* Tell rild that the data is now disabled */
|
||||
if (!ril_data_allow_submit_request(self, FALSE)) {
|
||||
priv->flags &= ~RIL_DATA_FLAG_ON;
|
||||
GASSERT(!ril_data_allowed(self));
|
||||
DBG_(self, "data off");
|
||||
@@ -1779,12 +1836,14 @@ static void ril_data_manager_check_network_mode(struct ril_data_manager *self)
|
||||
|
||||
static struct ril_data *ril_data_manager_allowed(struct ril_data_manager *self)
|
||||
{
|
||||
GSList *l;
|
||||
if (self) {
|
||||
GSList *l;
|
||||
|
||||
for (l= self->data_list; l; l = l->next) {
|
||||
struct ril_data *data = l->data;
|
||||
if (data->priv->flags & RIL_DATA_FLAG_ALLOWED) {
|
||||
return data;
|
||||
for (l= self->data_list; l; l = l->next) {
|
||||
struct ril_data *data = l->data;
|
||||
if (data->priv->flags & RIL_DATA_FLAG_ALLOWED) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1804,9 +1863,7 @@ static void ril_data_manager_switch_data_on(struct ril_data_manager *self,
|
||||
ril_data_max_mode(data), TRUE);
|
||||
}
|
||||
|
||||
if (priv->options.allow_data == RIL_ALLOW_DATA_ENABLED) {
|
||||
ril_data_request_queue(ril_data_allow_new(data, TRUE));
|
||||
} else {
|
||||
if (!ril_data_allow_submit_request(data, TRUE)) {
|
||||
priv->flags |= RIL_DATA_FLAG_ON;
|
||||
GASSERT(ril_data_allowed(data));
|
||||
DBG_(data, "data on");
|
||||
@@ -1830,12 +1887,7 @@ void ril_data_manager_check_data(struct ril_data_manager *self)
|
||||
|
||||
void ril_data_manager_assert_data_on(struct ril_data_manager *self)
|
||||
{
|
||||
if (self) {
|
||||
struct ril_data *data = ril_data_manager_allowed(self);
|
||||
if (data) {
|
||||
ril_data_request_queue(ril_data_allow_new(data, TRUE));
|
||||
}
|
||||
}
|
||||
ril_data_allow_submit_request(ril_data_manager_allowed(self), TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* oFono - Open Source Telephony - RIL-based devices
|
||||
*
|
||||
* Copyright (C) 2016-2020 Jolla Ltd.
|
||||
* Copyright (C) 2016-2021 Jolla Ltd.
|
||||
* Copyright (C) 2019 Open Mobile Platform LLC.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -40,6 +40,7 @@ struct ril_data_call {
|
||||
char **dnses;
|
||||
char **gateways;
|
||||
char **addresses;
|
||||
char **pcscf;
|
||||
};
|
||||
|
||||
struct ril_data_call_list {
|
||||
|
||||
@@ -436,7 +436,6 @@ static void ril_netreg_register_manual(struct ofono_netreg *netreg,
|
||||
ofono_info("nw select manual: %s%s%s", mcc, mnc, suffix);
|
||||
grilio_request_append_format(req, "%s%s%s", mcc, mnc, suffix);
|
||||
grilio_request_set_timeout(req, nd->network_selection_timeout);
|
||||
grilio_request_set_retry(req, 0, REGISTRATION_MAX_RETRIES);
|
||||
grilio_queue_send_request_full(nd->q, req,
|
||||
RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL,
|
||||
ril_netreg_register_cb, ril_netreg_cbd_free,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* oFono - Open Source Telephony - RIL-based devices
|
||||
*
|
||||
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||
* Copyright (C) 2015-2021 Jolla Ltd.
|
||||
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -444,14 +444,13 @@ static guint ril_network_poll_and_retry(struct ril_network *self, guint id,
|
||||
{
|
||||
struct ril_network_priv *priv = self->priv;
|
||||
|
||||
if (id) {
|
||||
/* Retry right away, don't wait for retry timeout to expire */
|
||||
grilio_channel_retry_request(priv->io, id);
|
||||
} else {
|
||||
/* Don't wait for retry timeout to expire */
|
||||
if (!id || !grilio_channel_retry_request(priv->io, id)) {
|
||||
GRilIoRequest *req = grilio_request_new();
|
||||
|
||||
grilio_request_set_retry(req, RIL_RETRY_SECS*1000, -1);
|
||||
grilio_request_set_retry_func(req, ril_network_retry);
|
||||
grilio_queue_cancel_request(priv->q, id, FALSE);
|
||||
id = grilio_queue_send_request_full(priv->q, req, code, fn,
|
||||
NULL, self);
|
||||
grilio_request_unref(req);
|
||||
@@ -697,7 +696,7 @@ struct ril_network_data_profile *ril_network_data_profile_new
|
||||
ptr += G_ALIGN8(sizeof(*profile));
|
||||
|
||||
profile->profile_id = profile_id;
|
||||
profile->type = RIL_PROFILE_3GPP;
|
||||
profile->type = RIL_PROFILE_COMMON;
|
||||
profile->auth_method = auth_method;
|
||||
profile->proto = context->proto;
|
||||
profile->enabled = TRUE;
|
||||
@@ -826,6 +825,9 @@ static void ril_network_check_data_profiles(struct ril_network *self)
|
||||
const struct ofono_gprs_primary_context* mms =
|
||||
ofono_gprs_context_settings_by_type(gprs,
|
||||
OFONO_GPRS_CONTEXT_TYPE_MMS);
|
||||
const struct ofono_gprs_primary_context* ims =
|
||||
ofono_gprs_context_settings_by_type(gprs,
|
||||
OFONO_GPRS_CONTEXT_TYPE_IMS);
|
||||
GSList *l = NULL;
|
||||
|
||||
if (internet) {
|
||||
@@ -841,6 +843,12 @@ static void ril_network_check_data_profiles(struct ril_network *self)
|
||||
ril_network_data_profile_new(mms,
|
||||
priv->mms_data_profile_id));
|
||||
}
|
||||
if (ims) {
|
||||
DBG_(self, "ims apn \"%s\"", ims->apn);
|
||||
l = g_slist_append(l,
|
||||
ril_network_data_profile_new(ims,
|
||||
RIL_DATA_PROFILE_IMS));
|
||||
}
|
||||
|
||||
if (ril_network_data_profiles_equal(priv->data_profiles, l)) {
|
||||
ril_network_data_profiles_free(l);
|
||||
|
||||
@@ -2369,7 +2369,6 @@ static int ril_plugin_init(void)
|
||||
static void ril_plugin_exit(void)
|
||||
{
|
||||
DBG("");
|
||||
GASSERT(ril_driver);
|
||||
|
||||
ofono_ril_transport_unregister(&ril_socket_transport);
|
||||
ofono_modem_driver_unregister(&ril_modem_driver);
|
||||
|
||||
@@ -231,6 +231,12 @@ socket=/dev/socket/rild
|
||||
#
|
||||
#lteNetworkMode=9
|
||||
|
||||
# UMTS network mode.
|
||||
#
|
||||
# Default 3 (PREF_NET_TYPE_GSM_WCDMA_AUTO)
|
||||
#
|
||||
#umtsNetworkMode=3
|
||||
|
||||
# Timeout for RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, in milliseconds.
|
||||
#
|
||||
# Default 20000 (20 seconds)
|
||||
|
||||
@@ -495,8 +495,6 @@ static void hfp_ag_enable(DBusConnection *conn)
|
||||
connection_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
|
||||
g_free, connection_destroy);
|
||||
|
||||
ofono_handsfree_audio_ref();
|
||||
|
||||
hfp_ag_enabled = TRUE;
|
||||
}
|
||||
|
||||
@@ -525,7 +523,6 @@ static void hfp_ag_disable(DBusConnection *conn)
|
||||
g_dbus_unregister_interface(conn, HFP_AG_EXT_PROFILE_PATH,
|
||||
BLUEZ_PROFILE_INTERFACE);
|
||||
ofono_handsfree_card_driver_unregister(&hfp_ag_driver);
|
||||
ofono_handsfree_audio_unref();
|
||||
}
|
||||
|
||||
hfp_ag_enabled = FALSE;
|
||||
@@ -545,13 +542,14 @@ static int hfp_ag_init(void)
|
||||
{
|
||||
DBusConnection *conn = ofono_dbus_get_connection();
|
||||
|
||||
hfp_ag_enable(conn);
|
||||
|
||||
/* g_dbus_add_service_watch immediately checks for bluetooth service
|
||||
* and calls connect callback if the service exists. */
|
||||
service_watch_id = g_dbus_add_service_watch(conn, "org.bluez",
|
||||
bluez_connect_cb,
|
||||
bluez_disconnect_cb,
|
||||
NULL, NULL);
|
||||
|
||||
ofono_handsfree_audio_ref();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -565,6 +563,7 @@ static void hfp_ag_exit(void)
|
||||
}
|
||||
|
||||
hfp_ag_disable(conn);
|
||||
ofono_handsfree_audio_unref();
|
||||
}
|
||||
|
||||
OFONO_PLUGIN_DEFINE(hfp_ag_bluez5, "Hands-Free Audio Gateway Profile Plugins",
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include <ofono/handsfree.h>
|
||||
#include <ofono/handsfree-audio.h>
|
||||
#include <ofono/siri.h>
|
||||
#include <ofono.h>
|
||||
|
||||
#include <drivers/atmodem/atutil.h>
|
||||
#include <drivers/hfpmodem/slc.h>
|
||||
@@ -833,8 +832,6 @@ static int hfp_init(void)
|
||||
if (DBUS_TYPE_UNIX_FD < 0)
|
||||
return -EBADF;
|
||||
|
||||
__ofono_handsfree_audio_manager_init();
|
||||
|
||||
/* Registers External Profile handler */
|
||||
if (!g_dbus_register_interface(conn, HFP_EXT_PROFILE_PATH,
|
||||
BLUEZ_PROFILE_INTERFACE,
|
||||
@@ -890,8 +887,6 @@ static void hfp_exit(void)
|
||||
g_dbus_client_unref(bluez);
|
||||
|
||||
ofono_handsfree_audio_unref();
|
||||
|
||||
__ofono_handsfree_audio_manager_cleanup();
|
||||
}
|
||||
|
||||
OFONO_PLUGIN_DEFINE(hfp_bluez5, "External Hands-Free Profile Plugin", VERSION,
|
||||
|
||||
@@ -121,6 +121,30 @@ void __ofono_dbus_queue_request(struct ofono_dbus_queue *q,
|
||||
}
|
||||
}
|
||||
|
||||
static void __ofono_dbus_queue_submit_next(struct ofono_dbus_queue *q)
|
||||
{
|
||||
struct ofono_dbus_queue_request *next = q->requests;
|
||||
|
||||
while (next) {
|
||||
struct ofono_dbus_queue_request *done;
|
||||
DBusMessage *reply = next->fn(next->msg, next->data);
|
||||
|
||||
/* The request has been sent, no reply yet */
|
||||
if (!reply)
|
||||
break;
|
||||
|
||||
/* The request has completed synchronously */
|
||||
done = next;
|
||||
next = done->next;
|
||||
q->requests = next;
|
||||
done->next = NULL;
|
||||
|
||||
/* Send the reply */
|
||||
__ofono_dbus_pending_reply(&done->msg, reply);
|
||||
__ofono_dbus_queue_req_free(done);
|
||||
}
|
||||
}
|
||||
|
||||
/* Consumes one reference to the reply */
|
||||
void __ofono_dbus_queue_reply_msg(struct ofono_dbus_queue *q,
|
||||
DBusMessage *reply)
|
||||
@@ -150,20 +174,7 @@ void __ofono_dbus_queue_reply_msg(struct ofono_dbus_queue *q,
|
||||
__ofono_dbus_queue_req_free(done);
|
||||
|
||||
/* Submit the next request if there is any */
|
||||
while (next && reply) {
|
||||
reply = next->fn(next->msg, next->data);
|
||||
if (reply) {
|
||||
/* The request has completed synchronously */
|
||||
done = next;
|
||||
next = done->next;
|
||||
q->requests = next;
|
||||
done->next = NULL;
|
||||
|
||||
/* Send the reply */
|
||||
__ofono_dbus_pending_reply(&done->msg, reply);
|
||||
__ofono_dbus_queue_req_free(done);
|
||||
}
|
||||
}
|
||||
__ofono_dbus_queue_submit_next(q);
|
||||
}
|
||||
|
||||
void __ofono_dbus_queue_reply_ok(struct ofono_dbus_queue *q)
|
||||
@@ -250,8 +261,10 @@ void __ofono_dbus_queue_reply_all_fn_param(struct ofono_dbus_queue *q,
|
||||
* Find all other requests with the same handler and the same data
|
||||
* and complete those too (except when the handler is NULL)
|
||||
*/
|
||||
if (!handler)
|
||||
if (!handler) {
|
||||
__ofono_dbus_queue_submit_next(q);
|
||||
return;
|
||||
}
|
||||
|
||||
prev = NULL;
|
||||
req = q->requests;
|
||||
@@ -274,6 +287,7 @@ void __ofono_dbus_queue_reply_all_fn_param(struct ofono_dbus_queue *q,
|
||||
|
||||
req = next;
|
||||
}
|
||||
__ofono_dbus_queue_submit_next(q);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* oFono - Open Source Telephony
|
||||
*
|
||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
@@ -281,7 +283,7 @@ int main(int argc, char **argv)
|
||||
|
||||
dbus_error_init(&error);
|
||||
|
||||
conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, OFONO_SERVICE, &error);
|
||||
conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, &error);
|
||||
if (conn == NULL) {
|
||||
if (dbus_error_is_set(&error) == TRUE) {
|
||||
ofono_error("Unable to hop onto D-Bus: %s",
|
||||
@@ -308,7 +310,12 @@ int main(int argc, char **argv)
|
||||
g_free(option_plugin);
|
||||
g_free(option_noplugin);
|
||||
|
||||
g_main_loop_run(event_loop);
|
||||
if (g_dbus_request_name(conn, OFONO_SERVICE, &error)) {
|
||||
g_main_loop_run(event_loop);
|
||||
} else {
|
||||
ofono_error("Unable to register D-Bus name: %s", error.message);
|
||||
dbus_error_free(&error);
|
||||
}
|
||||
|
||||
__ofono_plugin_cleanup();
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ static void test_reply_last_reply(DBusPendingCall *call, void *dbus)
|
||||
G_CAST(dbus, struct test_reply_data, dbus);
|
||||
|
||||
DBG("");
|
||||
test_dbus_check_error_reply(call, TEST_ERROR_FAILED);
|
||||
test_dbus_check_empty_reply(call, NULL);
|
||||
g_main_loop_quit(test->dbus.loop);
|
||||
}
|
||||
|
||||
@@ -445,6 +445,12 @@ static DBusMessage *test_reply_4(DBusMessage *msg, void *data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DBusMessage *test_reply_5(DBusMessage *msg, void *data)
|
||||
{
|
||||
DBG("");
|
||||
return dbus_message_new_method_return(msg);
|
||||
}
|
||||
|
||||
static DBusMessage *test_reply_handler(DBusConnection *conn,
|
||||
DBusMessage *msg, void *data)
|
||||
{
|
||||
@@ -485,10 +491,17 @@ static DBusMessage *test_reply_handler(DBusConnection *conn,
|
||||
case 6:
|
||||
__ofono_dbus_queue_request(test->queue, test_reply_4,
|
||||
msg, NULL);
|
||||
break;
|
||||
case 7:
|
||||
/* Call the same method again */
|
||||
__ofono_dbus_queue_request(test->queue, test_reply_4,
|
||||
msg, NULL);
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
/* Call the last one */
|
||||
__ofono_dbus_queue_request(test->queue, test_reply_5,
|
||||
msg, NULL);
|
||||
|
||||
/* This completes the first one, with NULL handler */
|
||||
__ofono_dbus_queue_reply_all_fn_param(test->queue, NULL, NULL);
|
||||
g_assert(__ofono_dbus_queue_pending(test->queue));
|
||||
@@ -508,10 +521,12 @@ static DBusMessage *test_reply_handler(DBusConnection *conn,
|
||||
/* This one test_reply_3 with Failed */
|
||||
__ofono_dbus_queue_reply_all_error(test->queue, NULL);
|
||||
|
||||
/* This one test_reply_4 with NotSupported */
|
||||
/* This one completes all test_reply_4 with NotSupported */
|
||||
error.type = OFONO_ERROR_TYPE_ERRNO;
|
||||
error.error = -EOPNOTSUPP;
|
||||
__ofono_dbus_queue_reply_all_error(test->queue, &error);
|
||||
|
||||
/* test_reply_5 must be already completed */
|
||||
g_assert(!__ofono_dbus_queue_pending(test->queue));
|
||||
|
||||
/* And this one does nothing */
|
||||
@@ -541,7 +556,8 @@ static void test_reply_start(struct test_dbus_context *dbus)
|
||||
test_client_call(dbus, 4, test_dbus_expect_empty_reply);
|
||||
test_client_call(dbus, 5, test_expect_failed);
|
||||
test_client_call(dbus, 6, test_expect_not_supported);
|
||||
test_client_call(dbus, 7, test_reply_last_reply);
|
||||
test_client_call(dbus, 7, test_expect_not_supported);
|
||||
test_client_call(dbus, 8, test_reply_last_reply);
|
||||
}
|
||||
|
||||
static void test_reply(void)
|
||||
|
||||
Reference in New Issue
Block a user