mirror of
https://github.com/sailfishos/ofono
synced 2025-11-25 03:49:44 +08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3afa0876c6 | ||
|
|
04162f719e | ||
|
|
4ae4d688ce | ||
|
|
224b551feb | ||
|
|
6acf808d89 | ||
|
|
942b2efc3b | ||
|
|
301b880a87 | ||
|
|
933525829f | ||
|
|
d8df18c80c |
@@ -23,14 +23,17 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ofono/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum ofono_cell_type {
|
||||
OFONO_CELL_TYPE_GSM,
|
||||
OFONO_CELL_TYPE_WCDMA,
|
||||
OFONO_CELL_TYPE_LTE
|
||||
OFONO_CELL_TYPE_LTE,
|
||||
OFONO_CELL_TYPE_NR /* Since 1.29+git8 */
|
||||
};
|
||||
|
||||
#define OFONO_CELL_INVALID_VALUE (INT_MAX)
|
||||
#define OFONO_CELL_INVALID_VALUE_INT64 (INT64_MAX)
|
||||
|
||||
struct ofono_cell_info_gsm {
|
||||
int mcc; /* Mobile Country Code (0..999) */
|
||||
@@ -70,6 +73,22 @@ struct ofono_cell_info_lte {
|
||||
int timingAdvance; /* (Distance = 300m/us) TS 36.321 */
|
||||
};
|
||||
|
||||
/* Since 1.29+git8 */
|
||||
struct ofono_cell_info_nr {
|
||||
int mcc; /* Mobile Country Code (0..999) */
|
||||
int mnc; /* Mobile Network Code (0..999) */
|
||||
int64_t nci; /* NR Cell Identity */
|
||||
int pci; /* Physical cell id (0..1007) */
|
||||
int tac; /* Tracking area code */
|
||||
int nrarfcn; /* 22-bit NR Absolute RC Channel Number */
|
||||
int ssRsrp; /* SS Reference Signal Receive Power TS 38.215 */
|
||||
int ssRsrq; /* SS Reference Signal Receive Quality TS 38.215 and 38.133 */
|
||||
int ssSinr; /* SS Reference Signal-to-Noise Ratio TS 38.215 and 38.133*/
|
||||
int csiRsrp; /* CSI Reference Signal Receive Power TS 38.215 */
|
||||
int csiRsrq; /* CSI Reference Signal Receive Quality TS 38.215 */
|
||||
int csiSinr; /* CSI Reference Signal-to-Noise Ratio TS 38.215 and 38.133 */
|
||||
};
|
||||
|
||||
typedef struct ofono_cell {
|
||||
enum ofono_cell_type type;
|
||||
ofono_bool_t registered;
|
||||
@@ -77,6 +96,7 @@ typedef struct ofono_cell {
|
||||
struct ofono_cell_info_gsm gsm;
|
||||
struct ofono_cell_info_wcdma wcdma;
|
||||
struct ofono_cell_info_lte lte;
|
||||
struct ofono_cell_info_nr nr; /* Since 1.29+git8 */
|
||||
} info;
|
||||
} *ofono_cell_ptr;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ enum ofono_radio_access_mode {
|
||||
OFONO_RADIO_ACCESS_MODE_GSM = 0x1,
|
||||
OFONO_RADIO_ACCESS_MODE_UMTS = 0x2,
|
||||
OFONO_RADIO_ACCESS_MODE_LTE = 0x4,
|
||||
OFONO_RADIO_ACCESS_MODE_NR = 0x8, /* Since 1.29+git8 */
|
||||
};
|
||||
|
||||
enum ofono_radio_band_gsm {
|
||||
|
||||
@@ -57,7 +57,11 @@ enum ofono_access_technology {
|
||||
OFONO_ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA = 6,
|
||||
OFONO_ACCESS_TECHNOLOGY_EUTRAN = 7,
|
||||
OFONO_ACCESS_TECHNOLOGY_NB_IOT_M1 = 8,
|
||||
OFONO_ACCESS_TECHNOLOGY_NB_IOT_NB1 = 9
|
||||
OFONO_ACCESS_TECHNOLOGY_NB_IOT_NB1 = 9,
|
||||
OFONO_ACCESS_TECHNOLOGY_EUTRA_5GCN = 10, /* Since 1.29+git8 */
|
||||
OFONO_ACCESS_TECHNOLOGY_NR_5GCN = 11, /* Since 1.29+git8 */
|
||||
OFONO_ACCESS_TECHNOLOGY_NG_RAN = 12, /* Since 1.29+git8 */
|
||||
OFONO_ACCESS_TECHNOLOGY_EUTRA_NR = 13, /* Since 1.29+git8 */
|
||||
};
|
||||
|
||||
/* 27.007 Section 6.2 */
|
||||
|
||||
@@ -771,7 +771,7 @@ static void sim_cbmi_read_cb(int ok, int length, int record,
|
||||
|
||||
mi = (data[i] << 8) + data[i+1];
|
||||
|
||||
if (mi > 999)
|
||||
if (mi > CBS_MAX_TOPIC)
|
||||
continue;
|
||||
|
||||
range = g_new0(struct cbs_topic_range, 1);
|
||||
@@ -818,7 +818,7 @@ static void sim_cbmir_read_cb(int ok, int length, int record,
|
||||
min = (data[i] << 8) + data[i+1];
|
||||
max = (data[i+2] << 8) + data[i+3];
|
||||
|
||||
if (min > 999 || max > 999 || min > max)
|
||||
if (min > CBS_MAX_TOPIC || max > CBS_MAX_TOPIC || min > max)
|
||||
continue;
|
||||
|
||||
range = g_new0(struct cbs_topic_range, 1);
|
||||
|
||||
@@ -57,14 +57,19 @@ struct cell_property {
|
||||
const char *name;
|
||||
glong off;
|
||||
int flag;
|
||||
int type;
|
||||
};
|
||||
|
||||
#define CELL_GSM_PROPERTY(value,name) \
|
||||
{ #name, G_STRUCT_OFFSET(struct ofono_cell_info_gsm,name), value }
|
||||
{ #name, G_STRUCT_OFFSET(struct ofono_cell_info_gsm,name), value, DBUS_TYPE_INT32 }
|
||||
#define CELL_WCDMA_PROPERTY(value,name) \
|
||||
{ #name, G_STRUCT_OFFSET(struct ofono_cell_info_wcdma,name), value }
|
||||
{ #name, G_STRUCT_OFFSET(struct ofono_cell_info_wcdma,name), value, DBUS_TYPE_INT32 }
|
||||
#define CELL_LTE_PROPERTY(value,name) \
|
||||
{ #name, G_STRUCT_OFFSET(struct ofono_cell_info_lte,name), value }
|
||||
{ #name, G_STRUCT_OFFSET(struct ofono_cell_info_lte,name), value, DBUS_TYPE_INT32 }
|
||||
#define CELL_NR_PROPERTY(value,name) \
|
||||
{ #name, G_STRUCT_OFFSET(struct ofono_cell_info_nr,name), value, DBUS_TYPE_INT32 }
|
||||
#define CELL_NR_PROPERTY64(value,name) \
|
||||
{ #name, G_STRUCT_OFFSET(struct ofono_cell_info_nr,name), value, DBUS_TYPE_INT64 }
|
||||
|
||||
static const struct cell_property cell_gsm_properties [] = {
|
||||
CELL_GSM_PROPERTY(0x001,mcc),
|
||||
@@ -104,6 +109,21 @@ static const struct cell_property cell_lte_properties [] = {
|
||||
CELL_LTE_PROPERTY(0x800,timingAdvance)
|
||||
};
|
||||
|
||||
static const struct cell_property cell_nr_properties [] = {
|
||||
CELL_NR_PROPERTY(0x001,mcc),
|
||||
CELL_NR_PROPERTY(0x002,mnc),
|
||||
CELL_NR_PROPERTY64(0x004,nci),
|
||||
CELL_NR_PROPERTY(0x008,pci),
|
||||
CELL_NR_PROPERTY(0x010,tac),
|
||||
CELL_NR_PROPERTY(0x020,nrarfcn),
|
||||
CELL_NR_PROPERTY(0x040,ssRsrp),
|
||||
CELL_NR_PROPERTY(0x080,ssRsrq),
|
||||
CELL_NR_PROPERTY(0x100,ssSinr),
|
||||
CELL_NR_PROPERTY(0x200,csiRsrp),
|
||||
CELL_NR_PROPERTY(0x400,csiRsrq),
|
||||
CELL_NR_PROPERTY(0x800,csiSinr),
|
||||
};
|
||||
|
||||
#define CELL_PROPERTY_REGISTERED 0x1000
|
||||
|
||||
typedef void (*cell_info_dbus_append_fn)(DBusMessageIter *it,
|
||||
@@ -124,6 +144,8 @@ static const char *cell_info_dbus_cell_type_str(enum ofono_cell_type type)
|
||||
return "wcdma";
|
||||
case OFONO_CELL_TYPE_LTE:
|
||||
return "lte";
|
||||
case OFONO_CELL_TYPE_NR:
|
||||
return "nr";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
@@ -142,6 +164,9 @@ static const struct cell_property *cell_info_dbus_cell_properties
|
||||
case OFONO_CELL_TYPE_LTE:
|
||||
*count = G_N_ELEMENTS(cell_lte_properties);
|
||||
return cell_lte_properties;
|
||||
case OFONO_CELL_TYPE_NR:
|
||||
*count = G_N_ELEMENTS(cell_nr_properties);
|
||||
return cell_nr_properties;
|
||||
default:
|
||||
*count = 0;
|
||||
return NULL;
|
||||
@@ -202,10 +227,18 @@ static void cell_info_dbus_append_properties(DBusMessageIter *it,
|
||||
|
||||
dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, "{sv}", &dict);
|
||||
for (i = 0; i < n; i++) {
|
||||
gint32 value = G_STRUCT_MEMBER(int, &cell->info, prop[i].off);
|
||||
if (value != OFONO_CELL_INVALID_VALUE) {
|
||||
ofono_dbus_dict_append(&dict, prop[i].name,
|
||||
DBUS_TYPE_INT32, &value);
|
||||
if (prop[i].type == DBUS_TYPE_INT64) {
|
||||
gint64 value = G_STRUCT_MEMBER(gint64, &cell->info, prop[i].off);
|
||||
if (value != OFONO_CELL_INVALID_VALUE_INT64) {
|
||||
ofono_dbus_dict_append(&dict, prop[i].name,
|
||||
DBUS_TYPE_INT64, &value);
|
||||
}
|
||||
} else {
|
||||
gint32 value = G_STRUCT_MEMBER(int, &cell->info, prop[i].off);
|
||||
if (value != OFONO_CELL_INVALID_VALUE) {
|
||||
ofono_dbus_dict_append(&dict, prop[i].name,
|
||||
DBUS_TYPE_INT32, &value);
|
||||
}
|
||||
}
|
||||
}
|
||||
dbus_message_iter_close_container(it, &dict);
|
||||
@@ -375,11 +408,20 @@ static int cell_info_dbus_compare(const struct ofono_cell *c1,
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
const glong offset = prop[i].off;
|
||||
gint32 v1 = G_STRUCT_MEMBER(int, &c1->info, offset);
|
||||
gint32 v2 = G_STRUCT_MEMBER(int, &c2->info, offset);
|
||||
if (prop[i].type == DBUS_TYPE_INT64) {
|
||||
gint64 v1 = G_STRUCT_MEMBER(gint64, &c1->info, offset);
|
||||
gint64 v2 = G_STRUCT_MEMBER(gint64, &c2->info, offset);
|
||||
|
||||
if (v1 != v2) {
|
||||
mask |= prop[i].flag;
|
||||
if (v1 != v2) {
|
||||
mask |= prop[i].flag;
|
||||
}
|
||||
} else {
|
||||
gint32 v1 = G_STRUCT_MEMBER(int, &c1->info, offset);
|
||||
gint32 v2 = G_STRUCT_MEMBER(int, &c2->info, offset);
|
||||
|
||||
if (v1 != v2) {
|
||||
mask |= prop[i].flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +469,7 @@ static void cell_info_dbus_property_changed(CellInfoDBus *dbus,
|
||||
ofono_dbus_clients_signal_property_changed(
|
||||
dbus->clients, entry->path,
|
||||
CELL_DBUS_INTERFACE, prop[i].name,
|
||||
DBUS_TYPE_INT32,
|
||||
prop[i].type,
|
||||
G_STRUCT_MEMBER_P(&cell->info, prop[i].off));
|
||||
mask &= ~prop[i].flag;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,23 @@ int ofono_cell_compare_location(const struct ofono_cell *c1,
|
||||
} else {
|
||||
return l1->tac - l2->tac;
|
||||
}
|
||||
} else if (c1->type == OFONO_CELL_TYPE_NR) {
|
||||
const struct ofono_cell_info_nr *n1 =
|
||||
&c1->info.nr;
|
||||
const struct ofono_cell_info_nr *n2 =
|
||||
&c2->info.nr;
|
||||
|
||||
if (n1->mcc != n2->mcc) {
|
||||
return n1->mcc - n2->mcc;
|
||||
} else if (n1->mnc != n2->mnc) {
|
||||
return n1->mnc - n2->mnc;
|
||||
} else if (n1->nci != n2->nci) {
|
||||
return n1->nci - n2->nci;
|
||||
} else if (n1->pci != n2->pci) {
|
||||
return n1->pci - n2->pci;
|
||||
} else {
|
||||
return n1->tac - n2->tac;
|
||||
}
|
||||
} else {
|
||||
ofono_warn("Unexpected cell type");
|
||||
return 0;
|
||||
|
||||
@@ -710,6 +710,12 @@ const char *registration_tech_to_string(enum ofono_access_technology tech)
|
||||
return "lte-cat-m1";
|
||||
case ACCESS_TECHNOLOGY_NB_IOT_NB1:
|
||||
return "lte-cat-nb1";
|
||||
case ACCESS_TECHNOLOGY_EUTRA_5GCN:
|
||||
return "lte";
|
||||
case ACCESS_TECHNOLOGY_NR_5GCN:
|
||||
case ACCESS_TECHNOLOGY_NG_RAN:
|
||||
case ACCESS_TECHNOLOGY_EUTRA_NR:
|
||||
return "nr";
|
||||
case OFONO_ACCESS_TECHNOLOGY_NONE:
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
OFONO_ACCESS_TECHNOLOGY_NB_IOT_M1 /* 8 */
|
||||
#define ACCESS_TECHNOLOGY_NB_IOT_NB1 \
|
||||
OFONO_ACCESS_TECHNOLOGY_NB_IOT_NB1 /* 9 */
|
||||
#define ACCESS_TECHNOLOGY_EUTRA_5GCN \
|
||||
OFONO_ACCESS_TECHNOLOGY_EUTRA_5GCN /* 10 */
|
||||
#define ACCESS_TECHNOLOGY_NR_5GCN \
|
||||
OFONO_ACCESS_TECHNOLOGY_NR_5GCN /* 11 */
|
||||
#define ACCESS_TECHNOLOGY_NG_RAN \
|
||||
OFONO_ACCESS_TECHNOLOGY_NG_RAN /* 12 */
|
||||
#define ACCESS_TECHNOLOGY_EUTRA_NR \
|
||||
OFONO_ACCESS_TECHNOLOGY_EUTRA_NR /* 13 */
|
||||
|
||||
/* 27.007 Section 7.2 <stat> */
|
||||
#define NETWORK_REGISTRATION_STATUS_NOT_REGISTERED \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* oFono - Open Source Telephony
|
||||
*
|
||||
* Copyright (C) 2015-2021 Jolla Ltd.
|
||||
* Copyright (C) 2015-2022 Jolla Ltd.
|
||||
* Copyright (C) 2019 Open Mobile Platform LLC.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -243,6 +243,7 @@ static void conf_merge_group(GKeyFile *conf, GKeyFile *k, const char *group)
|
||||
group, key, &count, NULL);
|
||||
|
||||
key[len-1] = 0;
|
||||
g_strchomp(key); /* Strip spaces before + */
|
||||
conf_list_append(conf, k, group, key,
|
||||
values, count, last == '?');
|
||||
g_strfreev(values);
|
||||
@@ -252,6 +253,7 @@ static void conf_merge_group(GKeyFile *conf, GKeyFile *k, const char *group)
|
||||
group, key, &count, NULL);
|
||||
|
||||
key[len-1] = 0;
|
||||
g_strchomp(key); /* Strip spaces before - */
|
||||
conf_list_remove(conf, k, group, key,
|
||||
values, count);
|
||||
g_strfreev(values);
|
||||
@@ -531,13 +533,16 @@ gboolean ofono_conf_get_mask(GKeyFile *file, const char *group,
|
||||
char **values, **ptr;
|
||||
|
||||
if (comment) *comment = 0;
|
||||
values = g_strsplit(str, "+", -1);
|
||||
values = g_strsplit_set(str, "+,", -1);
|
||||
|
||||
for (ok = TRUE, ptr = values; *ptr && ok; ptr++) {
|
||||
const char* found_str = NULL;
|
||||
const char* s = g_strstrip(*ptr);
|
||||
|
||||
if (!strcasecmp(s, name)) {
|
||||
if (!s[0]) {
|
||||
/* Ignore empty entries */
|
||||
continue;
|
||||
} else if (!strcasecmp(s, name)) {
|
||||
found_str = name;
|
||||
if (result) {
|
||||
*result |= value;
|
||||
|
||||
@@ -65,7 +65,9 @@ struct ofono_radio_settings {
|
||||
enum ofono_radio_access_mode ofono_radio_access_max_mode(
|
||||
enum ofono_radio_access_mode mask)
|
||||
{
|
||||
return (mask & OFONO_RADIO_ACCESS_MODE_LTE) ?
|
||||
return (mask & OFONO_RADIO_ACCESS_MODE_NR) ?
|
||||
OFONO_RADIO_ACCESS_MODE_NR :
|
||||
(mask & OFONO_RADIO_ACCESS_MODE_LTE) ?
|
||||
OFONO_RADIO_ACCESS_MODE_LTE :
|
||||
(mask & OFONO_RADIO_ACCESS_MODE_UMTS) ?
|
||||
OFONO_RADIO_ACCESS_MODE_UMTS :
|
||||
@@ -86,6 +88,8 @@ const char *ofono_radio_access_mode_to_string(enum ofono_radio_access_mode m)
|
||||
return "umts";
|
||||
case OFONO_RADIO_ACCESS_MODE_LTE:
|
||||
return "lte";
|
||||
case OFONO_RADIO_ACCESS_MODE_NR:
|
||||
return "nr";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@@ -110,6 +114,9 @@ ofono_bool_t ofono_radio_access_mode_from_string(const char *str,
|
||||
} else if (g_str_equal(str, "lte")) {
|
||||
*mode = OFONO_RADIO_ACCESS_MODE_LTE;
|
||||
return TRUE;
|
||||
} else if (g_str_equal(str, "nr")) {
|
||||
*mode = OFONO_RADIO_ACCESS_MODE_NR;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -438,7 +445,7 @@ static void radio_available_rats_query_callback(const struct ofono_error *error,
|
||||
struct ofono_radio_settings *rs = data;
|
||||
|
||||
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
|
||||
rs->available_rats = available_rats & 0x7;
|
||||
rs->available_rats = available_rats & 0xF;
|
||||
else
|
||||
DBG("Error while querying available rats");
|
||||
|
||||
|
||||
@@ -4593,13 +4593,11 @@ out:
|
||||
GSList *cbs_optimize_ranges(GSList *ranges)
|
||||
{
|
||||
struct cbs_topic_range *range;
|
||||
unsigned char bitmap[125];
|
||||
unsigned char *bitmap = g_malloc0(CBS_MAX_TOPIC / 8 + 1);
|
||||
GSList *l;
|
||||
unsigned short i;
|
||||
GSList *ret = NULL;
|
||||
|
||||
memset(bitmap, 0, sizeof(bitmap));
|
||||
|
||||
for (l = ranges; l; l = l->next) {
|
||||
range = l->data;
|
||||
|
||||
@@ -4613,7 +4611,7 @@ GSList *cbs_optimize_ranges(GSList *ranges)
|
||||
|
||||
range = NULL;
|
||||
|
||||
for (i = 0; i <= 999; i++) {
|
||||
for (i = 0; i <= CBS_MAX_TOPIC; i++) {
|
||||
int byte_offset = i / 8;
|
||||
int bit = i % 8;
|
||||
|
||||
@@ -4641,6 +4639,7 @@ GSList *cbs_optimize_ranges(GSList *ranges)
|
||||
|
||||
ret = g_slist_reverse(ret);
|
||||
|
||||
g_free(bitmap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -4653,10 +4652,10 @@ GSList *cbs_extract_topic_ranges(const char *ranges)
|
||||
GSList *tmp;
|
||||
|
||||
while (next_range(ranges, &offset, &min, &max) == TRUE) {
|
||||
if (min < 0 || min > 999)
|
||||
if (min < 0 || min > CBS_MAX_TOPIC)
|
||||
return NULL;
|
||||
|
||||
if (max < 0 || max > 999)
|
||||
if (max < 0 || max > CBS_MAX_TOPIC)
|
||||
return NULL;
|
||||
|
||||
if (max < min)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <ofono/types.h>
|
||||
|
||||
#define CBS_MAX_GSM_CHARS 93
|
||||
#define CBS_MAX_TOPIC 9999
|
||||
#define SMS_MSGID_LEN 20
|
||||
|
||||
enum sms_type {
|
||||
|
||||
@@ -2665,9 +2665,9 @@ void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
|
||||
if (l) {
|
||||
/* Incoming call was disconnected in the process of being
|
||||
* filtered. voicecall_destroy cancels it. */
|
||||
voicecall_destroy(l->data);
|
||||
vc->incoming_filter_list = g_slist_delete_link
|
||||
(vc->incoming_filter_list, l);
|
||||
voicecall_destroy(l->data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,9 +92,9 @@ def set_topics(cbs):
|
||||
break
|
||||
|
||||
if topicTemp:
|
||||
if int(topicTemp) > 999:
|
||||
if int(topicTemp) > 9999:
|
||||
invalidData = True
|
||||
print("Invalid Topic ID %s (range 0-999). \
|
||||
print("Invalid Topic ID %s (range 0-9999). \
|
||||
\nCould not register." % topicTemp)
|
||||
|
||||
index = index + 1
|
||||
|
||||
@@ -318,6 +318,28 @@ static struct ofono_cell *test_cell_init_lte(struct ofono_cell *cell)
|
||||
return cell;
|
||||
}
|
||||
|
||||
static struct ofono_cell *test_cell_init_nr(struct ofono_cell *cell)
|
||||
{
|
||||
struct ofono_cell_info_nr *nr = &cell->info.nr;
|
||||
|
||||
memset(cell, 0, sizeof(*cell));
|
||||
cell->type = OFONO_CELL_TYPE_NR;
|
||||
cell->registered = TRUE;
|
||||
nr->mcc = 244;
|
||||
nr->mnc = 91;
|
||||
nr->nci = 36591883;
|
||||
nr->pci = 309;
|
||||
nr->tac = 4030;
|
||||
nr->nrarfcn = INT_MAX;
|
||||
nr->ssRsrp = 106;
|
||||
nr->ssRsrq = 6;
|
||||
nr->ssSinr = INT_MAX;
|
||||
nr->csiRsrp = 106;
|
||||
nr->csiRsrq = 6;
|
||||
nr->csiSinr = INT_MAX;
|
||||
return cell;
|
||||
}
|
||||
|
||||
/* ==== Misc ==== */
|
||||
|
||||
static void test_misc(void)
|
||||
@@ -540,6 +562,13 @@ static void test_get_all4(void)
|
||||
{
|
||||
struct ofono_cell cell;
|
||||
|
||||
test_get_all(test_cell_init_nr(&cell), "nr");
|
||||
}
|
||||
|
||||
static void test_get_all5(void)
|
||||
{
|
||||
struct ofono_cell cell;
|
||||
|
||||
/* Invalid cell */
|
||||
memset(&cell, 0xff, sizeof(cell));
|
||||
test_get_all(&cell, "unknown");
|
||||
@@ -1145,6 +1174,7 @@ int main(int argc, char *argv[])
|
||||
g_test_add_func(TEST_("GetAll2"), test_get_all2);
|
||||
g_test_add_func(TEST_("GetAll3"), test_get_all3);
|
||||
g_test_add_func(TEST_("GetAll4"), test_get_all4);
|
||||
g_test_add_func(TEST_("GetAll5"), test_get_all5);
|
||||
g_test_add_func(TEST_("GetInterfaceVersion"), test_get_version);
|
||||
g_test_add_func(TEST_("GetType"), test_get_type);
|
||||
g_test_add_func(TEST_("GetRegistered"), test_get_registered);
|
||||
|
||||
@@ -226,6 +226,35 @@ static void test_compare(void)
|
||||
c2 = c1; c2.info.lte.timingAdvance++;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
|
||||
/* NR */
|
||||
c1.type = OFONO_CELL_TYPE_NR;
|
||||
c2 = c1;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
c2 = c1; c2.info.nr.mcc++;
|
||||
g_assert(ofono_cell_compare_location(&c1, &c2) < 0);
|
||||
c2 = c1; c2.info.nr.mnc++;
|
||||
g_assert(ofono_cell_compare_location(&c1, &c2) < 0);
|
||||
c2 = c1; c2.info.nr.nci++;
|
||||
g_assert(ofono_cell_compare_location(&c1, &c2) < 0);
|
||||
c2 = c1; c2.info.nr.pci++;
|
||||
g_assert(ofono_cell_compare_location(&c1, &c2) < 0);
|
||||
c2 = c1; c2.info.nr.tac++;
|
||||
g_assert(ofono_cell_compare_location(&c1, &c2) < 0);
|
||||
/* Other attributes are not being compared */
|
||||
c2 = c1; c2.info.nr.nrarfcn++;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
c2 = c1; c2.info.nr.ssRsrp++;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
c2 = c1; c2.info.nr.ssRsrq++;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
c2 = c1; c2.info.nr.ssSinr++;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
c2 = c1; c2.info.nr.csiRsrp++;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
c2 = c1; c2.info.nr.csiRsrq++;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
c2 = c1; c2.info.nr.csiSinr++;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
/* Unknown type */
|
||||
c1.type = c2.type = (enum ofono_cell_type)-1;
|
||||
g_assert(!ofono_cell_compare_location(&c1, &c2));
|
||||
|
||||
@@ -1589,7 +1589,7 @@ static void test_cbs_padding_character(void)
|
||||
static const char *ranges[] = { "1-5, 2, 3, 600, 569-900, 999",
|
||||
"0-20, 33, 44, 50-60, 20-50, 1-5, 5, 3, 5",
|
||||
NULL };
|
||||
static const char *inv_ranges[] = { "1-5, 3333", "1-5, afbcd", "1-5, 3-5,,",
|
||||
static const char *inv_ranges[] = { "1-5, 33333", "1-5, afbcd", "1-5, 3-5,,",
|
||||
"1-5, 3-5, c", NULL };
|
||||
|
||||
static void test_range_minimizer(void)
|
||||
|
||||
2
upstream
2
upstream
Submodule upstream updated: 5e597b599c...fe9d22374e
Reference in New Issue
Block a user