GSSDPResourceBrowser

## GSSDPResourceBrowser GSSDPResourceBrowser — Class handling resource discovery. |

## Synopsis

    struct              GSSDPResourceBrowser;
    #define             GSSDP_ALL_RESOURCES
    GSSDPResourceBrowser * gssdp_resource_browser_new       (GSSDPClient *client,
                                                             const char *target);
    GSSDPClient *       gssdp_resource_browser_get_client   (GSSDPResourceBrowser *resource_browser);
    void                gssdp_resource_browser_set_target   (GSSDPResourceBrowser *resource_browser,
                                                             const char *target);
    const char *        gssdp_resource_browser_get_target   (GSSDPResourceBrowser *resource_browser);
    void                gssdp_resource_browser_set_mx       (GSSDPResourceBrowser *resource_browser,
                                                             gushort mx);
    gushort             gssdp_resource_browser_get_mx       (GSSDPResourceBrowser *resource_browser);
    void                gssdp_resource_browser_set_active   (GSSDPResourceBrowser *resource_browser,
                                                             gboolean active);
    gboolean            gssdp_resource_browser_get_active   (GSSDPResourceBrowser *resource_browser);
    gboolean            gssdp_resource_browser_rescan       (GSSDPResourceBrowser *resource_browser);

## Object Hierarchy

      GObject
       +----GSSDPResourceBrowser

## Properties

      "active"                   gboolean              : Read / Write
      "client"                   GSSDPClient*          : Read / Write / Construct Only
      "mx"                       guint                 : Read / Write
      "target"                   gchar*                : Read / Write

## Signals

      "resource-available"                             : Run Last
      "resource-unavailable"                           : Run Last

## Description

GSSDPResourceBrowser handles resource discovery. After creating a browser and activating it, the ::resource-available and ::resource-unavailable signals will be emitted whenever the availability of a resource matching the specified discovery target changes. A discovery request is sent out automatically when activating the browser.

## Details

### struct GSSDPResourceBrowser

    struct GSSDPResourceBrowser;

### GSSDP_ALL_RESOURCES

    #define GSSDP_ALL_RESOURCES "ssdp:all"

SSDP search target for finding all possible resources.

### gssdp_resource_browser_new ()

    GSSDPResourceBrowser * gssdp_resource_browser_new       (GSSDPClient *client,
                                                             const char *target);

`target` is a generic string the resource browser listens for on the SSDP bus. There are several possible targets such as

- "ssdp:all" for everything

- "upnp:rootdevice" for UPnP device entry points, not caring about the device type

- The UUID of a specific device

- Device types such as "urn:schemas-upnp-org:device:MediaServer:1"

- Service types such as "urn:schemas-upnp-org:service:ContentDirectory:1"

`client` : | The GSSDPClient to associate with
`target` : | A SSDP search target
Returns : | A new GSSDPResourceBrowser object.

### gssdp_resource_browser_get_client ()

    GSSDPClient *       gssdp_resource_browser_get_client   (GSSDPResourceBrowser *resource_browser);

`resource_browser` : | A GSSDPResourceBrowser
Returns : | The GSSDPClient `resource_browser` is associated with. [transfer none]

### gssdp_resource_browser_set_target ()

    void                gssdp_resource_browser_set_target   (GSSDPResourceBrowser *resource_browser,
                                                             const char *target);

Sets the browser target of `resource_browser` to `target`.

`resource_browser` : | A GSSDPResourceBrowser
`target` : | The browser target

### gssdp_resource_browser_get_target ()

    const char *        gssdp_resource_browser_get_target   (GSSDPResourceBrowser *resource_browser);

`resource_browser` : | A GSSDPResourceBrowser
Returns : | The browser target.

### gssdp_resource_browser_set_mx ()

    void                gssdp_resource_browser_set_mx       (GSSDPResourceBrowser *resource_browser,
                                                             gushort mx);

Sets the used MX value of `resource_browser` to `mx`.

`resource_browser` : | A GSSDPResourceBrowser
`mx` : | The to be used MX value

### gssdp_resource_browser_get_mx ()

    gushort             gssdp_resource_browser_get_mx       (GSSDPResourceBrowser *resource_browser);

`resource_browser` : | A GSSDPResourceBrowser
Returns : | The used MX value.

### gssdp_resource_browser_set_active ()

    void                gssdp_resource_browser_set_active   (GSSDPResourceBrowser *resource_browser,
                                                             gboolean active);

(De)activates `resource_browser`.

`resource_browser` : | A GSSDPResourceBrowser
`active` : | `TRUE` to activate `resource_browser`

### gssdp_resource_browser_get_active ()

    gboolean            gssdp_resource_browser_get_active   (GSSDPResourceBrowser *resource_browser);

`resource_browser` : | A GSSDPResourceBrowser
Returns : | `TRUE` if `resource_browser` is active.

### gssdp_resource_browser_rescan ()

    gboolean            gssdp_resource_browser_rescan       (GSSDPResourceBrowser *resource_browser);

Begins discovery if `resource_browser` is active and no discovery is performed. Otherwise does nothing.

`resource_browser` : | A GSSDPResourceBrowser
Returns : | `TRUE` if rescaning has been started.

## Property Details

### The `"active"` property

      "active"                   gboolean              : Read / Write

Whether this browser is active or not.

Default value: FALSE

### The `"client"` property

      "client"                   GSSDPClient*          : Read / Write / Construct Only

The GSSDPClient to use.

### The `"mx"` property

      "mx"                       guint                 : Read / Write

The maximum number of seconds in which to request other parties to respond.

Allowed values: [1,65535]

Default value: 3

### The `"target"` property

      "target"                   gchar*                : Read / Write

The discovery target.

Default value: NULL

## Signal Details

### The `"resource-available"` signal

    void                user_function                      (GSSDPResourceBrowser *resource_browser,
                                                            gchar                *usn,
                                                            gpointer              locations,
                                                            gpointer              user_data)             : Run Last

The ::resource-available signal is emitted whenever a new resource has become available.

`resource_browser` : | The GSSDPResourceBrowser that received the signal
`usn` : | The USN of the discovered resource
`locations` : | A GList of strings describing the locations of the discovered resource. [type GList*][transfer none][element-type utf8]
`user_data` : | user data set when the signal handler was connected.

### The `"resource-unavailable"` signal

    void                user_function                      (GSSDPResourceBrowser *resource_browser,
                                                            gchar                *usn,
                                                            gpointer              user_data)             : Run Last

The ::resource-unavailable signal is emitted whenever a resource is not available any more.

`resource_browser` : | The GSSDPResourceBrowser that received the signal
`usn` : | The USN of the resource
`user_data` : | user data set when the signal handler was connected.