Re: How to add self-defined variant type ?

Lawrence D'Oliveiro <ldo-kC51rjc0cqs1dNLGKZg6taU/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Geek Central
Message-ID <[email protected]>
On Wed, 14 Nov 2018 16:34:46 +0900, dtdang wrote:

> I want to define new type of dbus variant as 'array of bytes' and
> value of it is '7a a1 d7 02 dc 31'
> Could you help me how to create/define new variant type ?

Don’t need a variant type if the element type is fixed:

Code:

    import dbussy

    mes = dbussy.Message.new(dbussy.DBUS.MESSAGE_TYPE_METHOD_CALL)

    indata = (0x7a, 0xa1, 0xd7, 0x02, 0xdc, 0x31)
    mes.append_objects("ay", indata)
    outdata = mes.all_objects
    outdata

Output:

    [[122, 161, 215, 2, 220, 49]]
_______________________________________________
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.