mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 11:38:08 +00:00
More work regarding the JNI bindings and the Java interface for the file upload/download
This commit is contained in:
parent
abc0265b97
commit
8ca0fac233
14 changed files with 268 additions and 51 deletions
|
|
@ -100,7 +100,7 @@ static int linphone_chat_message_file_transfer_on_send_body(belle_sip_user_body_
|
|||
char *buf = (char *)buffer;
|
||||
|
||||
/* if we've not reach the end of file yet, ask for more data*/
|
||||
if (offset<chatMsg->file_transfer_information->size){
|
||||
if (offset<chatMsg->file_transfer_information->size){
|
||||
/* get data from call back */
|
||||
lc->vtable.file_transfer_send(lc, chatMsg, chatMsg->file_transfer_information, buf, size);
|
||||
}
|
||||
|
|
@ -1385,7 +1385,6 @@ LinphoneChatMessage* linphone_chat_room_create_file_transfer_message(LinphoneCha
|
|||
linphone_chat_message_set_from(msg, linphone_address_new(linphone_core_get_identity(cr->lc)));
|
||||
msg->content_type=NULL; /* this will be set to application/vnd.gsma.rcs-ft-http+xml when we will transfer the xml reply from server to the peers */
|
||||
msg->http_request=NULL; /* this will store the http request during file upload to the server */
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
|
|
@ -307,5 +309,19 @@ public class TutorialBuddyStatus implements LinphoneCoreListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, String buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, ByteBuffer buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
|
|
@ -225,5 +227,19 @@ public class TutorialChatRoom implements LinphoneCoreListener, LinphoneChatMessa
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, String buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, ByteBuffer buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCallStats;
|
||||
|
|
@ -227,5 +229,19 @@ public class TutorialHelloWorld implements LinphoneCoreListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, String buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, ByteBuffer buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,14 +18,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallStats;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneContent;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
|
|
@ -34,9 +39,6 @@ import org.linphone.core.LinphoneEvent;
|
|||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneInfoMessage;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.PublishState;
|
||||
import org.linphone.core.SubscriptionState;
|
||||
|
||||
|
|
@ -258,6 +260,20 @@ public class TutorialRegistration implements LinphoneCoreListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, String buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, ByteBuffer buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,6 +209,8 @@ public:
|
|||
vTable.publish_state_changed=publishStateChanged;
|
||||
vTable.configuring_status=configuringStatus;
|
||||
vTable.file_transfer_progress_indication=fileTransferProgressIndication;
|
||||
vTable.file_transfer_send=fileTransferSend;
|
||||
vTable.file_transfer_recv=fileTransferRecv;
|
||||
|
||||
listenerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
|
||||
|
||||
|
|
@ -313,6 +315,8 @@ public:
|
|||
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");
|
||||
fileTransferSendId = env->GetMethodID(listenerClass, "fileTransferSend", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;Ljava/nio/ByteBuffer;I)I");
|
||||
fileTransferRecvId = env->GetMethodID(listenerClass, "fileTransferRecv", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;Ljava/lang/String;I)V");
|
||||
}
|
||||
|
||||
~LinphoneCoreData() {
|
||||
|
|
@ -421,6 +425,8 @@ public:
|
|||
jmethodID subscriptionDirFromIntId;
|
||||
|
||||
jmethodID fileTransferProgressIndicationId;
|
||||
jmethodID fileTransferSendId;
|
||||
jmethodID fileTransferRecvId;
|
||||
|
||||
LinphoneCoreVTable vTable;
|
||||
|
||||
|
|
@ -813,6 +819,41 @@ public:
|
|||
content ? create_java_linphone_content(env, content) : NULL,
|
||||
progress);
|
||||
}
|
||||
|
||||
static void fileTransferSend(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, char* buff, size_t* size) {
|
||||
JNIEnv *env = 0;
|
||||
size_t asking = *size;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
|
||||
*size = env->CallIntMethod(lcData->listener,
|
||||
lcData->fileTransferSendId,
|
||||
lcData->core,
|
||||
message ? env->NewObject(lcData->chatMessageClass, lcData->chatMessageCtrId, (jlong)message) : NULL,
|
||||
content ? create_java_linphone_content(env, content) : NULL,
|
||||
buff ? env->NewDirectByteBuffer(buff, asking) : NULL,
|
||||
asking);
|
||||
}
|
||||
|
||||
static void fileTransferRecv(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size) {
|
||||
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->fileTransferRecvId,
|
||||
lcData->core,
|
||||
message ? env->NewObject(lcData->chatMessageClass, lcData->chatMessageCtrId, (jlong)message) : NULL,
|
||||
content ? create_java_linphone_content(env, content) : NULL,
|
||||
buff ? env->NewStringUTF(buff) : NULL,
|
||||
size);
|
||||
}
|
||||
};
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* env
|
||||
|
|
@ -2614,6 +2655,45 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_destroy(JNIEnv* env
|
|||
linphone_chat_room_destroy((LinphoneChatRoom*)ptr);
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createFileTransferMessage(JNIEnv* env, jobject thiz, jlong ptr, jstring jname, jstring jtype, jstring jsubtype, jint data_size) {
|
||||
LinphoneContent content = {0};
|
||||
LinphoneChatMessage *message = NULL;
|
||||
|
||||
content.type = (char*)env->GetStringUTFChars(jtype, NULL);
|
||||
content.subtype = (char*)env->GetStringUTFChars(jsubtype, NULL);
|
||||
content.name = (char*)env->GetStringUTFChars(jname, NULL);
|
||||
content.size = data_size;
|
||||
message = linphone_chat_room_create_file_transfer_message((LinphoneChatRoom *)ptr, &content);
|
||||
env->ReleaseStringUTFChars(jtype, content.type);
|
||||
env->ReleaseStringUTFChars(jsubtype, content.subtype);
|
||||
env->ReleaseStringUTFChars(jname, content.name);
|
||||
|
||||
return (jlong) message;
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_cancelFileTransfer(JNIEnv* env, jobject thiz, jlong ptr, jlong message) {
|
||||
linphone_chat_room_cancel_file_transfer((LinphoneChatMessage *)message);
|
||||
}
|
||||
|
||||
extern "C" jobject Java_org_linphone_core_LinphoneChatMessageImpl_getFileTransferInformation(JNIEnv* env, jobject thiz, jlong ptr) {
|
||||
const LinphoneContent *content = linphone_chat_message_get_file_transfer_information((LinphoneChatMessage *)ptr);
|
||||
if (content)
|
||||
return create_java_linphone_content(env, content);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFileTransferServer(JNIEnv* env, jobject thiz, jlong ptr, jstring server_url) {
|
||||
const char * url = server_url ? env->GetStringUTFChars(server_url, NULL) : NULL;
|
||||
linphone_core_set_file_transfer_server((LinphoneCore *)ptr, url);
|
||||
if (server_url)
|
||||
env->ReleaseStringUTFChars(server_url, url);
|
||||
}
|
||||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getFileTransferServer(JNIEnv* env, jobject thiz, jlong ptr) {
|
||||
const char * server_url = linphone_core_get_file_transfer_server((LinphoneCore *)ptr);
|
||||
return server_url ? env->NewStringUTF(server_url) : NULL;
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_store(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
|
|
@ -2801,6 +2881,13 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage2(JNIEnv*
|
|||
linphone_chat_room_send_message2((LinphoneChatRoom*)chatroom_ptr, (LinphoneChatMessage*)messagePtr, chat_room_impl_callback, (void*)listener);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_startFileDownload(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
jobject listener = env->NewGlobalRef(jlistener);
|
||||
LinphoneChatMessage * message = (LinphoneChatMessage *)ptr;
|
||||
message->cb_ud = listener;
|
||||
linphone_chat_message_start_file_download(message, chat_room_impl_callback);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
|
|
@ -3836,22 +3923,23 @@ extern "C" jintArray Java_org_linphone_core_LpConfigImpl_getIntRange(JNIEnv *env
|
|||
static jobject create_java_linphone_content(JNIEnv *env, const LinphoneContent *content){
|
||||
jclass contentClass;
|
||||
jmethodID ctor;
|
||||
jstring jtype, jsubtype, jencoding;
|
||||
jbyteArray jdata=NULL;
|
||||
jstring jtype, jsubtype, jencoding, jname;
|
||||
jbyteArray jdata = NULL;
|
||||
|
||||
contentClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneContentImpl"));
|
||||
ctor = env->GetMethodID(contentClass,"<init>", "(Ljava/lang/String;Ljava/lang/String;[BLjava/lang/String;)V");
|
||||
ctor = env->GetMethodID(contentClass,"<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BLjava/lang/String;)V");
|
||||
|
||||
jtype=env->NewStringUTF(content->type);
|
||||
jsubtype=env->NewStringUTF(content->subtype);
|
||||
jencoding=content->encoding ? env->NewStringUTF(content->encoding) : NULL;
|
||||
jtype = env->NewStringUTF(content->type);
|
||||
jsubtype = env->NewStringUTF(content->subtype);
|
||||
jencoding = content->encoding ? env->NewStringUTF(content->encoding) : NULL;
|
||||
jname = content->name ? env->NewStringUTF(content->name) : NULL;
|
||||
|
||||
if (content->data){
|
||||
jdata=env->NewByteArray(content->size);
|
||||
env->SetByteArrayRegion(jdata,0,content->size,(jbyte*)content->data);
|
||||
jdata = env->NewByteArray(content->size);
|
||||
env->SetByteArrayRegion(jdata, 0, content->size, (jbyte*)content->data);
|
||||
}
|
||||
|
||||
jobject jobj=env->NewObject(contentClass,ctor,jtype, jsubtype, jdata,jencoding);
|
||||
jobject jobj = env->NewObject(contentClass, ctor, jname, jtype, jsubtype, jdata, jencoding);
|
||||
env->DeleteGlobalRef(contentClass);
|
||||
return jobj;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,4 +157,15 @@ public interface LinphoneChatMessage {
|
|||
* @return an ErrorInfo.
|
||||
*/
|
||||
ErrorInfo getErrorInfo();
|
||||
|
||||
/**
|
||||
* Start the download of the file bundled in the message
|
||||
*/
|
||||
void startFileDownload(LinphoneChatMessage.StateListener listener);
|
||||
|
||||
/**
|
||||
* Get the file_transfer_information (used by call backs to recover informations during a rcs file transfer)
|
||||
* @return a pointer to the LinphoneContent structure or NULL if not present.
|
||||
*/
|
||||
LinphoneContent getFileTransferInformation();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,11 +149,4 @@ public interface LinphoneChatRoom {
|
|||
* @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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,4 +59,8 @@ public interface LinphoneContent {
|
|||
* Set the data, as a byte buffer.
|
||||
**/
|
||||
void setData(byte data[]);
|
||||
|
||||
void setName(String name);
|
||||
|
||||
String getName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
||||
|
||||
|
||||
|
|
@ -197,5 +199,26 @@ public interface LinphoneCoreListener {
|
|||
* @param progress percentage of the transfer done
|
||||
*/
|
||||
void fileTransferProgressIndication(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, int progress);
|
||||
|
||||
/**
|
||||
* Callback to be notified when new data has been received
|
||||
* @param lc the LinphoneCore
|
||||
* @param message the LinphoneChatMessage
|
||||
* @param content the LinphoneContent
|
||||
* @param buffer
|
||||
* @param size
|
||||
*/
|
||||
void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, String buffer, int size);
|
||||
|
||||
/**
|
||||
* Callback to be notified when new data needs to be sent
|
||||
* @param lc the LinphoneCore
|
||||
* @param message the LinphoneChatMessage
|
||||
* @param content the LinphoneContent
|
||||
* @param buffer
|
||||
* @param size
|
||||
* @return the number of bytes written into buffer
|
||||
*/
|
||||
int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, ByteBuffer buffer, int size);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,4 +103,16 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage {
|
|||
unref(nativePtr);
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
private native void startFileDownload(long ptr, StateListener listener);
|
||||
@Override
|
||||
public void startFileDownload(StateListener listener) {
|
||||
startFileDownload(nativePtr, listener);
|
||||
}
|
||||
|
||||
private native Object getFileTransferInformation(long ptr);
|
||||
@Override
|
||||
public LinphoneContent getFileTransferInformation() {
|
||||
return (LinphoneContent) getFileTransferInformation(nativePtr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,22 +169,19 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
return messages;
|
||||
}
|
||||
|
||||
private native long createFileTransferMessage(long ptr, String name, String type, String subtype, int size);
|
||||
@Override
|
||||
public LinphoneChatMessage createFileTransferMessage(LinphoneContent content) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
synchronized(getCore()) {
|
||||
return new LinphoneChatMessageImpl(createFileTransferMessage(nativePtr, content.getName(), content.getType(), content.getSubtype(), content.getSize()));
|
||||
}
|
||||
}
|
||||
|
||||
private native void cancelFileTransfer(long ptr, long messagePtr);
|
||||
@Override
|
||||
public void cancelFileTransfer(LinphoneChatMessage message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinphoneContent getFileTransferInformation(
|
||||
LinphoneChatMessage message) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
synchronized(getCore()) {
|
||||
cancelFileTransfer(nativePtr, ((LinphoneChatMessageImpl)message).getNativePtr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,23 @@
|
|||
package org.linphone.core;
|
||||
|
||||
public class LinphoneContentImpl implements LinphoneContent {
|
||||
private String mType, mSubtype, mEncoding;
|
||||
private String mType, mSubtype, mEncoding, mName;
|
||||
private byte[] mData;
|
||||
|
||||
public LinphoneContentImpl(String type, String subtype, byte data[], String encoding ){
|
||||
mType=type;
|
||||
mSubtype=subtype;
|
||||
mData=data;
|
||||
mEncoding=encoding;
|
||||
public LinphoneContentImpl(String type, String subtype, byte data[], String encoding){
|
||||
mType = type;
|
||||
mSubtype = subtype;
|
||||
mData = data;
|
||||
mEncoding = encoding;
|
||||
mName = null;
|
||||
}
|
||||
|
||||
public LinphoneContentImpl(String name, String type, String subtype, byte data[], String encoding){
|
||||
mType = type;
|
||||
mSubtype = subtype;
|
||||
mData = data;
|
||||
mEncoding = encoding;
|
||||
mName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -23,32 +32,39 @@ public class LinphoneContentImpl implements LinphoneContent {
|
|||
|
||||
@Override
|
||||
public String getDataAsString() {
|
||||
return new String(mData);
|
||||
if (mData != null)
|
||||
return new String(mData);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return mData.length;
|
||||
if (mData != null)
|
||||
return mData.length;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(String type) {
|
||||
mType=type;
|
||||
mType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSubtype(String subtype) {
|
||||
mSubtype=subtype;
|
||||
mSubtype = subtype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStringData(String data) {
|
||||
mData=data.getBytes();
|
||||
if (data != null)
|
||||
mData = data.getBytes();
|
||||
else
|
||||
mData = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(byte data[]){
|
||||
mData=data;
|
||||
mData = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -63,7 +79,17 @@ public class LinphoneContentImpl implements LinphoneContent {
|
|||
|
||||
@Override
|
||||
public void setEncoding(String encoding) {
|
||||
mEncoding=encoding;
|
||||
mEncoding = encoding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
mName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1241,16 +1241,16 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
setVideoJittcomp(nativePtr,value);
|
||||
}
|
||||
|
||||
private native void setFileTransferServer(long ptr, String serverUrl);
|
||||
@Override
|
||||
public void setFileTransferServer(String serverUrl) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
public synchronized void setFileTransferServer(String serverUrl) {
|
||||
setFileTransferServer(nativePtr, serverUrl);
|
||||
}
|
||||
|
||||
private native String getFileTransferServer(long ptr);
|
||||
@Override
|
||||
public String getFileTransferServer() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
public synchronized String getFileTransferServer() {
|
||||
return getFileTransferServer(nativePtr);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue