Skip to contentSkip to conversation

error in setting speakergain in own application

DISCUSSION Peter Kornatowski 2 participants 4 messages Sep 2, 2009 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi,

I have a linux application where i do some stuff with bluez (4.50) over dbus. I have 3 headsets with which I test (Jabra BT530, Sora B-Speech, official PS3-BT headset) and on all I get the same behaviour/error.

I would like to set the speakergain of a headset from my linux-app. I tried two methods:

a) call the method "SetProperty":

GValue value;
value.g_type = 0; // also tried: value = { 0 };
guint16 ugain = (guint16)gain; // also tried: guint ugain = (guint)gain; g_value_init(&value, G_TYPE_UINT);
g_value_set_uint(&value, ugain);
dbus_g_proxy_call(proxy, "SetProperty", &error, G_TYPE_STRING,
"SpeakerGain", G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID);
g_value_unset(&value);

Quoted 1 line

From error->message I always get: Invalid arguments in method call

I get the same error when trying to set it through d-feet (but probably because d-feet can't set a value type?).

b) call the method "SetSpeakerGain" (it is deprecated, but the deprecated signal "SpeakerGainChanged" still works, too):

guint16 ugain = (guint16)gain; // also tried: guint ugain = (guint)gain; dbus_g_proxy_call(proxy, "SetSpeakerGain", &err, G_TYPE_UINT, ugain, G_TYPE_INVALID, G_TYPE_INVALID);

Quoted 1 line

From error->message I always get: Method "SetSpeakerGain" with signature "u" on interface "org.bluez.Headset" doesn't exist

Calling this method with d-feet works fine, the new value is transferred to the headset.

Does anyone have any idea how this could work? Thanks!

Greetings,
Peter

Signature · 2 lines
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
#1 lore raw
Quoted 8 lines · Peter Kornatowski

Hi,

I have a linux application where i do some stuff with bluez (4.50) over dbus. I have 3 headsets with which I test (Jabra BT530, Sora B-Speech, official PS3-BT headset) and on all I get the same behaviour/error.

I would like to set the speakergain of a headset from my linux-app. I tried two methods:

a) call the method "SetProperty":

Quoted 7 lines

GValue value;
value.g_type = 0; // also tried: value = { 0 };
guint16 ugain = (guint16)gain; // also tried: guint ugain = (guint)gain; g_value_init(&value, G_TYPE_UINT);
g_value_set_uint(&value, ugain);
dbus_g_proxy_call(proxy, "SetProperty", &error, G_TYPE_STRING,
"SpeakerGain", G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID);

This would work (and you don't need to use a GValue, the call will take care of marshalling the value to the proper type:
dbus_g_proxy_call(proxy, "SetProperty", &error, G_TYPE_STRING,
"SpeakerGain", G_TYPE_UINT, ugain, G_TYPE_INVALID, G_TYPE_INVALID);

Quoted 1 line

g_value_unset(&value);

Cheers

#2 lore raw

-------- Original-Nachricht --------

Quoted 26 lines

Datum: Wed, 02 Sep 2009 15:37:59 +0100
Von: Bastien Nocera <[email protected]>
An: Peter Kornatowski <[email protected]>
CC: [email protected]
Betreff: Re: error in setting speakergain in own application

Quoted 3 lines · Peter Kornatowski

Hi,

I have a linux application where i do some stuff with bluez (4.50) over

dbus. I have 3 headsets with which I test (Jabra BT530, Sora B-Speech, official PS3-BT headset) and on all I get the same behaviour/error.

Quoted 2 lines

I would like to set the speakergain of a headset from my linux-app. I

tried two methods:

Quoted 10 lines

a) call the method "SetProperty":

GValue value;
value.g_type = 0; // also tried: value = { 0 };
guint16 ugain = (guint16)gain; // also tried: guint ugain = (guint)gain; g_value_init(&value, G_TYPE_UINT);
g_value_set_uint(&value, ugain);
dbus_g_proxy_call(proxy, "SetProperty", &error, G_TYPE_STRING,
"SpeakerGain", G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID);

Quoted 4 lines

This would work (and you don't need to use a GValue, the call will take care of marshalling the value to the proper type:
dbus_g_proxy_call(proxy, "SetProperty", &error, G_TYPE_STRING,
"SpeakerGain", G_TYPE_UINT, ugain, G_TYPE_INVALID, G_TYPE_INVALID);

Thanks for the idea, but now I get the following error:
Method "SetProperty" with signature "su" on interface "org.bluez.Headset" doesn't exist

So the value is not set to the proper type, it still remains "u". Do you have any other ideas?

Greetings, Peter

Quoted 10 lines
Quoted 2 lines

g_value_unset(&value);

Cheers

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

Signature · 2 lines
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
#3 lore raw
Quoted 32 lines · Peter Kornatowski

-------- Original-Nachricht --------

Quoted 26 lines

Datum: Wed, 02 Sep 2009 15:37:59 +0100
Von: Bastien Nocera <[email protected]>
An: Peter Kornatowski <[email protected]>
CC: [email protected]
Betreff: Re: error in setting speakergain in own application

Quoted 3 lines · Peter Kornatowski

Hi,

I have a linux application where i do some stuff with bluez (4.50) over

dbus. I have 3 headsets with which I test (Jabra BT530, Sora B-Speech, official PS3-BT headset) and on all I get the same behaviour/error.

Quoted 2 lines

I would like to set the speakergain of a headset from my linux-app. I

tried two methods:

Quoted 10 lines

a) call the method "SetProperty":

GValue value;
value.g_type = 0; // also tried: value = { 0 };
guint16 ugain = (guint16)gain; // also tried: guint ugain = (guint)gain; g_value_init(&value, G_TYPE_UINT);
g_value_set_uint(&value, ugain);
dbus_g_proxy_call(proxy, "SetProperty", &error, G_TYPE_STRING,
"SpeakerGain", G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID);

Quoted 4 lines

This would work (and you don't need to use a GValue, the call will take care of marshalling the value to the proper type:
dbus_g_proxy_call(proxy, "SetProperty", &error, G_TYPE_STRING,
"SpeakerGain", G_TYPE_UINT, ugain, G_TYPE_INVALID, G_TYPE_INVALID);

Quoted 5 lines

Thanks for the idea, but now I get the following error:
Method "SetProperty" with signature "su" on interface "org.bluez.Headset" doesn't exist

So the value is not set to the proper type, it still remains "u". Do you have any other ideas?

Never mind, I didn't read your code properly.

The original code should work, given that the proxy used is the correct one. Check what path the proxy object has using dbus_g_proxy_get_path() and check against what you see in D-Feet (repeat with the name and interface if you didn't find a discrepancy).

Cheers