## DACPShare DACPShare |

## Synopsis

    #define             TYPE_DACP_SHARE
    #define             DACP_SHARE                          (o)
    #define             DACP_SHARE_CLASS                    (k)
    #define             IS_DACP_SHARE                       (o)
    #define             IS_DACP_SHARE_CLASS                 (k)
    #define             DACP_SHARE_GET_CLASS                (o)
    typedef             DACPSharePrivate;
                        DACPShare;
                        DACPShareClass;
    GType               dacp_share_get_type                 (void);
    DACPShare *         dacp_share_new                      (const gchar *library_name,
                                                             DACPPlayer *player,
                                                             DMAPDb *db,
                                                             DMAPContainerDb *container_db);
    void                dacp_share_pair                     (DACPShare *share,
                                                             gchar *service_name,
                                                             gchar passcode[4]);
    void                dacp_share_start_lookup             (DACPShare *share);
    void                dacp_share_stop_lookup              (DACPShare *share);
    void                dacp_share_player_updated           (DACPShare *share);

## Object Hierarchy

      GObject
       +----DMAPShare
             +----DAAPShare
                   +----DACPShare

## Properties

      "library-name"             gchar*                : Read / Write
      "player"                   GObject*              : Read / Write / Construct Only

## Signals

      "add-guid"                                       : Run Last
      "lookup-guid"                                    : Run Last
      "remote-found"                                   : Run Last
      "remote-lost"                                    : Run Last
      "remote-paired"                                  : Run Last

## Description

## Details

### TYPE_DACP_SHARE

    #define TYPE_DACP_SHARE         (dacp_share_get_type ())

The type for DACPShare.

### DACP_SHARE()

    #define             DACP_SHARE(o)

Casts a DACPShare or derived pointer into a (DACPShare*) pointer. Depending on the current debugging level, this function may invoke certain runtime checks to identify invalid casts.

`o` : | Object which is subject to casting.

### DACP_SHARE_CLASS()

    #define             DACP_SHARE_CLASS(k)

Casts a derived DACPShareClass structure into a DACPShareClass structure.

`k` : | a valid DACPShareClass

### IS_DACP_SHARE()

    #define             IS_DACP_SHARE(o)

Checks whether a valid GTypeInstance pointer is of type `TYPE_DACP_SHARE`.

`o` : | Instance to check for being a `TYPE_DACP_SHARE`.

### IS_DACP_SHARE_CLASS()

    #define             IS_DACP_SHARE_CLASS(k)

Checks whether `k` "is a" valid DACPShareClass structure of type `DACP_SHARE` or derived.

`k` : | a DACPShareClass

### DACP_SHARE_GET_CLASS()

    #define             DACP_SHARE_GET_CLASS(o)

Get the class structure associated to a DACPShare instance.

`o` : | a DACPShare instance.
Returns : | pointer to object class structure.

### DACPSharePrivate

    typedef struct DACPSharePrivate DACPSharePrivate;

### DACPShare

    typedef struct _DACPShare DACPShare;

### DACPShareClass

    typedef struct {
    	DAAPShareClass daap_share_class;

    	gboolean (*lookup_guid)            (DACPShare *share, gchar *guid);
    	void     (*add_guid)               (DACPShare *share, gchar *guid);

    	void (*remote_found)               (DACPShare *share,
    	                                    gchar *service_name,
    	                                    gchar *remote_name);
    	void (*remote_lost)                (DACPShare *share,
    	                                    gchar *service_name);
    	void (*remote_paired)              (DACPShare *share,
    	                                    gchar *service_name,
    	                                    gboolean connected);
    } DACPShareClass;

### dacp_share_get_type ()

    GType               dacp_share_get_type                 (void);

Returns : |

### dacp_share_new ()

    DACPShare *         dacp_share_new                      (const gchar *library_name,
                                                             DACPPlayer *player,
                                                             DMAPDb *db,
                                                             DMAPContainerDb *container_db);

