<div dir="ltr"><br>On Thu, Nov 24, 2011 at 21:33, Ludo Brands <span dir="ltr"><<a href="mailto:ludo.brands@free.fr" target="_blank">ludo.brands@free.fr</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<u></u>





<div><div><div>
<div><font color="#0000ff" face="Arial" size="2"></font> </div>
<blockquote dir="ltr" style="PADDING-LEFT:5px;MARGIN-LEFT:5px;BORDER-LEFT:#0000ff 2px solid;MARGIN-RIGHT:0px">
  <blockquote dir="ltr" style="PADDING-LEFT:5px;MARGIN-LEFT:5px;BORDER-LEFT:#0000ff 2px solid;MARGIN-RIGHT:0px">
    <div></div><font color="#0000ff" face="Arial" size="2"></font>
    <div dir="ltr"><br>I'm Trying to send notification using D-Bus Notify 
    method.<br>The thing is, that I do not understand how to properly use 
    it.<br>My current code: <a href="https://github.com/ik5/display-quotes/blob/master/src/units/untquotedbus.pas#L92" target="_blank">https://github.com/ik5/display-quotes/blob/master/src/units/untquotedbus.pas#L92</a><br>


<br>I'ved 
    marked the place where i Have AccessViolation exception.<br>What am I doing 
    wrong here ?<br><br><span><font color="#0000ff" face="Arial" size="2"> </font></span></div></blockquote>
  <div dir="ltr"><span> <font color="#0000ff" face="Arial" size="2">At first sight there are several things 
  wrong:</font></span></div>
  <div dir="ltr"><span><font color="#0000ff" face="Arial" size="2">- all values should be pointers to variables. PINTEGER(100) should be 
  the address of a variable that contains 100.</font></span></div>
  <div dir="ltr"><span><font color="#0000ff" face="Arial" size="2">- null pchars are not allowed (empty strings!)</font></span></div>
  <div dir="ltr"><span><font color="#0000ff" face="Arial" size="2">- 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</font></span></div>
  <div dir="ltr"><span><font color="#0000ff" face="Arial" size="2">- the array of const should terminate with a 
  DBUS_TYPE_INVALID</font></span></div>
  <div dir="ltr"><span><font color="#0000ff" face="Arial" size="2">- I doubt DBUS_TYPE_DICT_ENTRY is allowed in 
  dbus_message_append_args</font></span></div>
  <div dir="ltr"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
  <div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2">Ludo<span> </span></font></font></font></span></div>
  <div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div></blockquote>
</div></div><div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>A small 
rectification:</span></font></font></font></span></div>
<div dir="ltr"><span><font><font><span>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2">- 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 <b>the </b><span><b>pointer to</b> the </span>array, number of 
elements in the array<span>.</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>So to send an uint32, 
a string and an array of uint32 you hvae to do the 
following:</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>var 
</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>  
i:dword;</span></font></font></font></span></div>  
s:string;</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>  aa: array[0..4] 
of dword;</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>  
sp,aap:pointer;</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>...</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>s:='Display 
Qoutes';</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>sp:=@s[1];</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>aap:=@aa[0];</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>dbus_message_append_args(msg,</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>    
DBUS_TYPE_UINT32,</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>    
[@i,</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>    DBUS_TYPE_STRING,</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>    @sp,</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>    DBUS_TYPE_ARRAY,</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>    DBUS_TYPE_UINT32,</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>    @aap,</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>    PLongInt(5),</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>    DBUS_TYPE_INVALID] 
);</span></font></font></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span>Tested on ubuntu 
x64, message checked with dbus-monitor.<font><font><font face="Arial"><font color="#0000ff"><font size="2"></font></font></font></font></font> </span></font></font></font></span></div></span></font></font></span></div><span><font color="#888888">
<div dir="ltr"><span><span><font><font><font face="Arial"><font color="#0000ff"><font size="2"></font></font></font></font></font></span></span> </div></font></span></div></blockquote><div>Thank you Ludo. It still does not work, now it complains about the interface is wrong for some reason.<br>

I gave up, and I <a href="https://github.com/ik5/libnotify-fpc">binded libnotify</a> instead.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<div><span><font color="#888888">
<div dir="ltr"><span><span><font><font><font face="Arial"><font color="#0000ff"><font size="2">Ludo</font></font></font></font></font></span></span></div></font></span></div></blockquote><div><br>Ido <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><span><font color="#888888">
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span> </div></font></span></div>
<div dir="ltr"><span><font face="Arial"><font color="#0000ff"><font size="2"><span> </span></font></font></font></span></div>
<br>_______________________________________________<br>
fpc-pascal maillist  -  <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br></blockquote></div><br></div>