Update linphone submodule for echo canceller.

This commit is contained in:
Ghislain MARY 2012-10-16 16:50:39 +02:00
parent 6344e9eabc
commit b4576a0036
24 changed files with 6 additions and 2391 deletions

View file

@ -4,6 +4,7 @@
<classpathentry excluding="org/linphone/mediastream/MediastreamerActivity.java" kind="src" path="submodules/linphone/mediastreamer2/java/src"/> <classpathentry excluding="org/linphone/mediastream/MediastreamerActivity.java" kind="src" path="submodules/linphone/mediastreamer2/java/src"/>
<classpathentry kind="src" path="submodules/linphone/java/j2se"/> <classpathentry kind="src" path="submodules/linphone/java/j2se"/>
<classpathentry kind="src" path="submodules/linphone/java/common"/> <classpathentry kind="src" path="submodules/linphone/java/common"/>
<classpathentry kind="src" path="submodules/linphone/java/impl"/>
<classpathentry excluding="org/linphone/core/tutorials/" kind="src" path="src"/> <classpathentry excluding="org/linphone/core/tutorials/" kind="src" path="src"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="lib" path="libs/aXMLRPC.jar"/> <classpathentry exported="true" kind="lib" path="libs/aXMLRPC.jar"/>

View file

@ -66,6 +66,7 @@ import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.MediaEncryption; import org.linphone.core.LinphoneCore.MediaEncryption;
import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCore.Transports; import org.linphone.core.LinphoneCore.Transports;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener; import org.linphone.core.LinphoneCoreListener;
@ -926,6 +927,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
if (textReceivedListener != null) if (textReceivedListener != null)
textReceivedListener.onTextReceived(from, message); textReceivedListener.onTextReceived(from, message);
} }
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {}
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) { public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
if (dtmfReceivedListener != null) if (dtmfReceivedListener != null)
dtmfReceivedListener.onDTMFReceived(call, dtmf); dtmfReceivedListener.onDTMFReceived(call, dtmf);

View file

@ -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");
}
}

View file

@ -1,56 +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,null,password,null,realm);
}
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");
}
}

View file

@ -1,183 +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() {
return new LinphoneCallParamsImpl(getRemoteParams(nativePtr));
}
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 boolean 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);
}
}

View file

@ -1,59 +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);
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() {
throw new RuntimeException("not implemented yet");
}
@Override
public String getStartDate() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getCallDuration() {
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -1,68 +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 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);
}
private native boolean localConferenceMode(long nativePtr);
public boolean localConferenceMode() {
return localConferenceMode(nativePtr);
}
}

View file

@ -1,83 +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 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 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);
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 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;
}
}

View file

@ -1,37 +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;
class LinphoneChatRoomImpl implements LinphoneChatRoom {
protected final long nativePtr;
private native long getPeerAddress(long ptr);
private native void sendMessage(long ptr, String message);
protected LinphoneChatRoomImpl(long aNativePtr) {
nativePtr = aNativePtr;
}
public LinphoneAddress getPeerAddress() {
return new LinphoneAddressImpl(getPeerAddress(nativePtr));
}
public void sendMessage(String message) {
sendMessage(nativePtr,message);
}
}

View file

@ -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()) {
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");
}
}

View file

@ -1,737 +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 {
@SuppressWarnings("unused")
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 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);
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 void adjustSoftwareVolume(long nativePtr,int db);
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);
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) {
isValid();
long playLoadType = findPayloadType(nativePtr, mime, clockRate);
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() {
throw new RuntimeException("Not implemented");
}
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) {
adjustSoftwareVolume(nativePtr, i);
}
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);
}
private native void tunnelSetHttpProxyNative(long nativePtr, String proxy_host, int port, String username, String password);
@Override
public void tunnelSetHttpProxy(String proxy_host, int port,
String username, String password) {
tunnelSetHttpProxyNative(nativePtr,proxy_host, port, username, password);
}
private native void removeCallLog(long nativePtr, LinphoneCallLog log);
public void removeCallLog(LinphoneCallLog log) {
removeCallLog(nativePtr, log);
}
private native int getMissedCallsCount(long nativePtr);
public int getMissedCallsCount() {
return getMissedCallsCount(nativePtr);
}
private native void resetMissedCallsCount(long nativePtr);
public void resetMissedCallsCount() {
resetMissedCallsCount(nativePtr);
}
private native void refreshRegisters(long nativePtr);
public void refreshRegisters() {
refreshRegisters(nativePtr);
}
@Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,80 +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;
class LinphoneFriendImpl implements LinphoneFriend {
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);
}
}

