diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-02 15:00:14 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-02 15:00:14 +0300 |
commit | 3f0968edd3c7a220fe0a4413d5662921efa7a7b9 (patch) | |
tree | a8cc9fdd893fbb3044d3548a978f50c0497969a3 | |
parent | 167c10dcff54bfc92a2bc86ac5a899ed04c3aa67 (diff) |
Add support for subscriber number notification
-rw-r--r-- | audio/headset.c | 11 | ||||
-rw-r--r-- | audio/telephony-dummy.c | 24 | ||||
-rw-r--r-- | audio/telephony.h | 6 |
3 files changed, 41 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c index 2fce7b8c..2dc1dbe5 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -2208,3 +2208,14 @@ int telephony_list_current_call_ind(int idx, int dir, int status, int mode, return 0; } + +int telephony_subscriber_number_ind(const char *number, int type, int service) +{ + if (!active_devices) + return -ENODEV; + + send_foreach_headset(active_devices, "\r\n+CNUM:,%s,%d,,%d\r\n", + number, type, service); + + return 0; +} diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c index e4b45649..26e06ba3 100644 --- a/audio/telephony-dummy.c +++ b/audio/telephony-dummy.c @@ -36,6 +36,7 @@ #include "logging.h" #include "telephony.h" +static char *subscriber_number = NULL; static char *active_call_number = NULL; static int active_call_status = 0; static int active_call_dir = 0; @@ -151,6 +152,9 @@ void telephony_transmit_dtmf_req(void *telephony_device, char tone) void telephony_subscriber_number_req(void *telephony_device) { debug("telephony-dummy: subscriber number request"); + if (subscriber_number) + telephony_subscriber_number_ind(subscriber_number, 0, + SUBSCRIBER_SERVICE_VOICE); telephony_subscriber_number_rsp(telephony_device, CME_ERROR_NONE); } @@ -316,6 +320,25 @@ static DBusMessage *registration_status(DBusConnection *conn, DBusMessage *msg, return dbus_message_new_method_return(msg); } +static DBusMessage *set_subscriber_number(DBusConnection *conn, + DBusMessage *msg, + void *data) +{ + const char *number; + + if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &number, + DBUS_TYPE_INVALID)) + return NULL; + + g_free(subscriber_number); + subscriber_number = g_strdup(number); + + debug("telephony-dummy: subscriber number set to %s", number); + + return dbus_message_new_method_return(msg); +} + + static GDBusMethodTable dummy_methods[] = { { "OutgoingCall", "s", "", outgoing_call }, { "IncomingCall", "s", "", incoming_call }, @@ -324,6 +347,7 @@ static GDBusMethodTable dummy_methods[] = { { "BatteryLevel", "u", "", battery_level }, { "RoamingStatus", "b", "", roaming_status }, { "RegistrationStatus", "b", "", registration_status }, + { "SetSubscriberNumber","s", "", set_subscriber_number }, { } }; diff --git a/audio/telephony.h b/audio/telephony.h index 2cbcf055..81ed64de 100644 --- a/audio/telephony.h +++ b/audio/telephony.h @@ -82,6 +82,10 @@ #define CALL_MULTIPARTY_NO 0 #define CALL_MULTIPARTY_YES 1 +/* Subscriber number parameters */ +#define SUBSCRIBER_SERVICE_VOICE 4 +#define SUBSCRIBER_SERVICE_FAX 5 + /* Extended Audio Gateway Error Result Codes */ typedef enum { CME_ERROR_NONE = -1, @@ -155,6 +159,8 @@ int telephony_ready_ind(uint32_t features, const struct indicator *indicators, int telephony_list_current_call_ind(int idx, int dir, int status, int mode, int mprty, const char *number, int type); +int telephony_subscriber_number_ind(const char *number, int type, + int service); /* Helper function for quick indicator updates */ static inline int telephony_update_indicator(struct indicator *indicators, |