You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
287 lines
12 KiB
287 lines
12 KiB
#ifndef __GPHOTO_CAMERA_OBJECT_HEADER__
|
|
#define __GPHOTO_CAMERA_OBJECT_HEADER__
|
|
|
|
|
|
#include "../../../components/base/basicSettingsProvider.h"
|
|
#include "../../../components/base/basicThread.h"
|
|
#include "../../../components/base/basicMutex.h"
|
|
#include "../../../components/object/objectPathfinderBinaryLog.h"
|
|
#include "../../../pathfinder/pathfinderDBConnector.h"
|
|
|
|
#include <sys/types.h>
|
|
#include <utime.h>
|
|
#include <sys/time.h>
|
|
#include <gphoto2/gphoto2.h>
|
|
#include <gphoto2/gphoto2-camera.h>
|
|
#include <gphoto2/gphoto2-context.h>
|
|
#include <gphoto2/gphoto2-port.h>
|
|
#include <gphoto2/gphoto2-widget.h>
|
|
#include <queue>
|
|
|
|
|
|
#define GPHOTO_TAG_MOUNT_POINT "MOUNT_POINT"
|
|
#define GPHOTO_TAG_MOUNT_POINT_UID "UID"
|
|
#define GPHOTO_TAG_MOUNT_POINT_GID "GID"
|
|
|
|
typedef enum E_GP_COMMAND{
|
|
GP_NO_CMD = 0,
|
|
GP_SINGLE_SHOT = 1,
|
|
GP_START_BURST = 2,
|
|
GP_START_BURST_STAGE2 = 3,
|
|
GP_STOP_BURST_STAGE1 = 4,
|
|
GP_STOP_BURST = 5,
|
|
GP_SET_CONFIG = 6,
|
|
GP_RETREAVE = 7,
|
|
GP_PREVIEW_SHOT = 8,
|
|
GP_START_PREVIEW = 9,
|
|
GP_STOP_PREVIEW = 10,
|
|
GP_DEL_PHOTOS = 11
|
|
} GP_COMMAND;
|
|
|
|
typedef enum E_GP_CAP_TARGET{
|
|
GP_MEMORY = 0,
|
|
GP_SD_CARD = 1
|
|
} GP_CAP_TARGET;
|
|
|
|
typedef struct S_GP_CAM_COMMAND{
|
|
GP_COMMAND cmd;
|
|
char prm[128];
|
|
char var[128];
|
|
} GP_CAM_COMMAND;
|
|
|
|
typedef queue<GP_CAM_COMMAND *> GP_COMMAND_QUEUE;
|
|
|
|
typedef struct S_GP_CAP_INFO{
|
|
char folder[128];
|
|
char name[64];
|
|
uint64_t ts;
|
|
} GP_CAP_INFO;
|
|
|
|
typedef vector<GP_CAP_INFO *> GP_CAP_VECTOR;
|
|
|
|
typedef enum {
|
|
FLAGS_RECURSE = 1 << 0,
|
|
FLAGS_REVERSE = 1 << 1,
|
|
FLAGS_QUIET = 1 << 2,
|
|
FLAGS_FORCE_OVERWRITE = 1 << 3,
|
|
FLAGS_STDOUT = 1 << 4,
|
|
FLAGS_STDOUT_SIZE = 1 << 5,
|
|
FLAGS_NEW = 1 << 6,
|
|
FLAGS_RESET_CAPTURE_INTERVAL = 1 << 7,
|
|
FLAGS_KEEP = 1 << 8,
|
|
FLAGS_KEEP_RAW = 1 << 9,
|
|
FLAGS_SKIP_EXISTING = 1 << 10,
|
|
} Flags;
|
|
|
|
typedef enum {
|
|
MULTI_UPLOAD,
|
|
MULTI_UPLOAD_META,
|
|
MULTI_DOWNLOAD,
|
|
MULTI_DELETE
|
|
} MultiType;
|
|
enum download_type { DT_NO_DOWNLOAD, DT_DOWNLOAD };
|
|
|
|
#define GP_WM_NA 0
|
|
#define GP_WM_CTRL 1
|
|
#define GP_WM_STOR 2
|
|
#define GP_WM_PREV 3
|
|
#define GP_WM_BURST 4
|
|
|
|
|
|
class gPhotoCamera: public basicThread{
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
config_setting_t * m_pSettings;
|
|
PATHFINDER_DBC * m_pDBC;
|
|
|
|
objectPathfinderBinaryLog * m_pBLOG;
|
|
|
|
uint32_t m_nAccessUID;
|
|
uint32_t m_nAccessGID;
|
|
char m_pCamMountPoint[256];
|
|
basicMutex m_mCommandLock;
|
|
basicMutex m_mDataLock;
|
|
GP_COMMAND_QUEUE m_qCommands;
|
|
GP_CAP_INFO m_vCaptures;
|
|
uint8_t m_bOldWMode;
|
|
uint8_t m_bWMode;
|
|
int m_nCameraID;
|
|
CameraAbilities m_sCamAttribs;
|
|
CameraAbilitiesList * m_pAbilitiesList;
|
|
GPPortInfoList * m_pPortInfoList;
|
|
GPPortInfo m_pPortInfo; // pStruct
|
|
GPPortType m_ePortType; //Enum
|
|
Camera * m_pCamera;
|
|
CameraFile * m_pCamFile;
|
|
GPContext * m_pContext;
|
|
uint32_t m_nFlags;
|
|
char m_pCapFolder[128];
|
|
uint32_t m_nFolderID;
|
|
char m_pCapFile[64];
|
|
|
|
bool m_bBurstCapturing;
|
|
bool m_pChannelIsBusy;
|
|
|
|
int get_config_value_string ( Camera *camera, const char *key, char **str, GPContext *context );
|
|
int _lookup_widget( CameraWidget*widget, const char *key, CameraWidget **child );
|
|
bool fetchFile( uint32_t pictureID );
|
|
/*GPPhoto2 functions*/
|
|
int delete_all_action( char *folder );
|
|
int action_camera_upload_file( char *folder, char *path );
|
|
int action_camera_upload_metadata( char *folder, char *path );
|
|
int num_files_action();
|
|
int list_folders_action();
|
|
int list_files_action();
|
|
int print_info_action( char *folder, char *filename );
|
|
int print_file_action( char *folder, char *filename );
|
|
int save_file_action( char *folder, char *filename );
|
|
int save_exif_action( char *folder, char *filename );
|
|
int save_meta_action( char *folder, char *filename );
|
|
int save_thumbnail_action( char *folder, char *filename );
|
|
int save_raw_action( char *folder, char *filename );
|
|
int save_audio_action( char *folder, char *filename );
|
|
int save_all_audio_action( char *folder, char *filename );
|
|
int delete_file_action( char *folder, char *filename );
|
|
int print_exif_action( char *folder, char *filename );
|
|
int list_cameras_action();
|
|
void _get_portinfo_list();
|
|
int list_ports_action();
|
|
int auto_detect_action();
|
|
int action_camera_show_abilities();
|
|
int action_camera_set_port( const char *port );
|
|
int action_camera_about();
|
|
int action_camera_summary();
|
|
int action_camera_manual();
|
|
int action_camera_set_speed( unsigned int speed );
|
|
int action_camera_set_model( const char *model );
|
|
int set_folder_action( const char *folder );
|
|
int set_filename_action( const char *filename );
|
|
int print_version_action();
|
|
int _action_camera_capture_preview( int viewasciiart );
|
|
int action_camera_capture_preview();
|
|
int action_camera_show_preview();
|
|
int action_camera_capture_movie( const char *arg );
|
|
int action_camera_wait_event ( enum download_type downloadtype, const char*arg );
|
|
int print_storage_info();
|
|
int override_usbids_action( int usb_vendor, int usb_product, int usb_vendor_modified, int usb_product_modified );
|
|
void display_widgets( CameraWidget *widget, char *prefix, int dumpval );
|
|
int list_all_config_action();
|
|
int list_config_action();
|
|
int _find_widget_by_name( const char *name, CameraWidget **child, CameraWidget **rootconfig );
|
|
size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm);
|
|
int print_widget( const char *name, CameraWidget *widget );
|
|
int get_config_action( const char *name );
|
|
int set_config_action( const char *name, const char *value );
|
|
int set_config_index_action( const char *name, const char *value );
|
|
int set_config_value_action( const char *name, const char *value );
|
|
CameraAbilitiesList * gp_params_abilities_list();
|
|
|
|
//int save_file_to_file( Camera *camera, GPContext *context, uint32_t flags, char *folder, char *filename, CameraFileType type );
|
|
//int camera_file_exists( Camera *camera, GPContext *context, char *folder, char *filename, CameraFileType type );
|
|
|
|
//void ñli_error_print(char *format, ...);
|
|
//int get_path_for_file( const char *folder, const char *name, CameraFileType type, CameraFile *file, char **path);
|
|
//int camera_file_exists( Camera *camera, GPContext *context, const char *folder, const char *filename, CameraFileType type );
|
|
//int save_file_to_file( Camera *camera, GPContext *context, Flags flags, const char *folder, const char *filename, CameraFileType type);
|
|
//int save_camera_file_to_file( const char *folder, const char *fn, CameraFileType type, CameraFile *file, const char *tmpname);
|
|
int capture_generic( CameraCaptureType type, const char *name, int download);
|
|
void updateFileTree( int fsid, int parent, CSTR folder );
|
|
bool setWM( uint8_t NMode );
|
|
bool cancelWM( uint8_t NMode );
|
|
protected:
|
|
virtual void m_fThreadProc( void );
|
|
public:
|
|
explicit gPhotoCamera( config_setting_t *Settings );
|
|
explicit gPhotoCamera( PATHFINDER_DBC *DBC );
|
|
explicit gPhotoCamera( config_setting_t *Settings = NULL, PATHFINDER_DBC *DBC = NULL );
|
|
virtual ~gPhotoCamera();
|
|
bool makeShot();
|
|
bool makePreview();
|
|
bool validate();
|
|
bool create();
|
|
bool startBurst();
|
|
bool stopBurst();
|
|
bool startPreview();
|
|
bool stopPreview();
|
|
bool setCaptureTarget( GP_CAP_TARGET T );
|
|
bool retreavePicture( CSTR name );
|
|
bool switchToStorage();
|
|
bool switchToCamera();
|
|
bool deleteAllPictures();
|
|
bool isDead();
|
|
/*
|
|
|
|
/main/actions/syncdatetimeutc
|
|
/main/actions/syncdatetime
|
|
/main/actions/uilock
|
|
/main/actions/autofocusdrive
|
|
/main/actions/manualfocusdrive
|
|
/main/actions/cancelautofocus
|
|
/main/actions/eoszoom
|
|
/main/actions/eoszoomposition
|
|
/main/actions/viewfinder
|
|
/main/actions/eosremoterelease
|
|
/main/actions/opcode
|
|
|
|
|
|
/main/settings/datetimeutc
|
|
/main/settings/datetime
|
|
/main/settings/reviewtime
|
|
/main/settings/output
|
|
/main/settings/movierecordtarget
|
|
/main/settings/evfmode
|
|
/main/settings/ownername
|
|
/main/settings/artist
|
|
/main/settings/copyright
|
|
/main/settings/customfuncex
|
|
/main/settings/focusinfo
|
|
/main/settings/autopoweroff
|
|
/main/settings/depthoffield
|
|
/main/settings/capturetarget
|
|
/main/settings/capture
|
|
|
|
/main/status/serialnumber
|
|
/main/status/manufacturer
|
|
/main/status/cameramodel
|
|
/main/status/deviceversion
|
|
/main/status/vendorextension
|
|
/main/status/model
|
|
/main/status/ptpversion
|
|
/main/status/Battery Level
|
|
/main/status/batterylevel
|
|
/main/status/lensname
|
|
/main/status/eosserialnumber
|
|
/main/status/shuttercounter
|
|
/main/status/availableshots
|
|
|
|
/main/imgsettings/imageformat
|
|
/main/imgsettings/imageformatsd
|
|
/main/imgsettings/iso
|
|
/main/imgsettings/whitebalance
|
|
/main/imgsettings/whitebalanceadjusta
|
|
/main/imgsettings/whitebalanceadjustb
|
|
/main/imgsettings/whitebalancexa
|
|
/main/imgsettings/whitebalancexb
|
|
/main/imgsettings/colorspace
|
|
|
|
|
|
/main/capturesettings/exposurecompensation
|
|
/main/capturesettings/focusmode
|
|
/main/capturesettings/aspectratio
|
|
/main/capturesettings/storageid
|
|
/main/capturesettings/autoexposuremode
|
|
/main/capturesettings/drivemode
|
|
/main/capturesettings/picturestyle
|
|
/main/capturesettings/aperture
|
|
/main/capturesettings/shutterspeed
|
|
/main/capturesettings/meteringmode
|
|
/main/capturesettings/bracketmode
|
|
/main/capturesettings/aeb
|
|
|
|
|
|
*/
|
|
|
|
|
|
};
|
|
|
|
#endif
|