Return-Path: Message-ID: <037601c8c78f$c71a00c0$6701a8c0@freqonedev> From: "David Stockwell" To: "BlueZ development" Date: Thu, 5 Jun 2008 23:42:48 -0500 MIME-Version: 1.0 Subject: [Bluez-devel] Retrieving an Array of Strings, that is attached to a G_HASH_TABLE variant Reply-To: BlueZ development List-Id: BlueZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============2035804604==" Sender: bluez-devel-bounces@lists.sourceforge.net Errors-To: bluez-devel-bounces@lists.sourceforge.net This is a multi-part message in MIME format. --===============2035804604== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0373_01C8C765.DC51C5B0" This is a multi-part message in MIME format. ------=_NextPart_000_0373_01C8C765.DC51C5B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable In Bluez, certain messages return a GHashTable of type (G_TYPE_STRING, = G_TYPE_VALUE), so the key is a String, and the value is a Variant. Many = of the values returned are boolean, integer, and other simple types; = others are a boxed Object Path. These I can handle. However, in a couple of cases, the value returned is an array of = pointers to strings (G_TYPE_STRV). To retrieve the strings, I am trying something like the following: (GStrv) gPropValue =3D (GStrv) g_hash_table_lookup(propTable, = "Strings"); // Assume that the "key" is "Strings" if (gPropValue) { while (*gPropValue) { cout << *gPropValue << endl; ++gPropValue; } } I do get a properly terminated list of pointers, but each pointer points = to a null string. ('\0') I have not yet added debug statements to syslog (my next step) into the = system level code, but why are the strings not filled in? What else am = I missing? Any suggestions? David Stockwell ------=_NextPart_000_0373_01C8C765.DC51C5B0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
In Bluez, certain messages return a = GHashTable of=20 type (G_TYPE_STRING, G_TYPE_VALUE), so the key is a String, and the = value is a=20 Variant.  Many of the values returned are boolean, integer, and = other=20 simple types; others are a boxed Object Path.  These I can=20 handle.
 
However, in a couple of cases, the = value returned=20 is an array of pointers to strings (G_TYPE_STRV).
 
To retrieve the strings, I am trying = something like=20 the following:
 
(GStrv) gPropValue =3D (GStrv)=20 g_hash_table_lookup(propTable, "Strings"); // Assume that the "key" is=20 "Strings"
if (gPropValue) {
  while (*gPropValue) = {
    cout << = *gPropValue=20 << endl;
    = ++gPropValue;
  }
}
 
I do get a properly terminated list of = pointers,=20 but each pointer points to a null string. ('\0')
 
I have not yet added debug statements = to syslog (my=20 next step) into the system level code, but why are the strings not = filled=20 in?  What else am I missing?  Any suggestions?
 
David = Stockwell
------=_NextPart_000_0373_01C8C765.DC51C5B0-- --===============2035804604== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php --===============2035804604== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel --===============2035804604==--