[PATCH RFC BlueZ 14/16] Phone Alert: Mute once using new NGFD API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Anderson Briglia <anderson.briglia@xxxxxxxxxxxxx>

NGFD API has changed and now we have a dbus method to mute the ringer.
---
 alert/server.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/alert/server.c b/alert/server.c
index fb088a5..77540a7 100644
--- a/alert/server.c
+++ b/alert/server.c
@@ -49,6 +49,11 @@
 #define ALERT_INTERFACE "org.bluez.PhoneAlert"
 #define ALERT_PATH "/test/phonealert"
 
+/* OHM plugin D-Bus definitions */
+#define OHM_BUS_NAME		"com.nokia.NonGraphicFeedback1"
+#define OHM_INTERFACE		"com.nokia.NonGraphicFeedback1"
+#define OHM_PATH		"/com/nokia/NonGraphicFeedback1"
+
 enum {
 	ALERT_RINGER_STATE = 1 << 0,
 	ALERT_VIBRATOR_STATE = 1 << 1,
@@ -102,6 +107,21 @@ static void agent_operation(const char *operation)
 		error("D-Bus error: agent_operation %s", operation);
 }
 
+static void stop_ringtone(void)
+{
+	DBusMessage *message;
+
+	message = dbus_message_new_method_call(OHM_BUS_NAME, OHM_PATH,
+					OHM_INTERFACE, "StopRingtone");
+	if (message == NULL) {
+		error("Couldn't allocate D-Bus message");
+		return;
+	}
+
+	if (!g_dbus_send_message(connection, message))
+		error("Failed to send D-Bus message");
+}
+
 static uint8_t control_point_write(struct attribute *a, gpointer user_data)
 {
 	DBG("a = %p", a);
@@ -111,7 +131,7 @@ static uint8_t control_point_write(struct attribute *a, gpointer user_data)
 		agent_operation("SetSilentMode");
 		break;
 	case MUTE_ONCE:
-		agent_operation("MuteOnce");
+		stop_ringtone();
 		break;
 	case CANCEL_SILENT_MODE:
 		agent_operation("CancelSilentMode");
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux