libmpdclient 2.22
Enumerations | Functions
idle.h File Reference

MPD client library. More...

#include "compiler.h"
#include <stdbool.h>
Include dependency graph for idle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  mpd_idle {
  MPD_IDLE_DATABASE = 0x1 , MPD_IDLE_STORED_PLAYLIST = 0x2 , MPD_IDLE_QUEUE = 0x4 , MPD_IDLE_PLAYLIST = MPD_IDLE_QUEUE ,
  MPD_IDLE_PLAYER = 0x8 , MPD_IDLE_MIXER = 0x10 , MPD_IDLE_OUTPUT = 0x20 , MPD_IDLE_OPTIONS = 0x40 ,
  MPD_IDLE_UPDATE = 0x80 , MPD_IDLE_STICKER = 0x100 , MPD_IDLE_SUBSCRIPTION = 0x200 , MPD_IDLE_MESSAGE = 0x400 ,
  MPD_IDLE_PARTITION = 0x800 , MPD_IDLE_NEIGHBOR = 0x1000 , MPD_IDLE_MOUNT = 0x2000
}
 

Functions

const char * mpd_idle_name (enum mpd_idle idle)
 
enum mpd_idle mpd_idle_name_parse (const char *name)
 
bool mpd_send_idle (struct mpd_connection *connection)
 
bool mpd_send_idle_mask (struct mpd_connection *connection, enum mpd_idle mask)
 
bool mpd_send_noidle (struct mpd_connection *connection)
 
enum mpd_idle mpd_idle_parse_pair (const struct mpd_pair *pair)
 
enum mpd_idle mpd_recv_idle (struct mpd_connection *connection, bool disable_timeout)
 
enum mpd_idle mpd_run_idle (struct mpd_connection *connection)
 
enum mpd_idle mpd_run_idle_mask (struct mpd_connection *connection, enum mpd_idle mask)
 
enum mpd_idle mpd_run_noidle (struct mpd_connection *connection)
 

Detailed Description

MPD client library.

Do not include this header directly. Use mpd/client.h instead.

Definition in file idle.h.

Enumeration Type Documentation

◆ mpd_idle

enum mpd_idle

This enum contains bit masks for all idle events.

Since
libmpdclient 2.5 added support for MPD_IDLE_STICKER, MPD_IDLE_SUBSCRIPTION and MPD_IDLE_MESSAGE.
libmpdclient 2.17 added support for MPD_IDLE_PARTITION.
libmpdclient 2.19 added support for MPD_IDLE_NEIGHBOR, MPD_IDLE_MOUNT
Enumerator
MPD_IDLE_DATABASE 

song database has been updated

MPD_IDLE_STORED_PLAYLIST 

a stored playlist has been modified, created, deleted or renamed

MPD_IDLE_QUEUE 

the queue has been modified

MPD_IDLE_PLAYLIST 

deprecated, don't use

MPD_IDLE_PLAYER 

the player state has changed: play, stop, pause, seek, ...

MPD_IDLE_MIXER 

the volume has been modified

MPD_IDLE_OUTPUT 

an audio output device has been enabled or disabled

MPD_IDLE_OPTIONS 

options have changed: crossfade, random, repeat, ...

MPD_IDLE_UPDATE 

a database update has started or finished.

MPD_IDLE_STICKER 

a sticker has been modified.

MPD_IDLE_SUBSCRIPTION 

a client has subscribed to or unsubscribed from a channel

MPD_IDLE_MESSAGE 

a message on a subscribed channel was received

MPD_IDLE_PARTITION 

a partition was added or changed

MPD_IDLE_NEIGHBOR 

a neighbor was found or lost

MPD_IDLE_MOUNT 

the mount list has changed

Definition at line 29 of file idle.h.

Function Documentation

◆ mpd_idle_name()

const char * mpd_idle_name ( enum mpd_idle  idle)

Returns the name of the specified idle event.

Parameters
idlean idle event id
Returns
the name, or NULL if that event is not known

◆ mpd_idle_name_parse()

enum mpd_idle mpd_idle_name_parse ( const char *  name)

Parses the name of an idle event.

Parameters
namean idle event name
Returns
the id, or 0 if that event is not known

◆ mpd_send_idle()

bool mpd_send_idle ( struct mpd_connection connection)

Enters "idle" mode: MPD will stall the response until an event has occurred. Call mpd_send_noidle() to abort the idle mode, or mpd_recv_idle() to read the event mask (or synchronously wait for events).

Parameters
connectionthe connection to MPD
Returns
true on success

◆ mpd_send_idle_mask()

bool mpd_send_idle_mask ( struct mpd_connection connection,
enum mpd_idle  mask 
)

Same as mpd_send_idle(), but listen only on specific events.

Parameters
connectionthe connection to MPD
maska bit mask of idle events; must not be 0
Returns
true on success

◆ mpd_send_noidle()

bool mpd_send_noidle ( struct mpd_connection connection)

Tells MPD to leave the "idle" mode. MPD will then respond with a list of events which have occurred (which may be empty). Call mpd_recv_idle() after that.

Parameters
connectionthe connection to MPD
Returns
true on success

◆ mpd_idle_parse_pair()

enum mpd_idle mpd_idle_parse_pair ( const struct mpd_pair pair)

Parses a "changed" pair, which is part of MPD's response to the "idle" command.

Parameters
pairthe "changed" pair
Returns
an idle code, or 0 if the pair was not understood

◆ mpd_recv_idle()

enum mpd_idle mpd_recv_idle ( struct mpd_connection connection,
bool  disable_timeout 
)

Waits until MPD sends the list of idle events and returns it in a bit mask.

Parameters
connectionthe connection to MPD
disable_timeoutif true, then libmpdclient temporarily disables the configured timeout (see mpd_connection_set_timeout()): this function blocks forever, until either MPD sends a response, or an error occurs.
Returns
the event bit mask, or 0 on error or if there were no events

◆ mpd_run_idle()

enum mpd_idle mpd_run_idle ( struct mpd_connection connection)

Shortcut for mpd_send_idle() and mpd_recv_idle(). During mpd_recv_idle(), the configured timeout is disabled.

Parameters
connectionthe connection to MPD
Returns
the event bit mask, or 0 on error

◆ mpd_run_idle_mask()

enum mpd_idle mpd_run_idle_mask ( struct mpd_connection connection,
enum mpd_idle  mask 
)

Shortcut for mpd_send_idle_mask() and mpd_recv_idle(). During mpd_recv_idle(), the configured timeout is disabled.

Parameters
connectionthe connection to MPD
maska bit mask of idle events; must not be 0
Returns
the event bit mask, or 0 on error

◆ mpd_run_noidle()

enum mpd_idle mpd_run_noidle ( struct mpd_connection connection)

Shortcut for mpd_send_noidle() and mpd_recv_idle(). During mpd_recv_idle(), the configured timeout is not disabled.

Parameters
connectionthe connection to MPD
Returns
the event bit mask, or 0 on error or if there were no events