mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 00:29:21 +00:00
Started Java impl of file transfer
This commit is contained in:
parent
b2ae9095d9
commit
c384b0b362
13 changed files with 143 additions and 8 deletions
|
|
@ -300,5 +300,12 @@ public class TutorialBuddyStatus implements LinphoneCoreListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferProgressIndication(LinphoneCore lc,
|
||||
LinphoneChatMessage message, LinphoneContent content, int progress) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,5 +218,12 @@ public class TutorialChatRoom implements LinphoneCoreListener, LinphoneChatMessa
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferProgressIndication(LinphoneCore lc,
|
||||
LinphoneChatMessage message, LinphoneContent content, int progress) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,5 +220,12 @@ public class TutorialHelloWorld implements LinphoneCoreListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferProgressIndication(LinphoneCore lc,
|
||||
LinphoneChatMessage message, LinphoneContent content, int progress) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,6 +251,13 @@ public class TutorialRegistration implements LinphoneCoreListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferProgressIndication(LinphoneCore lc,
|
||||
LinphoneChatMessage message, LinphoneContent content, int progress) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6399,6 +6399,10 @@ void linphone_core_set_file_transfer_server(LinphoneCore *core, const char * ser
|
|||
core->file_transfer_server=ms_strdup(server_url);
|
||||
}
|
||||
|
||||
const char * linphone_core_get_file_transfer_server(LinphoneCore *core) {
|
||||
return core->file_transfer_server;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function controls signaling features supported by the core.
|
||||
* They are typically included in a SIP Supported header.
|
||||
|
|
|
|||
|
|
@ -2854,6 +2854,13 @@ LINPHONE_PUBLIC void linphone_core_set_tone(LinphoneCore *lc, LinphoneToneID id,
|
|||
* */
|
||||
LINPHONE_PUBLIC void linphone_core_set_file_transfer_server(LinphoneCore *core, const char * server_url);
|
||||
|
||||
/**
|
||||
* Get the globaly set http file transfer server to be used for content type application/vnd.gsma.rcs-ft-http+xml.
|
||||
* @param[in] core #LinphoneCore from which to get the server_url
|
||||
* @return URL of the file server like https://file.linphone.org/upload.php
|
||||
* */
|
||||
LINPHONE_PUBLIC const char * linphone_core_get_file_transfer_server(LinphoneCore *core);
|
||||
|
||||
/**
|
||||
* Returns a null terminated table of strings containing the file format extension supported for call recording.
|
||||
* @param core the core
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ public:
|
|||
vTable.notify_received=notifyReceived;
|
||||
vTable.publish_state_changed=publishStateChanged;
|
||||
vTable.configuring_status=configuringStatus;
|
||||
vTable.file_transfer_progress_indication=fileTransferProgressIndication;
|
||||
|
||||
listenerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
|
||||
|
||||
|
|
@ -310,6 +311,8 @@ public:
|
|||
configuringStateId = env->GetMethodID(listenerClass,"configuringStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$RemoteProvisioningState;Ljava/lang/String;)V");
|
||||
configuringStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RemoteProvisioningState"));
|
||||
configuringStateFromIntId = env->GetStaticMethodID(configuringStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RemoteProvisioningState;");
|
||||
|
||||
fileTransferProgressIndicationId = env->GetMethodID(listenerClass, "fileTransferProgressIndication", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;I)V");
|
||||
}
|
||||
|
||||
~LinphoneCoreData() {
|
||||
|
|
@ -417,6 +420,8 @@ public:
|
|||
jclass subscriptionDirClass;
|
||||
jmethodID subscriptionDirFromIntId;
|
||||
|
||||
jmethodID fileTransferProgressIndicationId;
|
||||
|
||||
LinphoneCoreVTable vTable;
|
||||
|
||||
static void showInterfaceCb(LinphoneCore *lc) {
|
||||
|
|
@ -792,6 +797,22 @@ public:
|
|||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
|
||||
env->CallVoidMethod(lcData->listener, lcData->configuringStateId, lcData->core, env->CallStaticObjectMethod(lcData->configuringStateClass,lcData->configuringStateFromIntId,(jint)status), message ? env->NewStringUTF(message) : NULL);
|
||||
}
|
||||
|
||||
static void fileTransferProgressIndication(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t progress) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
|
||||
env->CallVoidMethod(lcData->listener,
|
||||
lcData->fileTransferProgressIndicationId,
|
||||
lcData->core,
|
||||
message ? env->NewObject(lcData->chatMessageClass, lcData->chatMessageCtrId, (jlong)message) : NULL,
|
||||
content ? create_java_linphone_content(env, content) : NULL,
|
||||
progress);
|
||||
}
|
||||
};
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* env
|
||||
|
|
|
|||
|
|
@ -14,21 +14,25 @@ public interface LinphoneChatMessage {
|
|||
|
||||
private final String mStringValue;
|
||||
/**
|
||||
* Idle
|
||||
* Initial state
|
||||
*/
|
||||
public final static State Idle = new State(0,"Idle");
|
||||
/**
|
||||
* Incoming call received.
|
||||
* Delivery in progress
|
||||
*/
|
||||
public final static State InProgress = new State(1,"InProgress");
|
||||
/**
|
||||
* Outgoing call initialiazed.
|
||||
* Message succesffully delivered an acknoleged by remote end point
|
||||
*/
|
||||
public final static State Delivered = new State(2,"Delivered");
|
||||
/**
|
||||
* Outgoing call in progress.
|
||||
* Message was not delivered
|
||||
*/
|
||||
public final static State NotDelivered = new State(3,"NotDelivered");
|
||||
/**
|
||||
* Message was received(and acknowledged) but cannot get file from server
|
||||
*/
|
||||
public final static State FileTransferError = new State(4,"FileTransferError");
|
||||
|
||||
private State(int value,String stringValue) {
|
||||
mValue = value;
|
||||
|
|
@ -153,5 +157,4 @@ public interface LinphoneChatMessage {
|
|||
* @return an ErrorInfo.
|
||||
*/
|
||||
ErrorInfo getErrorInfo();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,11 +33,13 @@ public interface LinphoneChatRoom {
|
|||
* @return LinphoneAddress peer address
|
||||
*/
|
||||
LinphoneAddress getPeerAddress();
|
||||
|
||||
/**
|
||||
* send a message to peer member of this chat room.
|
||||
* @param message to be sent
|
||||
*/
|
||||
void sendMessage(String message);
|
||||
|
||||
/**
|
||||
* Send a message to peer member of this chat room.
|
||||
* @param chat message
|
||||
|
|
@ -128,9 +130,30 @@ public interface LinphoneChatRoom {
|
|||
* @return LinphoneChatMessage object
|
||||
*/
|
||||
LinphoneChatMessage createLinphoneChatMessage(String message, String url, State state, long timestamp, boolean isRead, boolean isIncoming);
|
||||
|
||||
/**
|
||||
* Returns a back pointer to the core managing the chat room.
|
||||
* @return the LinphoneCore
|
||||
*/
|
||||
LinphoneCore getCore();
|
||||
|
||||
/**
|
||||
* Create a message attached to a dedicated chat room with a particular content.
|
||||
* @param content LinphoneContent initial content.
|
||||
* @return a new LinphoneChatMessage
|
||||
*/
|
||||
LinphoneChatMessage createFileTransferMessage(LinphoneContent content);
|
||||
|
||||
/**
|
||||
* Cancel an ongoing file transfer attached to this message (upload or download)
|
||||
* @param message
|
||||
*/
|
||||
void cancelFileTransfer(LinphoneChatMessage message);
|
||||
|
||||
/**
|
||||
* Get the file_transfer_information (used by call backs to recover informations during a rcs file transfer)
|
||||
* @param message
|
||||
* @return a pointer to the LinphoneContent structure or NULL if not present.
|
||||
*/
|
||||
LinphoneContent getFileTransferInformation(LinphoneChatMessage message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||
|
|
@ -1695,4 +1694,16 @@ public interface LinphoneCore {
|
|||
* @param value the jitter buffer size in milliseconds.
|
||||
*/
|
||||
public void setVideoJittcomp(int value);
|
||||
|
||||
/**
|
||||
* Globaly set an http file transfer server to be used for content type application/vnd.gsma.rcs-ft-http+xml.
|
||||
* @param serverUrl URL of the file server like https://file.linphone.org/upload.php
|
||||
*/
|
||||
public void setFileTransferServer(String serverUrl);
|
||||
|
||||
/**
|
||||
* Get the globaly set http file transfer server to be used for content type application/vnd.gsma.rcs-ft-http+xml.
|
||||
* @return the serverUrl
|
||||
*/
|
||||
public String getFileTransferServer();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,6 +188,14 @@ public interface LinphoneCoreListener {
|
|||
/** @Deprecated Callback to display a warning to the user
|
||||
* @return */
|
||||
void displayWarning(LinphoneCore lc,String message);
|
||||
|
||||
|
||||
/**
|
||||
* Callback to be notified about the transfer progress.
|
||||
* @param lc the LinphoneCore
|
||||
* @param message the LinphoneChatMessage
|
||||
* @param content the LinphoneContent
|
||||
* @param progress percentage of the transfer done
|
||||
*/
|
||||
void fileTransferProgressIndication(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, int progress);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,4 +168,23 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinphoneChatMessage createFileTransferMessage(LinphoneContent content) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelFileTransfer(LinphoneChatMessage message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinphoneContent getFileTransferInformation(
|
||||
LinphoneChatMessage message) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import static android.media.AudioManager.MODE_IN_CALL;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
|
@ -1241,5 +1240,17 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public synchronized void setVideoJittcomp(int value) {
|
||||
setVideoJittcomp(nativePtr,value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFileTransferServer(String serverUrl) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileTransferServer() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue