diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-09-28 18:23:21 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-09-29 14:56:22 -0500 |
commit | 6a271dd25887ac5587f707b521a0d854e2f2e9ba (patch) | |
tree | 8731f7624e6fe267dc07f1c90ecdc57c7c7ec14d | |
parent | d76f6747944d147e3abd35a2510e5973a390a5d0 (diff) | |
download | ofono-6a271dd25887ac5587f707b521a0d854e2f2e9ba.tar.bz2 |
Refactor: Break up call volume notify
-rw-r--r-- | include/call-volume.h | 6 | ||||
-rw-r--r-- | src/call-volume.c | 38 |
2 files changed, 28 insertions, 16 deletions
diff --git a/include/call-volume.h b/include/call-volume.h index 646b4b11..d8af0082 100644 --- a/include/call-volume.h +++ b/include/call-volume.h @@ -47,8 +47,10 @@ struct ofono_call_volume_driver { ofono_call_volume_cb_t cb, void *data); }; -void ofono_call_volume_notify(struct ofono_call_volume *cv, - const char *property, unsigned char percent); +void ofono_call_volume_set_speaker_volume(struct ofono_call_volume *cv, + unsigned char percent); +void ofono_call_volume_set_microphone_volume(struct ofono_call_volume *cv, + unsigned char percent); int ofono_call_volume_driver_register(const struct ofono_call_volume_driver *d); void ofono_call_volume_driver_unregister( diff --git a/src/call-volume.c b/src/call-volume.c index 7a0bc9a5..415f177d 100644 --- a/src/call-volume.c +++ b/src/call-volume.c @@ -48,34 +48,44 @@ static GSList *g_drivers = NULL; struct ofono_call_volume { DBusMessage *pending; + unsigned char speaker_volume; + unsigned char microphone_volume; + unsigned char pending_volume; const struct ofono_call_volume_driver *driver; - int flags; void *driver_data; struct ofono_atom *atom; +}; - unsigned char speaker_volume; - unsigned char microphone_volume; +void ofono_call_volume_set_speaker_volume(struct ofono_call_volume *cv, + unsigned char percent) +{ + DBusConnection *conn = ofono_dbus_get_connection(); + const char *path = __ofono_atom_get_path(cv->atom); - /* temp volume before it is accepted by remote */ - unsigned char temp_volume; -}; + cv->speaker_volume = percent; -void ofono_call_volume_notify(struct ofono_call_volume *cv, - const char *property, + if (__ofono_atom_get_registered(cv->atom) == FALSE) + return; + + ofono_dbus_signal_property_changed(conn, path, CALL_VOLUME_INTERFACE, + "SpeakerVolume", + DBUS_TYPE_BYTE, &percent); +} + +void ofono_call_volume_set_microphone_volume(struct ofono_call_volume *cv, unsigned char percent) { DBusConnection *conn = ofono_dbus_get_connection(); const char *path = __ofono_atom_get_path(cv->atom); - if (!strcmp(property, "SpeakerVolume")) - cv->speaker_volume = percent; + cv->microphone_volume = percent; - if (!strcmp(property, "MicrophoneVolume")) - cv->microphone_volume = percent; + if (__ofono_atom_get_registered(cv->atom) == FALSE) + return; ofono_dbus_signal_property_changed(conn, path, CALL_VOLUME_INTERFACE, - property, DBUS_TYPE_BYTE, - &percent); + "MicrophoneVolume", + DBUS_TYPE_BYTE, &percent); } static DBusMessage *cv_get_properties(DBusConnection *conn, |