How to add self-defined variant type ?

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Wed Nov 14 08:08:55 UTC 2018


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]]


More information about the dbus mailing list