diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-09-05 16:50:39 +0300 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-09-05 16:50:39 +0300 | 
| commit | 8a4190b4130c005b20f738d4470d71e73bdb03e6 (patch) | |
| tree | d41c469ad1de8df9b6e65e9b61668569484d0ab0 | |
| parent | 63155e6a90748fbfd1e019041d91796a94712c48 (diff) | |
Add debug prints for HF and AG feature bits
| -rw-r--r-- | audio/headset.c | 77 | ||||
| -rw-r--r-- | audio/telephony.h | 26 | 
2 files changed, 94 insertions, 9 deletions
| diff --git a/audio/headset.c b/audio/headset.c index 1903fbf2..4dda362a 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -181,6 +181,78 @@ static int rfcomm_connect(struct audio_device *device, headset_stream_cb_t cb,  static int get_records(struct audio_device *device, headset_stream_cb_t cb,  			void *user_data, unsigned int *cb_id); +static void print_ag_features(uint32_t features) +{ +	GString *gstr; +	char *str; + +	if (features == 0) { +		debug("HFP AG features: (none)"); +		return; +	} + +	gstr = g_string_new("HFP AG features: "); + +	if (features & AG_FEATURE_THREE_WAY_CALLING) +		g_string_append(gstr, "\"Three-way calling\" "); +	if (features & AG_FEATURE_EC_ANDOR_NR) +		g_string_append(gstr, "\"EC and/or NR function\" "); +	if (features & AG_FEATURE_VOICE_RECOGNITION) +		g_string_append(gstr, "\"Voice recognition function\" "); +	if (features & AG_FEATURE_INBAND_RINGTONE) +		g_string_append(gstr, "\"In-band ring tone capability\" "); +	if (features & AG_FEATURE_ATTACH_NUMBER_TO_VOICETAG) +		g_string_append(gstr, "\"Attach a number to a voice tag\" "); +	if (features & AG_FEATURE_REJECT_A_CALL) +		g_string_append(gstr, "\"Ability to reject a call\" "); +	if (features & AG_FEATURE_ENHANCED_CALL_STATUS) +		g_string_append(gstr, "\"Enhanced call status\" "); +	if (features & AG_FEATURE_ENHANCED_CALL_CONTROL) +		g_string_append(gstr, "\"Enhanced call control\" "); +	if (features & AG_FEATURE_EXTENDED_ERROR_RESULT_CODES) +		g_string_append(gstr, "\"Extended Error Result Codes\" "); + +	str = g_string_free(gstr, FALSE); + +	debug("%s", str); + +	g_free(str); +} + +static void print_hf_features(uint32_t features) +{ +	GString *gstr; +	char *str; + +	if (features == 0) { +		debug("HFP HF features: (none)"); +		return; +	} + +	gstr = g_string_new("HFP HF features: "); + +	if (features & HF_FEATURE_EC_ANDOR_NR) +		g_string_append(gstr, "\"EC and/or NR function\" "); +	if (features & HF_FEATURE_CALL_WAITING_AND_3WAY) +		g_string_append(gstr, "\"Call waiting and 3-way calling\" "); +	if (features & HF_FEATURE_CLI_PRESENTATION) +		g_string_append(gstr, "\"CLI presentation capability\" "); +	if (features & HF_FEATURE_VOICE_RECOGNITION) +		g_string_append(gstr, "\"Voice recognition activation\" "); +	if (features & HF_FEATURE_REMOTE_VOLUME_CONTROL) +		g_string_append(gstr, "\"Remote volume control\" "); +	if (features & HF_FEATURE_ENHANCED_CALL_STATUS) +		g_string_append(gstr, "\"Enhanced call status\" "); +	if (features & HF_FEATURE_ENHANCED_CALL_CONTROL) +		g_string_append(gstr, "\"Enhanced call control\" "); + +	str = g_string_free(gstr, FALSE); + +	debug("%s", str); + +	g_free(str); +} +  static int headset_send(struct headset *hs, char *format, ...)  {  	char rsp[BUF_SIZE]; @@ -266,6 +338,9 @@ static int supported_features(struct audio_device *device, const char *buf)  		return -EINVAL;  	hs->hfp_features = strtoul(&buf[8], NULL, 10); + +	print_hf_features(hs->hfp_features); +  	err = headset_send(hs, "\r\n+BRSF=%u\r\n", ag.features);  	if (err < 0)  		return err; @@ -2104,5 +2179,7 @@ int telephony_ready_ind(uint32_t features,  	debug("Telephony plugin initialized"); +	print_ag_features(ag.features); +  	return 0;  } diff --git a/audio/telephony.h b/audio/telephony.h index 1b622933..5cca4997 100644 --- a/audio/telephony.h +++ b/audio/telephony.h @@ -27,15 +27,23 @@  #include <glib.h>  /* HFP feature bits */ -#define AG_FEATURE_THREE_WAY_CALLING             0x0001 -#define AG_FEATURE_EC_ANDOR_NR                   0x0002 -#define AG_FEATURE_VOICE_RECOGNITION             0x0004 -#define AG_FEATURE_INBAND_RINGTONE               0x0008 -#define AG_FEATURE_ATTACH_NUMBER_TO_VOICETAG     0x0010 -#define AG_FEATURE_REJECT_A_CALL                 0x0020 -#define AG_FEATURE_ENHANCES_CALL_STATUS          0x0040 -#define AG_FEATURE_ENHANCES_CALL_CONTROL         0x0080 -#define AG_FEATURE_EXTENDED_ERROR_RESULT_CODES   0x0100 +#define AG_FEATURE_THREE_WAY_CALLING		0x0001 +#define AG_FEATURE_EC_ANDOR_NR			0x0002 +#define AG_FEATURE_VOICE_RECOGNITION		0x0004 +#define AG_FEATURE_INBAND_RINGTONE		0x0008 +#define AG_FEATURE_ATTACH_NUMBER_TO_VOICETAG	0x0010 +#define AG_FEATURE_REJECT_A_CALL		0x0020 +#define AG_FEATURE_ENHANCED_CALL_STATUS		0x0040 +#define AG_FEATURE_ENHANCED_CALL_CONTROL	0x0080 +#define AG_FEATURE_EXTENDED_ERROR_RESULT_CODES	0x0100 + +#define HF_FEATURE_EC_ANDOR_NR			0x0001 +#define HF_FEATURE_CALL_WAITING_AND_3WAY	0x0002 +#define HF_FEATURE_CLI_PRESENTATION		0x0004 +#define HF_FEATURE_VOICE_RECOGNITION		0x0008 +#define HF_FEATURE_REMOTE_VOLUME_CONTROL	0x0010 +#define HF_FEATURE_ENHANCED_CALL_STATUS		0x0020 +#define HF_FEATURE_ENHANCED_CALL_CONTROL	0x0040  /* Indicator event values */  #define EV_SERVICE_NONE			0 | 
