libgphoto2 photo camera library (libgphoto2) Internals  2.5.26
gphoto2-setting.c File Reference
#include "config.h"
#include <gphoto2/gphoto2-setting.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gphoto2/gphoto2-result.h>
#include <gphoto2/gphoto2-port-log.h>
#include <gphoto2/gphoto2-port-portability.h>

Go to the source code of this file.

Data Structures

struct  Setting
 

Macros

#define _DEFAULT_SOURCE
 
#define CHECK_RESULT(result)   {int r = (result); if (r < 0) return (r);}
 

Functions

static int save_settings (void)
 
static int load_settings (void)
 
int gp_setting_get (char *id, char *key, char *value)
 Retrieve a specific gphoto setting. More...
 
int gp_setting_set (char *id, char *key, char *value)
 Set a specific gphoto setting. More...
 
static int verify_settings (char *settings_file)
 

Variables

static int glob_setting_count = 0
 
static Setting glob_setting [512]
 

Detailed Description

Author
Copyright 2000 Scott Fritzinger
License
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Definition in file gphoto2-setting.c.

Macro Definition Documentation

◆ _DEFAULT_SOURCE

#define _DEFAULT_SOURCE

Definition at line 24 of file gphoto2-setting.c.

◆ CHECK_RESULT

#define CHECK_RESULT (   result)    {int r = (result); if (r < 0) return (r);}

Definition at line 60 of file gphoto2-setting.c.

Function Documentation

◆ gp_setting_get()

int gp_setting_get ( char *  id,
char *  key,
char *  value 
)

Retrieve a specific gphoto setting.

Parameters
idthe frontend id of the caller
keythe key the frontend queries
valuechanged value
Returns
GPhoto error code

This function retrieves the setting key for a specific frontend id and copies the value into the passed value pointer.

Definition at line 75 of file gphoto2-setting.c.

References glob_setting, glob_setting_count, GP_ERROR, GP_OK, and load_settings().

Referenced by gp_filesystem_lru_update().

◆ gp_setting_set()

int gp_setting_set ( char *  id,
char *  key,
char *  value 
)

Set a specific gphoto setting.

Parameters
idthe frontend id of the caller
keythe key the frontend queries
valuenew value
Returns
GPhoto error code

This function sets the setting key for a specific frontend id to the value.

Definition at line 107 of file gphoto2-setting.c.

References glob_setting, glob_setting_count, GP_OK, load_settings(), and save_settings().

Referenced by gp_filesystem_lru_update().

◆ load_settings()

static int load_settings ( void  )
static

◆ save_settings()

static int save_settings ( void  )
static

Definition at line 229 of file gphoto2-setting.c.

References glob_setting, glob_setting_count, and GP_OK.

Referenced by gp_setting_set().

◆ verify_settings()

static int verify_settings ( char *  settings_file)
static

Definition at line 135 of file gphoto2-setting.c.

References GP_ERROR, and GP_OK.

Referenced by load_settings().

Variable Documentation

◆ glob_setting

Setting glob_setting[512]
static

Definition at line 56 of file gphoto2-setting.c.

Referenced by gp_setting_get(), gp_setting_set(), load_settings(), and save_settings().

◆ glob_setting_count

int glob_setting_count = 0
static

Definition at line 55 of file gphoto2-setting.c.

Referenced by gp_setting_get(), gp_setting_set(), load_settings(), and save_settings().