n00b: signals with an extensible message
Tim Hockin
thockin at hockin.org
Tue Feb 16 07:04:34 PST 2010
Are there examples of marshalling/unmarshalling an a{sv} payload?
That might work..
On Mon, Feb 15, 2010 at 11:22 PM, Thiago Macieira <thiago at kde.org> wrote:
> Em Terça-feira 16. Fevereiro 2010, às 03.04.23, Tim Hockin escreveu:
>> Hey there,
>>
>> I'm finally getting around to adding dbus support to some tools, and
>> I'm not sure how to do the payload.
>>
>> What I have is a data structure. It has about 10 fields (all numeric,
>> a mix of sizes and signedness) right now, but I know it will grow in
>> the future (new fields, not modifying or removing old ones). I want
>> to send signals which carry the equivalent of this data structure.
>> What I don't know is how to do this safely through DBUS.
>>
>> What happens if the server is newer and has more fields than the
>> client knows about?
>>
>> What happens if the server is older and has less fields than the
>> client knows about?
>>
>> Is there a canonical answer to this?
>
> Yes: it's not safe to do what you want.
>
> If you change the structure (adding or removing elements), the signal will
> change its signature, so the lookup & connection mechanism will probably fail.
>
> If you have a variable-sized argument, I recommend you consider using a hash
> or array (av or a{sv}).
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Senior Product Manager - Nokia, Qt Development Frameworks
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>
>
More information about the dbus
mailing list