mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-22 15:38:33 +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);
|
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.
|
* This function controls signaling features supported by the core.
|
||||||
* They are typically included in a SIP Supported header.
|
* 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);
|
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.
|
* Returns a null terminated table of strings containing the file format extension supported for call recording.
|
||||||
* @param core the core
|
* @param core the core
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,7 @@ public:
|
||||||
vTable.notify_received=notifyReceived;
|
vTable.notify_received=notifyReceived;
|
||||||
vTable.publish_state_changed=publishStateChanged;
|
vTable.publish_state_changed=publishStateChanged;
|
||||||
vTable.configuring_status=configuringStatus;
|
vTable.configuring_status=configuringStatus;
|
||||||
|
vTable.file_transfer_progress_indication=fileTransferProgressIndication;
|
||||||
|
|
||||||
listenerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
|
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");
|
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"));
|
configuringStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RemoteProvisioningState"));
|
||||||
configuringStateFromIntId = env->GetStaticMethodID(configuringStateClass,"fromInt","(I)Lorg/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() {
|
~LinphoneCoreData() {
|
||||||
|
|
@ -417,6 +420,8 @@ public:
|
||||||
jclass subscriptionDirClass;
|
jclass subscriptionDirClass;
|
||||||
jmethodID subscriptionDirFromIntId;
|
jmethodID subscriptionDirFromIntId;
|
||||||
|
|
||||||
|
jmethodID fileTransferProgressIndicationId;
|
||||||
|
|
||||||
LinphoneCoreVTable vTable;
|
LinphoneCoreVTable vTable;
|
||||||
|
|
||||||
static void showInterfaceCb(LinphoneCore *lc) {
|
static void showInterfaceCb(LinphoneCore *lc) {
|
||||||
|
|
@ -792,6 +797,22 @@ public:
|
||||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
|
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);
|
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
|
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* env
|
||||||
|
|
|
||||||
|
|
@ -14,21 +14,25 @@ public interface LinphoneChatMessage {
|
||||||
|
|
||||||
private final String mStringValue;
|
private final String mStringValue;
|
||||||
/**
|
/**
|
||||||
* Idle
|
* Initial state
|
||||||
*/
|
*/
|
||||||
public final static State Idle = new State(0,"Idle");
|
public final static State Idle = new State(0,"Idle");
|
||||||
/**
|
/**
|
||||||
* Incoming call received.
|
* Delivery in progress
|
||||||
*/
|
*/
|
||||||
public final static State InProgress = new State(1,"InProgress");
|
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");
|
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");
|
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) {
|
private State(int value,String stringValue) {
|
||||||
mValue = value;
|
mValue = value;
|
||||||
|
|
@ -153,5 +157,4 @@ public interface LinphoneChatMessage {
|
||||||
* @return an ErrorInfo.
|
* @return an ErrorInfo.
|
||||||
*/
|
*/
|
||||||
ErrorInfo getErrorInfo();
|
ErrorInfo getErrorInfo();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,13 @@ public interface LinphoneChatRoom {
|
||||||
* @return LinphoneAddress peer address
|
* @return LinphoneAddress peer address
|
||||||
*/
|
*/
|
||||||
LinphoneAddress getPeerAddress();
|
LinphoneAddress getPeerAddress();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send a message to peer member of this chat room.
|
* send a message to peer member of this chat room.
|
||||||
* @param message to be sent
|
* @param message to be sent
|
||||||
*/
|
*/
|
||||||
void sendMessage(String message);
|
void sendMessage(String message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to peer member of this chat room.
|
* Send a message to peer member of this chat room.
|
||||||
* @param chat message
|
* @param chat message
|
||||||
|
|
@ -128,9 +130,30 @@ public interface LinphoneChatRoom {
|
||||||
* @return LinphoneChatMessage object
|
* @return LinphoneChatMessage object
|
||||||
*/
|
*/
|
||||||
LinphoneChatMessage createLinphoneChatMessage(String message, String url, State state, long timestamp, boolean isRead, boolean isIncoming);
|
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.
|
* Returns a back pointer to the core managing the chat room.
|
||||||
* @return the LinphoneCore
|
* @return the LinphoneCore
|
||||||
*/
|
*/
|
||||||
LinphoneCore getCore();
|
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;
|
package org.linphone.core;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||||
|
|
@ -1695,4 +1694,16 @@ public interface LinphoneCore {
|
||||||
* @param value the jitter buffer size in milliseconds.
|
* @param value the jitter buffer size in milliseconds.
|
||||||
*/
|
*/
|
||||||
public void setVideoJittcomp(int value);
|
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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -189,5 +189,13 @@ public interface LinphoneCoreListener {
|
||||||
* @return */
|
* @return */
|
||||||
void displayWarning(LinphoneCore lc,String message);
|
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;
|
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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
|
@ -1242,4 +1241,16 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
setVideoJittcomp(nativePtr,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