ArnLib
4.0.x
Active Registry Network
|
Advertise an Arn service. More...
#include <ArnDiscover.hpp>
Classes | |
struct | State |
States of DiscoverAdvertise / These values must be synced with: ArnZeroConf::State. More... | |
Public Slots | |
virtual void | setService (const QString &service) |
Set the service name. More... | |
Signals | |
void | serviceChanged (const QString &serviceName) |
Indicate successfull advertise of service. More... | |
void | serviceChangeError (int code) |
Indicate unsuccessfull advertise of service. More... | |
Public Member Functions | |
ArnDiscoverAdvertise (QObject *parent=arnNullptr) | |
~ArnDiscoverAdvertise () | |
QStringList | groups () const |
Return service discover groups used for filter browsing. More... | |
void | setGroups (const QStringList &groups) |
Set service discover groups used for filter browsing. More... | |
void | addGroup (const QString &group) |
Add a service discover group. More... | |
QString | service () const |
Returns the requested service name for this Advertise. More... | |
QString | currentService () const |
Returns the current service name for this Advertise. More... | |
State | state () const |
Returns the state for this Advertise. More... | |
void | advertiseService (ArnDiscover::Type discoverType, const QString &serviceName, int port=-1, const QString &hostName=QString()) |
Start advertising the service. More... | |
Arn::XStringMap | customProperties () const |
Return service custom properties. More... | |
void | setCustomProperties (const Arn::XStringMap &customProperties) |
Set service custom properties. More... | |
void | addCustomProperty (const QString &key, const QString &val) |
Add service custom property. More... | |
Advertise an Arn service.
Arn Discover is the mid level support for advertising services on an local network. For higher level support, use ArnDiscoverRemote.
Example usage
Definition at line 629 of file ArnDiscover.hpp.
|
explicit |
Definition at line 831 of file ArnDiscover.cpp.
ArnDiscoverAdvertise::~ArnDiscoverAdvertise | ( | ) |
Definition at line 847 of file ArnDiscover.cpp.
void ArnDiscoverAdvertise::addCustomProperty | ( | const QString & | key, |
const QString & | val | ||
) |
Add service custom property.
The custom property are advised to have a key starting with a capital letter to avoid name collision with the system.
[in] | key | property key (Start with capital letter) e.g. "MyProp" |
[in] | val | property value kan be any text e.g. "my data" |
Definition at line 932 of file ArnDiscover.cpp.
void ArnDiscoverAdvertise::addGroup | ( | const QString & | group | ) |
Add a service discover group.
[in] | group | e.g. "Any Group ID" |
Definition at line 1014 of file ArnDiscover.cpp.
void ArnDiscoverAdvertise::advertiseService | ( | ArnDiscover::Type | discoverType, |
const QString & | serviceName, | ||
int | port = -1 , |
||
const QString & | hostName = QString() |
||
) |
Start advertising the service.
Tries to advertise the service on the local network. Result is indicated by serviceChanged() and serviceChangeError() signals.
Empty serviceName will be ignored, no advertising until using setService() with non empty name.
[in] | discoverType | is used for discover filtering |
[in] | serviceName | is requested name e.g. "My House Registry" |
[in] | port | is the port of the service, -1 gives default Arn port number |
[in] | hostName | is the host doing the service, empty gives this advertising host |
Definition at line 854 of file ArnDiscover.cpp.
QString ArnDiscoverAdvertise::currentService | ( | ) | const |
Returns the current service name for this Advertise.
This is the realy advertised name when it's available otherwise it's the requested service name.
Definition at line 964 of file ArnDiscover.cpp.
XStringMap ArnDiscoverAdvertise::customProperties | ( | ) | const |
Return service custom properties.
This is only the customer (application) properties, as there also are some Arn system properties.
Definition at line 916 of file ArnDiscover.cpp.
QStringList ArnDiscoverAdvertise::groups | ( | ) | const |
Return service discover groups used for filter browsing.
Definition at line 998 of file ArnDiscover.cpp.
QString ArnDiscoverAdvertise::service | ( | ) | const |
Returns the requested service name for this Advertise.
This is always the requested service name, the realy used name comes with the serviceChanged() signal and currentService().
Definition at line 956 of file ArnDiscover.cpp.
|
signal |
Indicate successfull advertise of service.
[in] | serviceName | is the realy advertised name e.g. "My House Registry (2)" |
|
signal |
Indicate unsuccessfull advertise of service.
[in] | code | error code. |
void ArnDiscoverAdvertise::setCustomProperties | ( | const Arn::XStringMap & | customProperties | ) |
Set service custom properties.
This is only the customer (application) properties, as there also are some Arn system properties.
These custom properties are advised to have a key starting with a capital letter to avoid name collision with the system.
[in] | customProperties | e.g. Arn::XStringMap().add("MyProp", "my data") |
Definition at line 924 of file ArnDiscover.cpp.
void ArnDiscoverAdvertise::setGroups | ( | const QStringList & | groups | ) |
Set service discover groups used for filter browsing.
Groups are used for filtering discovered services. They will also be availabe as properties with naming as "group0", "group1" ...
[in] | groups | e.g. ("mydomain.se", "mydomain.se/House", "Any Group ID") |
Definition at line 1006 of file ArnDiscover.cpp.
|
virtualslot |
Set the service name.
Will update current advertised service name if this advertiser has been setup, otherwise the service name is stored for future use.
Service names can be any human readable id. It should be easy to understand, without any cryptic coding, and can usually be modified by the end user
Empty name is ignored. The requested service name is not guaranted to be used for advertise, as it has to be unique within this local network. The realy used name comes with the serviceChanged() signal and currentService().
[in] | service | is the requested service name e.g. "My House Registry" |
Definition at line 980 of file ArnDiscover.cpp.
ArnDiscoverAdvertise::State ArnDiscoverAdvertise::state | ( | ) | const |
Returns the state for this Advertise.
Definition at line 972 of file ArnDiscover.cpp.