summaryrefslogtreecommitdiffstats
path: root/src/voicecall.c
diff options
context:
space:
mode:
authorFrédéric Dalleau <frederic.dalleau@linux.intel.com>2011-05-20 11:33:25 +0200
committerDenis Kenzior <denkenz@gmail.com>2011-05-22 06:06:39 -0500
commita3998f46e29cb2e78353fc40a34bbdb75caed0d3 (patch)
treefe74fd2ec48d3da77c4bbbc42bd097315d2a92cb /src/voicecall.c
parent5fd5a9b62832199e6e187412e7b468cc8fc5128f (diff)
downloadofono-a3998f46e29cb2e78353fc40a34bbdb75caed0d3.tar.bz2
voicecall: add +VTS support for HFP emulator
Diffstat (limited to 'src/voicecall.c')
-rw-r--r--src/voicecall.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/voicecall.c b/src/voicecall.c
index 2ab67ac3..0273ed69 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2421,6 +2421,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)
OFONO_ATOM_TYPE_EMULATOR_HFP,
emulator_remove_handler,
"+CHLD");
+ __ofono_modem_foreach_registered_atom(modem,
+ OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_remove_handler,
+ "+VTS");
__ofono_modem_remove_atom_watch(modem, vc->hfp_watch);
}
@@ -2866,6 +2870,53 @@ fail:
ofono_emulator_send_final(em, &result);
}
+static void vts_tone_cb(int error, void *data)
+{
+ struct ofono_emulator *em = data;
+ struct ofono_error result;
+
+ result.error = 0;
+ result.type = error ? OFONO_ERROR_TYPE_FAILURE :
+ OFONO_ERROR_TYPE_NO_ERROR;
+
+ ofono_emulator_send_final(em, &result);
+}
+
+static void emulator_vts_cb(struct ofono_emulator *em,
+ struct ofono_emulator_request *req, void *userdata)
+{
+ struct ofono_voicecall *vc = userdata;
+ struct ofono_error result;
+ const char *str;
+
+ switch (ofono_emulator_request_get_type(req)) {
+ case OFONO_EMULATOR_REQUEST_TYPE_SET:
+ str = ofono_emulator_request_get_raw(req);
+ if (str == NULL)
+ break;
+
+ if (!g_ascii_isdigit(str[0]) && str[0] != '*' && str[0] != '#'
+ && (str[0] < 'A' || str[0] > 'D'))
+ break;
+
+ if (str[1] != '\0')
+ break;
+
+ if (__ofono_voicecall_tone_send(vc, str, vts_tone_cb, em) >= 0)
+ return;
+
+ break;
+
+ default:
+ break;
+ }
+
+ result.error = 0;
+ result.type = OFONO_ERROR_TYPE_FAILURE;
+
+ ofono_emulator_send_final(em, &result);
+}
+
static void emulator_hfp_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond,
void *data)
@@ -2881,6 +2932,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,
ofono_emulator_add_handler(em, "+CHUP", emulator_chup_cb, data, NULL);
ofono_emulator_add_handler(em, "+CLCC", emulator_clcc_cb, data, NULL);
ofono_emulator_add_handler(em, "+CHLD", emulator_chld_cb, data, NULL);
+ ofono_emulator_add_handler(em, "+VTS", emulator_vts_cb, data, NULL);
}
void ofono_voicecall_register(struct ofono_voicecall *vc)