Re: How to add self-defined variant type

dtdang <[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <CAJpUOac778NgBgqLt46vnDHq80p4qVWubw6DC9TahS7ty-3Bdg@mail.gmail.com>
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 <[email protected]> wrote:

> Send dbus mailing list submissions to
>         [email protected]
>
> 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
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> 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 <[email protected]>
> To: [email protected]
> Subject: How to add self-defined variant type ?
> Message-ID:
>         <
> CAJpUOaefS1X4Jgi+bEY+43rPufAmY-SwH83BMpXSetbGLe47rQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
> 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-kC51rjc0cqs1dNLGKZg6taU/[email protected]>
> To: [email protected]
> Subject: Re: How to add self-defined variant type ?
> Message-ID: <20181114210855.19112ceb-QEjm8wl6P5m5/[email protected]>
> 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
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dbus
>
>
> ------------------------------
>
> End of dbus Digest, Vol 160, Issue 9
> ************************************
>

_______________________________________________
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.