From 41510592f2ef088cd205f67738203c06f8d67bb8 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Sun, 2 May 2010 19:23:44 +0200 Subject: [PATCH] add status bar --- LinphoneAddressImpl.java | 27 +++++++++++++++ LinphoneAuthInfoImpl.java | 4 +-- LinphoneCallLogImpl.java | 2 +- LinphoneCoreFactoryImpl.java | 65 ++++++++++++++++++++++++++++++++++++ LinphoneCoreImpl.java | 7 ++-- LinphoneProxyConfigImpl.java | 16 +++++---- 6 files changed, 107 insertions(+), 14 deletions(-) create mode 100644 LinphoneCoreFactoryImpl.java diff --git a/LinphoneAddressImpl.java b/LinphoneAddressImpl.java index 3f11322ed..bf4670ec3 100644 --- a/LinphoneAddressImpl.java +++ b/LinphoneAddressImpl.java @@ -66,5 +66,32 @@ public class LinphoneAddressImpl implements LinphoneAddress { public void setDisplayName(String name) { setDisplayName(nativePtr,name); } + public String asString() { + return toString(); + } + public String asStringUriOnly() { + return toUri(nativePtr); + } + public void clean() { + throw new RuntimeException("Not implemented"); + } + public String getPort() { + return String.valueOf(getPortInt()); + } + public int getPortInt() { + return getPortInt(); + } + public void setDomain(String domain) { + throw new RuntimeException("Not implemented"); + } + public void setPort(String port) { + throw new RuntimeException("Not implemented"); + } + public void setPortInt(int port) { + throw new RuntimeException("Not implemented"); + } + public void setUserName(String username) { + throw new RuntimeException("Not implemented"); + } } diff --git a/LinphoneAuthInfoImpl.java b/LinphoneAuthInfoImpl.java index fcea4900c..7f9e54dd2 100644 --- a/LinphoneAuthInfoImpl.java +++ b/LinphoneAuthInfoImpl.java @@ -22,8 +22,8 @@ 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) { - nativePtr = newLinphoneAuthInfo(username,null,password,null,null); + protected LinphoneAuthInfoImpl(String username,String password, String realm) { + nativePtr = newLinphoneAuthInfo(username,null,password,null,realm); } protected void finalize() throws Throwable { delete(nativePtr); diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java index c35eea2c7..b0360d194 100644 --- a/LinphoneCallLogImpl.java +++ b/LinphoneCallLogImpl.java @@ -32,7 +32,7 @@ class LinphoneCallLogImpl implements LinphoneCallLog { public CallDirection getDirection() { - return isIncoming(nativePtr)?CallDirection.Callincoming:CallDirection.CallOutgoing; + return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing; } public LinphoneAddress getFrom() { diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java new file mode 100644 index 000000000..a34eabcae --- /dev/null +++ b/LinphoneCoreFactoryImpl.java @@ -0,0 +1,65 @@ +/* +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; + +public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { + + static { + System.loadLibrary("linphone"); + } + @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 address) { + throw new RuntimeException("Not implemeneted yet"); + } + + @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 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); +} diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index d752cfdc0..547e4bc0d 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,8 +20,7 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +import java.util.Vector; class LinphoneCoreImpl implements LinphoneCore { @@ -139,9 +138,9 @@ class LinphoneCoreImpl implements LinphoneCore { acceptCall(nativePtr); } - public synchronized List getCallLogs() { + public synchronized Vector getCallLogs() { isValid(); - List logs = new ArrayList(); + Vector logs = new Vector(); for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) { logs.add(new LinphoneCallLogImpl(getCallLog(nativePtr, i))); } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index 90cc16bfb..01080bfc0 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -52,10 +52,15 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { 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); @@ -98,18 +103,15 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { setDialEscapePlus(nativePtr,value); } public String getIdentity() { - throw new RuntimeException("not implemeneted yet"); + return getIdentity(nativePtr); } public String getProxy() { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); + return getProxy(nativePtr); } public boolean isRegistered() { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); + return isRegistered(nativePtr); } public boolean registerEnabled() { - // TODO Auto-generated method stub - throw new RuntimeException("not implemeneted yet"); + return isRegisterEnabled(nativePtr); } }