<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Glenn,<br>
<br>
What do you mean by "The browser only seems to signal back on its
first run"? signal back what, new services? I use Avahi-client
(c api) in Qt. Avahi-client talks to the daemon over d-bus. My
callback fires whenever a service is added or removed long after
startup.<br>
<br>
On 15-09-01 02:28 PM, Glenn Martin wrote:<br>
</div>
<blockquote
cite="mid:1794849043.4377538.1441132102211.JavaMail.yahoo@mail.yahoo.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif;font-size:16px">
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr">My team and
i are trying to integrate Avahi via DBUS in Go (golang.org). I
have read through the documentation and i have worked with the
python bindings as a guide, we have basic browsing working,
however we seem to be running in to a few unexpected issues.<br>
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr">The browser
(<a class="moz-txt-link-freetext" href="http://avahi.org/download/ServiceBrowser.introspect.xml">http://avahi.org/download/ServiceBrowser.introspect.xml</a>) only
seems to signal back on its first run. This makes sense for
efficiencies sake, however in cases of things such as unit
tests, this means that the code that tests various lookups
fail on subsequent runs. Given that we are following a light
form of TDD this is becomming a real issue. </div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr">Is there
anyway to clear the Browser's cache or make it repeat values?
Or perhaps have some way to know when a session is over and
the next request will require a full update, not just a
differential? Code example at EOF.</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr">Thanks!</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr">Glenn Martin</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr">// The
following is a messy excerpt from the code we are presently
using to test. Many of the constants are stolen from the
python bindings found here: <span style="color: rgb(128, 128,
128); font-style: italic; font-family: 'Eco Coding';
font-size: 12pt; white-space: pre-wrap; background-color:
rgb(216, 213, 185);" id="yui_3_16_0_1_1441131540137_4343"
class=""><a moz-do-not-send="true"
href="http://git.0pointer.net/avahi.git/tree/avahi-python/avahi/__init__.py"
id="yui_3_16_0_1_1441131540137_4341">http://git.0pointer.net/avahi.git/tree/avahi-python/avahi/__init__.py</a></span></div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4085"> </span>sysbus, err :=
dbus.SystemBusPrivate()</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4088"> </span>if err != nil
{</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4091"> </span>return err</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4094"> </span>}</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4097" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4100"> </span>defer
sysbus.Close()</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4103" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4106"> </span>if err =
sysbus.Auth(nil); err != nil {</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4109"> </span>return err</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4112"> </span>}</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4115"> </span>if err =
sysbus.Hello(); err != nil {</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4118"> </span>return err</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4121"> </span>}</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4124" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4127"> </span>logs.Infof("SysBus
=> %+ v", sysbus)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4130" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4133"> </span>/* Lets get
our Service object */</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4136"> </span>avahiObject :=
sysbus.Object(DBUS_NAME, DBUS_PATH_SERVER)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4139" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4142"> </span>logs.Infof("Avahi
Object => %+v", avahiObject)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4145" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4148"> </span>/* Were gonna
need this for resolution later. */</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4151"> </span>var items
[]serviceBrowserRecord = []serviceBrowserRecord{}</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4154" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4157"> </span>/* Now lets
listen to our ServiceBrowser and Listen in to its wisdom */</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4160"> </span>c :=
avahiObject.Call("ServiceBrowserNew", 0, IF_UNSPEC,
PROTO_UNSPEC, service, "local", uint32(0))</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4163"> </span>if c.Err !=
nil {</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4166"> </span>panic(c.Err)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4169"> </span>}</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4172"> </span>logs.Infof("Browser
Object Response => %+v", c)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4175" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4178"> </span>browserObject
:= sysbus.Object(DBUS_INTERFACE_SERVICE_BROWSER,
c.Body[0].(dbus.ObjectPath))</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4181" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4184"> </span>defer
browserObject.Call("Free", 0)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4187" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4190"> </span>logs.Infof("Browser
Object => %+v", browserObject)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4193" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4196"> </span>browserMatchingRule
:=
fmt.Sprintf("type='signal',path='%s',interface='%s',sender='%s'",
c.Body[0].(dbus.ObjectPath), DBUS_INTERFACE_SERVICE_BROWSER,
DBUS_INTERFACE_SERVICE_BROWSER)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4199" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4202"> </span>sysbus.BusObject().Call(DBUS_OFD_ADD_MATCH,
0, browserMatchingRule)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4205" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4208"> </span>ch :=
make(chan *dbus.Signal, 10)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4211" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4214"> </span>sysbus.Signal(ch)</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><br
id="yui_3_16_0_1_1441131540137_4217" class="">
</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4220"> </span>breakIt :=
false</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4223"> </span>for v := range
ch {</div>
<div id="yui_3_16_0_1_1441131540137_3709" dir="ltr" class=""><span
class="" style="white-space:pre-wrap;"
id="yui_3_16_0_1_1441131540137_4226"> </span>logs.Infof("SIG
=> %+v",v)</div>
<div dir="ltr" id="yui_3_16_0_1_1441131540137_4228" class="">}</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
avahi mailing list
<a class="moz-txt-link-abbreviated" href="mailto:avahi@lists.freedesktop.org">avahi@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/avahi">http://lists.freedesktop.org/mailman/listinfo/avahi</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Jonathan Bagg
Embedded Systems Developer
NAD Electronics | Lenbrook Industries Limited
633 Granite Court, Pickering, Ontario, Canada L1W 3K1 | 905-831-0799 ext 4478 | <a class="moz-txt-link-freetext" href="http://www.nadelectronics.com">http://www.nadelectronics.com</a></pre>
</body>
</html>