How to add self-defined variant type
dtdang
ddt.fet.hut at gmail.com
Wed Nov 21 08:16:15 UTC 2018
Hi Lawrence,
Could you give example by using libdbus C ?
The variant type is required as spec by customer.
Actually, the type of variant is not fixed as bellows.
array [
dict entry(
string "bssid"
variant array of bytes [
7a a1 d7 02 dc 31
]
)
dict entry(
string "capabilities"
variant uint16 32
)
dict entry(
string "extended_capabilities"
variant uint32 16777248
...
Thanks,
Ton
On Wed, Nov 14, 2018 at 9:00 PM <dbus-request at lists.freedesktop.org> wrote:
> Send dbus mailing list submissions to
> dbus at lists.freedesktop.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.freedesktop.org/mailman/listinfo/dbus
> or, via email, send a message with subject or body 'help' to
> dbus-request at lists.freedesktop.org
>
> You can reach the person managing the list at
> dbus-owner at lists.freedesktop.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of dbus digest..."
>
>
> Today's Topics:
>
> 1. How to add self-defined variant type ? (dtdang)
> 2. Re: How to add self-defined variant type ? (Lawrence D'Oliveiro)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 14 Nov 2018 16:34:46 +0900
> From: dtdang <ddt.fet.hut at gmail.com>
> To: dbus at lists.freedesktop.org
> Subject: How to add self-defined variant type ?
> Message-ID:
> <
> CAJpUOaefS1X4Jgi+bEY+43rPufAmY-SwH83BMpXSetbGLe47rQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hello,
>
> 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 ?
>
> dict entry(
> string "bssid"
> variant array of bytes [7a a1 d7 02 dc 31]
> )
>
> Thanks,
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://lists.freedesktop.org/archives/dbus/attachments/20181114/841a781b/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Wed, 14 Nov 2018 21:08:55 +1300
> From: Lawrence D'Oliveiro <ldo at geek-central.gen.nz>
> To: dbus at lists.freedesktop.org
> Subject: Re: How to add self-defined variant type ?
> Message-ID: <20181114210855.19112ceb at theon.geek-central.gen.nz>
> Content-Type: text/plain; charset=UTF-8
>
> 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]]
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dbus
>
>
> ------------------------------
>
> End of dbus Digest, Vol 160, Issue 9
> ************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20181121/3d71a777/attachment.html>
More information about the dbus
mailing list