\section{DNSSD::Public\-Service Class Reference}
\label{classDNSSD_1_1PublicService}\index{DNSSD::PublicService@{DNSSD::PublicService}}
This class is most important for application that wants to announce its service on network. This class represents local service being published.  


{\tt \#include $<$publicservice.h$>$}

Inheritance diagram for DNSSD::Public\-Service:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=109pt]{classDNSSD_1_1PublicService__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for DNSSD::Public\-Service:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=154pt]{classDNSSD_1_1PublicService__coll__graph}
\end{center}
\end{figure}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf published} (bool)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Public\-Service} (const {\bf QString} \&{\bf name}=QString::null, const {\bf QString} \&type=QString::null, unsigned int port=0, const {\bf QString} \&domain=QString::null)
\item 
void {\bf stop} ()
\item 
bool {\bf publish} ()
\item 
bool {\bf is\-Published} () const 
\item 
void {\bf publish\-Async} ()
\item 
void {\bf set\-Text\-Data} (const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \&text\-Data)
\item 
void {\bf set\-Service\-Name} (const {\bf QString} \&service\-Name)
\item 
void {\bf set\-Type} (const {\bf QString} \&type)
\item 
void {\bf set\-Port} (unsigned short port)
\item 
void {\bf set\-Domain} (const {\bf QString} \&domain)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf custom\-Event} ({\bf QCustom\-Event} $\ast${\bf event})\label{classDNSSD_1_1PublicService_b0}

\item 
virtual void {\bf virtual\_\-hook} (int, void $\ast$)\label{classDNSSD_1_1PublicService_b1}

\end{CompactItemize}


\subsection{Detailed Description}
This class is most important for application that wants to announce its service on network. This class represents local service being published. 

Suppose that you want to make your web server public - this is simplest way:



\footnotesize\begin{verbatim}DNSSD::PublicService *service = new DNSSD::PublicService("My files","_http._tcp",80);
bool isOK = service->publish();
\end{verbatim}
\normalsize


In this example {\bf publish()}{\rm (p.\,\pageref{classDNSSD_1_1PublicService_a3})} is synchronous - it will not return until publishing is complete. This is usually not too long but it can freeze application's GUI for a moment. Asynchronous publishing is better for responsiveness. Example:



\footnotesize\begin{verbatim}DNSSD::PublicService *service = new DNSSD::PublicService("My files","_http._tcp",80);
connect(service,SIGNAL(published(bool)),this,SLOT(wasPublished(bool)));
service->publishAsync();
\end{verbatim}
\normalsize


\begin{Desc}
\item[Author:]Jakub Stachowski \end{Desc}




Definition at line 55 of file publicservice.h.

\subsection{Constructor \& Destructor Documentation}
\index{DNSSD::PublicService@{DNSSD::Public\-Service}!PublicService@{PublicService}}
\index{PublicService@{PublicService}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}DNSSD::Public\-Service::Public\-Service (const {\bf QString} \& {\em name} = {\tt QString::null}, const {\bf QString} \& {\em type} = {\tt QString::null}, unsigned int {\em port} = {\tt 0}, const {\bf QString} \& {\em domain} = {\tt QString::null})}\label{classDNSSD_1_1PublicService_a0}


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]Service name. If set to QString::null, computer name will be used and will be available via {\bf service\-Name()}{\rm (p.\,\pageref{classDNSSD_1_1ServiceBase_a2})} after successful registration \item[{\em type}]Service type. Has to be in form \_\-sometype.\_\-udp or \_\-sometype.\_\-tcp \item[{\em port}]Port number. Set to 0 to \char`\"{}reserve\char`\"{} service name. \item[{\em domain}]Domain name. If left as {\bf QString}:null, user configuration will be used. \char`\"{}local.\char`\"{} means local LAN\end{description}
\end{Desc}


Definition at line 47 of file publicservice.cpp.

References QString::is\-Null().

\subsection{Member Function Documentation}
\index{DNSSD::PublicService@{DNSSD::Public\-Service}!stop@{stop}}
\index{stop@{stop}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void DNSSD::Public\-Service::stop ()}\label{classDNSSD_1_1PublicService_a2}


Stops publishing or abort incomplete publish request. 

Useful when you want to disable service for some time.

Definition at line 122 of file publicservice.cpp.

Referenced by publish\-Async(), set\-Domain(), set\-Port(), set\-Service\-Name(), set\-Text\-Data(), and set\-Type().\index{DNSSD::PublicService@{DNSSD::Public\-Service}!publish@{publish}}
\index{publish@{publish}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool DNSSD::Public\-Service::publish ()}\label{classDNSSD_1_1PublicService_a3}


