mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2025-01-27 14:54:10 +08:00
Clean up AT+NREC behavior and API
In HFP 1.5 only AT+NREC=0 should be possible, but to accomodate for future profile changes make the telephony.h API such that AT+NREC=1 is possible without breaking the API.
This commit is contained in:
parent
2cfe2bae7b
commit
559e6476a1
@ -145,6 +145,8 @@ struct headset {
|
||||
gboolean cme_enabled;
|
||||
gboolean cwa_enabled;
|
||||
gboolean pending_ring;
|
||||
gboolean nrec;
|
||||
gboolean nrec_req;
|
||||
|
||||
headset_state_t state;
|
||||
struct pending_connect *pending;
|
||||
@ -1009,6 +1011,12 @@ int telephony_call_hold_rsp(void *telephony_device, cme_error_t err)
|
||||
|
||||
int telephony_disable_nr_and_ec_rsp(void *telephony_device, cme_error_t err)
|
||||
{
|
||||
struct audio_device *device = telephony_device;
|
||||
struct headset *hs = device->headset;
|
||||
|
||||
if (err == CME_ERROR_NONE)
|
||||
hs->nrec = hs->nrec_req;
|
||||
|
||||
return telephony_generic_rsp(telephony_device, err);
|
||||
}
|
||||
|
||||
@ -1044,10 +1052,17 @@ static int operator_selection(struct audio_device *device, const char *buf)
|
||||
|
||||
static int disable_nr_and_ec(struct audio_device *device, const char *buf)
|
||||
{
|
||||
struct headset *hs = device->headset;
|
||||
|
||||
if (strlen(buf) < 9)
|
||||
return -EINVAL;
|
||||
|
||||
telephony_disable_nr_and_ec_req(device);
|
||||
if (buf[8] == '0')
|
||||
hs->nrec_req = FALSE;
|
||||
else
|
||||
hs->nrec_req = TRUE;
|
||||
|
||||
telephony_disable_nr_and_ec_req(device, hs->nrec_req);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2006,6 +2021,7 @@ struct headset *headset_init(struct audio_device *dev, uint16_t svc,
|
||||
hs->search_hfp = server_is_enabled(&dev->src, HANDSFREE_SVCLASS_ID);
|
||||
hs->hfp_active = FALSE;
|
||||
hs->cli_active = FALSE;
|
||||
hs->nrec = TRUE;
|
||||
|
||||
record = btd_device_get_record(dev->btd_dev, uuidstr);
|
||||
if (!record)
|
||||
@ -2276,6 +2292,8 @@ static int headset_close_rfcomm(struct audio_device *dev)
|
||||
hs->data_start = 0;
|
||||
hs->data_length = 0;
|
||||
|
||||
hs->nrec = TRUE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -197,9 +197,11 @@ void telephony_call_hold_req(void *telephony_device, const char *cmd)
|
||||
telephony_call_hold_rsp(telephony_device, CME_ERROR_NONE);
|
||||
}
|
||||
|
||||
void telephony_disable_nr_and_ec_req(void *telephony_device)
|
||||
void telephony_disable_nr_and_ec_req(void *telephony_device, gboolean enable)
|
||||
{
|
||||
debug("telephony-dummy: got disable NR and EC request");
|
||||
debug("telephony-dummy: got %s NR and EC request",
|
||||
enable ? "enable" : "disable");
|
||||
|
||||
telephony_disable_nr_and_ec_rsp(telephony_device, CME_ERROR_NONE);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ void telephony_subscriber_number_req(void *telephony_device);
|
||||
void telephony_list_current_calls_req(void *telephony_device);
|
||||
void telephony_operator_selection_req(void *telephony_device);
|
||||
void telephony_call_hold_req(void *telephony_device, const char *cmd);
|
||||
void telephony_disable_nr_and_ec_req(void *telephony_device);
|
||||
void telephony_disable_nr_and_ec_req(void *telephony_device, gboolean enable);
|
||||
|
||||
/* AG responses to HF requests. These are implemented by headset.c */
|
||||
int telephony_event_reporting_rsp(void *telephony_device, cme_error_t err);
|
||||
|
Loading…
Reference in New Issue
Block a user