Refactor: Setup the HF features bitmap

Do not use magic numbers unless strictly necessary
This commit is contained in:
Denis Kenzior 2009-10-19 16:59:44 -05:00
parent 0ca88b36e7
commit 5635703141
2 changed files with 20 additions and 3 deletions

View File

@ -34,6 +34,14 @@
#define AG_FEATURE_ENHANCED_CALL_CONTROL 0x80
#define AG_FEATURE_EXTENDED_RES_CODE 0x100
#define HF_FEATURE_ECNR 0x1
#define HF_FEATURE_3WAY 0x2
#define HF_FEATURE_CLIP 0x4
#define HF_FEATURE_VOICE_RECOGNITION 0x8
#define HF_FEATURE_REMOTE_VOLUME_CONTROL 0x10
#define HF_FEATURE_ENHANCED_CALL_STATUS 0x20
#define HF_FEATURE_ENHANCED_CALL_CONTROL 0x40
enum hfp_indicator {
HFP_INDICATOR_SERVICE = 0,
HFP_INDICATOR_CALL,
@ -48,6 +56,7 @@ enum hfp_indicator {
struct hfp_data {
GAtChat *chat;
guint ag_features;
guint hf_features;
guint8 cind_pos[HFP_INDICATOR_LAST];
gint cind_val[HFP_INDICATOR_LAST];
};

View File

@ -24,6 +24,7 @@
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <glib.h>
@ -210,6 +211,7 @@ static int service_level_connection(struct ofono_modem *modem,
GIOChannel *io;
GAtSyntax *syntax;
GAtChat *chat;
char buf[64];
io = g_at_tty_open(tty, NULL);
if (!io) {
@ -229,9 +231,9 @@ static int service_level_connection(struct ofono_modem *modem,
if (getenv("OFONO_AT_DEBUG"))
g_at_chat_set_debug(chat, hfp_debug, NULL);
/* 118 = 0x76, support multiparty calling, enhanced call status
* and enhanced call control */
g_at_chat_send(chat, "AT+BRSF=118", brsf_prefix,
sprintf(buf, "AT+BRSF=%d", data->hf_features);
g_at_chat_send(chat, buf, brsf_prefix,
brsf_cb, modem, NULL);
data->chat = chat;
@ -246,6 +248,12 @@ static int hfp_probe(struct ofono_modem *modem)
if (!data)
return -ENOMEM;
data->hf_features |= HF_FEATURE_3WAY;
data->hf_features |= HF_FEATURE_CLIP;
data->hf_features |= HF_FEATURE_REMOTE_VOLUME_CONTROL;
data->hf_features |= HF_FEATURE_ENHANCED_CALL_STATUS;
data->hf_features |= HF_FEATURE_ENHANCED_CALL_CONTROL;
ofono_modem_set_data(modem, data);
return 0;