Commit 0e580208 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Merge branch 'newUI' of file:///home/ghislain/code/tmp-android into linphonecore_java

parents 981faabd 2be16caf
/*
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");
}
}
/*
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");
}
}
/*
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);
}
}
/*
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);
}
}
/*
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);
}
}
/*
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;
}