idle.h File Reference

MPD client library. More...

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 }

## Functions

mpd_const const char * | mpd_idle_name (enum mpd_idle idle)
mpd_pure 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)
mpd_pure 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

enum mpd_idle

This enum contains bit masks for all idle events.

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

Definition at line 52 of file idle.h.

## Function Documentation

mpd_const const char* mpd_idle_name | ( | enum mpd_idle | idle | ) |

Returns the name of the specified idle event.

Parameters

  idle | an idle event id

Returns
  the name, or NULL if that event is not known

mpd_pure enum mpd_idle mpd_idle_name_parse | ( | const char * | name | ) |

Parses the name of an idle event.

Parameters

  name | an idle event name

Returns
  the id, or 0 if that event is not known

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).

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

  connection | the connection to MPD
  mask | a bit mask of idle events; must not be 0

Returns
  a positive job id on success, 0 on error

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.

mpd_pure 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.

Returns
  an idle code, or 0 if the pair was not understood

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

  connection | the connection to MPD
  disable_timeout | if true, then libmpdclients 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

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

  connection | the connection to MPD

Returns
  the event bit mask, or 0 on error

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

  connection | the connection to MPD
  mask | a bit mask of idle events; must not be 0

Returns
  the event bit mask, or 0 on error

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

  connection | the connection to MPD

Returns
  the event bit mask, or 0 on error or if there were no events