From d3e0c6c4950496843eb769104b9659d3fb9640d7 Mon Sep 17 00:00:00 2001 From: Anderson Lizardo Date: Tue, 2 Oct 2012 16:24:40 -0400 Subject: [PATCH] alert: Implement MuteOnce command MuteOnce() is called by BlueZ to instruct the agent to mute the ringer during a incoming call. --- profiles/alert/server.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/profiles/alert/server.c b/profiles/alert/server.c index fc3d65ee9..ece3c1fbf 100644 --- a/profiles/alert/server.c +++ b/profiles/alert/server.c @@ -76,6 +76,12 @@ enum { NOTIFY_UNREAD_CAT, }; +enum { + RINGER_SILENT_MODE = 1, + RINGER_MUTE_ONCE, + RINGER_CANCEL_SILENT_MODE, +}; + /* Ringer Setting characteristic values */ enum { RINGER_SILENT, @@ -461,6 +467,25 @@ static uint8_t ringer_cp_write(struct attribute *a, { DBG("a = %p", a); + if (a->len > 1) { + DBG("Invalid command size (%zu)", a->len); + return 0; + } + + switch (a->data[0]) { + case RINGER_SILENT_MODE: + DBG("Silent Mode"); + break; + case RINGER_MUTE_ONCE: + DBG("Mute Once"); + break; + case RINGER_CANCEL_SILENT_MODE: + DBG("Cancel Silent Mode"); + break; + default: + DBG("Invalid command (0x%02x)", a->data[0]); + } + return 0; } -- 2.47.3