mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
bluez5: backend-native: Add AT+CNUM support
This only support the first subscriber number.
This commit is contained in:
parent
3566b0739b
commit
7c05574072
3 changed files with 28 additions and 0 deletions
|
|
@ -87,6 +87,7 @@ struct modem {
|
||||||
unsigned int signal_strength;
|
unsigned int signal_strength;
|
||||||
bool network_is_roaming;
|
bool network_is_roaming;
|
||||||
char *operator_name;
|
char *operator_name;
|
||||||
|
char *own_number;
|
||||||
bool active_call;
|
bool active_call;
|
||||||
unsigned int call_setup;
|
unsigned int call_setup;
|
||||||
};
|
};
|
||||||
|
|
@ -987,6 +988,16 @@ next_indicator:
|
||||||
|
|
||||||
rfcomm->extended_error_reporting = value;
|
rfcomm->extended_error_reporting = value;
|
||||||
rfcomm_send_reply(rfcomm, "OK");
|
rfcomm_send_reply(rfcomm, "OK");
|
||||||
|
} else if (spa_strstartswith(buf, "AT+CNUM")) {
|
||||||
|
if (backend->modem.own_number) {
|
||||||
|
unsigned int type;
|
||||||
|
if (spa_strstartswith(backend->modem.own_number, "+"))
|
||||||
|
type = INTERNATIONAL_NUMBER;
|
||||||
|
else
|
||||||
|
type = NATIONAL_NUMBER;
|
||||||
|
rfcomm_send_reply(rfcomm, "+CNUM: ,\"%s\",%u", backend->modem.own_number, type);
|
||||||
|
}
|
||||||
|
rfcomm_send_reply(rfcomm, "OK");
|
||||||
} else if (spa_strstartswith(buf, "AT+COPS=")) {
|
} else if (spa_strstartswith(buf, "AT+COPS=")) {
|
||||||
unsigned int mode, val;
|
unsigned int mode, val;
|
||||||
|
|
||||||
|
|
@ -2527,6 +2538,19 @@ static void set_modem_roaming(bool is_roaming, void *user_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_modem_own_number(const char *number, void *user_data)
|
||||||
|
{
|
||||||
|
struct impl *backend = user_data;
|
||||||
|
|
||||||
|
if (backend->modem.own_number) {
|
||||||
|
free(backend->modem.own_number);
|
||||||
|
backend->modem.own_number = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (number)
|
||||||
|
backend->modem.own_number = strdup(number);
|
||||||
|
}
|
||||||
|
|
||||||
static void set_modem_service(bool available, void *user_data)
|
static void set_modem_service(bool available, void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *backend = user_data;
|
struct impl *backend = user_data;
|
||||||
|
|
@ -2629,6 +2653,7 @@ static const struct mm_ops mm_ops = {
|
||||||
.set_modem_service = set_modem_service,
|
.set_modem_service = set_modem_service,
|
||||||
.set_modem_signal_strength = set_modem_signal_strength,
|
.set_modem_signal_strength = set_modem_signal_strength,
|
||||||
.set_modem_operator_name = set_modem_operator_name,
|
.set_modem_operator_name = set_modem_operator_name,
|
||||||
|
.set_modem_own_number = set_modem_own_number,
|
||||||
.set_modem_roaming = set_modem_roaming,
|
.set_modem_roaming = set_modem_roaming,
|
||||||
.set_call_active = set_call_active,
|
.set_call_active = set_call_active,
|
||||||
.set_call_setup = set_call_setup,
|
.set_call_setup = set_call_setup,
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,8 @@ static DBusHandlerResult mm_parse_modem_properties(struct impl *this, DBusMessag
|
||||||
if (dbus_message_iter_get_arg_type(&array_i) == DBUS_TYPE_STRING) {
|
if (dbus_message_iter_get_arg_type(&array_i) == DBUS_TYPE_STRING) {
|
||||||
dbus_message_iter_get_basic(&array_i, &number);
|
dbus_message_iter_get_basic(&array_i, &number);
|
||||||
spa_log_debug(this->log, "Modem own number: %s", number);
|
spa_log_debug(this->log, "Modem own number: %s", number);
|
||||||
|
if (this->ops->set_modem_own_number)
|
||||||
|
this->ops->set_modem_own_number(number, this->user_data);
|
||||||
}
|
}
|
||||||
} else if(spa_streq(key, MM_MODEM_PROPERTY_REVISION)) {
|
} else if(spa_streq(key, MM_MODEM_PROPERTY_REVISION)) {
|
||||||
char *revision;
|
char *revision;
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ struct mm_ops {
|
||||||
void (*set_modem_service)(bool available, void *user_data);
|
void (*set_modem_service)(bool available, void *user_data);
|
||||||
void (*set_modem_signal_strength)(unsigned int strength, void *user_data);
|
void (*set_modem_signal_strength)(unsigned int strength, void *user_data);
|
||||||
void (*set_modem_operator_name)(const char *name, void *user_data);
|
void (*set_modem_operator_name)(const char *name, void *user_data);
|
||||||
|
void (*set_modem_own_number)(const char *number, void *user_data);
|
||||||
void (*set_modem_roaming)(bool is_roaming, void *user_data);
|
void (*set_modem_roaming)(bool is_roaming, void *user_data);
|
||||||
void (*set_call_active)(bool active, void *user_data);
|
void (*set_call_active)(bool active, void *user_data);
|
||||||
void (*set_call_setup)(enum call_setup value, void *user_data);
|
void (*set_call_setup)(enum call_setup value, void *user_data);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue