[fpc-pascal] FPC And D-Bus

ik idokan at gmail.com
Fri Nov 25 16:57:48 CET 2011


On Thu, Nov 24, 2011 at 21:33, Ludo Brands <ludo.brands at free.fr> wrote:

> **
>
>
>
> I'm Trying to send notification using D-Bus Notify method.
> The thing is, that I do not understand how to properly use it.
> My current code:
> https://github.com/ik5/display-quotes/blob/master/src/units/untquotedbus.pas#L92
>
> I'ved marked the place where i Have AccessViolation exception.
> What am I doing wrong here ?
>
>
>
>  At first sight there are several things wrong:
> - all values should be pointers to variables. PINTEGER(100) should be the
> address of a variable that contains 100.
> - null pchars are not allowed (empty strings!)
> - DBUS_TYPE_ARRAY should be a group of 4 elements:  DBUS_TYPE_ARRAY , the
> type of array elements (fe DBUS_TYPE_UINT32), the address of the array,
> number of elements in the array
> - the array of const should terminate with a DBUS_TYPE_INVALID
> - I doubt DBUS_TYPE_DICT_ENTRY is allowed in dbus_message_append_args
>
> Ludo
>
>
> A small rectification:
>  - DBUS_TYPE_ARRAY should be a group of 4 elements:  DBUS_TYPE_ARRAY ,
> the type of array elements (fe DBUS_TYPE_UINT32), the address of *the **pointer
> to* the array, number of elements in the array.
>
> So to send an uint32, a string and an array of uint32 you hvae to do the
> following:
>
> var
>    i:dword;
>   s:string;
>   aa: array[0..4] of dword;
>   sp,aap:pointer;
>
> ...
>
> s:='Display Qoutes';
> sp:=@s[1];
> aap:=@aa[0];
> dbus_message_append_args(msg,
>     DBUS_TYPE_UINT32,
>     [@i,
>     DBUS_TYPE_STRING,
>     @sp,
>     DBUS_TYPE_ARRAY,
>     DBUS_TYPE_UINT32,
>     @aap,
>     PLongInt(5),
>     DBUS_TYPE_INVALID] );
>
>
> Tested on ubuntu x64, message checked with dbus-monitor.
>
>
Thank you Ludo. It still does not work, now it complains about the
interface is wrong for some reason.
I gave up, and I binded libnotify <https://github.com/ik5/libnotify-fpc>instead.


>  Ludo
>

Ido

>
>
>
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111125/19ed61fd/attachment.html>


More information about the fpc-pascal mailing list