summaryrefslogtreecommitdiffabout
path: root/src
Side-by-side diff
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/eyefi.h1
-rw-r--r--src/eyefiservice.cc6
2 files changed, 5 insertions, 2 deletions
diff --git a/src/eyefi.h b/src/eyefi.h
index 70e918d..84a5ebd 100644
--- a/src/eyefi.h
+++ b/src/eyefi.h
@@ -6,42 +6,43 @@
//gsoap efs service method-action: MarkLastPhotoInRoll "urn:MarkLastPhotoInRoll"
//gsoap rns service namespace: http://localhost/api/soap/eyefilm
struct rns__StartSessionResponse {
std::string credential;
std::string snonce;
int transfermode;
unsigned int transfermodetimestamp;
bool upsyncallowed;
};
int efs__StartSession(
std::string macaddress,std::string cnonce,
int transfermode,long transfermodetimestamp,
struct rns__StartSessionResponse &r );
struct rns__GetPhotoStatusResponse {
int fileid;
long offset;
};
int efs__GetPhotoStatus(
std::string credential, std::string macaddress,
std::string filename, long filesize, std::string filesignature,
+ int flags,
struct rns__GetPhotoStatusResponse &r );
struct rns__MarkLastPhotoInRollResponse {
};
int efs__MarkLastPhotoInRoll(
std::string macaddress, int mergedelta,
struct rns__MarkLastPhotoInRollResponse &r );
struct rns__UploadPhotoResponse {
bool success;
};
int efs__UploadPhoto(
int fileid, std::string macaddress,
std::string filename, long filesize, std::string filesignature,
std::string encryption, int flags,
struct rns__UploadPhotoResponse& r );
diff --git a/src/eyefiservice.cc b/src/eyefiservice.cc
index 1a21c02..5cbc396 100644
--- a/src/eyefiservice.cc
+++ b/src/eyefiservice.cc
@@ -52,53 +52,55 @@ int eyefiService::StartSession(
r.snonce = session_nonce.make_nonce().hex();
r.transfermode=transfermode;
r.transfermodetimestamp=transfermodetimestamp;
r.upsyncallowed=false;
std::string cmd = eyekinfig_t(macaddress).get_on_start_session();
if(!cmd.empty()) {
if(detached_child()) {
putenv( gnu::autosprintf("EYEFI_MACADDRESS=%s",macaddress.c_str()) );
putenv( gnu::autosprintf("EYEFI_TRANSFERMODE=%d",transfermode) );
putenv( gnu::autosprintf("EYEFI_TRANSFERMODETIMESTAMP=%ld",transfermodetimestamp) );
char *argv[] = { (char*)"/bin/sh", (char*)"-c", (char*)cmd.c_str(), 0 };
execv("/bin/sh",argv);
syslog(LOG_ERR,"Failed to execute '%s'",cmd.c_str());
_exit(-1);
}
}
return SOAP_OK;
}
int eyefiService::GetPhotoStatus(
std::string credential, std::string macaddress,
std::string filename, long filesize, std::string filesignature,
+ int flags,
struct rns__GetPhotoStatusResponse &r ) {
#ifndef NDEBUG
syslog(LOG_DEBUG,
- "GetPhotoStatus request from %s with credential=%s, filename=%s, filesize=%ld, filesignature=%s; session nonce=%s",
- macaddress.c_str(), credential.c_str(), filename.c_str(), filesize, filesignature.c_str(), session_nonce.hex().c_str() );
+ "GetPhotoStatus request from %s with credential=%s, filename=%s, filesize=%ld, filesignature=%s, flags=%d; session nonce=%s",
+ macaddress.c_str(), credential.c_str(), filename.c_str(), filesize, filesignature.c_str(), flags,
+ session_nonce.hex().c_str() );
#endif
std::string computed_credential = binary_t(macaddress+eyekinfig_t(macaddress).get_upload_key()+session_nonce.hex()).md5().hex();
#ifndef NDEBUG
syslog(LOG_DEBUG, " computed credential=%s", computed_credential.c_str());
#endif
if (credential != computed_credential) throw std::runtime_error("card authentication failed");
r.fileid = 1; r.offset = 0;
return SOAP_OK;
}
int eyefiService::MarkLastPhotoInRoll(
std::string macaddress, int mergedelta,
struct rns__MarkLastPhotoInRollResponse &r ) {
#ifndef NDEBUG
syslog(LOG_DEBUG,
"MarkLastPhotoInRoll request from %s with mergedelta=%d",
macaddress.c_str(), mergedelta );
#endif
std::string cmd = eyekinfig_t(macaddress).get_on_mark_last_photo_in_roll();
if(!cmd.empty()) {