forked from sailfishos/ofono
Compare commits
6 Commits
mer/1.23+g
...
mer/1.23+g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf91be9742 | ||
|
|
087771dc0f | ||
|
|
645dfe47e5 | ||
|
|
68e8b02d3b | ||
|
|
aa4309e8cb | ||
|
|
cb6b24d950 |
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony - RIL-based devices
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2019 Jolla Ltd.
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
* Copyright (C) 2019 Open Mobile Platform LLC.
|
* Copyright (C) 2019 Open Mobile Platform LLC.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include <ofono/watch.h>
|
#include <ofono/watch.h>
|
||||||
|
|
||||||
#define MAX_PDP_CONTEXTS (2)
|
|
||||||
#define ONLINE_TIMEOUT_SECS (15) /* 20 sec is hardcoded in ofono core */
|
#define ONLINE_TIMEOUT_SECS (15) /* 20 sec is hardcoded in ofono core */
|
||||||
|
|
||||||
enum ril_modem_power_state {
|
enum ril_modem_power_state {
|
||||||
@@ -307,15 +306,22 @@ static void ril_modem_post_sim(struct ofono_modem *modem)
|
|||||||
ofono_sms_create(modem, 0, RILMODEM_DRIVER, md);
|
ofono_sms_create(modem, 0, RILMODEM_DRIVER, md);
|
||||||
gprs = ofono_gprs_create(modem, 0, RILMODEM_DRIVER, md);
|
gprs = ofono_gprs_create(modem, 0, RILMODEM_DRIVER, md);
|
||||||
if (gprs) {
|
if (gprs) {
|
||||||
int i;
|
guint i;
|
||||||
|
static const enum ofono_gprs_context_type ap_types[] = {
|
||||||
|
OFONO_GPRS_CONTEXT_TYPE_INTERNET,
|
||||||
|
OFONO_GPRS_CONTEXT_TYPE_MMS,
|
||||||
|
OFONO_GPRS_CONTEXT_TYPE_IMS
|
||||||
|
};
|
||||||
|
|
||||||
for (i = 0; i < MAX_PDP_CONTEXTS; i++) {
|
/* Create a context for each type */
|
||||||
|
for (i = 0; i < G_N_ELEMENTS(ap_types); i++) {
|
||||||
struct ofono_gprs_context *gc =
|
struct ofono_gprs_context *gc =
|
||||||
ofono_gprs_context_create(modem, 0,
|
ofono_gprs_context_create(modem, 0,
|
||||||
RILMODEM_DRIVER, md);
|
RILMODEM_DRIVER, md);
|
||||||
if (gc == NULL)
|
if (gc == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
ofono_gprs_context_set_type(gc, ap_types[i]);
|
||||||
ofono_gprs_add_context(gprs, gc);
|
ofono_gprs_add_context(gprs, gc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
* Copyright (C) 2015-2017 Jolla Ltd.
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -60,6 +60,7 @@ const char *mbpi_database = MBPI_DATABASE;
|
|||||||
*/
|
*/
|
||||||
enum ofono_gprs_proto mbpi_default_internet_proto = OFONO_GPRS_PROTO_IPV4V6;
|
enum ofono_gprs_proto mbpi_default_internet_proto = OFONO_GPRS_PROTO_IPV4V6;
|
||||||
enum ofono_gprs_proto mbpi_default_mms_proto = OFONO_GPRS_PROTO_IP;
|
enum ofono_gprs_proto mbpi_default_mms_proto = OFONO_GPRS_PROTO_IP;
|
||||||
|
enum ofono_gprs_proto mbpi_default_ims_proto = OFONO_GPRS_PROTO_IPV4V6;
|
||||||
enum ofono_gprs_proto mbpi_default_proto = OFONO_GPRS_PROTO_IP;
|
enum ofono_gprs_proto mbpi_default_proto = OFONO_GPRS_PROTO_IP;
|
||||||
enum ofono_gprs_auth_method mbpi_default_auth_method = OFONO_GPRS_AUTH_METHOD_ANY;
|
enum ofono_gprs_auth_method mbpi_default_auth_method = OFONO_GPRS_AUTH_METHOD_ANY;
|
||||||
|
|
||||||
@@ -246,6 +247,9 @@ static void usage_start(GMarkupParseContext *context,
|
|||||||
} else if (strcmp(text, "mms") == 0) {
|
} else if (strcmp(text, "mms") == 0) {
|
||||||
apn->type = OFONO_GPRS_CONTEXT_TYPE_MMS;
|
apn->type = OFONO_GPRS_CONTEXT_TYPE_MMS;
|
||||||
apn->proto = mbpi_default_mms_proto;
|
apn->proto = mbpi_default_mms_proto;
|
||||||
|
} else if (strcmp(text, "ims") == 0) {
|
||||||
|
apn->type = OFONO_GPRS_CONTEXT_TYPE_IMS;
|
||||||
|
apn->proto = mbpi_default_ims_proto;
|
||||||
} else if (strcmp(text, "wap") == 0)
|
} else if (strcmp(text, "wap") == 0)
|
||||||
apn->type = OFONO_GPRS_CONTEXT_TYPE_WAP;
|
apn->type = OFONO_GPRS_CONTEXT_TYPE_WAP;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
|
* Copyright (C) 2013-2020 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
extern const char *mbpi_database;
|
extern const char *mbpi_database;
|
||||||
extern enum ofono_gprs_proto mbpi_default_internet_proto;
|
extern enum ofono_gprs_proto mbpi_default_internet_proto;
|
||||||
extern enum ofono_gprs_proto mbpi_default_mms_proto;
|
extern enum ofono_gprs_proto mbpi_default_mms_proto;
|
||||||
|
extern enum ofono_gprs_proto mbpi_default_ims_proto;
|
||||||
extern enum ofono_gprs_proto mbpi_default_proto;
|
extern enum ofono_gprs_proto mbpi_default_proto;
|
||||||
extern enum ofono_gprs_auth_method mbpi_default_auth_method;
|
extern enum ofono_gprs_auth_method mbpi_default_auth_method;
|
||||||
|
|
||||||
|
|||||||
@@ -743,18 +743,32 @@ static int sailfish_manager_update_modem_paths(struct sailfish_manager_priv *p)
|
|||||||
*/
|
*/
|
||||||
if (sailfish_manager_all_sims_are_initialized(p)) {
|
if (sailfish_manager_all_sims_are_initialized(p)) {
|
||||||
slot = sailfish_manager_find_slot_imsi(p, NULL);
|
slot = sailfish_manager_find_slot_imsi(p, NULL);
|
||||||
if (slot && slot->watch->online &&
|
if (slot && slot->watch->imsi && slot->watch->online &&
|
||||||
p->auto_data_sim == SIM_AUTO_SELECT_ONCE) {
|
p->auto_data_sim == SIM_AUTO_SELECT_ONCE) {
|
||||||
|
const char *imsi = slot->watch->imsi;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Data SIM only needs to be auto-selected
|
* Data SIM only needs to be auto-selected
|
||||||
* once and it's done. Write that down.
|
* once and it's done. Write that down.
|
||||||
*/
|
*/
|
||||||
|
DBG("Default data sim set to %s once", imsi);
|
||||||
p->auto_data_sim_done = TRUE;
|
p->auto_data_sim_done = TRUE;
|
||||||
g_key_file_set_boolean(p->storage,
|
g_key_file_set_boolean(p->storage,
|
||||||
SF_STORE_GROUP,
|
SF_STORE_GROUP,
|
||||||
SF_STORE_AUTO_DATA_SIM_DONE,
|
SF_STORE_AUTO_DATA_SIM_DONE,
|
||||||
p->auto_data_sim_done);
|
p->auto_data_sim_done);
|
||||||
|
|
||||||
|
g_free(p->default_data_imsi);
|
||||||
|
p->pub.default_data_imsi =
|
||||||
|
p->default_data_imsi = g_strdup(imsi);
|
||||||
|
g_key_file_set_string(p->storage,
|
||||||
|
SF_STORE_GROUP,
|
||||||
|
SF_STORE_DEFAULT_DATA_SIM,
|
||||||
|
imsi);
|
||||||
|
|
||||||
storage_sync(NULL, SF_STORE, p->storage);
|
storage_sync(NULL, SF_STORE, p->storage);
|
||||||
|
sailfish_manager_dbus_signal(p->dbus,
|
||||||
|
SAILFISH_MANAGER_SIGNAL_DATA_IMSI);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DBG("Skipping auto-selection of data SIM");
|
DBG("Skipping auto-selection of data SIM");
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
* Copyright (C) 2013-2017 Jolla Ltd.
|
* Copyright (C) 2013-2020 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -136,38 +136,56 @@ static GSList *provision_pick_best_ap(GSList *list, const char *spn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the list containing exactly one INTERNET and one MMS access point */
|
/**
|
||||||
|
* Returns the list containing INTERNET, MMS and IMS access points,
|
||||||
|
* always all three of them and always in this order.
|
||||||
|
*/
|
||||||
static GSList *provision_normalize_apn_list(GSList *apns, const char *spn)
|
static GSList *provision_normalize_apn_list(GSList *apns, const char *spn)
|
||||||
{
|
{
|
||||||
static const struct provision_ap_defaults internet_defaults =
|
static const struct provision_ap_defaults internet_defaults =
|
||||||
{ OFONO_GPRS_CONTEXT_TYPE_INTERNET, "Internet", "internet" };
|
{ OFONO_GPRS_CONTEXT_TYPE_INTERNET, "Internet", "internet" };
|
||||||
static const struct provision_ap_defaults mms_defaults =
|
static const struct provision_ap_defaults mms_defaults =
|
||||||
{ OFONO_GPRS_CONTEXT_TYPE_MMS, "MMS", "mms" };
|
{ OFONO_GPRS_CONTEXT_TYPE_MMS, "MMS", "mms" };
|
||||||
|
static const struct provision_ap_defaults ims_defaults =
|
||||||
|
{ OFONO_GPRS_CONTEXT_TYPE_IMS, "IMS", "ims" };
|
||||||
|
|
||||||
GSList *internet_apns = NULL;
|
GSList *internet_apns = NULL;
|
||||||
GSList *mms_apns = NULL;
|
GSList *mms_apns = NULL;
|
||||||
|
GSList *ims_apns = NULL;
|
||||||
|
|
||||||
/* Split internet and mms apns, delete all others */
|
/* Build separate apn list for each type */
|
||||||
while (apns) {
|
while (apns) {
|
||||||
GSList *link = apns;
|
GSList *link = apns;
|
||||||
struct ofono_gprs_provision_data *ap = link->data;
|
struct ofono_gprs_provision_data *ap = link->data;
|
||||||
|
|
||||||
apns = g_slist_remove_link(apns, link);
|
apns = g_slist_remove_link(apns, link);
|
||||||
if (ap->type == OFONO_GPRS_CONTEXT_TYPE_INTERNET) {
|
switch (ap->type) {
|
||||||
|
case OFONO_GPRS_CONTEXT_TYPE_INTERNET:
|
||||||
internet_apns = g_slist_concat(internet_apns, link);
|
internet_apns = g_slist_concat(internet_apns, link);
|
||||||
} else if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS) {
|
break;
|
||||||
|
case OFONO_GPRS_CONTEXT_TYPE_MMS:
|
||||||
mms_apns = g_slist_concat(mms_apns, link);
|
mms_apns = g_slist_concat(mms_apns, link);
|
||||||
} else {
|
break;
|
||||||
|
case OFONO_GPRS_CONTEXT_TYPE_IMS:
|
||||||
|
ims_apns = g_slist_concat(ims_apns, link);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
g_slist_free_full(link, provision_free_ap);
|
g_slist_free_full(link, provision_free_ap);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pick the best ap of each type and concatenate them */
|
/* Pick the best ap of each type */
|
||||||
return g_slist_concat(
|
internet_apns = provision_pick_best_ap(internet_apns, spn,
|
||||||
provision_pick_best_ap(internet_apns, spn,
|
mbpi_default_internet_proto, &internet_defaults);
|
||||||
mbpi_default_internet_proto, &internet_defaults),
|
mms_apns = provision_pick_best_ap(mms_apns, spn,
|
||||||
provision_pick_best_ap(mms_apns, spn,
|
mbpi_default_mms_proto, &mms_defaults);
|
||||||
mbpi_default_mms_proto, &mms_defaults));
|
ims_apns = provision_pick_best_ap(ims_apns, spn,
|
||||||
|
mbpi_default_ims_proto, &ims_defaults);
|
||||||
|
|
||||||
|
/* And concatenate them in the right order */
|
||||||
|
return g_slist_concat(internet_apns, g_slist_concat(mms_apns,
|
||||||
|
ims_apns));
|
||||||
}
|
}
|
||||||
|
|
||||||
int provision_get_settings(const char *mcc, const char *mnc,
|
int provision_get_settings(const char *mcc, const char *mnc,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
* Copyright (C) 2015-2019 Jolla Ltd.
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -2874,12 +2874,53 @@ static void provision_contexts(struct ofono_gprs *gprs, const char *mcc,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++) {
|
||||||
provision_context(&settings[i], gprs);
|
const struct ofono_gprs_provision_data *ap = settings + i;
|
||||||
|
|
||||||
|
if (!ofono_gprs_context_settings_by_type(gprs, ap->type)) {
|
||||||
|
provision_context(ap, gprs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
__ofono_gprs_provision_free_settings(settings, count);
|
__ofono_gprs_provision_free_settings(settings, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean all_contexts_configured(struct ofono_gprs *gprs)
|
||||||
|
{
|
||||||
|
GSList *l;
|
||||||
|
|
||||||
|
for (l = gprs->context_drivers; l; l = l->next) {
|
||||||
|
struct ofono_gprs_context *gc = l->data;
|
||||||
|
|
||||||
|
if (gc->type != OFONO_GPRS_CONTEXT_TYPE_ANY &&
|
||||||
|
!ofono_gprs_context_settings_by_type(gprs, gc->type)) {
|
||||||
|
return FALSE; /* Not yet */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void configure_remaining_contexts(struct ofono_gprs *gprs)
|
||||||
|
{
|
||||||
|
GSList *l;
|
||||||
|
|
||||||
|
for (l = gprs->context_drivers; l; l = l->next) {
|
||||||
|
struct ofono_gprs_context *gc = l->data;
|
||||||
|
|
||||||
|
if (gc->type != OFONO_GPRS_CONTEXT_TYPE_ANY &&
|
||||||
|
!ofono_gprs_context_settings_by_type(gprs, gc->type)) {
|
||||||
|
add_context(gprs, NULL, gc->type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure internet context is there */
|
||||||
|
if (!ofono_gprs_context_settings_by_type(gprs,
|
||||||
|
OFONO_GPRS_CONTEXT_TYPE_INTERNET)) {
|
||||||
|
add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void remove_non_active_context(struct ofono_gprs *gprs,
|
static void remove_non_active_context(struct ofono_gprs *gprs,
|
||||||
struct pri_context *ctx, DBusConnection *conn)
|
struct pri_context *ctx, DBusConnection *conn)
|
||||||
{
|
{
|
||||||
@@ -2960,8 +3001,7 @@ static DBusMessage *gprs_reset_contexts(DBusConnection *conn,
|
|||||||
provision_contexts(gprs, ofono_sim_get_mcc(sim),
|
provision_contexts(gprs, ofono_sim_get_mcc(sim),
|
||||||
ofono_sim_get_mnc(sim), ofono_sim_get_spn(sim));
|
ofono_sim_get_mnc(sim), ofono_sim_get_spn(sim));
|
||||||
|
|
||||||
if (gprs->contexts == NULL) /* Automatic provisioning failed */
|
configure_remaining_contexts(gprs);
|
||||||
add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET);
|
|
||||||
|
|
||||||
for (l = gprs->contexts; l; l = l->next) {
|
for (l = gprs->contexts; l; l = l->next) {
|
||||||
struct pri_context *ctx = l->data;
|
struct pri_context *ctx = l->data;
|
||||||
@@ -3832,8 +3872,7 @@ static void ofono_gprs_finish_register(struct ofono_gprs *gprs)
|
|||||||
struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom);
|
struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom);
|
||||||
const char *path = __ofono_atom_get_path(gprs->atom);
|
const char *path = __ofono_atom_get_path(gprs->atom);
|
||||||
|
|
||||||
if (gprs->contexts == NULL) /* Automatic provisioning failed */
|
configure_remaining_contexts(gprs);
|
||||||
add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET);
|
|
||||||
|
|
||||||
if (!g_dbus_register_interface(conn, path,
|
if (!g_dbus_register_interface(conn, path,
|
||||||
OFONO_CONNECTION_MANAGER_INTERFACE,
|
OFONO_CONNECTION_MANAGER_INTERFACE,
|
||||||
@@ -3856,56 +3895,14 @@ static void ofono_gprs_finish_register(struct ofono_gprs *gprs)
|
|||||||
__ofono_atom_register(gprs->atom, gprs_unregister);
|
__ofono_atom_register(gprs->atom, gprs_unregister);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean mms_context_configured(struct ofono_gprs *gprs)
|
|
||||||
{
|
|
||||||
GSList *l;
|
|
||||||
|
|
||||||
for (l = gprs->contexts; l; l = l->next) {
|
|
||||||
struct pri_context *ctx = l->data;
|
|
||||||
|
|
||||||
if (ctx->type == OFONO_GPRS_CONTEXT_TYPE_MMS)
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void provision_mms_context(struct ofono_gprs *gprs, const char *mcc,
|
|
||||||
const char *mnc, const char *spn)
|
|
||||||
{
|
|
||||||
struct ofono_gprs_provision_data *settings;
|
|
||||||
int count;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (__ofono_gprs_provision_get_settings(mcc, mnc, spn,
|
|
||||||
&settings, &count) == FALSE) {
|
|
||||||
ofono_warn("Provisioning failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
if (settings[i].type == OFONO_GPRS_CONTEXT_TYPE_MMS) {
|
|
||||||
provision_context(&settings[i], gprs);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__ofono_gprs_provision_free_settings(settings, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void spn_read_cb(const char *spn, const char *dc, void *data)
|
static void spn_read_cb(const char *spn, const char *dc, void *data)
|
||||||
{
|
{
|
||||||
struct ofono_gprs *gprs = data;
|
struct ofono_gprs *gprs = data;
|
||||||
struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom);
|
struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom);
|
||||||
struct ofono_sim *sim = __ofono_atom_find(OFONO_ATOM_TYPE_SIM, modem);
|
struct ofono_sim *sim = __ofono_atom_find(OFONO_ATOM_TYPE_SIM, modem);
|
||||||
|
|
||||||
if (gprs->contexts == NULL) {
|
provision_contexts(gprs, ofono_sim_get_mcc(sim),
|
||||||
provision_contexts(gprs, ofono_sim_get_mcc(sim),
|
|
||||||
ofono_sim_get_mnc(sim), spn);
|
ofono_sim_get_mnc(sim), spn);
|
||||||
} else if (!mms_context_configured(gprs)) {
|
|
||||||
provision_mms_context(gprs, ofono_sim_get_mcc(sim),
|
|
||||||
ofono_sim_get_mnc(sim), spn);
|
|
||||||
}
|
|
||||||
|
|
||||||
ofono_sim_remove_spn_watch(sim, &gprs->spn_watch);
|
ofono_sim_remove_spn_watch(sim, &gprs->spn_watch);
|
||||||
|
|
||||||
@@ -3927,7 +3924,7 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
|
|||||||
|
|
||||||
gprs_load_settings(gprs, ofono_sim_get_imsi(sim));
|
gprs_load_settings(gprs, ofono_sim_get_imsi(sim));
|
||||||
|
|
||||||
if (mms_context_configured(gprs))
|
if (all_contexts_configured(gprs))
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
ofono_sim_add_spn_watch(sim, &gprs->spn_watch, spn_read_cb, gprs, NULL);
|
ofono_sim_add_spn_watch(sim, &gprs->spn_watch, spn_read_cb, gprs, NULL);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2017 Jolla. All rights reserved.
|
* Copyright (C) 2014-2020 Jolla. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -105,21 +105,21 @@ static void test_provision(gconstpointer test_data)
|
|||||||
|
|
||||||
g_assert(actual->type == expected->type);
|
g_assert(actual->type == expected->type);
|
||||||
g_assert(actual->proto == expected->proto);
|
g_assert(actual->proto == expected->proto);
|
||||||
g_assert(!g_strcmp0(actual->provider_name,
|
g_assert_cmpstr(actual->provider_name, ==,
|
||||||
expected->provider_name));
|
expected->provider_name);
|
||||||
g_assert(!g_strcmp0(actual->name, expected->name));
|
g_assert_cmpstr(actual->name, ==, expected->name);
|
||||||
g_assert(actual->provider_primary ==
|
g_assert(actual->provider_primary ==
|
||||||
expected->provider_primary);
|
expected->provider_primary);
|
||||||
g_assert(!g_strcmp0(actual->apn, expected->apn));
|
g_assert_cmpstr(actual->apn, ==, expected->apn);
|
||||||
g_assert(!g_strcmp0(actual->username,
|
g_assert_cmpstr(actual->username, ==,
|
||||||
expected->username));
|
expected->username);
|
||||||
g_assert(!g_strcmp0(actual->password,
|
g_assert_cmpstr(actual->password, ==,
|
||||||
expected->password));
|
expected->password);
|
||||||
g_assert(actual->auth_method == expected->auth_method);
|
g_assert(actual->auth_method == expected->auth_method);
|
||||||
g_assert(!g_strcmp0(actual->message_proxy,
|
g_assert_cmpstr(actual->message_proxy, ==,
|
||||||
expected->message_proxy));
|
expected->message_proxy);
|
||||||
g_assert(!g_strcmp0(actual->message_center,
|
g_assert_cmpstr(actual->message_center, ==,
|
||||||
expected->message_center));
|
expected->message_center);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_assert(!__ofono_gprs_provision_get_settings(test->mcc,
|
g_assert(!__ofono_gprs_provision_get_settings(test->mcc,
|
||||||
@@ -212,6 +212,14 @@ static char telia_fi_message_center [] = "http://mms/";
|
|||||||
.apn = "mms", \
|
.apn = "mms", \
|
||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
||||||
|
|
||||||
|
/* Default IMS settings */
|
||||||
|
#define DEFAULT_IMS_SETTINGS \
|
||||||
|
.type = OFONO_GPRS_CONTEXT_TYPE_IMS, \
|
||||||
|
.proto = OFONO_GPRS_PROTO_IPV4V6, \
|
||||||
|
.name = "IMS", \
|
||||||
|
.apn = "ims", \
|
||||||
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data telia_fi_internet_mms_p[] = {
|
static const struct ofono_gprs_provision_data telia_fi_internet_mms_p[] = {
|
||||||
{
|
{
|
||||||
.type = OFONO_GPRS_CONTEXT_TYPE_INTERNET,
|
.type = OFONO_GPRS_CONTEXT_TYPE_INTERNET,
|
||||||
@@ -231,7 +239,8 @@ static const struct ofono_gprs_provision_data telia_fi_internet_mms_p[] = {
|
|||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE,
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE,
|
||||||
.message_proxy = telia_fi_message_proxy,
|
.message_proxy = telia_fi_message_proxy,
|
||||||
.message_center = telia_fi_message_center
|
.message_center = telia_fi_message_center
|
||||||
}
|
},
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data telia_fi_internet_mms[] = {
|
static const struct ofono_gprs_provision_data telia_fi_internet_mms[] = {
|
||||||
@@ -251,7 +260,8 @@ static const struct ofono_gprs_provision_data telia_fi_internet_mms[] = {
|
|||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE,
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE,
|
||||||
.message_proxy = telia_fi_message_proxy,
|
.message_proxy = telia_fi_message_proxy,
|
||||||
.message_center = telia_fi_message_center
|
.message_center = telia_fi_message_center
|
||||||
}
|
},
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data telia_fi_internet[] = {
|
static const struct ofono_gprs_provision_data telia_fi_internet[] = {
|
||||||
@@ -263,7 +273,8 @@ static const struct ofono_gprs_provision_data telia_fi_internet[] = {
|
|||||||
.apn = telia_fi_apn_internet,
|
.apn = telia_fi_apn_internet,
|
||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
||||||
},
|
},
|
||||||
{ DEFAULT_MMS_SETTINGS }
|
{ DEFAULT_MMS_SETTINGS },
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data telia_fi_mms[] = {
|
static const struct ofono_gprs_provision_data telia_fi_mms[] = {
|
||||||
@@ -277,12 +288,14 @@ static const struct ofono_gprs_provision_data telia_fi_mms[] = {
|
|||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE,
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE,
|
||||||
.message_proxy = telia_fi_message_proxy,
|
.message_proxy = telia_fi_message_proxy,
|
||||||
.message_center = telia_fi_message_center
|
.message_center = telia_fi_message_center
|
||||||
}
|
},
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data default_settings[] = {
|
static const struct ofono_gprs_provision_data default_settings[] = {
|
||||||
{ DEFAILT_INTERNET_SETTINGS },
|
{ DEFAILT_INTERNET_SETTINGS },
|
||||||
{ DEFAULT_MMS_SETTINGS }
|
{ DEFAULT_MMS_SETTINGS },
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data no_auth_settings[] = {
|
static const struct ofono_gprs_provision_data no_auth_settings[] = {
|
||||||
@@ -300,7 +313,8 @@ static const struct ofono_gprs_provision_data no_auth_settings[] = {
|
|||||||
.name = "MMS",
|
.name = "MMS",
|
||||||
.apn = "mms",
|
.apn = "mms",
|
||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
||||||
}
|
},
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data auth_settings[] = {
|
static const struct ofono_gprs_provision_data auth_settings[] = {
|
||||||
@@ -318,7 +332,8 @@ static const struct ofono_gprs_provision_data auth_settings[] = {
|
|||||||
.apn = "mms",
|
.apn = "mms",
|
||||||
.password = "password",
|
.password = "password",
|
||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_ANY
|
.auth_method = OFONO_GPRS_AUTH_METHOD_ANY
|
||||||
}
|
},
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data settings_ip[] = {
|
static const struct ofono_gprs_provision_data settings_ip[] = {
|
||||||
@@ -329,7 +344,8 @@ static const struct ofono_gprs_provision_data settings_ip[] = {
|
|||||||
.apn = "internet",
|
.apn = "internet",
|
||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
||||||
},
|
},
|
||||||
{ DEFAULT_MMS_SETTINGS }
|
{ DEFAULT_MMS_SETTINGS },
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data settings_ipv6[] = {
|
static const struct ofono_gprs_provision_data settings_ipv6[] = {
|
||||||
@@ -345,7 +361,8 @@ static const struct ofono_gprs_provision_data settings_ipv6[] = {
|
|||||||
.name = "MMS",
|
.name = "MMS",
|
||||||
.apn = "mms",
|
.apn = "mms",
|
||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
||||||
}
|
},
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ofono_gprs_provision_data settings_ipv4v6[] = {
|
static const struct ofono_gprs_provision_data settings_ipv4v6[] = {
|
||||||
@@ -356,7 +373,40 @@ static const struct ofono_gprs_provision_data settings_ipv4v6[] = {
|
|||||||
.name = "MMS",
|
.name = "MMS",
|
||||||
.apn = "mms",
|
.apn = "mms",
|
||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
||||||
}
|
},
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
|
};
|
||||||
|
|
||||||
|
static char beeline_provider_name [] = "Beeline";
|
||||||
|
static const struct ofono_gprs_provision_data beeline_ims[] = {
|
||||||
|
{
|
||||||
|
.type = OFONO_GPRS_CONTEXT_TYPE_INTERNET,
|
||||||
|
.proto = OFONO_GPRS_PROTO_IPV4V6,
|
||||||
|
.provider_name = beeline_provider_name,
|
||||||
|
.name = "Beeline Internet",
|
||||||
|
.apn = "internet.beeline.ru",
|
||||||
|
.username = "beeline",
|
||||||
|
.password = "beeline",
|
||||||
|
.auth_method = OFONO_GPRS_AUTH_METHOD_ANY
|
||||||
|
}, {
|
||||||
|
.type = OFONO_GPRS_CONTEXT_TYPE_MMS,
|
||||||
|
.proto = OFONO_GPRS_PROTO_IP,
|
||||||
|
.provider_name = beeline_provider_name,
|
||||||
|
.name = "Beeline MMS",
|
||||||
|
.apn = "mms.beeline.ru",
|
||||||
|
.username = "beeline",
|
||||||
|
.password = "beeline",
|
||||||
|
.auth_method = OFONO_GPRS_AUTH_METHOD_PAP,
|
||||||
|
.message_proxy = "192.168.94.23:8080",
|
||||||
|
.message_center = "http://mms/"
|
||||||
|
}, {
|
||||||
|
.type = OFONO_GPRS_CONTEXT_TYPE_IMS,
|
||||||
|
.proto = OFONO_GPRS_PROTO_IPV4V6,
|
||||||
|
.provider_name = beeline_provider_name,
|
||||||
|
.name = "Beeline IMS",
|
||||||
|
.apn = "ims.beeline.ru",
|
||||||
|
.auth_method = OFONO_GPRS_AUTH_METHOD_NONE
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static char test_provider_name[] = "Test provider";
|
static char test_provider_name[] = "Test provider";
|
||||||
@@ -382,7 +432,8 @@ static const struct ofono_gprs_provision_data test_username_password[] = {
|
|||||||
.auth_method = OFONO_GPRS_AUTH_METHOD_CHAP,
|
.auth_method = OFONO_GPRS_AUTH_METHOD_CHAP,
|
||||||
.message_proxy = test_message_proxy,
|
.message_proxy = test_message_proxy,
|
||||||
.message_center = test_message_center
|
.message_center = test_message_center
|
||||||
}
|
},
|
||||||
|
{ DEFAULT_IMS_SETTINGS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char telia_fi_internet_xml[] =
|
static const char telia_fi_internet_xml[] =
|
||||||
@@ -806,6 +857,42 @@ static const struct provision_test_case test_cases[] = {
|
|||||||
.mnc = "91",
|
.mnc = "91",
|
||||||
.settings = telia_fi_mms,
|
.settings = telia_fi_mms,
|
||||||
.count = G_N_ELEMENTS(telia_fi_mms)
|
.count = G_N_ELEMENTS(telia_fi_mms)
|
||||||
|
},{
|
||||||
|
.name = TEST_SUITE "ims",
|
||||||
|
.xml =
|
||||||
|
"<serviceproviders format=\"2.0\">\n\
|
||||||
|
<country code=\"ru\">\n\
|
||||||
|
<provider>\n\
|
||||||
|
<name>Beeline</name>\n\
|
||||||
|
<gsm>\n\
|
||||||
|
<network-id mcc=\"250\" mnc=\"99\"/>\n\
|
||||||
|
<apn value=\"internet.beeline.ru\">\n\
|
||||||
|
<usage type=\"internet\"/>\n\
|
||||||
|
<name>Beeline Internet</name>\n\
|
||||||
|
<username>beeline</username>\n\
|
||||||
|
<password>beeline</password>\n\
|
||||||
|
</apn>\n\
|
||||||
|
<apn value=\"mms.beeline.ru\">\n\
|
||||||
|
<usage type=\"mms\"/>\n\
|
||||||
|
<name>Beeline MMS</name>\n\
|
||||||
|
<authentication method=\"pap\"/>\n\
|
||||||
|
<username>beeline</username>\n\
|
||||||
|
<password>beeline</password>\n\
|
||||||
|
<mmsc>http://mms/</mmsc>\n\
|
||||||
|
<mmsproxy>192.168.94.23:8080</mmsproxy>\n\
|
||||||
|
</apn>\n\
|
||||||
|
<apn value=\"ims.beeline.ru\">\n\
|
||||||
|
<usage type=\"ims\"/>\n\
|
||||||
|
<name>Beeline IMS</name>\n\
|
||||||
|
</apn>\n\
|
||||||
|
</gsm>\n\
|
||||||
|
</provider>\n\
|
||||||
|
</country>\n\
|
||||||
|
</serviceproviders>\n",
|
||||||
|
.mcc = "250",
|
||||||
|
.mnc = "99",
|
||||||
|
.settings = beeline_ims,
|
||||||
|
.count = G_N_ELEMENTS(beeline_ims)
|
||||||
},{
|
},{
|
||||||
.name = TEST_SUITE "not_found_mcc",
|
.name = TEST_SUITE "not_found_mcc",
|
||||||
.xml = telia_fi_internet_xml,
|
.xml = telia_fi_internet_xml,
|
||||||
@@ -1297,3 +1384,11 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
return g_test_run();
|
return g_test_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: C
|
||||||
|
* c-basic-offset: 8
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user