Synchrounous publish. 

Application will be freezed until publishing is complete. \begin{Desc}
\item[Returns:]true if successfull.\end{Desc}


Definition at line 115 of file publicservice.cpp.

References publish\-Async().\index{DNSSD::PublicService@{DNSSD::Public\-Service}!isPublished@{isPublished}}
\index{isPublished@{isPublished}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool DNSSD::Public\-Service::is\-Published () const}\label{classDNSSD_1_1PublicService_a4}


Returns true is currently published. 



Definition at line 101 of file publicservice.cpp.\index{DNSSD::PublicService@{DNSSD::Public\-Service}!publishAsync@{publishAsync}}
\index{publishAsync@{publishAsync}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void DNSSD::Public\-Service::publish\-Async ()}\label{classDNSSD_1_1PublicService_a5}


Asynchronous version of {\bf publish()}{\rm (p.\,\pageref{classDNSSD_1_1PublicService_a3})}. 

It return immediately and emits signal {\bf published(bool)}{\rm (p.\,\pageref{classDNSSD_1_1PublicService_l0})} when completed. Note that in case of early detected error (like bad service type) signal may be emitted before return of this function.

Definition at line 128 of file publicservice.cpp.

References QString::ascii(), QMap::begin(), QMap::end(), QCString::length(), published(), stop(), and QString::utf8().

Referenced by publish(), set\-Domain(), set\-Port(), set\-Service\-Name(), set\-Text\-Data(), and set\-Type().\index{DNSSD::PublicService@{DNSSD::Public\-Service}!setTextData@{setTextData}}
\index{setTextData@{setTextData}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void DNSSD::Public\-Service::set\-Text\-Data (const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \& {\em text\-Data})}\label{classDNSSD_1_1PublicService_a6}


Sets new text properties. 

If services is already published, it will be re-announced with new data.

Definition at line 106 of file publicservice.cpp.

References publish\-Async(), and stop().\index{DNSSD::PublicService@{DNSSD::Public\-Service}!setServiceName@{setServiceName}}
\index{setServiceName@{setServiceName}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void DNSSD::Public\-Service::set\-Service\-Name (const {\bf QString} \& {\em service\-Name})}\label{classDNSSD_1_1PublicService_a7}


Sets name of the service. 

If service is currently published, it will be re-announced with new data.

Definition at line 64 of file publicservice.cpp.

References publish\-Async(), and stop().\index{DNSSD::PublicService@{DNSSD::Public\-Service}!setType@{setType}}
\index{setType@{setType}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void DNSSD::Public\-Service::set\-Type (const {\bf QString} \& {\em type})}\label{classDNSSD_1_1PublicService_a8}


Sets type of service. 

It has to in form of \_\-type.\_\-udp or \_\-type.\_\-tcp. If service is currently published, it will be re-announced with new data.

Definition at line 83 of file publicservice.cpp.

References publish\-Async(), and stop().\index{DNSSD::PublicService@{DNSSD::Public\-Service}!setPort@{setPort}}
\index{setPort@{setPort}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void DNSSD::Public\-Service::set\-Port (unsigned short {\em port})}\label{classDNSSD_1_1PublicService_a9}


Sets port. 

If service is currently published, it will be re-announced with new data.

Definition at line 92 of file publicservice.cpp.

References publish\-Async(), and stop().\index{DNSSD::PublicService@{DNSSD::Public\-Service}!setDomain@{setDomain}}
\index{setDomain@{setDomain}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void DNSSD::Public\-Service::set\-Domain (const {\bf QString} \& {\em domain})}\label{classDNSSD_1_1PublicService_a10}


Sets domain where service is published. 

\char`\"{}local.\char`\"{} means local LAN. If service is currently published, it will be re-announced with new data.

Definition at line 73 of file publicservice.cpp.

References publish\-Async(), and stop().\index{DNSSD::PublicService@{DNSSD::Public\-Service}!published@{published}}
\index{published@{published}!DNSSD::PublicService@{DNSSD::Public\-Service}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void DNSSD::Public\-Service::published (bool)\hspace{0.3cm}{\tt  [signal]}}\label{classDNSSD_1_1PublicService_l0}


Emitted when publishing is complete - parameter is set to true if it was successfull. 

It will also emitted when name, port or type of already published service is changed.

Referenced by publish\-Async().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
publicservice.h\item 
publicservice.cpp\end{CompactItemize}