View file

@ -1,146 +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);
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);
}
}

View file

@ -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();
}
}

View file

@ -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);
}
}

View file

@ -1,50 +0,0 @@
/*
AndroidTutorialNotifier.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.tutorials;
import android.os.Handler;
import android.widget.TextView;
/**
* Write notifications to a TextView widget.
* This is an helper class, not a test activity.
*
* @author Guillaume Beraudo
*
*/
class AndroidTutorialNotifier extends TutorialNotifier {
private Handler mHandler;
private TextView outputTextView;
public AndroidTutorialNotifier(Handler mHandler, final TextView outputTextView) {
this.mHandler = mHandler;
this.outputTextView = outputTextView;
}
@Override
public void notify(final String s) {
mHandler.post(new Runnable() {
public void run() {
outputTextView.setText(s + "\n" + outputTextView.getText());
}
});
}
}

View file

@ -1,109 +0,0 @@
/*
TutorialBuddyStatusActivity.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.tutorials;
import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Activity for displaying and starting the BuddyStatus example on Android phone.
*
* @author Guillaume Beraudo
*
*/
public class TutorialBuddyStatusActivity extends Activity {
private static final String defaultSipAddress = "sip:";
private TextView sipAddressWidget;
private TextView mySipAddressWidget;
private TextView mySipPasswordWidget;
private TutorialBuddyStatus tutorial;
private Handler mHandler = new Handler() ;
private Button buttonCall;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hello_world);
sipAddressWidget = (TextView) findViewById(R.id.AddressId);
sipAddressWidget.setText(defaultSipAddress);
mySipAddressWidget = (TextView) findViewById(R.id.MyAddressId);
mySipAddressWidget.setVisibility(View.VISIBLE);
mySipPasswordWidget = (TextView) findViewById(R.id.Password);
mySipPasswordWidget.setVisibility(TextView.VISIBLE);
// Output text to the outputText widget
final TextView outputText = (TextView) findViewById(R.id.OutputText);
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
// Create BuddyStatus object
tutorial = new TutorialBuddyStatus(notifier);
// Assign call action to call button
buttonCall = (Button) findViewById(R.id.CallButton);
buttonCall.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TutorialLaunchingThread thread = new TutorialLaunchingThread();
buttonCall.setEnabled(false);
thread.start();
}
});
// Assign stop action to stop button
Button buttonStop = (Button) findViewById(R.id.ButtonStop);
buttonStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tutorial.stopMainLoop();
}
});
}
private class TutorialLaunchingThread extends Thread {
@Override
public void run() {
super.run();
try {
String myIdentity = mySipAddressWidget.getText().length()>0?mySipAddressWidget.getText().toString():null;
String myPassword = mySipPasswordWidget.getText().length()>0?mySipPasswordWidget.getText().toString():null;
tutorial.launchTutorial(sipAddressWidget.getText().toString(), myIdentity, myPassword);
mHandler.post(new Runnable() {
public void run() {
buttonCall.setEnabled(true);
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
}

View file

@ -1,98 +0,0 @@
/*
TutorialChatRoomActivity.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.tutorials;
import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Activity for displaying and starting the chatroom example on Android phone.
*
* @author Guillaume Beraudo
*
*/
public class TutorialChatRoomActivity extends Activity {
private static final String defaultSipAddress = "sip:";
private TextView sipAddressWidget;
private TutorialChatRoom tutorial;
private Handler mHandler = new Handler() ;
private Button buttonCall;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hello_world);
sipAddressWidget = (TextView) findViewById(R.id.AddressId);
sipAddressWidget.setText(defaultSipAddress);
// Output text to the outputText widget
final TextView outputText = (TextView) findViewById(R.id.OutputText);
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
// Create HelloWorld object
tutorial = new TutorialChatRoom(notifier);
// Assign call action to call button
buttonCall = (Button) findViewById(R.id.CallButton);
buttonCall.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TutorialLaunchingThread thread = new TutorialLaunchingThread();
buttonCall.setEnabled(false);
thread.start();
}
});
// Assign stop action to stop button
Button buttonStop = (Button) findViewById(R.id.ButtonStop);
buttonStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tutorial.stopMainLoop();
}
});
}
private class TutorialLaunchingThread extends Thread {
@Override
public void run() {
super.run();
try {
tutorial.launchTutorial(sipAddressWidget.getText().toString());
mHandler.post(new Runnable() {
public void run() {
buttonCall.setEnabled(true);
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
}

View file

@ -1,98 +0,0 @@
/*
TutorialHelloWorldActivity.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.tutorials;
import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Activity for displaying and starting the HelloWorld example on Android phone.
*
* @author Guillaume Beraudo
*
*/
public class TutorialHelloWorldActivity extends Activity {
private static final String defaultSipAddress = "sip:";
private TextView sipAddressWidget;
private TutorialHelloWorld tutorial;
private Handler mHandler = new Handler() ;
private Button buttonCall;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hello_world);
sipAddressWidget = (TextView) findViewById(R.id.AddressId);
sipAddressWidget.setText(defaultSipAddress);
// Output text to the outputText widget
final TextView outputText = (TextView) findViewById(R.id.OutputText);
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
// Create HelloWorld object
tutorial = new TutorialHelloWorld(notifier);
// Assign call action to call button
buttonCall = (Button) findViewById(R.id.CallButton);
buttonCall.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TutorialLaunchingThread thread = new TutorialLaunchingThread();
buttonCall.setEnabled(false);
thread.start();
}
});
// Assign stop action to stop button
Button buttonStop = (Button) findViewById(R.id.ButtonStop);
buttonStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tutorial.stopMainLoop();
}
});
}
private class TutorialLaunchingThread extends Thread {
@Override
public void run() {
super.run();
try {
tutorial.launchTutorial(sipAddressWidget.getText().toString());
mHandler.post(new Runnable() {
public void run() {
buttonCall.setEnabled(true);
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
}

View file

@ -1,103 +0,0 @@
/*
TutorialRegistrationActivity.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.tutorials;
import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Activity for displaying and starting the registration example on Android phone.
*
* @author Guillaume Beraudo
*
*/
public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
private static final String defaultSipAddress = "sip:";
private static final String defaultSipPassword = "";
private TextView sipAddressWidget;
private TextView sipPasswordWidget;
private TutorialRegistration tutorial;
private Button buttonCall;
private Handler mHandler = new Handler();
private TextView outputText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hello_world);
sipAddressWidget = (TextView) findViewById(R.id.AddressId);
sipAddressWidget.setText(defaultSipAddress);
sipPasswordWidget = (TextView) findViewById(R.id.Password);
sipPasswordWidget.setVisibility(TextView.VISIBLE);
sipPasswordWidget.setText(defaultSipPassword);
// Output text to the outputText widget
outputText = (TextView) findViewById(R.id.OutputText);
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
// Create Tutorial object
tutorial = new TutorialRegistration(notifier);
// Assign call action to call button
buttonCall = (Button) findViewById(R.id.CallButton);
buttonCall.setText("Register");
buttonCall.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TutorialLaunchingThread thread = new TutorialLaunchingThread();
buttonCall.setEnabled(false);
thread.start();
}
});
Button buttonStop = (Button) findViewById(R.id.ButtonStop);
buttonStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tutorial.stopMainLoop();
}
});
}
private class TutorialLaunchingThread extends Thread {
@Override
public void run() {
super.run();
try {
tutorial.launchTutorial(
sipAddressWidget.getText().toString(),
sipPasswordWidget.getText().toString());
} catch (LinphoneCoreException e) {
e.printStackTrace();
outputText.setText(e.getMessage() +"\n"+outputText.getText());
}
}
}
}

View file

@ -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<VideoSize> createList(List<Size> supportedVideoSizes) {
List<VideoSize> converted = new ArrayList<VideoSize>(supportedVideoSizes.size());
for (Size s : supportedVideoSizes) {
converted.add(new VideoSize(s.width, s.height));
}
return converted;
}
}

@ -1 +1 @@
Subproject commit 05978321cfc73a91a12c2a818a45a308f3f55a47 Subproject commit 73097acf6afaef4827e6fe39214e77e53a1fbfd4

@ -1 +1 @@
Subproject commit 2bc1545f31cba925b8e3011d9fd9f4680144d83b Subproject commit edb0ac69254fb7c44846182bbd2aa9bc97117f60

@ -1 +1 @@
Subproject commit 18c23b44ea6875bbed2779e5392defc3f8ce0dfb Subproject commit c6eaf5a2fe4f643fd416a77c529df8c288d12ff4