wrap linphone_core_set_tone() to java

This commit is contained in:
Simon Morlat 2014-03-18 17:55:21 +01:00
parent d032c1d3c9
commit 8be3fd04d1
4 changed files with 47 additions and 0 deletions

View file

@ -1348,6 +1348,16 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getRing(JNIEnv* env
return NULL;
}
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setTone(JNIEnv* env
,jobject thiz
,jlong lc
,jint toneid
,jstring jpath) {
const char* path = jpath ? env->GetStringUTFChars(jpath, NULL) : NULL;
linphone_core_set_tone((LinphoneCore *)lc, (LinphoneToneID)toneid, path);
if (path) env->ReleaseStringUTFChars(jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCallErrorTone(JNIEnv* env
,jobject thiz
,jlong lc

View file

@ -1533,6 +1533,14 @@ public interface LinphoneCore {
*/
public void setCallErrorTone(Reason reason, String path);
/**
* Assign an audio file to be played locally in replacement of common telephony tone.
* This is typically used to internationalize tones.
* @param id a tone id
* @param wav a path to a 16 bit PCM linear wav file.
*/
public void setTone(ToneID id, String wavfile);
/**
* Inform the core about the maximum transmission unit of the network.
* This is used for fragmenting video RTP packets to a size compatible with the network.

View file

@ -0,0 +1,24 @@
package org.linphone.core;
public enum ToneID {
Undefined(0),
Busy(1),
CallWaiting(2),
CallOnHold(3),
CallLost(4);
protected final int mValue;
private ToneID(int value){
mValue=value;
}
static protected ToneID fromInt(int value) throws LinphoneCoreException{
switch(value){
case 0: return Undefined;
case 1: return Busy;
case 2: return CallWaiting;
case 3: return CallOnHold;
case 4: return CallLost;
default:
throw new LinphoneCoreException("Unhandled enum value "+value+" for LinphoneToneID");
}
}
}

View file

@ -1160,5 +1160,10 @@ class LinphoneCoreImpl implements LinphoneCore {
public boolean isSdp200AckEnabled() {
return isSdp200AckEnabled(nativePtr);
}
private native void setTone(long nativePtr, int id, String wavfile);
@Override
public void setTone(ToneID id, String wavfile) {
setTone(nativePtr, id.mValue, wavfile);
}
}