diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-02 14:47:32 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-02 14:47:32 +0300 |
commit | 167c10dcff54bfc92a2bc86ac5a899ed04c3aa67 (patch) | |
tree | e2d9c4c7a53c4f8b646689d3381bcf4bf0c021b8 /audio | |
parent | b5875caa0d77c181352ba7b6d65bc6e9091d01f2 (diff) |
Add support for simple call tracking in dummy driver
Diffstat (limited to 'audio')
-rw-r--r-- | audio/telephony-dummy.c | 40 | ||||
-rw-r--r-- | audio/telephony.h | 20 |
2 files changed, 58 insertions, 2 deletions
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c index 5c3d4db8..e4b45649 100644 --- a/audio/telephony-dummy.c +++ b/audio/telephony-dummy.c @@ -36,6 +36,10 @@ #include "logging.h" #include "telephony.h" +static char *active_call_number = NULL; +static int active_call_status = 0; +static int active_call_dir = 0; + static gboolean events_enabled = FALSE; /* Response and hold state @@ -92,10 +96,16 @@ void telephony_last_dialed_number_req(void *telephony_device) EV_CALLSETUP_OUTGOING); telephony_update_indicator(dummy_indicators, "callsetup", EV_CALLSETUP_ALERTING); + + active_call_status = CALL_STATUS_ALERTING; + active_call_dir = CALL_DIR_OUTGOING; } void telephony_terminate_call_req(void *telephony_device) { + g_free(active_call_number); + active_call_number = NULL; + telephony_terminate_call_rsp(telephony_device, CME_ERROR_NONE); if (telephony_get_indicator(dummy_indicators, "callsetup") > 0) @@ -117,6 +127,9 @@ void telephony_answer_call_req(void *telephony_device) void telephony_dial_number_req(void *telephony_device, const char *number) { + g_free(active_call_number); + active_call_number = g_strdup(number); + telephony_dial_number_rsp(telephony_device, CME_ERROR_NONE); /* Notify outgoing call set-up successfully initiated */ @@ -124,6 +137,9 @@ void telephony_dial_number_req(void *telephony_device, const char *number) EV_CALLSETUP_OUTGOING); telephony_update_indicator(dummy_indicators, "callsetup", EV_CALLSETUP_ALERTING); + + active_call_status = CALL_STATUS_ALERTING; + active_call_dir = CALL_DIR_OUTGOING; } void telephony_transmit_dtmf_req(void *telephony_device, char tone) @@ -138,9 +154,16 @@ void telephony_subscriber_number_req(void *telephony_device) telephony_subscriber_number_rsp(telephony_device, CME_ERROR_NONE); } -int telephony_list_current_calls_req(void *telephony_device) +void telephony_list_current_calls_req(void *telephony_device) { debug("telephony-dummy: list current calls request"); + if (active_call_number) + telephony_list_current_call_ind(1, active_call_dir, + active_call_status, + CALL_MODE_VOICE, + CALL_MULTIPARTY_NO, + active_call_number, + 0); telephony_list_current_calls_rsp(telephony_device, CME_ERROR_NONE); } @@ -156,11 +179,17 @@ static DBusMessage *outgoing_call(DBusConnection *conn, DBusMessage *msg, debug("telephony-dummy: outgoing call to %s", number); + g_free(active_call_number); + active_call_number = g_strdup(number); + telephony_update_indicator(dummy_indicators, "callsetup", EV_CALLSETUP_OUTGOING); telephony_update_indicator(dummy_indicators, "callsetup", EV_CALLSETUP_ALERTING); + active_call_status = CALL_STATUS_ALERTING; + active_call_dir = CALL_DIR_OUTGOING; + return dbus_message_new_method_return(msg); } @@ -175,9 +204,15 @@ static DBusMessage *incoming_call(DBusConnection *conn, DBusMessage *msg, debug("telephony-dummy: incoming call to %s", number); + g_free(active_call_number); + active_call_number = g_strdup(number); + telephony_update_indicator(dummy_indicators, "callsetup", EV_CALLSETUP_INCOMING); + active_call_status = CALL_STATUS_INCOMING; + active_call_dir = CALL_DIR_INCOMING; + telephony_incoming_call_ind(number, 0); return dbus_message_new_method_return(msg); @@ -188,6 +223,9 @@ static DBusMessage *cancel_call(DBusConnection *conn, DBusMessage *msg, { debug("telephony-dummy: cancel call"); + g_free(active_call_number); + active_call_number = NULL; + if (telephony_get_indicator(dummy_indicators, "callsetup") > 0) { telephony_update_indicator(dummy_indicators, "callsetup", EV_CALLSETUP_INACTIVE); diff --git a/audio/telephony.h b/audio/telephony.h index 2581b00f..2cbcf055 100644 --- a/audio/telephony.h +++ b/audio/telephony.h @@ -64,6 +64,24 @@ #define EV_ROAM_INACTIVE 0 #define EV_ROAM_ACTIVE 1 +/* Call parameters */ +#define CALL_DIR_OUTGOING 0 +#define CALL_DIR_INCOMING 1 + +#define CALL_STATUS_ACTIVE 0 +#define CALL_STATUS_HELD 1 +#define CALL_STATUS_DIALING 2 +#define CALL_STATUS_ALERTING 3 +#define CALL_STATUS_INCOMING 4 +#define CALL_STATUS_WAITING 5 + +#define CALL_MODE_VOICE 0 +#define CALL_MODE_DATA 1 +#define CALL_MODE_FAX 2 + +#define CALL_MULTIPARTY_NO 0 +#define CALL_MULTIPARTY_YES 1 + /* Extended Audio Gateway Error Result Codes */ typedef enum { CME_ERROR_NONE = -1, @@ -114,7 +132,7 @@ void telephony_answer_call_req(void *telephony_device); void telephony_dial_number_req(void *telephony_device, const char *number); void telephony_transmit_dtmf_req(void *telephony_device, char tone); void telephony_subscriber_number_req(void *telephony_device); -int telephony_list_current_calls_req(void *telephony_device); +void telephony_list_current_calls_req(void *telephony_device); /* AG responses to HF requests. These are implemented by headset.c */ int telephony_event_reporting_rsp(void *telephony_device, cme_error_t err); |