Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
770f6efb
Commit
770f6efb
authored
7 years ago
by
Pierre Duchemin
Committed by
Adrien Béraud
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add swig interface for file transfer
Change-Id: I7428bbc065224cdb5c46b6d8aceeab3c28d848ba
parent
ac0b8da8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/jni/datatransfer.i
+66
-0
66 additions, 0 deletions
bin/jni/datatransfer.i
bin/jni/jni_interface.i
+23
-0
23 additions, 0 deletions
bin/jni/jni_interface.i
with
89 additions
and
0 deletions
bin/jni/datatransfer.i
0 → 100644
+
66
−
0
View file @
770f6efb
/*
* Copyright (C) 2004-2017 Savoir-faire Linux Inc.
*
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
* Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
* Author: Pierre Duchemin <pierre.duchemin@savoirfairelinux.com>
*
* 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
%
apply
int32_t
{ DRing::DataTransferEventCode }
;
%
header
%
{
#
include
"
dring/dring.h
"
#
include
"
dring/datatransfer_interface.h
"
class
DataTransferCallback
{
public
:
virtual
~
DataTransferCallback
()
{}
virtual
void
dataTransferEvent
(
const
uint64_t
transferId
,
int
eventCode
)
{}
}
;
%
}
%
feature
(
"
director
"
)
DataTransferCallback
;
namespace
DRing
{
struct DataTransferInfo
{
bool isOutgoing;
DRing::DataTransferEventCode lastEvent;
std::size_t totalSize {0};
std::streamsize bytesProgress {0};
std::string displayName;
std::string path;
std::string accountId;
std::string peer;
};
void acceptFileTransfer(const uint64_t id, const std::string &file_path, std::size_t offset);
void cancelDataTransfer(const uint64_t id);
std::streamsize dataTransferBytesProgress(const uint64_t id);
DRing::DataTransferInfo dataTransferInfo(const uint64_t id);
/* std::vector<uint64_t> dataTransferList(); */
uint64_t sendFile(const std::string &account_id, const std::string &peer_uri, const std::string &file_path, const std::string &display_name) throw(std::invalid_argument, std::runtime_error);
}
class
DataTransferCallback
{
public
:
virtual
~
DataTransferCallback
()
{}
virtual
void
dataTransferEvent
(
const
uint64_t
transferId
,
int
eventCode
)
{}
}
;
This diff is collapsed.
Click to expand it.
bin/jni/jni_interface.i
+
23
−
0
View file @
770f6efb
...
@@ -52,8 +52,24 @@
...
@@ -52,8 +52,24 @@
return $jnicall;
return $jnicall;
}
}
/* Maps exceptions */
%
typemap
(
throws
,
throws
=
"
java.lang.IllegalArgumentException
"
)
std
::
invalid_argument
{
jclass excep = jenv->FindClass("java/lang/IllegalArgumentException");
if (excep)
jenv->ThrowNew(excep, $1.what().c_str());
return $null;
}
%
typemap
(
throws
,
throws
=
"
java.lang.IllegalStateException
"
)
std
::
runtime_error
{
jclass excep = jenv->FindClass("java/lang/IllegalStateException");
if (excep)
jenv->ThrowNew(excep, $1.what().c_str());
return $null;
}
/* Avoid uint64_t to be converted to BigInteger */
/* Avoid uint64_t to be converted to BigInteger */
%
apply
int64_t
{ uint64_t }
;
%
apply
int64_t
{ uint64_t }
;
%
apply
int64_t
{ const uint64_t }
;
%
apply
int64_t
{ std::streamsize }
;
%
apply
uint64_t
{ time_t }
;
%
apply
uint64_t
{ time_t }
;
namespace
std
{
namespace
std
{
...
@@ -180,6 +196,7 @@ namespace std {
...
@@ -180,6 +196,7 @@ namespace std {
%
include
"
managerimpl.i
"
%
include
"
managerimpl.i
"
%
include
"
callmanager.i
"
%
include
"
callmanager.i
"
%
include
"
configurationmanager.i
"
%
include
"
configurationmanager.i
"
%
include
"
datatransfer.i
"
%
include
"
presencemanager.i
"
%
include
"
presencemanager.i
"
%
include
"
videomanager.i
"
%
include
"
videomanager.i
"
...
@@ -197,6 +214,8 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
...
@@ -197,6 +214,8 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
using DRing::exportable_callback;
using DRing::exportable_callback;
using DRing::CallSignal;
using DRing::CallSignal;
using DRing::ConfigurationSignal;
using DRing::ConfigurationSignal;
using DRing::DataTransferInfo;
using DRing::DataTransferSignal;
using DRing::PresenceSignal;
using DRing::PresenceSignal;
using DRing::VideoSignal;
using DRing::VideoSignal;
...
@@ -258,6 +277,9 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
...
@@ -258,6 +277,9 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
exportable_callback<PresenceSignal::SubscriptionStateChanged>(bind(&PresenceCallback::subscriptionStateChanged, presM, _1, _2, _3 ))
exportable_callback<PresenceSignal::SubscriptionStateChanged>(bind(&PresenceCallback::subscriptionStateChanged, presM, _1, _2, _3 ))
};
};
const std::map<std::string, SharedCallback> dataTransferEvHandlers = {
};
const std::map<std::string, SharedCallback> videoEvHandlers = {
const std::map<std::string, SharedCallback> videoEvHandlers = {
exportable_callback<VideoSignal::GetCameraInfo>(bind(&VideoCallback::getCameraInfo, videoM, _1, _2, _3, _4)),
exportable_callback<VideoSignal::GetCameraInfo>(bind(&VideoCallback::getCameraInfo, videoM, _1, _2, _3, _4)),
exportable_callback<VideoSignal::SetParameters>(bind(&VideoCallback::setParameters, videoM, _1, _2, _3, _4, _5)),
exportable_callback<VideoSignal::SetParameters>(bind(&VideoCallback::setParameters, videoM, _1, _2, _3, _4, _5)),
...
@@ -273,6 +295,7 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
...
@@ -273,6 +295,7 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
registerCallHandlers(callEvHandlers);
registerCallHandlers(callEvHandlers);
registerConfHandlers(configEvHandlers);
registerConfHandlers(configEvHandlers);
registerPresHandlers(presenceEvHandlers);
registerPresHandlers(presenceEvHandlers);
registerDataXferHandlers(dataTransferEvHandlers);
registerVideoHandlers(videoEvHandlers);
registerVideoHandlers(videoEvHandlers);
DRing::start();
DRing::start();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment