Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 41640b7d04ef5b5040e7668305a5ba3d > files > 190

python-kde4-doc-4.11.4-1.mga4.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
  <title>DNSSD.ServiceBrowser</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <link rel="stylesheet" type="text/css" href="../common/doxygen.css" />
  <link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../common/kde.css" />
</head>
<body>
<div id="container">
<div id="header">
  <div id="header_top">
    <div>
      <div>
        <img alt ="" src="../common/top-kde.jpg"/>
        KDE 4.9 PyKDE API Reference
      </div>
    </div>
  </div>
  <div id="header_bottom">
    <div id="location">
      <ul>
        <li>KDE's Python API</li>
      </ul>
    </div>

    <div id="menu">
      <ul>
        <li><a href="../modules.html">Overview</a></li>
<li><a href="http://techbase.kde.org/Development/Languages/Python">PyKDE Home</a></li>
<li><a href="http://kde.org/family/">Sitemap</a></li>
<li><a href="http://kde.org/contact/">Contact Us</a></li>
</ul>
    </div>
  </div>
</div>

<div id="body_wrapper">
<div id="body">
<div id="right">
<div class="content">
<div id="main">
<div class="clearer">&nbsp;</div>

<h1>ServiceBrowser Class Reference</h1>
<code>from PyKDE4.dnssd import *</code>
<p>
Inherits: QObject<br />

Namespace: <a href="../dnssd/DNSSD.html">DNSSD</a><br />
<h2>Detailed Description</h2>

<p>ServiceBrowser servicebrowser.h DNSSD/ServiceBrowser
Browses for network services advertised over DNS-SD
</p>
<p>
This is the central class in the DNSSD library for applications
that want to discover services on network.
</p>
<p>
Suppose that you need list of web servers running. Then you
might do something like
<pre class="fragment">
 DNSSD.ServiceBrowser* browser = new DNSSD.ServiceBrowser("_http._tcp");
 connect(browser, SIGNAL(serviceAdded(RemoteService.Ptr)),
         this,    SLOT(addService(RemoteService.Ptr)));
 connect(browser, SIGNAL(serviceRemoved(RemoteService.Ptr)),
         this,    SLOT(delService(RemoteService.Ptr)));
 browser-&gt;startBrowse();
</pre>
</p>
<p>
In above example addService() will be called for every web server
already running and for every web service that subsequently
appears on the network and delService() will be called when
a server previously advertised is stopped.
</p>
<p>
Because no domain was passed to constructor, the default domain
will be searched. To find other domains to browse for services on,
use DomainBrowser.
</p>
<p>

<dl class="author" compact><dt><b>Author:</b></dt><dd> Jakub Stachowski </dd></dl>
</p>
<table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#State">State</a>&nbsp;</td><td class="memItemRight" valign="bottom">{&nbsp;Working, Stopped, Unsupported&nbsp;}</td></tr>
<tr><td colspan="2"><br><h2>Signals</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#finished">finished</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#serviceAdded">serviceAdded</a> (KSharedPtr<DNSSD::RemoteService> service)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#serviceRemoved">serviceRemoved</a> (KSharedPtr<DNSSD::RemoteService> service)</td></tr>
<tr><td colspan="2"><br><h2>Methods</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ServiceBrowser">__init__</a> (self, QString type, bool autoResolve=0, QString domain=QString(), QString subtype=QString())</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#isAutoResolving">isAutoResolving</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">[KSharedPtr<DNSSD::RemoteService>]&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#services">services</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#startBrowse">startBrowse</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#virtual_hook">virtual_hook</a> (self, int a0, void a1)</td></tr>
<tr><td colspan="2"><br><h2>Static Methods</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#getLocalHostName">getLocalHostName</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../dnssd/DNSSD.ServiceBrowser.html#State">DNSSD.ServiceBrowser.State</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#isAvailable">isAvailable</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QHostAddress&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#resolveHostName">resolveHostName</a> (QString hostname)</td></tr>
</table>
<hr><h2>Signal Documentation</h2><a class="anchor" name="finished"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> finished</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Emitted when the list of published services has settled
</p>
<p>
This signal is emitted once after startBrowse() is called
when all the services of the requested type that are
currently published have been reported (even if none
are available or the DNS-SD service is not available).
It is emitted again when a new batch of services become
available or disappear.
</p>
<p>
For example, if a new host is connected to network and
announces some services watched for by this ServiceBrowser,
they will be reported by one or more serviceAdded() signals
and the whole batch will be concluded by finished().
</p>
<p>
This signal can be used by applications that just want to
get a list of the currently available services
(similar to a directory listing) and do not care about
adding or removing services that appear or disappear later.
</p>
<p>
<dl class="warning" compact><dt><b>Warning:</b></dt><dd>
There is no guarantee any RemoteService
pointers received by serviceAdded() will be valid
by the time this signal is emitted, so you should either
do all your work involving them in the slot receiving
the serviceAdded() signal, or you should listen to
serviceRemoved() as well.
</dd></dl> </p>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd> serviceAdded() and serviceRemoved()
</dd></dl>
</p><dl compact><dt><b>Signal syntax:</b></dt><dd><code>QObject.connect(source, SIGNAL("finished()"), target_slot)</code></dd></dl></div></div><a class="anchor" name="serviceAdded"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> serviceAdded</td>
<td>(</td>
<td class="paramtype">KSharedPtr<DNSSD::RemoteService>&nbsp;</td>
<td class="paramname"><em>service</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Emitted when new service is discovered
</p>
<p>
If isAutoResolving() returns true, this will not be emitted
until the service has been resolved.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>service</em>&nbsp;</td><td> a RemoteService object describing the service
</td></tr>
</table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> serviceRemoved() and finished()
</dd></dl>
</p><dl compact><dt><b>Signal syntax:</b></dt><dd><code>QObject.connect(source, SIGNAL("serviceAdded(DNSSD::RemoteService::Ptr)"), target_slot)</code></dd></dl></div></div><a class="anchor" name="serviceRemoved"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> serviceRemoved</td>
<td>(</td>
<td class="paramtype">KSharedPtr<DNSSD::RemoteService>&nbsp;</td>
<td class="paramname"><em>service</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Emitted when a service is no longer published over DNS-SD
</p>
<p>
The RemoteService object is removed from the services() list
and deleted immediately after this signal returns.
</p>
<p>
<dl class="warning" compact><dt><b>Warning:</b></dt><dd>
Do <b>not</b> use a delayed connection with this signal
</dd></dl> </p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>service</em>&nbsp;</td><td> a RemoteService object describing the service
</td></tr>
</table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> serviceAdded() and finished()
</dd></dl>
</p><dl compact><dt><b>Signal syntax:</b></dt><dd><code>QObject.connect(source, SIGNAL("serviceRemoved(DNSSD::RemoteService::Ptr)"), target_slot)</code></dd></dl></div></div><hr><h2>Method Documentation</h2><a class="anchor" name="ServiceBrowser"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype">&nbsp;<em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"><em>autoResolve=0</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>domain=QString()</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>subtype=QString()</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Create a ServiceBrowser for a particular service type
</p>
<p>
DomainBrowser can be used to find other domains to browse on.
If no domain is given, the default domain is used.
</p>
<p>
The service type is the high-level protocol type, followed by a dot,
followed by the transport protocol type (@c _tcp or _udp).
The <a href="http://www.dns-sd.org">DNS-SD website</a> maintains
<a href="http://www.dns-sd.org/ServiceTypes.html">a full list</a>
of service types.
</p>
<p>
The <b>subtype</b> parameter allows you to do more fine-grained filtering
on the services you are interested in. So you might request only
FTP servers that allow anonymous access by passing "_ftp._tcp" as the
<b>type</b> and "_anon" as the <b>subtype.</b> Subtypes are particularly
important for types like _soap and _upnp, which are far too generic
for most applications. In these cases, the subtype can be used to
specify the particular SOAP or UPnP protocol they want.
</p>
<p>
<dl class="warning" compact><dt><b>Warning:</b></dt><dd>
Enabling <b>autoResolve</b> will increase network usage by resolving
all services, so this feature should be used only when necessary.
</dd></dl> </p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>type</em>&nbsp;</td><td> service types to browse for (example: "_http._tcp")

<tr><td></td><td valign="top"><em>autoResolve</em>&nbsp;</td><td> discovered services will be resolved before being
reported with the serviceAdded() signal

<tr><td></td><td valign="top"><em>domain</em>&nbsp;</td><td> a domain to search on instead of the default one

<tr><td></td><td valign="top"><em>subtype</em>&nbsp;</td><td> only browse for a specific subtype
</td></tr>
</table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> startBrowse() and isAvailable()
</dd></dl>
</p></div></div><a class="anchor" name="isAutoResolving"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isAutoResolving</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Whether discovered services are resolved before being reported
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> the value of the <b>autoResolve</b> parameter passed to the constructor
</dd></dl> </p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.1
</dd></dl>
</p></div></div><a class="anchor" name="services"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">[KSharedPtr<DNSSD::RemoteService>] services</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The currently known services of the specified type
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> a list of RemoteService pointers
</dd></dl> </p>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd> serviceAdded() and serviceRemoved()
</dd></dl>
</p></div></div><a class="anchor" name="startBrowse"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> startBrowse</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Starts browsing for services
</p>
<p>
Only the first call to this function will have any effect.
</p>
<p>
Browsing stops when the ServiceBrowser object is destroyed.
</p>
<p>
<dl class="warning" compact><dt><b>Warning:</b></dt><dd> The serviceAdded() signal may be emitted before this
function returns.
</dd></dl> </p>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd> serviceAdded(), serviceRemoved() and finished()
</dd></dl>
</p></div></div><a class="anchor" name="virtual_hook"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> virtual_hook</td>
<td>(</td>
<td class="paramtype">&nbsp;<em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"><em>a0</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"><em>a1</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><hr><h2>Static Method Documentation</h2><a class="anchor" name="getLocalHostName"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString getLocalHostName</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>The mDNS hostname of the local machine
</p>
<p>
Usually this will return the same as QHostInfo.localHostName(),
but it may be changed to something different
in the Avahi configuration file (if using the Avahi backend).
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> the hostname, or an empty string on failure
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.2
</dd></dl>
</p></div></div><a class="anchor" name="isAvailable"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../dnssd/DNSSD.ServiceBrowser.html#State">DNSSD.ServiceBrowser.State</a> isAvailable</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Checks availability of DNS-SD services
</p>
<p>
Although this method is part of ServiceBrowser, none of the classes
in this library will be able to perform their intended function
if this method does not return Working.
</p>
<p>
If this method does not return Working, it is still safe to call
any of the methods in this library. However, no services will be
found or published and no domains will be found.
</p>
<p>
If you use this function to report an error to the user, below
is a suggestion on how to word the errors when publishing a
service. The first line of each error message can also be
used for reporting errors when browsing for services.
</p>
<p>
<pre class="fragment">
 switch(DNSSD.ServiceBrowser.isAvailable()) {
 case DNSSD.ServiceBrowser.Working:
     return "";
 case DNSSD.ServiceBrowser.Stopped:
     return i18n("&lt;p&gt;The Zeroconf daemon is not running. See the Service"
                 " Discovery Handbook for more information.&lt;br/&gt;"
                 "Other users will not see the services provided by this
                 " system when browsing the network via zeroconf, but "
                 " normal access will still work.&lt;/p&gt;");
 case DNSSD.ServiceBrowser.Unsupported:
     return i18n("&lt;p&gt;Zeroconf support is not available in this version of KDE."
                 " See the Service Discovery Handbook for more information.&lt;br/&gt;"
                 "Other users will not see the services provided by this
                 " application when browsing the network via zeroconf, but "
                 " normal access will still work.&lt;/p&gt;");
 default:
     return i18n("&lt;p&gt;Unknown error with Zeroconf.&lt;br/&gt;"
                 "Other users will not see the services provided by this
                 " application when browsing the network via zeroconf, but "
                 " normal access will still work.&lt;/p&gt;");
 }
</pre>
</p></div></div><a class="anchor" name="resolveHostName"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QHostAddress resolveHostName</td>
<td>(</td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>hostname</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Resolves an mDNS hostname into an IP address
</p>
<p>
This function is very rarely useful, since a properly configured
system is able to resolve an mDNS-based host name using the system
resolver (ie: you can just pass the mDNS hostname to KIO or other
library).
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>hostname</em>&nbsp;</td><td> the hostname to be resolved
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> a QHostAddress containing the IP address, or QHostAddress() if
resolution failed
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.2
</dd></dl>
</p></div></div><hr><h2>Enumeration Documentation</h2><a class="anchor" name="State"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr><td class="memname">State</td>
</tr>
</table>
</div>
<div class="memdoc"><p>Availability of DNS-SD services
</p><dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>Working</em>&nbsp;</td><td><tr><td valign="top"><em>Stopped</em>&nbsp;</td><td><tr><td valign="top"><em>Unsupported</em>&nbsp;</td><td></table>
</dl>
</div></div><p>
</div>
</div>
</div>

<div id="left">

<div class="menu_box">
<div class="nav_list">
<ul>
<li><a href="../allclasses.html">Full Index</a></li>
</ul>
</div>

<a name="cp-menu" /><div class="menutitle"><div>
  <h2 id="cp-menu-project">Modules</h2>
</div></div>
<div class="nav_list">
<ul><li><a href="../akonadi/index.html">akonadi</a></li>
<li><a href="../dnssd/index.html">dnssd</a></li>
<li><a href="../kdecore/index.html">kdecore</a></li>
<li><a href="../kdeui/index.html">kdeui</a></li>
<li><a href="../khtml/index.html">khtml</a></li>
<li><a href="../kio/index.html">kio</a></li>
<li><a href="../knewstuff/index.html">knewstuff</a></li>
<li><a href="../kparts/index.html">kparts</a></li>
<li><a href="../kutils/index.html">kutils</a></li>
<li><a href="../nepomuk/index.html">nepomuk</a></li>
<li><a href="../phonon/index.html">phonon</a></li>
<li><a href="../plasma/index.html">plasma</a></li>
<li><a href="../polkitqt/index.html">polkitqt</a></li>
<li><a href="../solid/index.html">solid</a></li>
<li><a href="../soprano/index.html">soprano</a></li>
</ul></div></div>

</div>

</div>
  <div class="clearer"/>
</div>

<div id="end_body"></div>
</div>
<div id="footer"><div id="footer_text">
This documentation is maintained by <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;simon&#64;simonzone&#46;com">Simon Edwards</a>.<br />
        KDE<sup>&#174;</sup> and <a href="../images/kde_gear_black.png">the K Desktop Environment<sup>&#174;</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
        <a href="http://www.kde.org/contact/impressum.php">Legal</a>
    </div></div>
</body>
</html>