Skip to content

Commit

Permalink
Add missing file.
Browse files Browse the repository at this point in the history
  • Loading branch information
weetmuts committed Aug 1, 2024
1 parent 0493bf1 commit b1d043e
Show file tree
Hide file tree
Showing 2 changed files with 176 additions and 0 deletions.
113 changes: 113 additions & 0 deletions src/storage_gphoto2.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
Copyright (C) 2024 Fredrik Öhrström
This program 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 3 of the License, or
(at your option) any later version.
This program 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, see <http://www.gnu.org/licenses/>.
*/

#include "storage_gphoto2.h"

#include<unistd.h>
#include<algorithm>

#include "log.h"

#include <gphoto2/gphoto2.h>

using namespace std;

static ComponentId GPHOTO2 = registerLogComponent("gphoto2");

Camera *camera {};
GPContext *context {};

RC gphoto2ListBeakFiles(Storage *storage,
vector<TarFileName> *files,
vector<TarFileName> *bad_files,
vector<string> *other_files,
map<Path*,FileStat> *contents,
ptr<System> sys,
ProgressStatistics *st)
{
assert(storage->type == GPhoto2Storage);
return RC::OK;
}

RC gphoto2SendFiles(Storage *storage,
vector<Path*> *files,
Path *local_dir,
FileSystem *local_fs,
ptr<System> sys,
ProgressStatistics *st)
{
assert(storage->type == GPhoto2Storage);
return RC::OK;
}


RC gphoto2FetchFiles(Storage *storage,
vector<Path*> *files,
Path *local_dir,
System *sys,
FileSystem *local_fs,
ProgressStatistics *progress)
{
assert(storage->type == GPhoto2Storage);
return RC::OK;
}


RC gphoto2DeleteFiles(Storage *storage,
std::vector<Path*> *files,
FileSystem *local_fs,
ptr<System> sys,
ProgressStatistics *progress)
{
assert(storage->type == GPhoto2Storage);
return RC::OK;
}

RC gphoto2ListFiles(Storage *storage,
map<Path*,FileStat> *contents,
ptr<System> sys,
ProgressStatistics *st)
{
assert(storage->type == GPhoto2Storage);
CameraFilesystem *fs;
CameraList *list;
GPContext *context;

int x = gp_filesystem_list_files(fs,
"foler",
list,
context);

assert(x);
return RC::OK;
}

static void errordumper(GPLogLevel level,
const char *domain,
const char *str,
void *data)
{
fprintf(stderr, "%s\n", str);
}

string gphoto2EstablishAccess(System *sys)
{
gp_log_add_func(GP_LOG_ERROR, errordumper, NULL);
gp_camera_new(&camera);

return "FFOF";
}
63 changes: 63 additions & 0 deletions src/storage_gphoto2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
Copyright (C) 2018-2024 Fredrik Öhrström
This program 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 3 of the License, or
(at your option) any later version.
This program 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, see <http://www.gnu.org/licenses/>.
*/

#include "always.h"

#include "configuration.h"
#include "monitor.h"
#include "system.h"
#include "tarfile.h"

#include <map>
#include <string>
#include <vector>

std::string gphoto2EstablishAccess(System *sys);
std::string gphoto2ReEstablishAccess(System *sys, bool hint_unplug);

RC gphoto2ListBeakFiles(Storage *storage,
std::vector<TarFileName> *files,
std::vector<TarFileName> *bad_files,
std::vector<std::string> *other_files,
std::map<Path*,FileStat> *contents,
ptr<System> sys,
ProgressStatistics *progress);

RC gphoto2FetchFiles(Storage *storage,
std::vector<Path*> *files,
Path *local_dir,
System *sys,
FileSystem *local_fs,
ProgressStatistics *progress);

RC gphoto2SendFiles(Storage *storage,
std::vector<Path*> *files,
Path *local_dir,
FileSystem *local_fs,
ptr<System> sys,
ProgressStatistics *progress);

RC gphoto2DeleteFiles(Storage *storage,
std::vector<Path*> *files,
FileSystem *local_fs,
ptr<System> sys,
ProgressStatistics *progress);

RC gphoto2ListFiles(Storage *storage,
std::map<Path*,FileStat> *contents,
ptr<System> sys,
ProgressStatistics *st);

0 comments on commit b1d043e

Please sign in to comment.