diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-09-05 12:49:39 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-09-05 12:49:39 +0300 |
commit | 624760ab4e7eb0480aea751ceb1876e7a846f67a (patch) | |
tree | 1d5ecb42d3ca1a9fb582ca2740ca3b82c507731f /audio | |
parent | 1b971b060ba37714d970089e978fa720a2c9326c (diff) |
Implement telephony plugin support for terminate call (AT+CHUP)
Diffstat (limited to 'audio')
-rw-r--r-- | audio/headset.c | 22 | ||||
-rw-r--r-- | audio/telephony-dummy.c | 10 | ||||
-rw-r--r-- | audio/telephony.h | 15 |
3 files changed, 37 insertions, 10 deletions
diff --git a/audio/headset.c b/audio/headset.c index 0785df91..098cf75e 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -619,16 +619,21 @@ static int answer_call(struct audio_device *device, const char *buf) static int terminate_call(struct audio_device *device, const char *buf) { struct headset *hs = device->headset; - int err; + + ag.ev_buf_active = TRUE; + + if (telephony_terminate_call() < 0) { + headset_send(hs, "\r\nERROR\r\n"); + return 0; + } + + flush_events(); + ag.ev_buf_active = FALSE; g_dbus_emit_signal(device->conn, device->path, AUDIO_HEADSET_INTERFACE, "CallTerminated", DBUS_TYPE_INVALID); - err = headset_send(hs, "\r\nOK\r\n"); - if (err < 0) - return err; - if (hs->ph_number) { g_free(hs->ph_number); hs->ph_number = NULL; @@ -637,12 +642,9 @@ static int terminate_call(struct audio_device *device, const char *buf) if (hs->ring_timer) { g_source_remove(hs->ring_timer); hs->ring_timer = 0; - /*+CIEV: (callsetup = 0)*/ - return headset_send(hs, "\r\n+CIEV:3,0\r\n"); } - /*+CIEV: (call = 0)*/ - return headset_send(hs, "\r\n+CIEV:2,0\r\n"); + return headset_send(hs, "\r\nOK\n\r"); } static int cli_notification(struct audio_device *device, const char *buf) @@ -689,7 +691,7 @@ static int last_dialed_number(struct audio_device *device, const char *buf) flush_events(); ag.ev_buf_active = FALSE; - return headset_send(hs, "\r\nOK\n\r", ag.rh); + return headset_send(hs, "\r\nOK\n\r"); } static int signal_gain_setting(struct audio_device *device, const char *buf) diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c index 46637b95..f71f65f6 100644 --- a/audio/telephony-dummy.c +++ b/audio/telephony-dummy.c @@ -79,6 +79,16 @@ int telephony_last_dialed_number(void) return 0; } +int telephony_terminate_call(void) +{ + if (telephony_get_indicator(dummy_indicators, "callsetup" > 0)) + telephony_update_indicator(dummy_indicators, "callsetup", 0); + else + telephony_update_indicator(dummy_indicators, "call", 0); + + return 0; +} + int telephony_init(void) { uint32_t features = 0; diff --git a/audio/telephony.h b/audio/telephony.h index 398f98df..60b1d423 100644 --- a/audio/telephony.h +++ b/audio/telephony.h @@ -52,6 +52,8 @@ int telephony_response_and_hold_ind(int rh); int telephony_last_dialed_number(void); +int telephony_terminate_call(void); + int telephony_ready(uint32_t features, struct indicator *indicators, int rh); /* Helper function for quick indicator updates */ @@ -77,5 +79,18 @@ static inline int telephony_update_indicator(struct indicator *indicators, return telephony_event_ind(i); } +static inline int telephony_get_indicator(struct indicator *indicators, + const char *desc) +{ + int i; + + for (i = 0; indicators[i].desc != NULL; i++) { + if (g_str_equal(indicators[i].desc, desc)) + return indicators[i].val; + } + + return -ENOENT; +} + int telephony_init(void); void telephony_exit(void); |