![]() |
![]() |
![]() |
Easy Publish and Consume Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
#include <libepc/service-monitor.h> EpcServiceMonitorClass; EpcServiceMonitorPrivate; EpcServiceMonitor; EpcServiceMonitor* epc_service_monitor_new (const gchar *application, const gchar *domain, EpcProtocol first_protocol, ...); EpcServiceMonitor* epc_service_monitor_new_for_types (const gchar *domain, ...); EpcServiceMonitor* epc_service_monitor_new_for_types_strv (const gchar *domain, gchar **types); void epc_service_monitor_set_skip_our_own (EpcServiceMonitor *monitor, gboolean setting); gboolean epc_service_monitor_get_skip_our_own (EpcServiceMonitor *monitor);
"application" gchar* : Read / Write / Construct Only "domain" gchar* : Read / Write / Construct Only "service-types" GStrv* : Read / Write / Construct Only "skip-our-own" gboolean : 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
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);
typedef struct { 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); } EpcServiceMonitorClass;
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.
typedef struct _EpcServiceMonitor EpcServiceMonitor;
Public fields of the EpcServiceMonitor class.
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()
).
|
name of the application to monitor, or NULL
|
|
the DNS domain to monitor, or NULL
|
|
the first protocol to monitor |
|
a list of additional protocols, terminated by EPC_PROTOCOL_UNKNOWN |
Returns : |
The newly created service monitor. |
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()
|
the DNS domain to monitor, or NULL
|
|
a NULL terminated list of service types to monitor
|
Returns : |
The newly created service monitor. |
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.
|
a EpcServiceMonitor |
|
the new setting |
gboolean epc_service_monitor_get_skip_our_own (EpcServiceMonitor *monitor);
Queries the current value of the "skip-our-own" property.
|
a EpcServiceMonitor |
Returns : |
The current value of the "skip-our-own" property |
"application"
property"application" gchar* : Read / Write / Construct Only
The application to monitor.
Default value: NULL
"domain"
property"domain" gchar* : Read / Write / Construct Only
The DNS domain to monitor.
Default value: NULL
"service-types"
property"service-types" GStrv* : Read / Write / Construct Only
The DNS-SD services types to watch.
"scanning-done"
signalvoid user_function (EpcServiceMonitor *monitor, gchar *type, gpointer user_data) : Run First
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.
|
a EpcServiceMonitor |
|
the service type watched |
|
user data set when the signal handler was connected. |
"service-found"
signalvoid user_function (EpcServiceMonitor *monitor, gchar *name, EpcServiceInfo *info, gpointer user_data) : Run First
This signal is emitted when a new service was found.
|
a EpcServiceMonitor |
|
name of the service removed |
|
a description of the service found |
|
user data set when the signal handler was connected. |
"service-removed"
signalvoid user_function (EpcServiceMonitor *monitor, gchar *name, gchar *type, gpointer user_data) : Run First
This signal is emitted when a previously known service disappears.
|
a EpcServiceMonitor |
|
name of the service removed |
|
the service type watched |
|
user data set when the signal handler was connected. |