diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-10-02 16:31:50 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-10-02 16:31:50 -0300 |
commit | c1172863fc0aa6d430dd6aa14012cfa44f891fe5 (patch) | |
tree | cfaaa6582f876209ecb258b019dbc1c16871b886 /audio/headset.c | |
parent | 214aa81f389a0bc9ac80353aa09e00e674bf4064 (diff) |
Add code to emit PropertyChanged on headset interface.
Diffstat (limited to 'audio/headset.c')
-rw-r--r-- | audio/headset.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/audio/headset.c b/audio/headset.c index 86a8e0a3..f85f053a 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -790,6 +790,7 @@ static int dial_number(struct audio_device *device, const char *buf) static int signal_gain_setting(struct audio_device *device, const char *buf) { struct headset *hs = device->headset; + const char *property; const char *name; dbus_uint16_t gain; @@ -810,12 +811,14 @@ static int signal_gain_setting(struct audio_device *device, const char *buf) if (hs->sp_gain == gain) goto ok; name = "SpeakerGainChanged"; + property = "SpeakerGain"; hs->sp_gain = gain; break; case HEADSET_GAIN_MICROPHONE: if (hs->mic_gain == gain) goto ok; name = "MicrophoneGainChanged"; + property = "MicrophoneGain"; hs->mic_gain = gain; break; default: @@ -824,9 +827,13 @@ static int signal_gain_setting(struct audio_device *device, const char *buf) } g_dbus_emit_signal(device->conn, device->path, - AUDIO_HEADSET_INTERFACE, name, - DBUS_TYPE_UINT16, &gain, - DBUS_TYPE_INVALID); + AUDIO_HEADSET_INTERFACE, name, + DBUS_TYPE_UINT16, &gain, + DBUS_TYPE_INVALID); + + dbus_connection_emit_property_changed(device->conn, device->path, + AUDIO_HEADSET_INTERFACE, property, + DBUS_TYPE_UINT16, &gain); ok: return headset_send(hs, "\r\nOK\r\n"); @@ -2130,18 +2137,24 @@ void headset_set_authorized(struct audio_device *dev) void headset_set_state(struct audio_device *dev, headset_state_t state) { struct headset *hs = dev->headset; + gboolean value; if (hs->state == state) return; switch (state) { case HEADSET_STATE_DISCONNECTED: + value = FALSE; close_sco(dev); headset_close_rfcomm(dev); g_dbus_emit_signal(dev->conn, dev->path, AUDIO_HEADSET_INTERFACE, "Disconnected", DBUS_TYPE_INVALID); + dbus_connection_emit_property_changed(dev->conn, dev->path, + AUDIO_HEADSET_INTERFACE, + "Connected", + DBUS_TYPE_BOOLEAN, &value); telephony_device_disconnected(dev); active_devices = g_slist_remove(active_devices, dev); break; @@ -2150,22 +2163,33 @@ void headset_set_state(struct audio_device *dev, headset_state_t state) case HEADSET_STATE_CONNECTED: close_sco(dev); if (hs->state < state) { + value = TRUE; g_dbus_emit_signal(dev->conn, dev->path, AUDIO_HEADSET_INTERFACE, "Connected", DBUS_TYPE_INVALID); + dbus_connection_emit_property_changed(dev->conn, dev->path, + AUDIO_HEADSET_INTERFACE, + "Connected", + DBUS_TYPE_BOOLEAN, &value); active_devices = g_slist_append(active_devices, dev); telephony_device_connected(dev); } else if (hs->state == HEADSET_STATE_PLAYING) { + value = FALSE; g_dbus_emit_signal(dev->conn, dev->path, AUDIO_HEADSET_INTERFACE, "Stopped", DBUS_TYPE_INVALID); + dbus_connection_emit_property_changed(dev->conn, dev->path, + AUDIO_HEADSET_INTERFACE, + "Playing", + DBUS_TYPE_BOOLEAN, &value); } break; case HEADSET_STATE_PLAY_IN_PROGRESS: break; case HEADSET_STATE_PLAYING: + value = TRUE; hs->sco_id = g_io_add_watch(hs->sco, G_IO_ERR | G_IO_HUP | G_IO_NVAL, (GIOFunc) sco_cb, dev); @@ -2173,6 +2197,10 @@ void headset_set_state(struct audio_device *dev, headset_state_t state) g_dbus_emit_signal(dev->conn, dev->path, AUDIO_HEADSET_INTERFACE, "Playing", DBUS_TYPE_INVALID); + dbus_connection_emit_property_changed(dev->conn, dev->path, + AUDIO_HEADSET_INTERFACE, + "Playing", + DBUS_TYPE_BOOLEAN, &value); if (hs->sp_gain >= 0) headset_send(hs, "\r\n+VGS=%u\r\n", hs->sp_gain); |