Top | ![]() |
![]() |
![]() |
![]() |
gchar * | application | Read / Write / Construct Only |
gchar * | domain | Read / Write / Construct Only |
GStrv | service-types | Read / Write / Construct Only |
gboolean | skip-our-own | Read / Write / Construct |
The EpcServiceMonitor object provides an easy method for finding DNS-SD services. It hides all the boring state and callback handling Avahi requires, and just exposes three simple GObject signals: “service-found”, “service-removed” and “scanning-done”.
Example 8. Find an Easy-Publish service
1 2 3 4 5 6 |
monitor = epc_service_monitor_new ("glom", NULL, EPC_PROTOCOL_UNKNOWN); g_signal_connect (monitor, "service-found", service_found_cb, self); g_signal_connect (monitor, "service-removed", service_removed_cb, self); g_main_loop_run (loop); |
EpcServiceMonitor * epc_service_monitor_new (const gchar *application
,const gchar *domain
,EpcProtocol first_protocol
,...
);
Creates a new service monitor watching the specified domain
for a
certain application
using one of the protocols listed. Passing NULL
for
application
lists all libepc based applications. Passing NULL
for domain
monitors the local network. Passing an empty protocol list requests
monitoring of all service-types supported by the library (see
epc_service_type_list_supported()
).
application |
name of the application to monitor, or |
|
domain |
the DNS domain to monitor, or |
|
first_protocol |
the first protocol to monitor |
|
... |
a list of additional protocols, terminated by EPC_PROTOCOL_UNKNOWN |
EpcServiceMonitor * epc_service_monitor_new_for_types (const gchar *domain
,...
);
Creates a new service monitor watching the specified domain
for the
service-types listed. Passing NULL
for domain
monitors the local network.
Passing an empty service list requests monitoring of all service-types
supported by the library (see epc_service_type_list_supported()
).
See also: epc_service_monitor_new_for_types_strv()
Since: 0.3.1
EpcServiceMonitor * epc_service_monitor_new_for_types_strv (const gchar *domain
,gchar **types
);
Creates a new service monitor watching the specified domain
for the
service-types listed. Passing NULL
for domain
monitors the local network.
Passing an empty service list requests monitoring of all service-types
supported by the library (see epc_service_type_list_supported()
).
See also: epc_service_monitor_new_for_types()
void epc_service_monitor_set_skip_our_own (EpcServiceMonitor *monitor
,gboolean setting
);
Updates the “skip-our-own” property.
gboolean
epc_service_monitor_get_skip_our_own (EpcServiceMonitor *monitor
);
Queries the current value of the “skip-our-own” property.
struct EpcServiceMonitorClass { void (*service_found) (EpcServiceMonitor *monitor, const gchar *name, EpcServiceInfo *info); void (*service_removed) (EpcServiceMonitor *monitor, const gchar *name, const gchar *type); void (*scanning_done) (EpcServiceMonitor *monitor, const gchar *type); };
Virtual methods of the EpcServiceMonitor class.
virtual method of the “service-found” signal |
||
virtual method of the “service-removed” signal |
||
virtual method of the “scanning-done” signal |
typedef struct _EpcServiceMonitorPrivate EpcServiceMonitorPrivate;
Private fields of the EpcServiceMonitor class.
“application”
property“application” gchar *
The application to monitor.
Flags: Read / Write / Construct Only
Default value: NULL
“domain”
property“domain” gchar *
The DNS domain to monitor.
Flags: Read / Write / Construct Only
Default value: NULL
“service-types”
property“service-types” GStrv
The DNS-SD services types to watch.
Flags: Read / Write / Construct Only
“skip-our-own”
property“skip-our-own” gboolean
Skip services of the current application.
Flags: Read / Write / Construct
Default value: FALSE
“scanning-done”
signalvoid user_function (EpcServiceMonitor *monitor, gchar *type, gpointer user_data)
This signal is emitted when active scanning as finished and most certainly no new services will be detected for some time. Can be used for instance to hide an progress indicator.
monitor |
||
type |
the service type watched |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“service-found”
signalvoid user_function (EpcServiceMonitor *monitor, gchar *name, EpcServiceInfo *info, gpointer user_data)
This signal is emitted when a new service was found.
monitor |
||
name |
name of the service removed |
|
info |
a description of the service found |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“service-removed”
signalvoid user_function (EpcServiceMonitor *monitor, gchar *name, gchar *type, gpointer user_data)
This signal is emitted when a previously known service disappears.
monitor |
||
name |
name of the service removed |
|
type |
the service type watched |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First