From: Alok <develnewbie@gmail.com>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] [PATCH][HFP] - Setting the inband Ringtone
Date: Thu, 10 Jan 2008 21:06:48 +0530 [thread overview]
Message-ID: <1199979409.23989.20.camel@greatbear> (raw)
In-Reply-To: <20080109002828.GB5883@ps.ms.mff.cuni.cz>
[-- Attachment #1: Type: text/plain, Size: 545 bytes --]
Hi Johan,
Here is a patch to change the In-BandRingtone setting through a D-Bus
method.
Let me know if the Method/Signal names are fine with you.
Ill send the patch for the audio-api.txt next.
Do you think we shud have a DBus method call to Identify the type of
headset i.e HSP/HFP? A method like "IsHFP" which returns the value of
hs->hfp_active will be useful. Otherwise there is no way to know (apart
for reading /etc/bluetooth/audio.conf) what profile is active.
Let me know if anything in the patch needs to be changed.
-Alok.
[-- Attachment #2: patch1 --]
[-- Type: text/x-patch, Size: 2997 bytes --]
Index: audio/headset.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/headset.c,v
retrieving revision 1.156
diff -u -5 -p -r1.156 headset.c
--- audio/headset.c 9 Jan 2008 12:36:58 -0000 1.156
+++ audio/headset.c 10 Jan 2008 15:04:17 -0000
@@ -1447,10 +1453,67 @@ static DBusHandlerResult hf_setup_call(D
send_message_and_unref(conn, reply);
return DBUS_HANDLER_RESULT_HANDLED;
}
+static DBusHandlerResult hf_set_inband(DBusConnection *conn,
+ DBusMessage *msg,
+ void *data)
+{
+ struct device *device = data;
+ struct headset *hs = device->headset;
+ DBusMessage *reply;
+ DBusError derr;
+ gboolean *active;
+ int err;
+
+ if (!hs->hfp_active)
+ return error_not_supported(device->conn, msg);
+
+ if (hs->state < HEADSET_STATE_CONNECTED)
+ return error_not_connected(conn, msg);
+
+ dbus_error_init(&derr);
+ dbus_message_get_args(msg, &derr, DBUS_TYPE_BOOLEAN, &active,
+ DBUS_TYPE_INVALID);
+
+ if (dbus_error_is_set(&derr)) {
+ error_invalid_arguments(conn, msg, derr.message);
+ dbus_error_free(&derr);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ if (active && !(ag_features & AG_FEATURE_INBAND_RINGTONE)) {
+ ag_features |= AG_FEATURE_INBAND_RINGTONE;
+ err = headset_send(hs, "\r\n+BSIR:1\r\n");
+ }
+
+ if (!active && (ag_features & AG_FEATURE_INBAND_RINGTONE)) {
+ ag_features &= ~AG_FEATURE_INBAND_RINGTONE;
+ err = headset_send(hs, "\r\n+BSIR:0\r\n");
+ }
+
+ if (err < 0) {
+ dbus_message_unref(reply);
+ return error_failed(conn, msg, "Unable to send to headset");
+ }
+
+ dbus_connection_emit_signal(conn, device->path,
+ AUDIO_HEADSET_INTERFACE,
+ "InBandSettingChanged",
+ DBUS_TYPE_BOOLEAN, &active,
+ DBUS_TYPE_INVALID);
+
+ send_message_and_unref(conn, reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
static DBusMethodVTable headset_methods[] = {
{ "Connect", hs_connect, "", "" },
{ "Disconnect", hs_disconnect, "", "" },
{ "IsConnected", hs_is_connected, "", "b" },
{ "IndicateCall", hs_ring, "", "" },
@@ -1461,10 +1524,11 @@ static DBusMethodVTable headset_methods[
{ "GetSpeakerGain", hs_get_speaker_gain, "", "q" },
{ "GetMicrophoneGain", hs_get_mic_gain, "", "q" },
{ "SetSpeakerGain", hs_set_speaker_gain, "q", "" },
{ "SetMicrophoneGain", hs_set_mic_gain, "q", "" },
{ "SetupCall", hf_setup_call, "s", "" },
+ { "SetInbandRingtone", hf_set_inband, "b", "" },
{ NULL, NULL, NULL, NULL }
};
static DBusSignalVTable headset_signals[] = {
{ "Connected", "" },
@@ -1473,10 +1537,11 @@ static DBusSignalVTable headset_signals[
{ "Stopped", "" },
{ "Playing", "" },
{ "SpeakerGainChanged", "q" },
{ "MicrophoneGainChanged", "q" },
{ "CallTerminated", "" },
+ { "InBandSettingChanged", "b" },
{ NULL, NULL }
};
static void headset_set_channel(struct headset *headset, sdp_record_t *record)
{
[-- Attachment #3: Type: text/plain, Size: 278 bytes --]
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
prev parent reply other threads:[~2008-01-10 15:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-09 0:28 [Bluez-devel] error in headset capture, patch included Pavel Semerad
2008-01-09 3:03 ` Johan Hedberg
2008-01-09 10:37 ` [Bluez-devel] [PATCH] HFP - Rejecting a call Alok
2008-01-10 15:24 ` [Bluez-devel] [PATCH][HFP] - default device as hfp Alok
2008-01-10 15:36 ` Alok [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1199979409.23989.20.camel@greatbear \
--to=develnewbie@gmail.com \
--cc=bluez-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox