diff --git a/build.xml b/build.xml index 53d321830..623465b90 100644 --- a/build.xml +++ b/build.xml @@ -1051,6 +1051,10 @@ + + + + diff --git a/src/org/linphone/core/LinphoneAddressImpl.java b/src/org/linphone/core/LinphoneAddressImpl.java deleted file mode 100644 index b9d290971..000000000 --- a/src/org/linphone/core/LinphoneAddressImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -/* -LinphoneAddressImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - - - -public class LinphoneAddressImpl implements LinphoneAddress { - protected final long nativePtr; - boolean ownPtr = false; - private native long newLinphoneAddressImpl(String uri,String displayName); - private native void delete(long ptr); - private native String getDisplayName(long ptr); - private native String getUserName(long ptr); - private native String getDomain(long ptr); - private native String toUri(long ptr); - private native void setDisplayName(long ptr,String name); - private native String toString(long ptr); - - protected LinphoneAddressImpl(String identity) { - nativePtr = newLinphoneAddressImpl(identity, null); - } - - protected LinphoneAddressImpl(String username,String domain,String displayName) { - nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName); - } - protected LinphoneAddressImpl(long aNativePtr,boolean javaOwnPtr) { - nativePtr = aNativePtr; - ownPtr=javaOwnPtr; - } - protected LinphoneAddressImpl(long aNativePtr) { - nativePtr = aNativePtr; - ownPtr=false; - } - protected void finalize() throws Throwable { - if (ownPtr) delete(nativePtr); - } - public String getDisplayName() { - return getDisplayName(nativePtr); - } - public String getDomain() { - return getDomain(nativePtr); - } - public String getUserName() { - return getUserName(nativePtr); - } - - public String toString() { - return toString(nativePtr); - } - public String toUri() { - return toUri(nativePtr); - } - public void setDisplayName(String name) { - setDisplayName(nativePtr,name); - } - public String asString() { - return toString(); - } - public String asStringUriOnly() { - return toUri(nativePtr); - } - public void clean() { - throw new RuntimeException("Not implemented"); - } - public String getPort() { - return String.valueOf(getPortInt()); - } - public int getPortInt() { - return getPortInt(); - } - public void setDomain(String domain) { - throw new RuntimeException("Not implemented"); - } - public void setPort(String port) { - throw new RuntimeException("Not implemented"); - } - public void setPortInt(int port) { - throw new RuntimeException("Not implemented"); - } - public void setUserName(String username) { - throw new RuntimeException("Not implemented"); - } - -} diff --git a/src/org/linphone/core/LinphoneAuthInfoImpl.java b/src/org/linphone/core/LinphoneAuthInfoImpl.java deleted file mode 100644 index 45fd8a45e..000000000 --- a/src/org/linphone/core/LinphoneAuthInfoImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/* -LinphoneAuthInfoImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -class LinphoneAuthInfoImpl implements LinphoneAuthInfo { - protected final long nativePtr; - private native long newLinphoneAuthInfo(String username, String userid, String passwd, String ha1,String realm); - private native void delete(long ptr); - protected LinphoneAuthInfoImpl(String username,String password, String realm) { - nativePtr = newLinphoneAuthInfo(username,"",password,"",""); - } - protected void finalize() throws Throwable { - delete(nativePtr); - } - public String getPassword() { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); - } - public String getRealm() { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); - } - public String getUsername() { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); - } - public void setPassword(String password) { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); - } - public void setRealm(String realm) { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); - } - public void setUsername(String username) { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); - } -} diff --git a/src/org/linphone/core/LinphoneCallImpl.java b/src/org/linphone/core/LinphoneCallImpl.java deleted file mode 100644 index 7e39cebc7..000000000 --- a/src/org/linphone/core/LinphoneCallImpl.java +++ /dev/null @@ -1,187 +0,0 @@ -/* -LinphoneCallImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - - -class LinphoneCallImpl implements LinphoneCall { - - protected final long nativePtr; - boolean ownPtr = false; - private LinphoneCallStats audioStats; - private LinphoneCallStats videoStats; - - native private void finalize(long nativePtr); - native private long getCallLog(long nativePtr); - private native boolean isIncoming(long nativePtr); - native private long getRemoteAddress(long nativePtr); - native private int getState(long nativePtr); - private native long getCurrentParamsCopy(long nativePtr); - private native long getRemoteParams(long nativePtr); - private native void enableCamera(long nativePtr, boolean enabled); - private native boolean cameraEnabled(long nativePtr); - private native void enableEchoCancellation(long nativePtr,boolean enable); - private native boolean isEchoCancellationEnabled(long nativePtr) ; - private native void enableEchoLimiter(long nativePtr,boolean enable); - private native boolean isEchoLimiterEnabled(long nativePtr); - private native Object getReplacedCall(long nativePtr); - private native int getDuration(long nativePtr); - private native float getCurrentQuality(long nativePtr); - private native float getAverageQuality(long nativePtr); - - /* - * This method must always be called from JNI, nothing else. - */ - private LinphoneCallImpl(long aNativePtr) { - nativePtr = aNativePtr; - } - protected void finalize() throws Throwable { - finalize(nativePtr); - } - public LinphoneCallLog getCallLog() { - long lNativePtr = getCallLog(nativePtr); - if (lNativePtr!=0) { - return new LinphoneCallLogImpl(lNativePtr); - } else { - return null; - } - } - public void setAudioStats(LinphoneCallStats stats) { - audioStats = stats; - } - public void setVideoStats(LinphoneCallStats stats) { - videoStats = stats; - } - public LinphoneCallStats getAudioStats() { - return audioStats; - } - public LinphoneCallStats getVideoStats() { - return videoStats; - } - public CallDirection getDirection() { - return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing; - } - public LinphoneAddress getRemoteAddress() { - long lNativePtr = getRemoteAddress(nativePtr); - if (lNativePtr!=0) { - return new LinphoneAddressImpl(lNativePtr); - } else { - return null; - } - } - public State getState() { - return LinphoneCall.State.fromInt(getState(nativePtr)); - } - public LinphoneCallParams getCurrentParamsCopy() { - return new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); - } - public LinphoneCallParams getRemoteParams() { - long remoteParamsPtr = getRemoteParams(nativePtr); - if (remoteParamsPtr == 0) { - return null; - } - return new LinphoneCallParamsImpl(remoteParamsPtr); - } - public void enableCamera(boolean enabled) { - enableCamera(nativePtr, enabled); - } - public boolean cameraEnabled() { - return cameraEnabled(nativePtr); - } - - @Override - public boolean equals(Object call) { - if (this == call) return true; - if (call == null) return false; - if (!(call instanceof LinphoneCallImpl)) return false; - return nativePtr == ((LinphoneCallImpl)call).nativePtr; - } - - @Override - public int hashCode() { - int result = 17; - result = 31 * result + (int) (nativePtr ^ (nativePtr >>> 32)); - return result; - } - public void enableEchoCancellation(boolean enable) { - enableEchoCancellation(nativePtr,enable); - - } - public boolean isEchoCancellationEnabled() { - return isEchoCancellationEnabled(nativePtr); - } - public void enableEchoLimiter(boolean enable) { - enableEchoLimiter(nativePtr,enable); - } - public boolean isEchoLimiterEnabled() { - return isEchoLimiterEnabled(nativePtr); - } - public LinphoneCall getReplacedCall(){ - return (LinphoneCall)getReplacedCall(nativePtr); - } - - public int getDuration() { - return getDuration(nativePtr); - } - public float getAverageQuality() { - return getAverageQuality(nativePtr); - } - public float getCurrentQuality() { - return getCurrentQuality(nativePtr); - } - - private native String getAuthenticationToken(long nativePtr); - public String getAuthenticationToken(){ - return getAuthenticationToken(nativePtr); - } - - private native boolean isAuthenticationTokenVerified(long nativePtr); - public boolean isAuthenticationTokenVerified(){ - return isAuthenticationTokenVerified(nativePtr); - } - - private native void setAuthenticationTokenVerified(long nativePtr, boolean verified); - public void setAuthenticationTokenVerified(boolean verified){ - setAuthenticationTokenVerified(nativePtr, verified); - } - - public boolean isInConference() { - LinphoneCallParamsImpl params = new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); - return params.localConferenceMode(); - } - - @Override - public String toString() { - return "Call " + nativePtr; - } - - private native float getPlayVolume(long nativePtr); - public float getPlayVolume() { - return getPlayVolume(nativePtr); - } - - private native void takeSnapshot(long nativePtr, String path); - public void takeSnapshot(String path) { - takeSnapshot(nativePtr, path); - } - - private native void zoomVideo(long nativePtr, float factor, float cx, float cy); - public void zoomVideo(float factor, float cx, float cy) { - zoomVideo(nativePtr, factor, cx, cy); - } -} diff --git a/src/org/linphone/core/LinphoneCallLogImpl.java b/src/org/linphone/core/LinphoneCallLogImpl.java deleted file mode 100644 index 05468626e..000000000 --- a/src/org/linphone/core/LinphoneCallLogImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -/* -LinPhoneCallLogImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - - -class LinphoneCallLogImpl implements LinphoneCallLog { - - protected final long nativePtr; - - private native long getFrom(long nativePtr); - private native long getTo(long nativePtr); - private native boolean isIncoming(long nativePtr); - private native int getStatus(long nativePtr); - private native String getStartDate(long nativePtr); - private native int getCallDuration(long nativePtr); - private native int getCallId(long nativePtr); - - LinphoneCallLogImpl(long aNativePtr) { - nativePtr = aNativePtr; - } - - public CallDirection getDirection() { - return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing; - } - - public LinphoneAddress getFrom() { - return new LinphoneAddressImpl(getFrom(nativePtr)); - } - - public LinphoneAddress getTo() { - return new LinphoneAddressImpl(getTo(nativePtr)); - } - public CallStatus getStatus() { - return LinphoneCallLog.CallStatus.fromInt(getStatus(nativePtr)); - } - - public long getNativePtr() { - return nativePtr; - } - - public String getStartDate() { - return getStartDate(nativePtr); - } - - public int getCallDuration() { - return getCallDuration(nativePtr); - } - public int getCallId() { - return getCallId(nativePtr); - } -} diff --git a/src/org/linphone/core/LinphoneCallParamsImpl.java b/src/org/linphone/core/LinphoneCallParamsImpl.java deleted file mode 100644 index 3c4514017..000000000 --- a/src/org/linphone/core/LinphoneCallParamsImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -LinphoneCallParamsImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import org.linphone.core.LinphoneCore.MediaEncryption; - -public class LinphoneCallParamsImpl implements LinphoneCallParams { - protected final long nativePtr; - - public LinphoneCallParamsImpl(long nativePtr) { - this.nativePtr = nativePtr; - } - - private native void enableVideo(long nativePtr, boolean b); - private native boolean getVideoEnabled(long nativePtr); - private native void audioBandwidth(long nativePtr, int bw); - private native void setMediaEncryption(long nativePtr, int menc); - private native int getMediaEncryption(long nativePtr); - private native long getUsedAudioCodec(long nativePtr); - private native long getUsedVideoCodec(long nativePtr); - private native void destroy(long nativePtr); - - - public boolean getVideoEnabled() { - return getVideoEnabled(nativePtr); - } - - public void setVideoEnabled(boolean b) { - enableVideo(nativePtr, b); - } - - @Override - protected void finalize() throws Throwable { - destroy(nativePtr); - super.finalize(); - } - - public void setAudioBandwidth(int value) { - audioBandwidth(nativePtr, value); - } - - public MediaEncryption getMediaEncryption() { - return MediaEncryption.fromInt(getMediaEncryption(nativePtr)); - } - - public void setMediaEnctyption(MediaEncryption menc) { - setMediaEncryption(nativePtr, menc.mValue); - } - - public PayloadType getUsedAudioCodec() { - long ptr = getUsedAudioCodec(nativePtr); - if (ptr == 0) return null; - return new PayloadTypeImpl(ptr); - } - - public PayloadType getUsedVideoCodec() { - long ptr = getUsedVideoCodec(nativePtr); - if (ptr == 0) return null; - return new PayloadTypeImpl(ptr); - } - - private native boolean localConferenceMode(long nativePtr); - public boolean localConferenceMode() { - return localConferenceMode(nativePtr); - } -} diff --git a/src/org/linphone/core/LinphoneCallStatsImpl.java b/src/org/linphone/core/LinphoneCallStatsImpl.java deleted file mode 100644 index 53fcb5ffd..000000000 --- a/src/org/linphone/core/LinphoneCallStatsImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* -LinPhoneCallStatsImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - - -class LinphoneCallStatsImpl implements LinphoneCallStats { - private int mediaType; - private int iceState; - private float downloadBandwidth; - private float uploadBandwidth; - private float senderLossRate; - private float receiverLossRate; - private float senderInterarrivalJitter; - private float receiverInterarrivalJitter; - private float roundTripDelay; - private long latePacketsCumulativeNumber; - private float jitterBufferSize; - - private native int getMediaType(long nativeStatsPtr); - private native int getIceState(long nativeStatsPtr); - private native float getDownloadBandwidth(long nativeStatsPtr); - private native float getUploadBandwidth(long nativeStatsPtr); - private native float getSenderLossRate(long nativeStatsPtr); - private native float getReceiverLossRate(long nativeStatsPtr); - private native float getSenderInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr); - private native float getReceiverInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr); - private native float getRoundTripDelay(long nativeStatsPtr); - private native long getLatePacketsCumulativeNumber(long nativeStatsPtr, long nativeCallPtr); - private native float getJitterBufferSize(long nativeStatsPtr); - - protected LinphoneCallStatsImpl(long nativeCallPtr, long nativeStatsPtr) { - mediaType = getMediaType(nativeStatsPtr); - iceState = getIceState(nativeStatsPtr); - downloadBandwidth = getDownloadBandwidth(nativeStatsPtr); - uploadBandwidth = getUploadBandwidth(nativeStatsPtr); - senderLossRate = getSenderLossRate(nativeStatsPtr); - receiverLossRate = getReceiverLossRate(nativeStatsPtr); - senderInterarrivalJitter = getSenderInterarrivalJitter(nativeStatsPtr, nativeCallPtr); - receiverInterarrivalJitter = getReceiverInterarrivalJitter(nativeStatsPtr, nativeCallPtr); - roundTripDelay = getRoundTripDelay(nativeStatsPtr); - latePacketsCumulativeNumber = getLatePacketsCumulativeNumber(nativeStatsPtr, nativeCallPtr); - jitterBufferSize = getJitterBufferSize(nativeStatsPtr); - } - - public MediaType getMediaType() { - return MediaType.fromInt(mediaType); - } - - public IceState getIceState() { - return IceState.fromInt(iceState); - } - - public float getDownloadBandwidth() { - return downloadBandwidth; - } - - public float getUploadBandwidth() { - return uploadBandwidth; - } - - public float getSenderLossRate() { - return senderLossRate; - } - - public float getReceiverLossRate() { - return receiverLossRate; - } - - public float getSenderInterarrivalJitter() { - return senderInterarrivalJitter; - } - - public float getReceiverInterarrivalJitter() { - return receiverInterarrivalJitter; - } - - public float getRoundTripDelay() { - return roundTripDelay; - } - - public long getLatePacketsCumulativeNumber() { - return latePacketsCumulativeNumber; - } - - public float getJitterBufferSize() { - return jitterBufferSize; - } -} diff --git a/src/org/linphone/core/LinphoneChatMessageImpl.java b/src/org/linphone/core/LinphoneChatMessageImpl.java deleted file mode 100644 index 62fac1dc3..000000000 --- a/src/org/linphone/core/LinphoneChatMessageImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.linphone.core; - -public class LinphoneChatMessageImpl implements LinphoneChatMessage { - protected final long nativePtr; - private native void setUserData(long ptr); - private native String getMessage(long ptr); - private native long getPeerAddress(long ptr); - private native String getExternalBodyUrl(long ptr); - private native void setExternalBodyUrl(long ptr, String url); - private native long getFrom(long ptr); - - protected LinphoneChatMessageImpl(long aNativePtr) { - nativePtr = aNativePtr; - setUserData(); - } - - public long getNativePtr() { - return nativePtr; - } - - @Override - public Object getUserData() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setUserData() { - setUserData(nativePtr); - } - - @Override - public String getMessage() { - return getMessage(nativePtr); - } - - @Override - public LinphoneAddress getPeerAddress() { - return new LinphoneAddressImpl(getPeerAddress(nativePtr)); - } - - @Override - public String getExternalBodyUrl() { - return getExternalBodyUrl(nativePtr); - } - - @Override - public void setExternalBodyUrl(String url) { - setExternalBodyUrl(nativePtr, url); - } - - @Override - public LinphoneAddress getFrom() { - return new LinphoneAddressImpl(getFrom(nativePtr)); - } -} diff --git a/src/org/linphone/core/LinphoneChatRoomImpl.java b/src/org/linphone/core/LinphoneChatRoomImpl.java deleted file mode 100644 index 83141ad1c..000000000 --- a/src/org/linphone/core/LinphoneChatRoomImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/* -LinphoneChatRoomImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import org.linphone.core.LinphoneChatMessage.StateListener; - -class LinphoneChatRoomImpl implements LinphoneChatRoom { - protected final long nativePtr; - private native long createLinphoneChatMessage(long ptr, String message); - private native long getPeerAddress(long ptr); - private native void sendMessage(long ptr, String message); - private native void sendMessage2(long ptr, long message, StateListener listener); - - protected LinphoneChatRoomImpl(long aNativePtr) { - nativePtr = aNativePtr; - } - - public LinphoneAddress getPeerAddress() { - return new LinphoneAddressImpl(getPeerAddress(nativePtr)); - } - - public void sendMessage(String message) { - sendMessage(nativePtr,message); - } - - @Override - public void sendMessage(LinphoneChatMessage message, StateListener listener) { - sendMessage2(nativePtr, message.getNativePtr(), listener); - - } - - @Override - public LinphoneChatMessage createLinphoneChatMessage(String message) { - return new LinphoneChatMessageImpl(createLinphoneChatMessage(nativePtr, message)); - } -} diff --git a/src/org/linphone/core/LinphoneCoreFactoryImpl.java b/src/org/linphone/core/LinphoneCoreFactoryImpl.java deleted file mode 100644 index a99509fa3..000000000 --- a/src/org/linphone/core/LinphoneCoreFactoryImpl.java +++ /dev/null @@ -1,182 +0,0 @@ -/* -LinphoneCoreFactoryImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import org.linphone.mediastream.Version; - -import android.util.Log; - -public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { - - private static boolean loadOptionalLibrary(String s) { - try { - System.loadLibrary(s); - return true; - } catch (Throwable e) { - Log.w("Unable to load optional library lib", s); - } - return false; - } - - static { - // FFMPEG (audio/video) - loadOptionalLibrary("avutil"); - loadOptionalLibrary("swscale"); - loadOptionalLibrary("avcore"); - - if (!hasNeonInCpuFeatures()) { - boolean noNeonLibrariesLoaded = loadOptionalLibrary("avcodecnoneon"); - if (!noNeonLibrariesLoaded) { - loadOptionalLibrary("avcodec"); - } - } else { - loadOptionalLibrary("avcodec"); - } - - // OPENSSL (cryptography) - // lin prefix avoids collision with libs in /system/lib - loadOptionalLibrary("lincrypto"); - loadOptionalLibrary("linssl"); - - // Secure RTP and key negotiation - loadOptionalLibrary("srtp"); - loadOptionalLibrary("zrtpcpp"); // GPLv3+ - - // Tunnel - loadOptionalLibrary("tunnelclient"); - - // g729 A implementation - loadOptionalLibrary("bcg729"); - - //Main library - if (!hasNeonInCpuFeatures()) { - try { - if (!isArmv7() && !Version.isX86()) { - System.loadLibrary("linphonearmv5"); - } else { - System.loadLibrary("linphonenoneon"); - } - Log.w("linphone", "No-neon liblinphone loaded"); - } catch (UnsatisfiedLinkError ule) { - Log.w("linphone", "Failed to load no-neon liblinphone, loading neon liblinphone"); - System.loadLibrary("linphone"); - } - } else { - System.loadLibrary("linphone"); - } - - Version.dumpCapabilities(); - } - @Override - public LinphoneAuthInfo createAuthInfo(String username, String password, - String realm) { - return new LinphoneAuthInfoImpl(username,password,realm); - } - - @Override - public LinphoneAddress createLinphoneAddress(String username, - String domain, String displayName) { - return new LinphoneAddressImpl(username,domain,displayName); - } - - @Override - public LinphoneAddress createLinphoneAddress(String identity) { - return new LinphoneAddressImpl(identity); - } - - @Override - public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, - String userConfig, String factoryConfig, Object userdata) - throws LinphoneCoreException { - try { - return new LinphoneCoreImpl(listener,new File(userConfig),new File(factoryConfig),userdata); - } catch (IOException e) { - throw new LinphoneCoreException("Cannot create LinphoneCore",e); - } - } - - @Override - public LinphoneCore createLinphoneCore(LinphoneCoreListener listener) throws LinphoneCoreException { - try { - return new LinphoneCoreImpl(listener); - } catch (IOException e) { - throw new LinphoneCoreException("Cannot create LinphoneCore",e); - } - } - - @Override - public LinphoneProxyConfig createProxyConfig(String identity, String proxy, - String route, boolean enableRegister) throws LinphoneCoreException { - return new LinphoneProxyConfigImpl(identity,proxy,route,enableRegister); - } - - @Override - public native void setDebugMode(boolean enable); - - @Override - public void setLogHandler(LinphoneLogHandler handler) { - //not implemented on Android - - } - - @Override - public LinphoneFriend createLinphoneFriend(String friendUri) { - return new LinphoneFriendImpl(friendUri); - } - - @Override - public LinphoneFriend createLinphoneFriend() { - return createLinphoneFriend(null); - } - - public static boolean hasNeonInCpuFeatures() - { - ProcessBuilder cmd; - boolean result = false; - - try { - String[] args = {"/system/bin/cat", "/proc/cpuinfo"}; - cmd = new ProcessBuilder(args); - - Process process = cmd.start(); - InputStream in = process.getInputStream(); - byte[] re = new byte[1024]; - while(in.read(re) != -1){ - String line = new String(re); - if (line.contains("Features")) { - result = line.contains("neon"); - break; - } - } - in.close(); - } catch(IOException ex){ - ex.printStackTrace(); - } - return result; - } - - public static boolean isArmv7() - { - return System.getProperty("os.arch").contains("armv7"); - } -} diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java deleted file mode 100644 index 7b62ba835..000000000 --- a/src/org/linphone/core/LinphoneCoreImpl.java +++ /dev/null @@ -1,760 +0,0 @@ -/* -LinphoneCoreImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import java.io.File; -import java.io.IOException; - - -class LinphoneCoreImpl implements LinphoneCore { - - private final LinphoneCoreListener mListener; //to make sure to keep a reference on this object - private long nativePtr = 0; - private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); - private native void iterate(long nativePtr); - private native long getDefaultProxyConfig(long nativePtr); - - private native void setDefaultProxyConfig(long nativePtr,long proxyCfgNativePtr); - private native int addProxyConfig(LinphoneProxyConfig jprtoxyCfg,long nativePtr,long proxyCfgNativePtr); - private native void clearAuthInfos(long nativePtr); - - private native void clearProxyConfigs(long nativePtr); - private native void addAuthInfo(long nativePtr,long authInfoNativePtr); - private native Object invite(long nativePtr,String uri); - private native void terminateCall(long nativePtr, long call); - private native long getRemoteAddress(long nativePtr); - private native boolean isInCall(long nativePtr); - private native boolean isInComingInvitePending(long nativePtr); - private native void acceptCall(long nativePtr, long call); - private native long getCallLog(long nativePtr,int position); - private native int getNumberOfCallLogs(long nativePtr); - private native void delete(long nativePtr); - private native void setNetworkStateReachable(long nativePtr,boolean isReachable); - private native boolean isNetworkStateReachable(long nativePtr); - private native void setPlaybackGain(long nativeptr, float gain); - private native float getPlaybackGain(long nativeptr); - private native void muteMic(long nativePtr,boolean isMuted); - private native long interpretUrl(long nativePtr,String destination); - private native Object inviteAddress(long nativePtr,long to); - private native Object inviteAddressWithParams(long nativePtrLc,long to, long nativePtrParam); - private native void sendDtmf(long nativePtr,char dtmf); - private native void clearCallLogs(long nativePtr); - private native boolean isMicMuted(long nativePtr); - private native long findPayloadType(long nativePtr, String mime, int clockRate, int channels); - private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); - private native void enableEchoCancellation(long nativePtr,boolean enable); - private native boolean isEchoCancellationEnabled(long nativePtr); - private native Object getCurrentCall(long nativePtr) ; - private native void playDtmf(long nativePtr,char dtmf,int duration); - private native void stopDtmf(long nativePtr); - private native void setVideoWindowId(long nativePtr, Object wid); - private native void setPreviewWindowId(long nativePtr, Object wid); - private native void setDeviceRotation(long nativePtr, int rotation); - private native void addFriend(long nativePtr,long friend); - private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status); - private native long createChatRoom(long nativePtr,String to); - private native void enableVideo(long nativePtr,boolean vcap_enabled,boolean display_enabled); - private native boolean isVideoEnabled(long nativePtr); - private native void setFirewallPolicy(long nativePtr, int enum_value); - private native int getFirewallPolicy(long nativePtr); - private native void setStunServer(long nativePtr, String stun_server); - private native String getStunServer(long nativePtr); - private native long createDefaultCallParams(long nativePtr); - private native int updateCall(long ptrLc, long ptrCall, long ptrParams); - private native void setUploadBandwidth(long nativePtr, int bw); - private native void setDownloadBandwidth(long nativePtr, int bw); - private native void setPreferredVideoSize(long nativePtr, int width, int heigth); - private native int[] getPreferredVideoSize(long nativePtr); - private native void setRing(long nativePtr, String path); - private native String getRing(long nativePtr); - private native void setRootCA(long nativePtr, String path); - private native long[] listVideoPayloadTypes(long nativePtr); - private native long[] getProxyConfigList(long nativePtr); - private native long[] listAudioPayloadTypes(long nativePtr); - private native void enableKeepAlive(long nativePtr,boolean enable); - private native boolean isKeepAliveEnabled(long nativePtr); - private native int startEchoCalibration(long nativePtr,Object data); - private native int getSignalingTransportPort(long nativePtr, int code); - private native void setSignalingTransportPorts(long nativePtr, int udp, int tcp, int tls); - private native void enableIpv6(long nativePtr,boolean enable); - private native int pauseCall(long nativePtr, long callPtr); - private native int pauseAllCalls(long nativePtr); - private native int resumeCall(long nativePtr, long callPtr); - private native void setUploadPtime(long nativePtr, int ptime); - private native void setDownloadPtime(long nativePtr, int ptime); - private native void setZrtpSecretsCache(long nativePtr, String file); - private native void enableEchoLimiter(long nativePtr2, boolean val); - private native int setVideoDevice(long nativePtr2, int id); - private native int getVideoDevice(long nativePtr2); - private native int getMediaEncryption(long nativePtr); - private native void setMediaEncryption(long nativePtr, int menc); - private native boolean isMediaEncryptionMandatory(long nativePtr); - private native void setMediaEncryptionMandatory(long nativePtr, boolean yesno); - private native void removeCallLog(long nativePtr, long callLogPtr); - private native int getMissedCallsCount(long nativePtr); - private native void resetMissedCallsCount(long nativePtr); - private native String getVersion(long nativePtr); - - LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { - mListener=listener; - nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); - } - LinphoneCoreImpl(LinphoneCoreListener listener) throws IOException { - mListener=listener; - nativePtr = newLinphoneCore(listener,null,null,null); - } - - protected void finalize() throws Throwable { - - } - - public synchronized void addAuthInfo(LinphoneAuthInfo info) { - isValid(); - addAuthInfo(nativePtr,((LinphoneAuthInfoImpl)info).nativePtr); - } - - - - public synchronized LinphoneProxyConfig getDefaultProxyConfig() { - isValid(); - long lNativePtr = getDefaultProxyConfig(nativePtr); - if (lNativePtr!=0) { - return new LinphoneProxyConfigImpl(lNativePtr); - } else { - return null; - } - } - - public synchronized LinphoneCall invite(String uri) { - isValid(); - return (LinphoneCall)invite(nativePtr,uri); - } - - public synchronized void iterate() { - isValid(); - iterate(nativePtr); - } - - public synchronized void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) { - isValid(); - setDefaultProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr); - } - public synchronized void addProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{ - isValid(); - if (addProxyConfig(proxyCfg,nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) { - throw new LinphoneCoreException("bad proxy config"); - } - } - public synchronized void clearAuthInfos() { - isValid(); - clearAuthInfos(nativePtr); - - } - public synchronized void clearProxyConfigs() { - isValid(); - clearProxyConfigs(nativePtr); - } - public synchronized void terminateCall(LinphoneCall aCall) { - isValid(); - if (aCall!=null)terminateCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr); - } - public synchronized LinphoneAddress getRemoteAddress() { - isValid(); - long ptr = getRemoteAddress(nativePtr); - if (ptr==0) { - return null; - } else { - return new LinphoneAddressImpl(ptr); - } - } - public synchronized boolean isIncall() { - isValid(); - return isInCall(nativePtr); - } - public synchronized boolean isInComingInvitePending() { - isValid(); - return isInComingInvitePending(nativePtr); - } - public synchronized void acceptCall(LinphoneCall aCall) { - isValid(); - acceptCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr); - - } - public synchronized LinphoneCallLog[] getCallLogs() { - isValid(); - LinphoneCallLog[] logs = new LinphoneCallLog[getNumberOfCallLogs(nativePtr)]; - for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) { - logs[i] = new LinphoneCallLogImpl(getCallLog(nativePtr, i)); - } - return logs; - } - public synchronized void destroy() { - isValid(); - delete(nativePtr); - nativePtr = 0; - } - - private void isValid() { - if (nativePtr == 0) { - throw new RuntimeException("object already destroyed"); - } - } - public synchronized void setNetworkReachable(boolean isReachable) { - setNetworkStateReachable(nativePtr,isReachable); - } - public synchronized void setPlaybackGain(float gain) { - setPlaybackGain(nativePtr,gain); - - } - public synchronized float getPlaybackGain() { - return getPlaybackGain(nativePtr); - } - public synchronized void muteMic(boolean isMuted) { - muteMic(nativePtr,isMuted); - } - public synchronized LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException { - long lAddress = interpretUrl(nativePtr,destination); - if (lAddress != 0) { - return new LinphoneAddressImpl(lAddress,true); - } else { - throw new LinphoneCoreException("Cannot interpret ["+destination+"]"); - } - } - public synchronized LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException { - LinphoneCall call = (LinphoneCall)inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); - if (call!=null) { - return call; - } else { - throw new LinphoneCoreException("Unable to invite address " + to.asString()); - } - } - - public synchronized void sendDtmf(char number) { - sendDtmf(nativePtr,number); - } - public synchronized void clearCallLogs() { - clearCallLogs(nativePtr); - } - public synchronized boolean isMicMuted() { - return isMicMuted(nativePtr); - } - public synchronized PayloadType findPayloadType(String mime, int clockRate, int channels) { - isValid(); - long playLoadType = findPayloadType(nativePtr, mime, clockRate, channels); - if (playLoadType == 0) { - return null; - } else { - return new PayloadTypeImpl(playLoadType); - } - } - public synchronized void enablePayloadType(PayloadType pt, boolean enable) - throws LinphoneCoreException { - isValid(); - if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) { - throw new LinphoneCoreException("cannot enable payload type ["+pt+"]"); - } - - } - public synchronized void enableEchoCancellation(boolean enable) { - isValid(); - enableEchoCancellation(nativePtr, enable); - } - public synchronized boolean isEchoCancellationEnabled() { - isValid(); - return isEchoCancellationEnabled(nativePtr); - - } - - public synchronized LinphoneCall getCurrentCall() { - isValid(); - return (LinphoneCall)getCurrentCall(nativePtr); - } - - public int getPlayLevel() { - // TODO Auto-generated method stub - return 0; - } - public void setPlayLevel(int level) { - // TODO Auto-generated method stub - - } - public void enableSpeaker(boolean value) { - // TODO Auto-generated method stub - - } - public boolean isSpeakerEnabled() { - // TODO Auto-generated method stub - return false; - } - public synchronized void playDtmf(char number, int duration) { - playDtmf(nativePtr,number, duration); - - } - public synchronized void stopDtmf() { - stopDtmf(nativePtr); - } - - public synchronized void addFriend(LinphoneFriend lf) throws LinphoneCoreException { - addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr); - - } - public synchronized void setPresenceInfo(int minute_away, String alternative_contact, - OnlineStatus status) { - setPresenceInfo(nativePtr,minute_away,alternative_contact,status.mValue); - - } - public synchronized LinphoneChatRoom createChatRoom(String to) { - return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to)); - } - public synchronized void setPreviewWindow(Object w) { - setPreviewWindowId(nativePtr,w); - } - public synchronized void setVideoWindow(Object w) { - setVideoWindowId(nativePtr, w); - } - public synchronized void setDeviceRotation(int rotation) { - setDeviceRotation(nativePtr, rotation); - } - - public synchronized void enableVideo(boolean vcap_enabled, boolean display_enabled) { - enableVideo(nativePtr,vcap_enabled, display_enabled); - } - public synchronized boolean isVideoEnabled() { - return isVideoEnabled(nativePtr); - } - public synchronized FirewallPolicy getFirewallPolicy() { - return FirewallPolicy.fromInt(getFirewallPolicy(nativePtr)); - } - public synchronized String getStunServer() { - return getStunServer(nativePtr); - } - public synchronized void setFirewallPolicy(FirewallPolicy pol) { - setFirewallPolicy(nativePtr,pol.value()); - } - public synchronized void setStunServer(String stunServer) { - setStunServer(nativePtr,stunServer); - } - - public synchronized LinphoneCallParams createDefaultCallParameters() { - return new LinphoneCallParamsImpl(createDefaultCallParams(nativePtr)); - } - - public synchronized LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException { - long ptrDestination = ((LinphoneAddressImpl)to).nativePtr; - long ptrParams =((LinphoneCallParamsImpl)params).nativePtr; - - LinphoneCall call = (LinphoneCall)inviteAddressWithParams(nativePtr, ptrDestination, ptrParams); - if (call!=null) { - return call; - } else { - throw new LinphoneCoreException("Unable to invite with params " + to.asString()); - } - } - - public synchronized int updateCall(LinphoneCall call, LinphoneCallParams params) { - long ptrCall = ((LinphoneCallImpl) call).nativePtr; - long ptrParams = params!=null ? ((LinphoneCallParamsImpl)params).nativePtr : 0; - - return updateCall(nativePtr, ptrCall, ptrParams); - } - public synchronized void setUploadBandwidth(int bw) { - setUploadBandwidth(nativePtr, bw); - } - - public synchronized void setDownloadBandwidth(int bw) { - setDownloadBandwidth(nativePtr, bw); - } - - public synchronized void setPreferredVideoSize(VideoSize vSize) { - setPreferredVideoSize(nativePtr, vSize.width, vSize.height); - } - - public synchronized VideoSize getPreferredVideoSize() { - int[] nativeSize = getPreferredVideoSize(nativePtr); - - VideoSize vSize = new VideoSize(); - vSize.width = nativeSize[0]; - vSize.height = nativeSize[1]; - return vSize; - } - public synchronized void setRing(String path) { - setRing(nativePtr, path); - } - public synchronized String getRing() { - return getRing(nativePtr); - } - - public synchronized void setRootCA(String path) { - setRootCA(nativePtr, path); - } - - public synchronized LinphoneProxyConfig[] getProxyConfigList() { - long[] typesPtr = getProxyConfigList(nativePtr); - if (typesPtr == null) return null; - - LinphoneProxyConfig[] proxies = new LinphoneProxyConfig[typesPtr.length]; - - for (int i=0; i < proxies.length; i++) { - proxies[i] = new LinphoneProxyConfigImpl(typesPtr[i]); - } - - return proxies; - } - - public synchronized PayloadType[] getVideoCodecs() { - long[] typesPtr = listVideoPayloadTypes(nativePtr); - if (typesPtr == null) return null; - - PayloadType[] codecs = new PayloadType[typesPtr.length]; - - for (int i=0; i < codecs.length; i++) { - codecs[i] = new PayloadTypeImpl(typesPtr[i]); - } - - return codecs; - } - public synchronized PayloadType[] getAudioCodecs() { - long[] typesPtr = listAudioPayloadTypes(nativePtr); - if (typesPtr == null) return null; - - PayloadType[] codecs = new PayloadType[typesPtr.length]; - - for (int i=0; i < codecs.length; i++) { - codecs[i] = new PayloadTypeImpl(typesPtr[i]); - } - - return codecs; - } - public synchronized boolean isNetworkReachable() { - return isNetworkStateReachable(nativePtr); - } - - public synchronized void enableKeepAlive(boolean enable) { - enableKeepAlive(nativePtr,enable); - - } - public synchronized boolean isKeepAliveEnabled() { - return isKeepAliveEnabled(nativePtr); - } - public synchronized void startEchoCalibration(Object data) throws LinphoneCoreException { - startEchoCalibration(nativePtr, data); - } - - public synchronized Transports getSignalingTransportPorts() { - Transports transports = new Transports(); - transports.udp = getSignalingTransportPort(nativePtr, 0); - transports.tcp = getSignalingTransportPort(nativePtr, 1); - transports.tls = getSignalingTransportPort(nativePtr, 3); - // See C struct LCSipTransports in linphonecore.h - // Code is the index in the structure - return transports; - } - public synchronized void setSignalingTransportPorts(Transports transports) { - setSignalingTransportPorts(nativePtr, transports.udp, transports.tcp, transports.tls); - } - - public synchronized void enableIpv6(boolean enable) { - enableIpv6(nativePtr,enable); - } - public synchronized void adjustSoftwareVolume(int i) { - //deprecated, does the same as setPlaybackGain(). - } - - public synchronized boolean pauseCall(LinphoneCall call) { - return 0 == pauseCall(nativePtr, ((LinphoneCallImpl) call).nativePtr); - } - public synchronized boolean resumeCall(LinphoneCall call) { - return 0 == resumeCall(nativePtr, ((LinphoneCallImpl) call).nativePtr); - } - public synchronized boolean pauseAllCalls() { - return 0 == pauseAllCalls(nativePtr); - } - public synchronized void setDownloadPtime(int ptime) { - setDownloadPtime(nativePtr,ptime); - - } - public synchronized void setUploadPtime(int ptime) { - setUploadPtime(nativePtr,ptime); - } - - public synchronized void setZrtpSecretsCache(String file) { - setZrtpSecretsCache(nativePtr,file); - } - public synchronized void enableEchoLimiter(boolean val) { - enableEchoLimiter(nativePtr,val); - } - public void setVideoDevice(int id) { - Log.i("Setting camera id :", id); - if (setVideoDevice(nativePtr, id) != 0) { - Log.e("Failed to set video device to id:", id); - } - } - public int getVideoDevice() { - return getVideoDevice(nativePtr); - } - - - private native void leaveConference(long nativePtr); - public synchronized void leaveConference() { - leaveConference(nativePtr); - } - - private native boolean enterConference(long nativePtr); - public synchronized boolean enterConference() { - return enterConference(nativePtr); - } - - private native boolean isInConference(long nativePtr); - public synchronized boolean isInConference() { - return isInConference(nativePtr); - } - - private native void terminateConference(long nativePtr); - public synchronized void terminateConference() { - terminateConference(nativePtr); - } - private native int getConferenceSize(long nativePtr); - public synchronized int getConferenceSize() { - return getConferenceSize(nativePtr); - } - private native int getCallsNb(long nativePtr); - public synchronized int getCallsNb() { - return getCallsNb(nativePtr); - } - private native void terminateAllCalls(long nativePtr); - public synchronized void terminateAllCalls() { - terminateAllCalls(nativePtr); - } - private native Object getCall(long nativePtr, int position); - public synchronized LinphoneCall[] getCalls() { - int size = getCallsNb(nativePtr); - LinphoneCall[] calls = new LinphoneCall[size]; - for (int i=0; i < size; i++) { - calls[i]=((LinphoneCall)getCall(nativePtr, i)); - } - return calls; - } - private native void addAllToConference(long nativePtr); - public synchronized void addAllToConference() { - addAllToConference(nativePtr); - - } - private native void addToConference(long nativePtr, long nativePtrLcall); - public synchronized void addToConference(LinphoneCall call) { - addToConference(nativePtr, getCallPtr(call)); - - } - private native void removeFromConference(long nativePtr, long nativeCallPtr); - public synchronized void removeFromConference(LinphoneCall call) { - removeFromConference(nativePtr,getCallPtr(call)); - } - - private long getCallPtr(LinphoneCall call) { - return ((LinphoneCallImpl)call).nativePtr; - } - - private long getCallParamsPtr(LinphoneCallParams callParams) { - return ((LinphoneCallParamsImpl)callParams).nativePtr; - } - - private native int transferCall(long nativePtr, long callPtr, String referTo); - public synchronized void transferCall(LinphoneCall call, String referTo) { - transferCall(nativePtr, getCallPtr(call), referTo); - } - - private native int transferCallToAnother(long nativePtr, long callPtr, long destPtr); - public synchronized void transferCallToAnother(LinphoneCall call, LinphoneCall dest) { - transferCallToAnother(nativePtr, getCallPtr(call), getCallPtr(dest)); - } - - private native Object findCallFromUri(long nativePtr, String uri); - @Override - public synchronized LinphoneCall findCallFromUri(String uri) { - return (LinphoneCall) findCallFromUri(nativePtr, uri); - } - - public synchronized MediaEncryption getMediaEncryption() { - return MediaEncryption.fromInt(getMediaEncryption(nativePtr)); - } - public synchronized boolean isMediaEncryptionMandatory() { - return isMediaEncryptionMandatory(nativePtr); - } - public synchronized void setMediaEncryption(MediaEncryption menc) { - setMediaEncryption(nativePtr, menc.mValue); - } - public synchronized void setMediaEncryptionMandatory(boolean yesno) { - setMediaEncryptionMandatory(nativePtr, yesno); - } - - private native int getMaxCalls(long nativePtr); - public synchronized int getMaxCalls() { - return getMaxCalls(nativePtr); - } - @Override - public boolean isMyself(String uri) { - LinphoneProxyConfig lpc = getDefaultProxyConfig(); - if (lpc == null) return false; - return uri.equals(lpc.getIdentity()); - } - - private native boolean soundResourcesLocked(long nativePtr); - public synchronized boolean soundResourcesLocked() { - return soundResourcesLocked(nativePtr); - } - - private native void setMaxCalls(long nativePtr, int max); - @Override - public synchronized void setMaxCalls(int max) { - setMaxCalls(nativePtr, max); - } - private native boolean isEchoLimiterEnabled(long nativePtr); - @Override - public synchronized boolean isEchoLimiterEnabled() { - return isEchoLimiterEnabled(nativePtr); - } - private native boolean mediaEncryptionSupported(long nativePtr, int menc); - @Override - public synchronized boolean mediaEncryptionSupported(MediaEncryption menc) { - return mediaEncryptionSupported(nativePtr,menc.mValue); - } - - private native void setPlayFile(long nativePtr, String path); - - @Override - public synchronized void setPlayFile(String path) { - setPlayFile(nativePtr, path); - } - - - private native void tunnelAddServerAndMirror(long nativePtr, String host, int port, int mirror, int ms); - @Override - public synchronized void tunnelAddServerAndMirror(String host, int port, int mirror, int ms) { - tunnelAddServerAndMirror(nativePtr, host, port, mirror, ms); - } - - private native void tunnelAutoDetect(long nativePtr); - @Override - public synchronized void tunnelAutoDetect() { - tunnelAutoDetect(nativePtr); - } - - private native void tunnelCleanServers(long nativePtr); - @Override - public synchronized void tunnelCleanServers() { - tunnelCleanServers(nativePtr); - } - - private native void tunnelEnable(long nativePtr, boolean enable); - @Override - public synchronized void tunnelEnable(boolean enable) { - tunnelEnable(nativePtr, enable); - } - - @Override - public native boolean isTunnelAvailable(); - - private native void acceptCallWithParams(long nativePtr, long aCall, - long params); - @Override - public synchronized void acceptCallWithParams(LinphoneCall aCall, - LinphoneCallParams params) throws LinphoneCoreException { - acceptCallWithParams(nativePtr, getCallPtr(aCall), getCallParamsPtr(params)); - } - - private native void acceptCallUpdate(long nativePtr, long aCall, long params); - @Override - public synchronized void acceptCallUpdate(LinphoneCall aCall, LinphoneCallParams params) - throws LinphoneCoreException { - acceptCallUpdate(nativePtr, getCallPtr(aCall), getCallParamsPtr(params)); - } - - private native void deferCallUpdate(long nativePtr, long aCall); - @Override - public synchronized void deferCallUpdate(LinphoneCall aCall) - throws LinphoneCoreException { - deferCallUpdate(nativePtr, getCallPtr(aCall)); - } - - private native void setVideoPolicy(long nativePtr, boolean autoInitiate, boolean autoAccept); - public synchronized void setVideoPolicy(boolean autoInitiate, boolean autoAccept) { - setVideoPolicy(nativePtr, autoInitiate, autoAccept); - } - private native void setUserAgent(long nativePtr, String name, String version); - @Override - public void setUserAgent(String name, String version) { - setUserAgent(nativePtr,name,version); - } - - private native void setCpuCountNative(int count); - public void setCpuCount(int count) - { - setCpuCountNative(count); - } - - public int getMissedCallsCount() { - return getMissedCallsCount(nativePtr); - } - - public void removeCallLog(LinphoneCallLog log) { - removeCallLog(nativePtr, ((LinphoneCallLogImpl) log).getNativePtr()); - } - - public void resetMissedCallsCount() { - resetMissedCallsCount(nativePtr); - } - - private native void tunnelSetHttpProxy(long nativePtr, String proxy_host, int port, - String username, String password); - @Override - public void tunnelSetHttpProxy(String proxy_host, int port, - String username, String password) { - tunnelSetHttpProxy(nativePtr, proxy_host, port, username, password); - } - - private native void refreshRegisters(long nativePtr); - public void refreshRegisters() { - refreshRegisters(nativePtr); - } - - @Override - public String getVersion() { - return getVersion(nativePtr); - } - - @Override - public PayloadType findPayloadType(String mime, int clockRate) { - return null; - } - - private native void removeFriend(long ptr, long lf); - @Override - public void removeFriend(LinphoneFriend lf) { - removeFriend(nativePtr, lf.getNativePtr()); - } - - private native long getFriendByAddress(long ptr, String sipUri); - @Override - public LinphoneFriend findFriendByAddress(String sipUri) { - long ptr = getFriendByAddress(nativePtr, sipUri); - if (ptr == 0) { - return null; - } - return new LinphoneFriendImpl(ptr); - } -} diff --git a/src/org/linphone/core/LinphoneFriendImpl.java b/src/org/linphone/core/LinphoneFriendImpl.java deleted file mode 100644 index 6e7aa2db1..000000000 --- a/src/org/linphone/core/LinphoneFriendImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -/* -LinphoneFriendImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import java.io.Serializable; - -class LinphoneFriendImpl implements LinphoneFriend, Serializable { - protected final long nativePtr; - private native long newLinphoneFriend(String friendUri); - private native void setAddress(long nativePtr,long friend); - private native long getAddress(long nativePtr); - private native void setIncSubscribePolicy(long nativePtr,int enumValue); - private native int getIncSubscribePolicy(long nativePtr); - private native void enableSubscribes(long nativePtr,boolean value); - private native boolean isSubscribesEnabled(long nativePtr); - private native int getStatus(long nativePtr); - private native void edit(long nativePtr); - private native void done(long nativePtr); - - private native void delete(long ptr); - boolean ownPtr = false; - protected LinphoneFriendImpl() { - nativePtr = newLinphoneFriend(null); - } - protected LinphoneFriendImpl(String friendUri) { - nativePtr = newLinphoneFriend(friendUri); - } - protected LinphoneFriendImpl(long aNativePtr) { - nativePtr = aNativePtr; - ownPtr=false; - } - protected void finalize() throws Throwable { - if (ownPtr) delete(nativePtr); - } - public void setAddress(LinphoneAddress anAddress) { - this.setAddress(nativePtr, ((LinphoneAddressImpl)anAddress).nativePtr); - } - public LinphoneAddress getAddress() { - return new LinphoneAddressImpl(getAddress(nativePtr)); - } - public void setIncSubscribePolicy(SubscribePolicy policy) { - setIncSubscribePolicy(nativePtr,policy.mValue); - } - public SubscribePolicy getIncSubscribePolicy() { - return SubscribePolicy.fromInt(getIncSubscribePolicy(nativePtr)) ; - } - public void enableSubscribes(boolean enable) { - enableSubscribes(nativePtr, enable); - } - public boolean isSubscribesEnabled() { - return isSubscribesEnabled(nativePtr); - } - public OnlineStatus getStatus() { - return OnlineStatus.fromInt(getStatus(nativePtr)); - } - public void edit() { - edit(nativePtr); - } - public void done() { - done(nativePtr); - } - public long getNativePtr() { - return nativePtr; - } -} diff --git a/src/org/linphone/core/LinphoneProxyConfigImpl.java b/src/org/linphone/core/LinphoneProxyConfigImpl.java deleted file mode 100644 index 2295bce03..000000000 --- a/src/org/linphone/core/LinphoneProxyConfigImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -/* -LinphoneProxyConfigImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import org.linphone.core.LinphoneCore.RegistrationState; - - - - - -class LinphoneProxyConfigImpl implements LinphoneProxyConfig { - - protected final long nativePtr; - - private native int getState(long nativePtr); - private native void setExpires(long nativePtr, int delay); - - boolean ownPtr = false; - protected LinphoneProxyConfigImpl(String identity,String proxy,String route, boolean enableRegister) throws LinphoneCoreException { - nativePtr = newLinphoneProxyConfig(); - setIdentity(identity); - setProxy(proxy); - enableRegister(enableRegister); - ownPtr=true; - } - protected LinphoneProxyConfigImpl(long aNativePtr) { - nativePtr = aNativePtr; - ownPtr=false; - } - protected void finalize() throws Throwable { - //Log.e(LinphoneService.TAG,"fixme, should release underlying proxy config"); - if (ownPtr) delete(nativePtr); - } - private native long newLinphoneProxyConfig(); - private native void delete(long ptr); - - private native void edit(long ptr); - private native void done(long ptr); - - private native void setIdentity(long ptr,String identity); - private native String getIdentity(long ptr); - private native int setProxy(long ptr,String proxy); - private native String getProxy(long ptr); - - - private native void enableRegister(long ptr,boolean value); - private native boolean isRegisterEnabled(long ptr); - - private native boolean isRegistered(long ptr); - private native void setDialPrefix(long ptr, String prefix); - - private native String normalizePhoneNumber(long ptr,String number); - - private native String getDomain(long ptr); - - private native void setDialEscapePlus(long ptr, boolean value); - - private native String getRoute(long ptr); - private native int setRoute(long ptr,String uri); - private native void enablePublish(long ptr,boolean enable); - private native boolean publishEnabled(long ptr); - private native void setContactParameters(long ptr, String params); - - private native int lookupCCCFromIso(long nativePtr, String iso); - - public void enableRegister(boolean value) { - enableRegister(nativePtr,value); - } - - public void done() { - done(nativePtr); - } - - public void edit() { - edit(nativePtr); - } - - public void setIdentity(String identity) throws LinphoneCoreException { - setIdentity(nativePtr,identity); - } - - public void setProxy(String proxyUri) throws LinphoneCoreException { - if (setProxy(nativePtr,proxyUri)!=0) { - throw new LinphoneCoreException("Bad proxy address ["+proxyUri+"]"); - } - } - public String normalizePhoneNumber(String number) { - return normalizePhoneNumber(nativePtr,number); - } - public void setDialPrefix(String prefix) { - setDialPrefix(nativePtr, prefix); - } - public String getDomain() { - return getDomain(nativePtr); - } - public void setDialEscapePlus(boolean value) { - setDialEscapePlus(nativePtr,value); - } - public String getIdentity() { - return getIdentity(nativePtr); - } - public String getProxy() { - return getProxy(nativePtr); - } - public boolean isRegistered() { - return isRegistered(nativePtr); - } - public boolean registerEnabled() { - return isRegisterEnabled(nativePtr); - } - public String getRoute() { - return getRoute(nativePtr); - } - public void setRoute(String routeUri) throws LinphoneCoreException { - if (setRoute(nativePtr, routeUri) != 0) { - throw new LinphoneCoreException("cannot set route ["+routeUri+"]"); - } - } - public void enablePublish(boolean enable) { - enablePublish(nativePtr,enable); - } - public RegistrationState getState() { - return RegistrationState.fromInt(getState(nativePtr)); - } - - public void setExpires(int delay) { - setExpires(nativePtr, delay); - } - public boolean publishEnabled() { - return publishEnabled(nativePtr); - } - @Override - public void setContactParameters(String params) { - setContactParameters(nativePtr, params); - } - @Override - public int lookupCCCFromIso(String iso) { - return lookupCCCFromIso(nativePtr, iso); - } -} diff --git a/src/org/linphone/core/Log.java b/src/org/linphone/core/Log.java deleted file mode 100644 index b70b65931..000000000 --- a/src/org/linphone/core/Log.java +++ /dev/null @@ -1,112 +0,0 @@ -/* -Log.java -Copyright (C) 2011 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import static android.util.Log.DEBUG; -import static android.util.Log.ERROR; -import static android.util.Log.INFO; -import static android.util.Log.WARN; - -/** - * Convenient wrapper for Android logs. - * - * @author Guillaume Beraudo - */ -public final class Log { - - public static final String TAG = "Linphone"; - private static final boolean useIsLoggable = false; - - @SuppressWarnings(value="all") - private static boolean isLoggable(int level) { - return !useIsLoggable || android.util.Log.isLoggable(TAG, level); - } - - public static void i(Object...objects) { - if (isLoggable(INFO)) { - android.util.Log.i(TAG, toString(objects)); - } - } - public static void i(Throwable t, Object...objects) { - if (isLoggable(INFO)) { - android.util.Log.i(TAG, toString(objects), t); - } - } - - - public static void d(Object...objects) { - if (isLoggable(DEBUG)) { - android.util.Log.d(TAG, toString(objects)); - } - } - public static void d(Throwable t, Object...objects) { - if (isLoggable(DEBUG)) { - android.util.Log.d(TAG, toString(objects), t); - } - } - - public static void w(Object...objects) { - if (isLoggable(WARN)) { - android.util.Log.w(TAG, toString(objects)); - } - } - public static void w(Throwable t, Object...objects) { - if (isLoggable(WARN)) { - android.util.Log.w(TAG, toString(objects), t); - } - } - - public static void e(Object...objects) { - if (isLoggable(ERROR)) { - android.util.Log.e(TAG, toString(objects)); - } - } - public static void e(Throwable t, Object...objects) { - if (isLoggable(ERROR)) { - android.util.Log.e(TAG, toString(objects), t); - } - } - - /** - * @throws RuntimeException always throw after logging the error message. - */ - public static void f(Object...objects) { - if (isLoggable(ERROR)) { - android.util.Log.e(TAG, toString(objects)); - throw new RuntimeException("Fatal error : " + toString(objects)); - } - } - /** - * @throws RuntimeException always throw after logging the error message. - */ - public static void f(Throwable t, Object...objects) { - if (isLoggable(ERROR)) { - android.util.Log.e(TAG, toString(objects), t); - throw new RuntimeException("Fatal error : " + toString(objects), t); - } - } - - private static String toString(Object...objects) { - StringBuilder sb = new StringBuilder(); - for (Object o : objects) { - sb.append(o); - } - return sb.toString(); - } -} diff --git a/src/org/linphone/core/PayloadTypeImpl.java b/src/org/linphone/core/PayloadTypeImpl.java deleted file mode 100644 index 864b094ff..000000000 --- a/src/org/linphone/core/PayloadTypeImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/* -PayloadTypeImpl.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -package org.linphone.core; - -class PayloadTypeImpl implements PayloadType { - - protected final long nativePtr; - - private native String toString(long ptr); - private native String getMime(long ptr); - private native int getRate(long ptr); - - protected PayloadTypeImpl(long aNativePtr) { - nativePtr = aNativePtr; - } - - public int getRate() { - return getRate(nativePtr); - } - - public String getMime() { - return getMime(nativePtr); - } - - public String toString() { - return toString(nativePtr); - } -} diff --git a/src/org/linphone/core/video/VideoUtil.java b/src/org/linphone/core/video/VideoUtil.java deleted file mode 100644 index 065557b77..000000000 --- a/src/org/linphone/core/video/VideoUtil.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -VideoUtil.java -Copyright (C) 2011 Belledonne Communications, Grenoble, France - -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 2 -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core.video; - -import java.util.ArrayList; -import java.util.List; - -import org.linphone.core.VideoSize; - -import android.hardware.Camera.Size; - -/** - * @author Guillaume Beraudo - */ -final class VideoUtil { - - private VideoUtil() {} - - public static List createList(List supportedVideoSizes) { - List converted = new ArrayList(supportedVideoSizes.size()); - for (Size s : supportedVideoSizes) { - converted.add(new VideoSize(s.width, s.height)); - } - return converted; - } -} diff --git a/submodules/linphone b/submodules/linphone index eb5ca31cf..0e580208a 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit eb5ca31cfd8f7dbfde549a81455376b59ba121fe +Subproject commit 0e580208a63ef4559f2e9cdb9f2200129a33b4b8