summaryrefslogtreecommitdiffstats
path: root/audio/headset.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-11-27 12:48:08 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-11-27 12:48:08 +0000
commit954a25724ff381df97c0cc15bda110b9da4273ea (patch)
tree42debed54df2e0279dd4e0c326f4927dea6fbd2a /audio/headset.c
parent59a4bc3afb004d7aeef69461987307738a9fe4af (diff)
Implement SpeakerGainChanged and MicrophoneGainChanged signals
Diffstat (limited to 'audio/headset.c')
-rw-r--r--audio/headset.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 4491fc2e..742bf558 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -200,7 +200,40 @@ static DBusHandlerResult err_failed(DBusConnection *conn, DBusMessage *msg)
static void send_gain_setting(const char *buf)
{
- /* Not yet implemented */
+ const char *name;
+ DBusMessage *signal;
+ dbus_uint16_t gain;
+
+ if (strlen(buf) < 6) {
+ error("Too short string for Gain setting");
+ return;
+ }
+
+ switch (buf[3]) {
+ case 'S':
+ name = "SpeakerGainChanged";
+ break;
+ case 'M':
+ name = "MicrophoneGainChanged";
+ break;
+ default:
+ error("Unknown gain setting");
+ return;
+ }
+
+ signal = dbus_message_new_signal(HEADSET_PATH, "org.bluez.Headset", name);
+ if (!signal) {
+ error("Unable to allocate new GainChanged signal");
+ return;
+ }
+
+ gain = (dbus_uint16_t) strtol(&buf[5], NULL, 10);
+
+ dbus_message_append_args(signal, DBUS_TYPE_UINT16, &gain,
+ DBUS_TYPE_INVALID);
+
+ dbus_connection_send(connection, signal, NULL);
+ dbus_message_unref(signal);
}
static void send_simple_signal(const char *name)