Static Configuration — WirePlumber 0.5.14 documentation

# Static Configuration

struct WpConf

  WpConf allows accessing the different sections of the wireplumber configuration.

WpConf *wp_conf_new(const gchar *name, WpProperties *properties)

  Creates a new WpConf object.

  This does not open the files, it only creates the object. For most use cases, you should use wp_conf_new_open() instead.

  Parameters:

    - name -- the name of the configuration file

    - properties -- (transfer full) (nullable): a WpProperties with keys specifying how to load the WpConf object

  Returns:

    (transfer full): a new WpConf object

WpConf *wp_conf_new_open(const gchar *name, WpProperties *properties, GError **error)

  Creates a new WpConf object and opens the configuration file and its fragments, keeping them mapped in memory for further access.

  Parameters:

    - name -- the name of the configuration file

    - properties -- (transfer full) (nullable): a WpProperties with keys specifying how to load the WpConf object

    - error -- (out) (nullable): return location for a GError, or NULL

  Returns:

    (transfer full) (nullable): a new WpConf object, or NULL if an error occurred

gboolean wp_conf_open(WpConf *self, GError **error)

  Opens the configuration file and its fragments and keeps them mapped in memory for further access.

  Parameters:

    - self -- the configuration

    - error -- (out)(nullable): return location for a GError, or NULL

  Returns:

    TRUE on success, FALSE on error

void wp_conf_close(WpConf *self)

  Closes the configuration file and its fragments.

  Parameters:

    - self -- the configuration

gboolean wp_conf_is_open(WpConf *self)

  Tests if the configuration files are open.

  Parameters:

    - self -- the configuration

  Returns:

    TRUE if the configuration files are open, FALSE otherwise

const gchar *wp_conf_get_name(WpConf *self)

  Gets the name of the configuration file.

  Parameters:

    - self -- the configuration

  Returns:

    the name of the configuration file

WpSpaJson *wp_conf_get_section(WpConf *self, const gchar *section)

  This method will get the JSON value of a specific section from the configuration. If the same section is defined in multiple locations, the sections with the same name will be either merged in case of arrays and objects, or overridden in case of boolean, int, double and strings.

  Parameters:

    - self -- the configuration

    - section -- the section name

  Returns:

    (transfer full) (nullable): the JSON value of the section or NULL if the section does not exist

gint wp_conf_section_update_props(WpConf *self, const gchar *section, WpProperties *props)

  Updates the given properties with the values of a specific section from the configuration.

  Parameters:

    - self -- the configuration

    - section -- the section name

    - props -- the properties to update

  Returns:

    the number of properties updated

void wp_conf_parse_pw_context_sections(WpConf *self, struct pw_context *context)

  Parses standard pw_context sections from conf.

  Parameters:

    - self -- the configuration

    - context -- the associated pw_context

WP_TYPE_CONF (wp_conf_get_type ())

  The WpConf GType.