mirror of git://git.sysmocom.de/ofono
voicecall: Make is_emergency_number API available to drivers
It will be needed by the qmimodem driver to decide which type of call to request to the modem.
This commit is contained in:
parent
d64755bd93
commit
7ecd8955e8
|
@ -182,6 +182,9 @@ void ofono_voicecall_ssn_mt_notify(struct ofono_voicecall *vc, unsigned int id,
|
|||
int code, int index,
|
||||
const struct ofono_phone_number *ph);
|
||||
|
||||
ofono_bool_t ofono_voicecall_is_emergency_number(struct ofono_voicecall *vc,
|
||||
const char *number);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -384,12 +384,6 @@ static void tone_request_finish(struct ofono_voicecall *vc,
|
|||
g_free(entry);
|
||||
}
|
||||
|
||||
static gboolean is_emergency_number(struct ofono_voicecall *vc,
|
||||
const char *number)
|
||||
{
|
||||
return g_hash_table_lookup_extended(vc->en_list, number, NULL, NULL);
|
||||
}
|
||||
|
||||
static void append_voicecall_properties(struct voicecall *v,
|
||||
DBusMessageIter *dict)
|
||||
{
|
||||
|
@ -459,7 +453,7 @@ static void append_voicecall_properties(struct voicecall *v,
|
|||
ofono_dbus_dict_append(dict, "Icon",
|
||||
DBUS_TYPE_BYTE, &v->icon_id);
|
||||
|
||||
if (is_emergency_number(v->vc, callerid) == TRUE)
|
||||
if (ofono_voicecall_is_emergency_number(v->vc, callerid) == TRUE)
|
||||
emergency_call = TRUE;
|
||||
else
|
||||
emergency_call = FALSE;
|
||||
|
@ -983,7 +977,7 @@ static void voicecall_set_call_lineid(struct voicecall *v,
|
|||
"LineIdentification",
|
||||
DBUS_TYPE_STRING, &lineid_str);
|
||||
|
||||
if (is_emergency_number(v->vc, lineid_str)) {
|
||||
if (ofono_voicecall_is_emergency_number(v->vc, lineid_str)) {
|
||||
dbus_bool_t emergency_call = TRUE;
|
||||
|
||||
ofono_dbus_signal_property_changed(conn, path,
|
||||
|
@ -1473,7 +1467,7 @@ static void manager_dial_callback(const struct ofono_error *error, void *data)
|
|||
} else {
|
||||
struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
|
||||
|
||||
if (is_emergency_number(vc, number) == TRUE)
|
||||
if (ofono_voicecall_is_emergency_number(vc, number) == TRUE)
|
||||
__ofono_modem_dec_emergency_mode(modem);
|
||||
|
||||
reply = __ofono_error_failed(vc->pending);
|
||||
|
@ -1517,7 +1511,7 @@ static int voicecall_dial(struct ofono_voicecall *vc, const char *number,
|
|||
if (voicecalls_have_active(vc) && voicecalls_have_held(vc))
|
||||
return -EBUSY;
|
||||
|
||||
if (is_emergency_number(vc, number) == TRUE)
|
||||
if (ofono_voicecall_is_emergency_number(vc, number) == TRUE)
|
||||
__ofono_modem_inc_emergency_mode(modem);
|
||||
|
||||
string_to_phone_number(number, &ph);
|
||||
|
@ -2363,7 +2357,7 @@ void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
|
|||
voicecall_emit_disconnect_reason(call, reason);
|
||||
|
||||
number = phone_number_to_string(&call->call->phone_number);
|
||||
if (is_emergency_number(vc, number) == TRUE)
|
||||
if (ofono_voicecall_is_emergency_number(vc, number) == TRUE)
|
||||
__ofono_modem_dec_emergency_mode(modem);
|
||||
|
||||
voicecall_set_call_status(call, CALL_STATUS_DISCONNECTED);
|
||||
|
@ -3515,7 +3509,7 @@ static void emulator_dial_callback(const struct ofono_error *error, void *data)
|
|||
if (v == NULL) {
|
||||
struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
|
||||
|
||||
if (is_emergency_number(vc, number) == TRUE)
|
||||
if (ofono_voicecall_is_emergency_number(vc, number) == TRUE)
|
||||
__ofono_modem_dec_emergency_mode(modem);
|
||||
}
|
||||
|
||||
|
@ -3788,7 +3782,7 @@ static void dial_request_cb(const struct ofono_error *error, void *data)
|
|||
v = dial_handle_result(vc, error, number, &need_to_emit);
|
||||
|
||||
if (v == NULL) {
|
||||
if (is_emergency_number(vc, number) == TRUE) {
|
||||
if (ofono_voicecall_is_emergency_number(vc, number) == TRUE) {
|
||||
struct ofono_modem *modem =
|
||||
__ofono_atom_get_modem(vc->atom);
|
||||
|
||||
|
@ -3823,7 +3817,7 @@ static void dial_request(struct ofono_voicecall *vc)
|
|||
{
|
||||
const char *number = phone_number_to_string(&vc->dial_req->ph);
|
||||
|
||||
if (is_emergency_number(vc, number) == TRUE) {
|
||||
if (ofono_voicecall_is_emergency_number(vc, number) == TRUE) {
|
||||
struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
|
||||
|
||||
__ofono_modem_inc_emergency_mode(modem);
|
||||
|
@ -4218,3 +4212,9 @@ void ofono_voicecall_ssn_mo_notify(struct ofono_voicecall *vc,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ofono_bool_t ofono_voicecall_is_emergency_number(struct ofono_voicecall *vc,
|
||||
const char *number)
|
||||
{
|
||||
return g_hash_table_lookup_extended(vc->en_list, number, NULL, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue