mirror of git://git.sysmocom.de/ofono
Create ofono_phone_number struct
Creates a new structure in driver.h called ofono_phone_number. This is meant to replace const char *number, int number_type arguments everywhere. Fix up all existing code to use this structure instead.
This commit is contained in:
parent
17fd4588fe
commit
ab68cd8e7e
|
@ -50,6 +50,7 @@ static void ccfc_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
int num = 0;
|
int num = 0;
|
||||||
struct ofono_cf_condition *list = NULL;
|
struct ofono_cf_condition *list = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
int maxlen;
|
||||||
|
|
||||||
dump_response("ccfc_query_cb", ok, result);
|
dump_response("ccfc_query_cb", ok, result);
|
||||||
decode_at_error(&error, g_at_result_final_response(result));
|
decode_at_error(&error, g_at_result_final_response(result));
|
||||||
|
@ -79,24 +80,26 @@ static void ccfc_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
|
|
||||||
g_at_result_iter_init(&iter, result);
|
g_at_result_iter_init(&iter, result);
|
||||||
|
|
||||||
|
maxlen = OFONO_MAX_PHONE_NUMBER_LENGTH;
|
||||||
|
|
||||||
for (num = 0; g_at_result_iter_next(&iter, "+CCFC:"); num++) {
|
for (num = 0; g_at_result_iter_next(&iter, "+CCFC:"); num++) {
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
g_at_result_iter_next_number(&iter, &(list[num].status));
|
g_at_result_iter_next_number(&iter, &(list[num].status));
|
||||||
g_at_result_iter_next_number(&iter, &(list[num].cls));
|
g_at_result_iter_next_number(&iter, &(list[num].cls));
|
||||||
|
|
||||||
list[num].phone_number[0] = '\0';
|
list[num].phone_number.number[0] = '\0';
|
||||||
list[num].number_type = 129;
|
list[num].phone_number.type = 129;
|
||||||
list[num].time = 20;
|
list[num].time = 20;
|
||||||
|
|
||||||
if (!g_at_result_iter_next_string(&iter, &str))
|
if (!g_at_result_iter_next_string(&iter, &str))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
strncpy(list[num].phone_number, str,
|
strncpy(list[num].phone_number.number, str, maxlen);
|
||||||
OFONO_MAX_PHONE_NUMBER_LENGTH);
|
list[num].phone_number.number[maxlen] = '\0';
|
||||||
list[num].phone_number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
|
|
||||||
|
|
||||||
g_at_result_iter_next_number(&iter, &(list[num].number_type));
|
g_at_result_iter_next_number(&iter,
|
||||||
|
&(list[num].phone_number.type));
|
||||||
|
|
||||||
if (!g_at_result_iter_skip_next(&iter))
|
if (!g_at_result_iter_skip_next(&iter))
|
||||||
continue;
|
continue;
|
||||||
|
@ -110,8 +113,8 @@ static void ccfc_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
ofono_debug("ccfc_cb: %d, %d, %s(%d) - %d sec",
|
ofono_debug("ccfc_cb: %d, %d, %s(%d) - %d sec",
|
||||||
list[i].status, list[i].cls,
|
list[i].status, list[i].cls,
|
||||||
list[i].phone_number, list[i].number_type,
|
list[i].phone_number.number,
|
||||||
list[i].time);
|
list[i].phone_number.type, list[i].time);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
cb(&error, num, list, cbd->data);
|
cb(&error, num, list, cbd->data);
|
||||||
|
@ -227,7 +230,7 @@ static void at_ccfc_activation(struct ofono_modem *modem, int type, int cls,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void at_ccfc_registration(struct ofono_modem *modem, int type, int cls,
|
static void at_ccfc_registration(struct ofono_modem *modem, int type, int cls,
|
||||||
const char *number, int number_type,
|
const struct ofono_phone_number *ph,
|
||||||
int time, ofono_generic_cb_t cb,
|
int time, ofono_generic_cb_t cb,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
@ -235,7 +238,7 @@ static void at_ccfc_registration(struct ofono_modem *modem, int type, int cls,
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
offset = sprintf(buf, "AT+CCFC=%d,3,\"%s\",%d,%d", type,
|
offset = sprintf(buf, "AT+CCFC=%d,3,\"%s\",%d,%d", type,
|
||||||
number, number_type, cls);
|
ph->number, ph->type, cls);
|
||||||
|
|
||||||
if (type == 2 || type == 4 || type == 5)
|
if (type == 2 || type == 4 || type == 5)
|
||||||
sprintf(buf+offset, ",,,%d", time);
|
sprintf(buf+offset, ",,,%d", time);
|
||||||
|
|
|
@ -236,8 +236,7 @@ static void at_cnum_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
GAtResultIter iter;
|
GAtResultIter iter;
|
||||||
ofono_numbers_cb_t cb = cbd->cb;
|
ofono_numbers_cb_t cb = cbd->cb;
|
||||||
struct ofono_error error;
|
struct ofono_error error;
|
||||||
struct ofono_own_number *numbers;
|
struct ofono_phone_number *numbers;
|
||||||
GSList *l = NULL;
|
|
||||||
int count;
|
int count;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
|
@ -245,7 +244,7 @@ static void at_cnum_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
decode_at_error(&error, g_at_result_final_response(result));
|
decode_at_error(&error, g_at_result_final_response(result));
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
cb(&error, NULL, cbd->data);
|
cb(&error, 0, NULL, cbd->data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,10 +253,10 @@ static void at_cnum_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
for (count = 0; g_at_result_iter_next(&iter, "+CNUM:"); count++);
|
for (count = 0; g_at_result_iter_next(&iter, "+CNUM:"); count++);
|
||||||
ofono_debug("Got %i elements", count);
|
ofono_debug("Got %i elements", count);
|
||||||
|
|
||||||
numbers = g_try_new0(struct ofono_own_number, count);
|
numbers = g_try_new0(struct ofono_phone_number, count);
|
||||||
if (!numbers) {
|
if (!numbers) {
|
||||||
DECLARE_FAILURE(e);
|
DECLARE_FAILURE(e);
|
||||||
cb(&e, NULL, cbd->data);
|
cb(&e, 0, NULL, cbd->data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,19 +268,15 @@ static void at_cnum_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
if (!g_at_result_iter_next_string(&iter, &str))
|
if (!g_at_result_iter_next_string(&iter, &str))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
g_strlcpy(numbers[count].phone_number, str,
|
g_strlcpy(numbers[count].number, str,
|
||||||
OFONO_MAX_PHONE_NUMBER_LENGTH);
|
OFONO_MAX_PHONE_NUMBER_LENGTH);
|
||||||
|
|
||||||
g_at_result_iter_next_number(&iter,
|
g_at_result_iter_next_number(&iter, &numbers[count].type);
|
||||||
&numbers[count].number_type);
|
|
||||||
|
|
||||||
l = g_slist_append(l, &numbers[count]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cb(&error, l, cbd->data);
|
cb(&error, count, numbers, cbd->data);
|
||||||
|
|
||||||
g_free(numbers);
|
g_free(numbers);
|
||||||
g_slist_free(l);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void at_read_msisdn(struct ofono_modem *modem, ofono_numbers_cb_t cb,
|
static void at_read_msisdn(struct ofono_modem *modem, ofono_numbers_cb_t cb,
|
||||||
|
@ -303,7 +298,7 @@ error:
|
||||||
|
|
||||||
{
|
{
|
||||||
DECLARE_FAILURE(error);
|
DECLARE_FAILURE(error);
|
||||||
cb(&error, NULL, data);
|
cb(&error, 0, NULL, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,8 +168,9 @@ static struct ofono_call *create_call(struct voicecall_data *d, int type,
|
||||||
call->status = status;
|
call->status = status;
|
||||||
|
|
||||||
if (clip != 2) {
|
if (clip != 2) {
|
||||||
strncpy(call->phone_number, num, OFONO_MAX_PHONE_NUMBER_LENGTH);
|
strncpy(call->phone_number.number, num,
|
||||||
call->number_type = num_type;
|
OFONO_MAX_PHONE_NUMBER_LENGTH);
|
||||||
|
call->phone_number.type = num_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
call->clip_validity = clip;
|
call->clip_validity = clip;
|
||||||
|
@ -229,10 +230,11 @@ static GSList *parse_clcc(GAtResult *result)
|
||||||
call->direction = dir;
|
call->direction = dir;
|
||||||
call->status = status;
|
call->status = status;
|
||||||
call->type = type;
|
call->type = type;
|
||||||
strncpy(call->phone_number, str, OFONO_MAX_PHONE_NUMBER_LENGTH);
|
strncpy(call->phone_number.number, str,
|
||||||
call->number_type = number_type;
|
OFONO_MAX_PHONE_NUMBER_LENGTH);
|
||||||
|
call->phone_number.type = number_type;
|
||||||
|
|
||||||
if (strlen(call->phone_number) > 0)
|
if (strlen(call->phone_number.number) > 0)
|
||||||
call->clip_validity = 0;
|
call->clip_validity = 0;
|
||||||
else
|
else
|
||||||
call->clip_validity = 2;
|
call->clip_validity = 2;
|
||||||
|
@ -440,7 +442,8 @@ out:
|
||||||
cb(&error, cbd->data);
|
cb(&error, cbd->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void at_dial(struct ofono_modem *modem, const char *number, int number_type,
|
static void at_dial(struct ofono_modem *modem,
|
||||||
|
const struct ofono_phone_number *ph,
|
||||||
enum ofono_clir_option clir, enum ofono_cug_option cug,
|
enum ofono_clir_option clir, enum ofono_cug_option cug,
|
||||||
ofono_generic_cb_t cb, void *data)
|
ofono_generic_cb_t cb, void *data)
|
||||||
{
|
{
|
||||||
|
@ -451,7 +454,7 @@ static void at_dial(struct ofono_modem *modem, const char *number, int number_ty
|
||||||
if (!cbd)
|
if (!cbd)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
sprintf(buf, "ATD%s", number);
|
sprintf(buf, "ATD%s", ph->number);
|
||||||
|
|
||||||
switch (clir) {
|
switch (clir) {
|
||||||
case OFONO_CLIR_OPTION_INVOCATION:
|
case OFONO_CLIR_OPTION_INVOCATION:
|
||||||
|
@ -678,13 +681,14 @@ static void at_transfer(struct ofono_modem *modem, ofono_generic_cb_t cb,
|
||||||
at_template("AT+CHLD=4", modem, generic_cb, transfer, cb, data);
|
at_template("AT+CHLD=4", modem, generic_cb, transfer, cb, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void at_deflect(struct ofono_modem *modem, const char *number,
|
static void at_deflect(struct ofono_modem *modem,
|
||||||
int number_type, ofono_generic_cb_t cb, void *data)
|
const struct ofono_phone_number *ph,
|
||||||
|
ofono_generic_cb_t cb, void *data)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
unsigned int incoming_or_waiting = (0x1 << 4) | (0x1 << 5);
|
unsigned int incoming_or_waiting = (0x1 << 4) | (0x1 << 5);
|
||||||
|
|
||||||
sprintf(buf, "AT+CTFR=%s,%d", number, number_type);
|
sprintf(buf, "AT+CTFR=%s,%d", ph->number, ph->type);
|
||||||
at_template(buf, modem, generic_cb, incoming_or_waiting, cb, data);
|
at_template(buf, modem, generic_cb, incoming_or_waiting, cb, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,9 +865,10 @@ static void clip_notify(GAtResult *result, gpointer user_data)
|
||||||
|
|
||||||
call = l->data;
|
call = l->data;
|
||||||
|
|
||||||
strncpy(call->phone_number, num, OFONO_MAX_PHONE_NUMBER_LENGTH);
|
strncpy(call->phone_number.number, num,
|
||||||
call->phone_number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
|
OFONO_MAX_PHONE_NUMBER_LENGTH);
|
||||||
call->number_type = type;
|
call->phone_number.number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
|
||||||
|
call->phone_number.type = type;
|
||||||
call->clip_validity = validity;
|
call->clip_validity = validity;
|
||||||
|
|
||||||
if (call->type == 0)
|
if (call->type == 0)
|
||||||
|
@ -993,9 +998,13 @@ static void cssu_notify(GAtResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_modem *modem = user_data;
|
struct ofono_modem *modem = user_data;
|
||||||
GAtResultIter iter;
|
GAtResultIter iter;
|
||||||
int code2, index, num_type, satype;
|
int code2;
|
||||||
const char *num, *subaddr;
|
int index = -1;
|
||||||
char num_buf[OFONO_MAX_PHONE_NUMBER_LENGTH];
|
const char *num;
|
||||||
|
struct ofono_phone_number ph;
|
||||||
|
|
||||||
|
ph.number[0] = '\0';
|
||||||
|
ph.type = 129;
|
||||||
|
|
||||||
dump_response("cssu_notify", TRUE, result);
|
dump_response("cssu_notify", TRUE, result);
|
||||||
|
|
||||||
|
@ -1007,32 +1016,21 @@ static void cssu_notify(GAtResult *result, gpointer user_data)
|
||||||
if (!g_at_result_iter_next_number(&iter, &code2))
|
if (!g_at_result_iter_next_number(&iter, &code2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!g_at_result_iter_next_number(&iter, &index)) {
|
/* This field is optional, if we can't read it, try to skip it */
|
||||||
index = 0;
|
if (!g_at_result_iter_next_number(&iter, &index) &&
|
||||||
num = NULL;
|
!g_at_result_iter_skip_next(&iter))
|
||||||
num_type = 0;
|
goto out;
|
||||||
subaddr = NULL;
|
|
||||||
satype = 0;
|
|
||||||
} else if (!g_at_result_iter_next_string(&iter, &num)) {
|
|
||||||
num = NULL;
|
|
||||||
num_type = 0;
|
|
||||||
subaddr = NULL;
|
|
||||||
satype = 0;
|
|
||||||
} else {
|
|
||||||
strncpy(num_buf, num, OFONO_MAX_PHONE_NUMBER_LENGTH);
|
|
||||||
num = num_buf;
|
|
||||||
|
|
||||||
if (!g_at_result_iter_next_number(&iter, &num_type))
|
if (!g_at_result_iter_next_string(&iter, &num))
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
if (!g_at_result_iter_next_string(&iter, &subaddr)) {
|
strncpy(ph.number, num, OFONO_MAX_PHONE_NUMBER_LENGTH);
|
||||||
subaddr = NULL;
|
|
||||||
satype = 0;
|
|
||||||
} else if (!g_at_result_iter_next_number(&iter, &satype))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ofono_cssu_notify(modem, code2, index, num, num_type);
|
if (!g_at_result_iter_next_number(&iter, &ph.type))
|
||||||
|
return;
|
||||||
|
|
||||||
|
out:
|
||||||
|
ofono_cssu_notify(modem, code2, index, &ph);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ofono_voicecall_ops ops = {
|
static struct ofono_voicecall_ops ops = {
|
||||||
|
|
|
@ -122,8 +122,8 @@ static void cf_cond_list_print(GSList *list)
|
||||||
|
|
||||||
ofono_debug("CF Condition status: %d, class: %d, number: %s,"
|
ofono_debug("CF Condition status: %d, class: %d, number: %s,"
|
||||||
" number_type: %d, time: %d",
|
" number_type: %d, time: %d",
|
||||||
cond->status, cond->cls, cond->phone_number,
|
cond->status, cond->cls, cond->phone_number.number,
|
||||||
cond->number_type, cond->time);
|
cond->phone_number.type, cond->time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,8 +241,7 @@ static void set_new_cond_list(struct ofono_modem *modem, int type, GSList *list)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
timeout = lc->time;
|
timeout = lc->time;
|
||||||
number = phone_number_to_string(lc->phone_number,
|
number = phone_number_to_string(&lc->phone_number);
|
||||||
lc->number_type);
|
|
||||||
|
|
||||||
sprintf(attr, "%s%s", bearer_class_to_string(lc->cls),
|
sprintf(attr, "%s%s", bearer_class_to_string(lc->cls),
|
||||||
cf_type_lut[type]);
|
cf_type_lut[type]);
|
||||||
|
@ -256,8 +255,9 @@ static void set_new_cond_list(struct ofono_modem *modem, int type, GSList *list)
|
||||||
if (o) { /* On the old list, must be active */
|
if (o) { /* On the old list, must be active */
|
||||||
oc = o->data;
|
oc = o->data;
|
||||||
|
|
||||||
if (oc->number_type != lc->number_type ||
|
if (oc->phone_number.type != lc->phone_number.type ||
|
||||||
strcmp(oc->phone_number, lc->phone_number))
|
strcmp(oc->phone_number.number,
|
||||||
|
lc->phone_number.number))
|
||||||
dbus_gsm_signal_property_changed(conn,
|
dbus_gsm_signal_property_changed(conn,
|
||||||
modem->path,
|
modem->path,
|
||||||
CALL_FORWARDING_INTERFACE,
|
CALL_FORWARDING_INTERFACE,
|
||||||
|
@ -276,8 +276,7 @@ static void set_new_cond_list(struct ofono_modem *modem, int type, GSList *list)
|
||||||
g_free(o->data);
|
g_free(o->data);
|
||||||
old = g_slist_remove(old, o->data);
|
old = g_slist_remove(old, o->data);
|
||||||
} else {
|
} else {
|
||||||
number = phone_number_to_string(lc->phone_number,
|
number = phone_number_to_string(&lc->phone_number);
|
||||||
lc->number_type);
|
|
||||||
|
|
||||||
dbus_gsm_signal_property_changed(conn, modem->path,
|
dbus_gsm_signal_property_changed(conn, modem->path,
|
||||||
CALL_FORWARDING_INTERFACE,
|
CALL_FORWARDING_INTERFACE,
|
||||||
|
@ -365,8 +364,7 @@ static void property_append_cf_conditions(DBusMessageIter *dict,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
number = phone_number_to_string(cf->phone_number,
|
number = phone_number_to_string(&cf->phone_number);
|
||||||
cf->number_type);
|
|
||||||
|
|
||||||
property_append_cf_condition(dict, i, postfix, number,
|
property_append_cf_condition(dict, i, postfix, number,
|
||||||
cf->time);
|
cf->time);
|
||||||
|
@ -581,26 +579,27 @@ static void set_property_callback(const struct ofono_error *error, void *data)
|
||||||
static DBusMessage *set_property_request(struct ofono_modem *modem,
|
static DBusMessage *set_property_request(struct ofono_modem *modem,
|
||||||
DBusMessage *msg,
|
DBusMessage *msg,
|
||||||
int type, int cls,
|
int type, int cls,
|
||||||
const char *number,
|
struct ofono_phone_number *ph,
|
||||||
int number_type, int timeout)
|
int timeout)
|
||||||
{
|
{
|
||||||
struct call_forwarding_data *cf = modem->call_forwarding;
|
struct call_forwarding_data *cf = modem->call_forwarding;
|
||||||
|
|
||||||
if (number[0] != '\0' && cf->ops->registration == NULL)
|
if (ph->number[0] != '\0' && cf->ops->registration == NULL)
|
||||||
return dbus_gsm_not_implemented(msg);
|
return dbus_gsm_not_implemented(msg);
|
||||||
|
|
||||||
if (number[0] == '\0' && cf->ops->erasure == NULL)
|
if (ph->number[0] == '\0' && cf->ops->erasure == NULL)
|
||||||
return dbus_gsm_not_implemented(msg);
|
return dbus_gsm_not_implemented(msg);
|
||||||
|
|
||||||
cf->pending = dbus_message_ref(msg);
|
cf->pending = dbus_message_ref(msg);
|
||||||
cf->query_next = type;
|
cf->query_next = type;
|
||||||
cf->query_end = type;
|
cf->query_end = type;
|
||||||
|
|
||||||
ofono_debug("Farming off request, will be erasure: %d", number[0] == 0);
|
ofono_debug("Farming off request, will be erasure: %d",
|
||||||
|
ph->number[0] == '\0');
|
||||||
|
|
||||||
if (number[0] != '\0')
|
if (ph->number[0] != '\0')
|
||||||
cf->ops->registration(modem, type, cls, number, number_type,
|
cf->ops->registration(modem, type, cls, ph, timeout,
|
||||||
timeout, set_property_callback, modem);
|
set_property_callback, modem);
|
||||||
else
|
else
|
||||||
cf->ops->erasure(modem, type, cls, set_property_callback, modem);
|
cf->ops->erasure(modem, type, cls, set_property_callback, modem);
|
||||||
|
|
||||||
|
@ -660,13 +659,15 @@ static DBusMessage *cf_set_property(DBusConnection *conn, DBusMessage *msg,
|
||||||
c = l->data;
|
c = l->data;
|
||||||
|
|
||||||
return set_property_request(modem, msg, type, cls,
|
return set_property_request(modem, msg, type, cls,
|
||||||
c->phone_number,
|
&c->phone_number, timeout);
|
||||||
c->number_type, timeout);
|
|
||||||
} else if (cf_condition_enabled_property(cf, property, &type, &cls)) {
|
} else if (cf_condition_enabled_property(cf, property, &type, &cls)) {
|
||||||
|
struct ofono_phone_number ph;
|
||||||
const char *number;
|
const char *number;
|
||||||
int number_type;
|
|
||||||
int timeout;
|
int timeout;
|
||||||
|
|
||||||
|
ph.number[0] = '\0';
|
||||||
|
ph.type = 129;
|
||||||
|
|
||||||
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
|
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
|
||||||
return dbus_gsm_invalid_args(msg);
|
return dbus_gsm_invalid_args(msg);
|
||||||
|
|
||||||
|
@ -676,14 +677,12 @@ static DBusMessage *cf_set_property(DBusConnection *conn, DBusMessage *msg,
|
||||||
return dbus_gsm_invalid_format(msg);
|
return dbus_gsm_invalid_format(msg);
|
||||||
|
|
||||||
if (number[0] != '\0')
|
if (number[0] != '\0')
|
||||||
string_to_phone_number(number, &number_type, &number);
|
string_to_phone_number(number, &ph);
|
||||||
else
|
|
||||||
number_type = 129;
|
|
||||||
|
|
||||||
timeout = cf_find_timeout(cf->cf_conditions[type], cls);
|
timeout = cf_find_timeout(cf->cf_conditions[type], cls);
|
||||||
|
|
||||||
return set_property_request(modem, msg, type, cls, number,
|
return set_property_request(modem, msg, type, cls, &ph,
|
||||||
number_type, timeout);
|
timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dbus_gsm_invalid_args(msg);
|
return dbus_gsm_invalid_args(msg);
|
||||||
|
@ -929,8 +928,7 @@ static gboolean cf_ss_control(struct ofono_modem *modem, int type, const char *s
|
||||||
int timeout = DEFAULT_NO_REPLY_TIMEOUT;
|
int timeout = DEFAULT_NO_REPLY_TIMEOUT;
|
||||||
int cf_type;
|
int cf_type;
|
||||||
DBusMessage *reply;
|
DBusMessage *reply;
|
||||||
const char *number;
|
struct ofono_phone_number ph;
|
||||||
int number_type;
|
|
||||||
void *operation;
|
void *operation;
|
||||||
|
|
||||||
/* Before we do anything, make sure we're actually initialized */
|
/* Before we do anything, make sure we're actually initialized */
|
||||||
|
@ -1083,10 +1081,9 @@ static gboolean cf_ss_control(struct ofono_modem *modem, int type, const char *s
|
||||||
|
|
||||||
switch (cf->ss_req->ss_type) {
|
switch (cf->ss_req->ss_type) {
|
||||||
case SS_CONTROL_TYPE_REGISTRATION:
|
case SS_CONTROL_TYPE_REGISTRATION:
|
||||||
string_to_phone_number(sia, &number_type, &number);
|
string_to_phone_number(sia, &ph);
|
||||||
cf->ops->registration(modem, cf_type, cls, number, number_type,
|
cf->ops->registration(modem, cf_type, cls, &ph, timeout,
|
||||||
timeout, cf_ss_control_callback,
|
cf_ss_control_callback, modem);
|
||||||
modem);
|
|
||||||
break;
|
break;
|
||||||
case SS_CONTROL_TYPE_ACTIVATION:
|
case SS_CONTROL_TYPE_ACTIVATION:
|
||||||
cf->ops->activation(modem, cf_type, cls, cf_ss_control_callback,
|
cf->ops->activation(modem, cf_type, cls, cf_ss_control_callback,
|
||||||
|
|
19
src/common.c
19
src/common.c
|
@ -362,30 +362,31 @@ int mmi_service_code_to_bearer_class(int code)
|
||||||
return cls;
|
return cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *phone_number_to_string(const char *number, int type)
|
const char *phone_number_to_string(const struct ofono_phone_number *ph)
|
||||||
{
|
{
|
||||||
static char buffer[64];
|
static char buffer[64];
|
||||||
|
|
||||||
if (type == 145 && (strlen(number) > 0) && number[0] != '+') {
|
if (ph->type == 145 && (strlen(ph->number) > 0) &&
|
||||||
|
ph->number[0] != '+') {
|
||||||
buffer[0] = '+';
|
buffer[0] = '+';
|
||||||
strncpy(buffer + 1, number, 62);
|
strncpy(buffer + 1, ph->number, 62);
|
||||||
buffer[63] = '\0';
|
buffer[63] = '\0';
|
||||||
} else {
|
} else {
|
||||||
strncpy(buffer, number, 63);
|
strncpy(buffer, ph->number, 63);
|
||||||
buffer[63] = '\0';
|
buffer[63] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void string_to_phone_number(const char *str, int *type, const char **number)
|
void string_to_phone_number(const char *str, struct ofono_phone_number *ph)
|
||||||
{
|
{
|
||||||
if (strlen(str) && str[0] == '+') {
|
if (strlen(str) && str[0] == '+') {
|
||||||
*number = &str[1];
|
strcpy(ph->number, str+1);
|
||||||
*type = 145; /* International */
|
ph->type = 145; /* International */
|
||||||
} else {
|
} else {
|
||||||
*number = &str[0];
|
strcpy(ph->number, str);
|
||||||
*type = 129; /* Local */
|
ph->type = 129; /* Local */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,8 +173,8 @@ enum ss_cssu {
|
||||||
const char *telephony_error_to_str(const struct ofono_error *error);
|
const char *telephony_error_to_str(const struct ofono_error *error);
|
||||||
|
|
||||||
gboolean valid_phone_number_format(const char *number);
|
gboolean valid_phone_number_format(const char *number);
|
||||||
const char *phone_number_to_string(const char *number, int type);
|
const char *phone_number_to_string(const struct ofono_phone_number *ph);
|
||||||
void string_to_phone_number(const char *str, int *type, const char **number);
|
void string_to_phone_number(const char *str, struct ofono_phone_number *ph);
|
||||||
|
|
||||||
int mmi_service_code_to_bearer_class(int code);
|
int mmi_service_code_to_bearer_class(int code);
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ void ofono_cssi_notify(struct ofono_modem *modem, int code1, int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ofono_cssu_notify(struct ofono_modem *modem, int code2, int index,
|
void ofono_cssu_notify(struct ofono_modem *modem, int code2, int index,
|
||||||
const char *number, int number_type)
|
const struct ofono_phone_number *ph)
|
||||||
{
|
{
|
||||||
struct cssn_data *ss = modem->cssn;
|
struct cssn_data *ss = modem->cssn;
|
||||||
struct mt_handler *h;
|
struct mt_handler *h;
|
||||||
|
@ -170,6 +170,6 @@ void ofono_cssu_notify(struct ofono_modem *modem, int code2, int index,
|
||||||
for (l = ss->mt_handler_list; l; l = l->next) {
|
for (l = ss->mt_handler_list; l; l = l->next) {
|
||||||
h = l->data;
|
h = l->data;
|
||||||
if (h->code2 == (enum ss_cssu) code2)
|
if (h->code2 == (enum ss_cssu) code2)
|
||||||
h->cb(index, number, number_type, h->cb_data);
|
h->cb(index, ph, h->cb_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#define __CSSN_H__
|
#define __CSSN_H__
|
||||||
|
|
||||||
typedef void (*mo_ss_notify_cb)(int index, void *userdata);
|
typedef void (*mo_ss_notify_cb)(int index, void *userdata);
|
||||||
typedef void (*mt_ss_notify_cb)(int index, const char *num, int num_type,
|
typedef void (*mt_ss_notify_cb)(int index, const struct ofono_phone_number *ph,
|
||||||
void *userdata);
|
void *userdata);
|
||||||
|
|
||||||
void ofono_cssn_init(struct ofono_modem *modem);
|
void ofono_cssn_init(struct ofono_modem *modem);
|
||||||
void ofono_cssn_exit(struct ofono_modem *modem);
|
void ofono_cssn_exit(struct ofono_modem *modem);
|
||||||
|
|
42
src/driver.h
42
src/driver.h
|
@ -21,6 +21,12 @@
|
||||||
|
|
||||||
struct ofono_modem;
|
struct ofono_modem;
|
||||||
|
|
||||||
|
#define OFONO_MAX_PHONE_NUMBER_LENGTH 20
|
||||||
|
struct ofono_phone_number {
|
||||||
|
char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1];
|
||||||
|
int type;
|
||||||
|
};
|
||||||
|
|
||||||
/* 27.007 Section 6.2 */
|
/* 27.007 Section 6.2 */
|
||||||
enum ofono_clir_option {
|
enum ofono_clir_option {
|
||||||
OFONO_CLIR_OPTION_DEFAULT = 0,
|
OFONO_CLIR_OPTION_DEFAULT = 0,
|
||||||
|
@ -54,15 +60,12 @@ enum ofono_disconnect_reason {
|
||||||
OFONO_DISCONNECT_REASON_ERROR,
|
OFONO_DISCONNECT_REASON_ERROR,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define OFONO_MAX_PHONE_NUMBER_LENGTH 20
|
|
||||||
|
|
||||||
struct ofono_call {
|
struct ofono_call {
|
||||||
unsigned id;
|
unsigned id;
|
||||||
int type;
|
int type;
|
||||||
int direction;
|
int direction;
|
||||||
int status;
|
int status;
|
||||||
char phone_number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1];
|
struct ofono_phone_number phone_number;
|
||||||
int number_type;
|
|
||||||
int clip_validity;
|
int clip_validity;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,8 +86,7 @@ struct ofono_network_operator {
|
||||||
struct ofono_cf_condition {
|
struct ofono_cf_condition {
|
||||||
int status;
|
int status;
|
||||||
int cls;
|
int cls;
|
||||||
char phone_number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1];
|
struct ofono_phone_number phone_number;
|
||||||
int number_type;
|
|
||||||
int time;
|
int time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -94,11 +96,6 @@ struct ofono_cw_condition {
|
||||||
int cls;
|
int cls;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ofono_own_number {
|
|
||||||
char phone_number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1];
|
|
||||||
int number_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Notification functions, the integer values here should map to
|
/* Notification functions, the integer values here should map to
|
||||||
* values obtained from the modem. The enumerations are the same
|
* values obtained from the modem. The enumerations are the same
|
||||||
* as the values for the fields found in 3GPP TS 27.007
|
* as the values for the fields found in 3GPP TS 27.007
|
||||||
|
@ -168,8 +165,8 @@ typedef void (*ofono_sim_read_cb_t)(const struct ofono_error *error,
|
||||||
typedef void (*ofono_imsi_cb_t)(const struct ofono_error *error,
|
typedef void (*ofono_imsi_cb_t)(const struct ofono_error *error,
|
||||||
const char *imsi, void *data);
|
const char *imsi, void *data);
|
||||||
|
|
||||||
typedef void (*ofono_numbers_cb_t)(const struct ofono_error *error,
|
typedef void (*ofono_numbers_cb_t)(const struct ofono_error *error, int num,
|
||||||
GSList *numbers, void *data);
|
const struct ofono_phone_number *numbers, void *data);
|
||||||
|
|
||||||
struct ofono_modem_attribute_ops {
|
struct ofono_modem_attribute_ops {
|
||||||
void (*query_manufacturer)(struct ofono_modem *modem,
|
void (*query_manufacturer)(struct ofono_modem *modem,
|
||||||
|
@ -226,10 +223,10 @@ void ofono_network_registration_unregister(struct ofono_modem *modem);
|
||||||
* not support vendor extensions for call progress indication.
|
* not support vendor extensions for call progress indication.
|
||||||
*/
|
*/
|
||||||
struct ofono_voicecall_ops {
|
struct ofono_voicecall_ops {
|
||||||
void (*dial)(struct ofono_modem *modem, const char *number,
|
void (*dial)(struct ofono_modem *modem,
|
||||||
int number_type, enum ofono_clir_option clir,
|
const struct ofono_phone_number *number,
|
||||||
enum ofono_cug_option cug, ofono_generic_cb_t cb,
|
enum ofono_clir_option clir, enum ofono_cug_option cug,
|
||||||
void *data);
|
ofono_generic_cb_t cb, void *data);
|
||||||
void (*answer)(struct ofono_modem *modem,
|
void (*answer)(struct ofono_modem *modem,
|
||||||
ofono_generic_cb_t cb, void *data);
|
ofono_generic_cb_t cb, void *data);
|
||||||
void (*hangup)(struct ofono_modem *modem,
|
void (*hangup)(struct ofono_modem *modem,
|
||||||
|
@ -252,8 +249,9 @@ struct ofono_voicecall_ops {
|
||||||
ofono_generic_cb_t cb, void *data);
|
ofono_generic_cb_t cb, void *data);
|
||||||
void (*transfer)(struct ofono_modem *modem,
|
void (*transfer)(struct ofono_modem *modem,
|
||||||
ofono_generic_cb_t cb, void *data);
|
ofono_generic_cb_t cb, void *data);
|
||||||
void (*deflect)(struct ofono_modem *modem, const char *number,
|
void (*deflect)(struct ofono_modem *modem,
|
||||||
int number_type, ofono_generic_cb_t cb, void *data);
|
const struct ofono_phone_number *ph,
|
||||||
|
ofono_generic_cb_t cb, void *data);
|
||||||
void (*swap_without_accept)(struct ofono_modem *modem,
|
void (*swap_without_accept)(struct ofono_modem *modem,
|
||||||
ofono_generic_cb_t cb, void *data);
|
ofono_generic_cb_t cb, void *data);
|
||||||
void (*send_tones)(struct ofono_modem *modem, const char *tones,
|
void (*send_tones)(struct ofono_modem *modem, const char *tones,
|
||||||
|
@ -271,14 +269,14 @@ void ofono_voicecall_unregister(struct ofono_modem *modem);
|
||||||
/* SSN notifications (CSSI and CSSU). */
|
/* SSN notifications (CSSI and CSSU). */
|
||||||
void ofono_cssi_notify(struct ofono_modem *modem, int code, int index);
|
void ofono_cssi_notify(struct ofono_modem *modem, int code, int index);
|
||||||
void ofono_cssu_notify(struct ofono_modem *modem, int code, int index,
|
void ofono_cssu_notify(struct ofono_modem *modem, int code, int index,
|
||||||
const char *number, int number_type);
|
const struct ofono_phone_number *number);
|
||||||
|
|
||||||
struct ofono_call_forwarding_ops {
|
struct ofono_call_forwarding_ops {
|
||||||
void (*activation)(struct ofono_modem *modem, int type, int cls,
|
void (*activation)(struct ofono_modem *modem, int type, int cls,
|
||||||
ofono_generic_cb_t cb, void *data);
|
ofono_generic_cb_t cb, void *data);
|
||||||
void (*registration)(struct ofono_modem *modem, int type, int cls,
|
void (*registration)(struct ofono_modem *modem, int type, int cls,
|
||||||
const char *number, int number_type, int time,
|
const struct ofono_phone_number *number,
|
||||||
ofono_generic_cb_t cb, void *data);
|
int time, ofono_generic_cb_t cb, void *data);
|
||||||
void (*deactivation)(struct ofono_modem *modem, int type, int cls,
|
void (*deactivation)(struct ofono_modem *modem, int type, int cls,
|
||||||
ofono_generic_cb_t cb, void *data);
|
ofono_generic_cb_t cb, void *data);
|
||||||
void (*erasure)(struct ofono_modem *modem, int type, int cls,
|
void (*erasure)(struct ofono_modem *modem, int type, int cls,
|
||||||
|
|
22
src/sim.c
22
src/sim.c
|
@ -69,10 +69,12 @@ static void sim_manager_destroy(gpointer userdata)
|
||||||
g_free(data->imsi);
|
g_free(data->imsi);
|
||||||
data->imsi = NULL;
|
data->imsi = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->numbers) {
|
if (data->numbers) {
|
||||||
dbus_gsm_free_string_array(data->numbers);
|
dbus_gsm_free_string_array(data->numbers);
|
||||||
data->numbers = NULL;
|
data->numbers = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->spn) {
|
if (data->spn) {
|
||||||
g_free(data->spn);
|
g_free(data->spn);
|
||||||
data->spn = NULL;
|
data->spn = NULL;
|
||||||
|
@ -220,26 +222,26 @@ static gboolean sim_retrieve_imsi(void *user_data)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sim_own_number_cb(const struct ofono_error *error, GSList *numbers,
|
static void sim_own_number_cb(const struct ofono_error *error, int num,
|
||||||
void *data)
|
const struct ofono_phone_number *phs, void *data)
|
||||||
{
|
{
|
||||||
struct ofono_modem *modem = data;
|
struct ofono_modem *modem = data;
|
||||||
struct sim_manager_data *sim = modem->sim_manager;
|
struct sim_manager_data *sim = modem->sim_manager;
|
||||||
GSList *l;
|
|
||||||
struct ofono_own_number *msisdn;
|
|
||||||
char **number_str;
|
char **number_str;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
|
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sim->numbers = g_try_new0(char *, g_slist_length(numbers) + 1);
|
sim->numbers = g_try_new0(char *, num + 1);
|
||||||
number_str = sim->numbers;
|
number_str = sim->numbers;
|
||||||
|
|
||||||
for (l = numbers; l; l = l->next) {
|
for (i = 0; i < num; i++) {
|
||||||
msisdn = l->data;
|
if (phs[i].number[0] == '\0')
|
||||||
*number_str++ = g_strdup(phone_number_to_string(
|
continue;
|
||||||
msisdn->phone_number,
|
|
||||||
msisdn->number_type));
|
*number_str = g_strdup(phone_number_to_string(&phs[i]));
|
||||||
|
number_str++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,16 +119,16 @@ static const char *call_status_to_string(int status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *phone_and_clip_to_string(const char *number, int type,
|
static const char *phone_and_clip_to_string(const struct ofono_phone_number *n,
|
||||||
int clip_validity)
|
int clip_validity)
|
||||||
{
|
{
|
||||||
if (clip_validity == CLIP_VALIDITY_WITHHELD && !strlen(number))
|
if (clip_validity == CLIP_VALIDITY_WITHHELD && !strlen(n->number))
|
||||||
return "withheld";
|
return "withheld";
|
||||||
|
|
||||||
if (clip_validity == CLIP_VALIDITY_NOT_AVAILABLE)
|
if (clip_validity == CLIP_VALIDITY_NOT_AVAILABLE)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return phone_number_to_string(number, type);
|
return phone_number_to_string(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *time_to_str(const time_t *t)
|
static const char *time_to_str(const time_t *t)
|
||||||
|
@ -159,8 +159,7 @@ static DBusMessage *voicecall_get_properties(DBusConnection *conn,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
status = call_status_to_string(call->status);
|
status = call_status_to_string(call->status);
|
||||||
callerid = phone_number_to_string(call->phone_number,
|
callerid = phone_number_to_string(&call->phone_number);
|
||||||
call->number_type);
|
|
||||||
|
|
||||||
dbus_message_iter_init_append(reply, &iter);
|
dbus_message_iter_init_append(reply, &iter);
|
||||||
|
|
||||||
|
@ -221,8 +220,8 @@ static DBusMessage *voicecall_deflect(DBusConnection *conn,
|
||||||
struct voicecalls_data *voicecalls = modem->voicecalls;
|
struct voicecalls_data *voicecalls = modem->voicecalls;
|
||||||
struct ofono_call *call = v->call;
|
struct ofono_call *call = v->call;
|
||||||
|
|
||||||
|
struct ofono_phone_number ph;
|
||||||
const char *number;
|
const char *number;
|
||||||
int number_type;
|
|
||||||
|
|
||||||
if (call->status != CALL_STATUS_INCOMING &&
|
if (call->status != CALL_STATUS_INCOMING &&
|
||||||
call->status != CALL_STATUS_WAITING)
|
call->status != CALL_STATUS_WAITING)
|
||||||
|
@ -244,10 +243,9 @@ static DBusMessage *voicecall_deflect(DBusConnection *conn,
|
||||||
voicecalls->flags |= VOICECALLS_FLAG_PENDING;
|
voicecalls->flags |= VOICECALLS_FLAG_PENDING;
|
||||||
voicecalls->pending = dbus_message_ref(msg);
|
voicecalls->pending = dbus_message_ref(msg);
|
||||||
|
|
||||||
string_to_phone_number(number, &number_type, &number);
|
string_to_phone_number(number, &ph);
|
||||||
|
|
||||||
voicecalls->ops->deflect(modem, number, number_type,
|
voicecalls->ops->deflect(modem, &ph, generic_callback, voicecalls);
|
||||||
generic_callback, voicecalls);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -401,7 +399,7 @@ static void voicecall_set_call_status(struct ofono_modem *modem,
|
||||||
|
|
||||||
static void voicecall_set_call_lineid(struct ofono_modem *modem,
|
static void voicecall_set_call_lineid(struct ofono_modem *modem,
|
||||||
struct voicecall *v,
|
struct voicecall *v,
|
||||||
const char *number, int number_type,
|
const struct ofono_phone_number *ph,
|
||||||
int clip_validity)
|
int clip_validity)
|
||||||
{
|
{
|
||||||
struct ofono_call *call = v->call;
|
struct ofono_call *call = v->call;
|
||||||
|
@ -409,8 +407,8 @@ static void voicecall_set_call_lineid(struct ofono_modem *modem,
|
||||||
const char *path;
|
const char *path;
|
||||||
const char *lineid_str;
|
const char *lineid_str;
|
||||||
|
|
||||||
if (!strcmp(call->phone_number, number) &&
|
if (!strcmp(call->phone_number.number, ph->number) &&
|
||||||
call->number_type == number_type &&
|
call->phone_number.type == ph->type &&
|
||||||
call->clip_validity == clip_validity)
|
call->clip_validity == clip_validity)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -424,17 +422,16 @@ static void voicecall_set_call_lineid(struct ofono_modem *modem,
|
||||||
clip_validity == CLIP_VALIDITY_NOT_AVAILABLE)
|
clip_validity == CLIP_VALIDITY_NOT_AVAILABLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
strcpy(call->phone_number, number);
|
strcpy(call->phone_number.number, ph->number);
|
||||||
call->clip_validity = clip_validity;
|
call->clip_validity = clip_validity;
|
||||||
call->number_type = number_type;
|
call->phone_number.type = ph->type;
|
||||||
|
|
||||||
path = voicecall_build_path(modem, call);
|
path = voicecall_build_path(modem, call);
|
||||||
|
|
||||||
if (call->direction == CALL_DIRECTION_MOBILE_TERMINATED)
|
if (call->direction == CALL_DIRECTION_MOBILE_TERMINATED)
|
||||||
lineid_str = phone_and_clip_to_string(number, number_type,
|
lineid_str = phone_and_clip_to_string(ph, clip_validity);
|
||||||
clip_validity);
|
|
||||||
else
|
else
|
||||||
lineid_str = phone_number_to_string(number, number_type);
|
lineid_str = phone_number_to_string(ph);
|
||||||
|
|
||||||
dbus_gsm_signal_property_changed(conn, path, VOICECALL_INTERFACE,
|
dbus_gsm_signal_property_changed(conn, path, VOICECALL_INTERFACE,
|
||||||
"LineIdentification",
|
"LineIdentification",
|
||||||
|
@ -737,7 +734,7 @@ static DBusMessage *manager_dial(DBusConnection *conn,
|
||||||
struct ofono_modem *modem = data;
|
struct ofono_modem *modem = data;
|
||||||
struct voicecalls_data *calls = modem->voicecalls;
|
struct voicecalls_data *calls = modem->voicecalls;
|
||||||
const char *number;
|
const char *number;
|
||||||
int number_type;
|
struct ofono_phone_number ph;
|
||||||
const char *clirstr;
|
const char *clirstr;
|
||||||
enum ofono_clir_option clir;
|
enum ofono_clir_option clir;
|
||||||
|
|
||||||
|
@ -774,10 +771,9 @@ static DBusMessage *manager_dial(DBusConnection *conn,
|
||||||
calls->flags |= VOICECALLS_FLAG_PENDING;
|
calls->flags |= VOICECALLS_FLAG_PENDING;
|
||||||
calls->pending = dbus_message_ref(msg);
|
calls->pending = dbus_message_ref(msg);
|
||||||
|
|
||||||
string_to_phone_number(number, &number_type, &number);
|
string_to_phone_number(number, &ph);
|
||||||
|
|
||||||
calls->ops->dial(modem, number, number_type, clir,
|
calls->ops->dial(modem, &ph, clir, OFONO_CUG_OPTION_DEFAULT,
|
||||||
OFONO_CUG_OPTION_DEFAULT,
|
|
||||||
dial_callback, modem);
|
dial_callback, modem);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1244,7 +1240,7 @@ void ofono_voicecall_notify(struct ofono_modem *modem, const struct ofono_call *
|
||||||
struct ofono_call *newcall = NULL;
|
struct ofono_call *newcall = NULL;
|
||||||
|
|
||||||
ofono_debug("Got a voicecall event, status: %d, id: %u, number: %s",
|
ofono_debug("Got a voicecall event, status: %d, id: %u, number: %s",
|
||||||
call->status, call->id, call->phone_number);
|
call->status, call->id, call->phone_number.number);
|
||||||
|
|
||||||
l = g_slist_find_custom(calls->call_list, GINT_TO_POINTER(call->id),
|
l = g_slist_find_custom(calls->call_list, GINT_TO_POINTER(call->id),
|
||||||
call_compare_by_id);
|
call_compare_by_id);
|
||||||
|
@ -1252,8 +1248,8 @@ void ofono_voicecall_notify(struct ofono_modem *modem, const struct ofono_call *
|
||||||
if (l) {
|
if (l) {
|
||||||
ofono_debug("Found call with id: %d\n", call->id);
|
ofono_debug("Found call with id: %d\n", call->id);
|
||||||
voicecall_set_call_status(modem, l->data, call->status);
|
voicecall_set_call_status(modem, l->data, call->status);
|
||||||
voicecall_set_call_lineid(modem, l->data, call->phone_number,
|
voicecall_set_call_lineid(modem, l->data, &call->phone_number,
|
||||||
call->number_type, call->clip_validity);
|
call->clip_validity);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1358,7 +1354,6 @@ static struct ofono_call *synthesize_outgoing_call(struct ofono_modem *modem,
|
||||||
DBusMessage *msg)
|
DBusMessage *msg)
|
||||||
{
|
{
|
||||||
const char *number;
|
const char *number;
|
||||||
int number_type;
|
|
||||||
struct ofono_call *call;
|
struct ofono_call *call;
|
||||||
|
|
||||||
call = g_try_new0(struct ofono_call, 1);
|
call = g_try_new0(struct ofono_call, 1);
|
||||||
|
@ -1366,12 +1361,6 @@ static struct ofono_call *synthesize_outgoing_call(struct ofono_modem *modem,
|
||||||
if (!call)
|
if (!call)
|
||||||
return call;
|
return call;
|
||||||
|
|
||||||
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &number,
|
|
||||||
DBUS_TYPE_INVALID) == FALSE)
|
|
||||||
number = "";
|
|
||||||
else
|
|
||||||
string_to_phone_number(number, &number_type, &number);
|
|
||||||
|
|
||||||
call->id = modem_alloc_callid(modem);
|
call->id = modem_alloc_callid(modem);
|
||||||
|
|
||||||
if (call->id == 0) {
|
if (call->id == 0) {
|
||||||
|
@ -1380,10 +1369,14 @@ static struct ofono_call *synthesize_outgoing_call(struct ofono_modem *modem,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &number,
|
||||||
|
DBUS_TYPE_INVALID) == FALSE)
|
||||||
|
number = "";
|
||||||
|
else
|
||||||
|
string_to_phone_number(number, &call->phone_number);
|
||||||
|
|
||||||
call->direction = CALL_DIRECTION_MOBILE_ORIGINATED;
|
call->direction = CALL_DIRECTION_MOBILE_ORIGINATED;
|
||||||
call->status = CALL_STATUS_DIALING;
|
call->status = CALL_STATUS_DIALING;
|
||||||
strcpy(call->phone_number, number);
|
|
||||||
call->number_type = number_type;
|
|
||||||
call->clip_validity = CLIP_VALIDITY_VALID;
|
call->clip_validity = CLIP_VALIDITY_VALID;
|
||||||
|
|
||||||
return call;
|
return call;
|
||||||
|
|
Loading…
Reference in New Issue