summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-10-19 16:59:44 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-10-19 16:59:44 -0500
commit56357031416bdb06d6095e283f4912eb73e86ae4 (patch)
tree001f9dc3897d9795625ec2a5175c92a1abc9ce84
parent0ca88b36e73e15f505d9543705bf1d332c412189 (diff)
downloadofono-56357031416bdb06d6095e283f4912eb73e86ae4.tar.bz2
Refactor: Setup the HF features bitmap
Do not use magic numbers unless strictly necessary
-rw-r--r--drivers/hfpmodem/hfp.h9
-rw-r--r--plugins/hfp.c14
2 files changed, 20 insertions, 3 deletions
diff --git a/drivers/hfpmodem/hfp.h b/drivers/hfpmodem/hfp.h
index 97e5d47f..6c6ab6fd 100644
--- a/drivers/hfpmodem/hfp.h
+++ b/drivers/hfpmodem/hfp.h
@@ -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];
};
diff --git a/plugins/hfp.c b/plugins/hfp.c
index b1b87d3c..1ac9bb42 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -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;