Creates a new DACP share and publishes it using mDNS.

`library_name` : | The library name that will be shown in the remote.
`player` : | A DACPPlayer instance, used to retrieve information from a player implementation.
`db` : | a media database represented by a DMAPDb instance.
`container_db` : | a container (album) database represented by a DMAPContainerDb instance.
Returns : | a pointer to a DACPShare.

### dacp_share_pair ()

    void                dacp_share_pair                     (DACPShare *share,
                                                             gchar *service_name,
                                                             gchar passcode[4]);

Pairs a DACP client (Remote) with this server. If the passcode is correct (the same as shown on the remote), the remote will start connecting to this server.

`share` : | a DACPShare
`service_name` : | DACP client (remote) service identifier.
`passcode` : | 4-Digit PIN code entered by the user.

### dacp_share_start_lookup ()

    void                dacp_share_start_lookup             (DACPShare *share);

Start looking up for DACP remotes. Connect to "remote-found" signal to detect new remotes. Be aware that when a DACPShare is created, only after calling this function is that it starts looking up for Remotes on the network.

`share` : | A DACPShare.

### dacp_share_stop_lookup ()

    void                dacp_share_stop_lookup              (DACPShare *share);

Stop looking up for DACP remotes.

`share` : | A DACPShare.

### dacp_share_player_updated ()

    void                dacp_share_player_updated           (DACPShare *share);

`share` : |

## Property Details

### The `"library-name"` property

      "library-name"             gchar*                : Read / Write

Library name as will be shown in the Remote.

Default value: NULL

### The `"player"` property

      "player"                   GObject*              : Read / Write / Construct Only

Player.

## Signal Details

### The `"add-guid"` signal

    void                user_function                      (DACPShare *share,
                                                            gchar     *guid,
                                                            gpointer   user_data)      : Run Last

Signal emited when the remote wants to log in and save a special guid which will be used later when it wants to reconnect. With this guid, we know that this remote has connected before, thus this signal must save somewhere all guids that connected before, so that ::lookup-guid will find this remote. The user interface probably wants to include a button to forget previously connected remotes, so that the user may disconnect all previously connected remotes.

`share` : | the DACPShare that received the signal
`guid` : | a string containing the guid to be saved.
`user_data` : | user data set when the signal handler was connected.

### The `"lookup-guid"` signal

    gboolean            user_function                      (DACPShare *share,
                                                            gchar     *guid,
                                                            gpointer   user_data)      : Run Last

Signal emited when the remote has logged in before and wants to be validated. An implementation must implement this signal to lookup for guids saved by ::add-guid

`share` : | the DACPShare that received the signal
`guid` : | a string containing the guid to be validated.
`user_data` : | user data set when the signal handler was connected.

### The `"remote-found"` signal

    void                user_function                      (DACPShare *share,
                                                            gchar     *service_name,
                                                            gchar     *remote_name,
                                                            gpointer   user_data)         : Run Last

Signal emited when a remote is found in the local network.

`share` : | the DACPShare that received the signal.
`service_name` : | the remote identifier.
`remote_name` : | the remote friendly name.
`user_data` : | user data set when the signal handler was connected.

### The `"remote-lost"` signal

    void                user_function                      (DACPShare *share,
                                                            gchar     *service_name,
                                                            gpointer   user_data)         : Run Last

Signal emited when a remote is lost in the local network.

`share` : | the DACPShare that received the signal
`service_name` : | the remote identifier.
`user_data` : | user data set when the signal handler was connected.

### The `"remote-paired"` signal

    void                user_function                      (DACPShare *share,
                                                            gchar     *service_name,
                                                            gboolean   connected,
                                                            gpointer   user_data)         : Run Last

Signal emited when a remote is paired.

`share` : | the DACPShare that received the signal
`service_name` : | the remote identifier.
`connected` : | indicates if the connection was succesfull or not.
`user_data` : | user data set when the signal handler was connected.