/*
 * digitalcamera.h: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *   
 * based on the image plugin
 *
 * This code is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This code 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
 * $Id: digitalcamera.h,v 1.4 2004/11/26 21:18:53 peter Exp $
 */

 
/*

File	: digitalcamera.h
Autor	: Peter Juszack

Description
-----------------------------------------------------------------
wrapper class for libgphoto2

*/

#ifndef _DIGITALCAMERA__H
#define _DIGITALCAMERA__H

/* 
author:	Peter Juszack

DigitalCamera - class to handle a gphoto2 camera handle 

*/

#include <gphoto2/gphoto2.h>

#define CAMERA_PATH_MAXLENGTH 1024
#define DIGICAM_CLASS_ERROR 1
#define DIGICAM_NO_ERROR 0

class DigitalCamera {

private:
    // gphoto2 camera handle
    Camera *camera;
    // current directory in camera memory
    char cameraDirectory[CAMERA_PATH_MAXLENGTH];
    
    int lastError;
    
    void buildPath(char* target, const char* path1, const char* path2);
public:
    // constructor: creates new camera handle
    DigitalCamera(void);
    // destructor: releases camera handle
    virtual ~DigitalCamera();
    
    // bind (use) the camera handle
    int bind(void);
    // release (free) the camera handle
    int release(void);
    // returns wether camera handle is bound or not
    bool isAvailable(void);
    
    // Set directory on the camera (for listing etc)
    void setDirectory( const char* path1, const char* path2 );
    

public:
    // WRAPPERS for gphoto2 functions -------------------------------------
    
    // get summary    
    int getSummary( CameraText *summ );    
    // get folder list in camera directory
    int getFolderList( CameraList *list );
    // get file list in camera directory
    int getFileList( CameraList *list );
    // get file information
    int getFileInformation( CameraFileInfo *info, const char* file );
    // get file
    int getFile( const char* fileName, CameraFile *file );
    // save file to disc
    int saveFileToDisc( CameraFile *file, const char* fileName );
    // delete file
    int deleteFile( const char* fileName );
    // delete folder
    int deleteFolder( const char* folderName, bool deleteFiles = false );
    
    // ERROR information --------------------------------------------------
    int getErrNo(void);    
};


#endif
