From 3f0612f88f3851f35e98b02893a5ea4d7046ac9e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 18 Feb 2010 18:29:40 +0100 Subject: [PATCH] -create LinphoneService -fix landscape ui -create History tab view --- LinphoneCallLog.java | 31 ++++++++++++++++++++++++ LinphoneCallLogImpl.java | 46 ++++++++++++++++++++++++++++++++++++ LinphoneCore.java | 7 ++++++ LinphoneCoreImpl.java | 12 ++++++++++ LinphoneProxyConfigImpl.java | 6 ++--- 5 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 LinphoneCallLog.java create mode 100644 LinphoneCallLogImpl.java diff --git a/LinphoneCallLog.java b/LinphoneCallLog.java new file mode 100644 index 000000000..19d851a43 --- /dev/null +++ b/LinphoneCallLog.java @@ -0,0 +1,31 @@ +/* +LinPhoneCallLog.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 interface LinphoneCallLog { + public enum CallDirection { + CallOutgoing,Callincoming + } + + public LinphoneAddress getFrom(); + + public LinphoneAddress getTo (); + + public LinphoneCallLog.CallDirection getDirection(); +} diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java new file mode 100644 index 000000000..c35eea2c7 --- /dev/null +++ b/LinphoneCallLogImpl.java @@ -0,0 +1,46 @@ +/* +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.Callincoming:CallDirection.CallOutgoing; + } + + public LinphoneAddress getFrom() { + return new LinphoneAddressImpl(getFrom(nativePtr)); + } + + public LinphoneAddress getTo() { + return new LinphoneAddressImpl(getTo(nativePtr)); + } + +} diff --git a/LinphoneCore.java b/LinphoneCore.java index 59747220c..c39ef36f2 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; +import java.util.List; + public interface LinphoneCore { @@ -116,4 +118,9 @@ public interface LinphoneCore { public void acceptCall(); + /** + * @return a list of LinphoneCallLog + */ + public List getCallLogs(); + } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 2997033e5..80d24bd67 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,6 +20,8 @@ package org.linphone.core; import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; class LinphoneCoreImpl implements LinphoneCore { @@ -42,6 +44,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native boolean isInCall(long nativePtr); private native boolean isInComingInvitePending(long nativePtr); private native void acceptCall(long nativePtr); + private native long getCallLog(long nativePtr,int position); + private native int getNumberOfCallLogs(long nativePtr); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -109,4 +114,11 @@ class LinphoneCoreImpl implements LinphoneCore { acceptCall(nativePtr); } + public List getCallLogs() { + List logs = new ArrayList(); + for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) { + logs.add(new LinphoneCallLogImpl(getCallLog(nativePtr, i))); + } + return logs; + } } diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index af2722dd2..3794c58bf 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.core; -import org.linphone.Linphone; +import org.linphone.LinphoneService; import android.util.Log; @@ -35,14 +35,14 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { setProxy(proxy); enableRegister(enableRegister); ownPtr=true; - Log.w(Linphone.TAG, "route ["+route+"] not used yet"); + Log.w(LinphoneService.TAG, "route ["+route+"] not used yet"); } protected LinphoneProxyConfigImpl(long aNativePtr) { nativePtr = aNativePtr; ownPtr=false; } protected void finalize() throws Throwable { - Log.e(Linphone.TAG,"fixme, should release underlying proxy config"); + Log.e(LinphoneService.TAG,"fixme, should release underlying proxy config"); // FIXME if (ownPtr) delete(nativePtr); } private native long newLinphoneProxyConfig();