RE: packing an array of dictionaries

"koorapati, koundinya" <Koundinya.Koorapati-xgeKidS/TS9Wk0Htik3J/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <DM6PR19MB2473BC480EAEE0B11C7E6E8E97B90@DM6PR19MB2473.namprd19.prod.outlook.com>
I was having issues with encoding data and figured out that this is the way I can achieve it. 

        GVariantBuilder *b1 = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
        g_variant_builder_init (b1, G_VARIANT_TYPE ("a{sv}"));
        g_variant_builder_add (b1, "{sv}", "origin", g_variant_new_string("compat:suse:/etc/sysconfig/network/ifcfg-eth2"));
        gchar array[] = {0x70, 0x4f, 0xd6, 0x77, 0x5d, 0x73, 0x5d, 0x80, 0x83, 0x90, 0x3b, 0x2b, 0xb0, 0x57, 0x2d, 0xff};
        g_variant_builder_add (b1, "{sv}", "uuid", g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, array, 16, sizeof(gchar)));
        g_variant_builder_add (b1, "{sv}", "owner-uid", g_variant_new_uint32(4294967295));
        GVariant *v2 = g_variant_builder_end(b1);
        g_variant_builder_unref(b1);

        GVariantBuilder *b2 = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
        g_variant_builder_init (b2, G_VARIANT_TYPE ("a{sv}"));
        g_variant_builder_add (b2, "{sv}", "config", v2);
        GVariant *v3 = g_variant_builder_end(b2);

Thank You!

-----Original Message-----
From: dbus <[email protected]> On Behalf Of Lawrence D'Oliveiro
Sent: Tuesday, May 19, 2020 4:15 AM
To: [email protected]
Subject: Re: packing an array of dictionaries


[EXTERNAL EMAIL] 

On Mon, 18 May 2020 13:20:00 +0000, koorapati, koundinya wrote:

> but are getting some or the other issue.

Maybe it would help if you told us what the issue was ...
_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.