diff --git a/.classpath b/.classpath index d4d2b5b73..9ca73728a 100644 --- a/.classpath +++ b/.classpath @@ -1,7 +1,8 @@ - + + diff --git a/libs/armeabi/liblinphone.so b/libs/armeabi/liblinphone.so index 2c25b9989..9b23b0662 100755 Binary files a/libs/armeabi/liblinphone.so and b/libs/armeabi/liblinphone.so differ diff --git a/res/drawable/clavier_bg.9.png b/res/drawable/clavier_bg.9.png new file mode 100644 index 000000000..4fa36399e Binary files /dev/null and b/res/drawable/clavier_bg.9.png differ diff --git a/res/drawable/clavier_bg_ori.png b/res/drawable/clavier_bg_ori.png new file mode 100644 index 000000000..59d80324c Binary files /dev/null and b/res/drawable/clavier_bg_ori.png differ diff --git a/res/drawable/contact_orange.png b/res/drawable/contact_orange.png new file mode 100644 index 000000000..53ba07ed8 Binary files /dev/null and b/res/drawable/contact_orange.png differ diff --git a/res/drawable/dialer_orange.png b/res/drawable/dialer_orange.png new file mode 100644 index 000000000..2d715eac0 Binary files /dev/null and b/res/drawable/dialer_orange.png differ diff --git a/res/drawable/green.png b/res/drawable/green.png deleted file mode 100644 index 0005537ca..000000000 Binary files a/res/drawable/green.png and /dev/null differ diff --git a/res/drawable/history_orange.png b/res/drawable/history_orange.png new file mode 100644 index 000000000..dc9bbf60a Binary files /dev/null and b/res/drawable/history_orange.png differ diff --git a/res/drawable/linphone.png b/res/drawable/linphone.png deleted file mode 100644 index 06cf18315..000000000 Binary files a/res/drawable/linphone.png and /dev/null differ diff --git a/res/drawable/linphone2.png b/res/drawable/linphone2.png deleted file mode 100644 index d1bf1ab63..000000000 Binary files a/res/drawable/linphone2.png and /dev/null differ diff --git a/res/drawable/linphone_3_250x130.png b/res/drawable/linphone_3_250x130.png deleted file mode 100644 index 020e943b6..000000000 Binary files a/res/drawable/linphone_3_250x130.png and /dev/null differ diff --git a/res/drawable/linphone_banner.png b/res/drawable/linphone_banner.png new file mode 100644 index 000000000..0abff3ebf Binary files /dev/null and b/res/drawable/linphone_banner.png differ diff --git a/res/drawable/red.png b/res/drawable/red.png deleted file mode 100644 index e6136b3ff..000000000 Binary files a/res/drawable/red.png and /dev/null differ diff --git a/res/drawable/startcall_green.png b/res/drawable/startcall_green.png new file mode 100644 index 000000000..940802a0c Binary files /dev/null and b/res/drawable/startcall_green.png differ diff --git a/res/drawable/status_green.png b/res/drawable/status_green.png new file mode 100644 index 000000000..1a39a4242 Binary files /dev/null and b/res/drawable/status_green.png differ diff --git a/res/drawable/status_level.xml b/res/drawable/status_level.xml new file mode 100644 index 000000000..592a6b94f --- /dev/null +++ b/res/drawable/status_level.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/res/drawable/status_offline.png b/res/drawable/status_offline.png new file mode 100644 index 000000000..243c5c069 Binary files /dev/null and b/res/drawable/status_offline.png differ diff --git a/res/drawable/status_orange.png b/res/drawable/status_orange.png new file mode 100644 index 000000000..f2e66d34d Binary files /dev/null and b/res/drawable/status_orange.png differ diff --git a/res/drawable/status_red.png b/res/drawable/status_red.png new file mode 100644 index 000000000..e7a0ec98a Binary files /dev/null and b/res/drawable/status_red.png differ diff --git a/res/drawable/stopcall_red.png b/res/drawable/stopcall_red.png new file mode 100644 index 000000000..1004b8a01 Binary files /dev/null and b/res/drawable/stopcall_red.png differ diff --git a/res/layout-land/dialer.xml b/res/layout-land/dialer.xml index e6fc58984..21717d81e 100644 --- a/res/layout-land/dialer.xml +++ b/res/layout-land/dialer.xml @@ -11,8 +11,7 @@ android:hint="sip:" android:layout_width="fill_parent" android:lines="1" android:layout_weight="0.2"> + android:layout_width="fill_parent" android:layout_weight="0.8" android:text="<"> @@ -28,20 +27,20 @@ - - - + + + + android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="0.25" android:id="@+id/Decline" android:background="@drawable/clavier_bg_ori"> - - - + + + diff --git a/res/layout/dialer.xml b/res/layout/dialer.xml index 611eb59ad..35264d827 100644 --- a/res/layout/dialer.xml +++ b/res/layout/dialer.xml @@ -11,9 +11,8 @@ android:hint="sip:" android:layout_width="fill_parent" android:lines="1" android:layout_weight="0.2"> + android:layout_width="fill_parent" android:layout_weight="0.8" android:textSize="20sp" + android:textStyle="bold" android:text="<"> @@ -35,15 +34,15 @@ + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> + android:layout_weight="1" android:background="@drawable/clavier_bg_ori"> @@ -97,17 +96,17 @@ - - - + + + - + - + diff --git a/res/values/strings.xml b/res/values/strings.xml index 0d401dd68..310352574 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -31,5 +31,8 @@ History Cannot build destination address from [%s] Clear - +Cannot invite destination address [%s] +registered to %s +fails to register to %s +started diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java index d024dcc36..859fde229 100644 --- a/src/org/linphone/DialerActivity.java +++ b/src/org/linphone/DialerActivity.java @@ -166,7 +166,15 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { return; } lAddress.setDisplayName(mDisplayName); - lLinphoneCore.invite(lAddress); + try { + lLinphoneCore.invite(lAddress); + } catch (LinphoneCoreException e) { + Toast toast = Toast.makeText(DialerActivity.this + ,String.format(getString(R.string.error_cannot_invite_address),mAddress.getText().toString()) + , Toast.LENGTH_LONG); + toast.show(); + return; + } } }); @@ -221,30 +229,35 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { if (LinphoneService.isready()) { LinphoneCore lLinphoenCore = LinphoneService.instance().getLinphoneCore(); if (lLinphoenCore.isIncall()) { - mCall.setEnabled(false); - mHangup.setEnabled(!mCall.isEnabled()); - mCallControlRow.setVisibility(View.GONE); - mInCallControlRow.setVisibility(View.VISIBLE); - mAddressLayout.setVisibility(View.GONE); - mInCallAddressLayout.setVisibility(View.VISIBLE); - mMute.setChecked(!lLinphoenCore.isMicMuted()); - mMute.setCompoundDrawablesWithIntrinsicBounds(0 - , mMute.isChecked()?R.drawable.mic_active:R.drawable.mic_muted - , 0 - , 0); - String DisplayName = lLinphoenCore.getRemoteAddress().getDisplayName(); - if (DisplayName!=null) { - mDisplayNameView.setText(DisplayName); + if(lLinphoenCore.isInComingInvitePending()) { + callPending(); } else { - mDisplayNameView.setText(lLinphoenCore.getRemoteAddress().getUserName()); - } - if ((Integer.parseInt(Build.VERSION.SDK) <=4 && mAudioManager.getMode() == AudioManager.MODE_NORMAL) - || Integer.parseInt(Build.VERSION.SDK) >4 &&mAudioManager.isSpeakerphoneOn()) { - mSpeaker.setChecked(true); - } - mWakeLock.acquire(); + mCall.setEnabled(false); + mHangup.setEnabled(!mCall.isEnabled()); + mCallControlRow.setVisibility(View.GONE); + mInCallControlRow.setVisibility(View.VISIBLE); + mAddressLayout.setVisibility(View.GONE); + mInCallAddressLayout.setVisibility(View.VISIBLE); + mMute.setChecked(!lLinphoenCore.isMicMuted()); + mMute.setCompoundDrawablesWithIntrinsicBounds(0 + , mMute.isChecked()?R.drawable.mic_active:R.drawable.mic_muted + , 0 + , 0); + + String DisplayName = lLinphoenCore.getRemoteAddress().getDisplayName(); + if (DisplayName!=null) { + mDisplayNameView.setText(DisplayName); + } else { + mDisplayNameView.setText(lLinphoenCore.getRemoteAddress().getUserName()); + } + if ((Integer.parseInt(Build.VERSION.SDK) <=4 && mAudioManager.getMode() == AudioManager.MODE_NORMAL) + || Integer.parseInt(Build.VERSION.SDK) >4 &&mAudioManager.isSpeakerphoneOn()) { + mSpeaker.setChecked(true); + } + mWakeLock.acquire(); + } } - } + } @@ -270,8 +283,10 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { routeAudioToSpeaker(); + mSpeaker.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.speaker_32_on, 0, 0); } else { routeAudioToReceiver(); + mSpeaker.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.speaker_32_off, 0, 0); } } @@ -359,70 +374,57 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { } public void generalState(LinphoneCore lc, GeneralState state) { - switch(state) { - case GSTATE_POWER_ON: + if (state == GeneralState.GSTATE_POWER_ON) { mCall.setEnabled(!lc.isIncall()); mHangup.setEnabled(!mCall.isEnabled()); try{ - LinphoneService.instance().initFromConf(); + LinphoneService.instance().initFromConf(); } catch (LinphoneConfigException ec) { Log.w(LinphoneService.TAG,"no valid settings found",ec); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(getString(R.string.initial_config_error)) - .setCancelable(false) - .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - LinphoneActivity.instance().startprefActivity(); - } - }).setNeutralButton(getString(R.string.no), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - - } - }).setNegativeButton(getString(R.string.never_remind), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - mPref.edit().putBoolean(PREF_CHECK_CONFIG, true).commit(); - dialog.cancel(); - } - }); + .setCancelable(false) + .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + LinphoneActivity.instance().startprefActivity(); + } + }).setNeutralButton(getString(R.string.no), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + + } + }).setNegativeButton(getString(R.string.never_remind), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + mPref.edit().putBoolean(PREF_CHECK_CONFIG, true).commit(); + dialog.cancel(); + } + }); if (mPref.getBoolean(PREF_CHECK_CONFIG, false) == false) { builder.create().show(); } } catch (Exception e ) { Log.e(LinphoneService.TAG,"Cannot get initial config", e); } - break; - case GSTATE_REG_OK: { - break; - } - case GSTATE_CALL_OUT_INVITE: { + } else if (state == GeneralState.GSTATE_REG_OK) { + //nop + } else if (state == GeneralState.GSTATE_CALL_OUT_INVITE) { mWakeLock.acquire(); enterIncalMode(lc); routeAudioToReceiver(); - break; - } - case GSTATE_CALL_IN_INVITE: { - mDecline.setEnabled(true); - routeAudioToSpeaker(); - break; - } - case GSTATE_CALL_IN_CONNECTED: - case GSTATE_CALL_OUT_CONNECTED: { + } else if (state == GeneralState.GSTATE_CALL_IN_INVITE) { + callPending(); + } else if (state == GeneralState.GSTATE_CALL_IN_CONNECTED + || state == GeneralState.GSTATE_CALL_OUT_CONNECTED) { enterIncalMode(lc); - break; - } - case GSTATE_CALL_ERROR: { + } else if (state == GeneralState.GSTATE_CALL_ERROR) { if (mWakeLock.isHeld()) mWakeLock.release(); Toast toast = Toast.makeText(this ,String.format(getString(R.string.call_error),lc.getRemoteAddress()) , Toast.LENGTH_LONG); toast.show(); - } - case GSTATE_CALL_END: { + } else if (state == GeneralState.GSTATE_CALL_END) { exitCallMode(); - break; - } } } public void inviteReceived(LinphoneCore lc, String from) { @@ -487,5 +489,9 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { mAudioManager.setSpeakerphoneOn(false); } } + private void callPending() { + mDecline.setEnabled(true); + routeAudioToSpeaker(); + } } diff --git a/src/org/linphone/HistoryActivity.java b/src/org/linphone/HistoryActivity.java index 2e8d82d61..5748e47a7 100644 --- a/src/org/linphone/HistoryActivity.java +++ b/src/org/linphone/HistoryActivity.java @@ -26,7 +26,7 @@ import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCallLog; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneProxyConfig; -import org.linphone.core.LinphoneCallLog.CallDirection; +import org.linphone.core.CallDirection; import android.app.ListActivity; import android.content.Context; @@ -132,7 +132,7 @@ public class HistoryActivity extends ListActivity { ImageView lDirectionImageIn = (ImageView) lView.findViewById(R.id.history_cell_icon_in); ImageView lDirectionImageOut = (ImageView) lView.findViewById(R.id.history_cell_icon_out); - if (lLog.getDirection() == CallDirection.Callincoming) { + if (lLog.getDirection() == CallDirection.Incoming) { lAddress = lLog.getFrom(); lDirectionImageIn.setVisibility(View.VISIBLE); lDirectionImageOut.setVisibility(View.GONE); @@ -150,7 +150,7 @@ public class HistoryActivity extends ListActivity { if (lProxyConfig != null && lProxyConfig.getDomain().equals(lAddress.getDomain())) { lDetailedName = lAddress.getUserName(); } else { - lDetailedName = lAddress.toUri(); + lDetailedName = lAddress.asStringUriOnly(); } if (lDisplayName == null) { lFirstLineView.setText(lDetailedName); diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index c2ec98354..861c67c46 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -94,7 +94,7 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener Intent lHistoryItent = new Intent().setClass(this, HistoryActivity.class); spec = lTabHost.newTabSpec("history").setIndicator(getString(R.string.tab_history), - null) + getResources().getDrawable(R.drawable.history_orange)) .setContent(lHistoryItent); lTabHost.addTab(spec); @@ -103,7 +103,7 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener // Initialize a TabSpec for each tab and add it to the TabHost spec = lTabHost.newTabSpec("dialer").setIndicator(getString(R.string.tab_dialer), - getResources().getDrawable(android.R.drawable.ic_menu_call)) + getResources().getDrawable(R.drawable.dialer_orange)) .setContent(lDialerIntent); lTabHost.addTab(spec); @@ -111,7 +111,7 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener Intent lContactItent = new Intent().setClass(this, ContactPickerActivity.class); spec = lTabHost.newTabSpec("contact").setIndicator(getString(R.string.tab_contact), - null) + getResources().getDrawable(R.drawable.history_orange)) .setContent(lContactItent); lTabHost.addTab(spec); @@ -135,9 +135,7 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener } else { mAudioManager.setSpeakerphoneOn(false); } - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.setClass(this, LinphoneService.class); - stopService(intent); + theLinphoneActivity = null; } @@ -173,6 +171,9 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener return true; case R.id.menu_exit: finish(); + Intent exitIntent = new Intent(Intent.ACTION_MAIN); + exitIntent.setClass(this, LinphoneService.class); + stopService(exitIntent); break; case R.id.menu_about: Intent intent = new Intent(Intent.ACTION_MAIN); diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index 4889c61e1..a4398105f 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -35,6 +35,9 @@ import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LinphoneCore.GeneralState; +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; @@ -58,7 +61,18 @@ public class LinphoneService extends Service implements LinphoneCoreListener { private LinphoneCore mLinphoneCore; private SharedPreferences mPref; Timer mTimer = new Timer("Linphone scheduler"); - + + NotificationManager mNotificationManager; + Notification mNotification; + PendingIntent mNofificationContentIntent; + final static int NOTIFICATION_ID=1; + final String NOTIFICATION_TITLE = "Linphone"; + + final int IC_LEVEL_OFFLINE=3; + final int IC_LEVEL_ORANGE=0; + final int IC_LEVEL_GREEN=1; + final int IC_LEVEL_RED=2; + private Handler mHandler = new Handler() ; static boolean isready() { return (theLinphone!=null); @@ -75,14 +89,24 @@ public class LinphoneService extends Service implements LinphoneCoreListener { public void onCreate() { super.onCreate(); theLinphone = this; - + + mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + mNotification = new Notification(R.drawable.status_level + , "" + , System.currentTimeMillis()); + mNotification.iconLevel=IC_LEVEL_ORANGE; + mNotification.flags |= Notification.FLAG_ONGOING_EVENT; + Intent notificationIntent = new Intent(this, LinphoneActivity.class); + mNofificationContentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); + mNotification.setLatestEventInfo(this, NOTIFICATION_TITLE,"", mNofificationContentIntent); + mNotificationManager.notify(NOTIFICATION_ID, mNotification); mPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); try { copyAssetsFromPackage(); mLinphoneCore = LinphoneCoreFactory.instance().createLinphoneCore( this - , new File(LINPHONE_RC) - , new File(LINPHONE_FACTORY_RC) + , LINPHONE_RC + , LINPHONE_FACTORY_RC , null); mLinphoneCore.setSoftPlayLevel(3); @@ -101,6 +125,8 @@ public class LinphoneService extends Service implements LinphoneCoreListener { }; mTimer.scheduleAtFixedRate(lTask, 0, 100); + + } catch (Exception e) { Log.e(TAG,"Cannot start linphone",e); @@ -166,20 +192,52 @@ public class LinphoneService extends Service implements LinphoneCoreListener { } public void generalState(final LinphoneCore lc, final LinphoneCore.GeneralState state) { Log.i(TAG, "new state ["+state+"]"); - if (state == GeneralState.GSTATE_POWER_OFF) { - //just exist - //System.exit(0); + if (state == GeneralState.GSTATE_POWER_ON) { + mNotification.iconLevel=IC_LEVEL_OFFLINE; + mNotification.when=System.currentTimeMillis(); + mNotification.setLatestEventInfo(this + , NOTIFICATION_TITLE + ,getString(R.string.notification_started) + , mNofificationContentIntent); + mNotificationManager.notify(NOTIFICATION_ID, mNotification); + } + if (state == GeneralState.GSTATE_REG_OK && lc.getDefaultProxyConfig().isRegistered()) { + mNotification.iconLevel=IC_LEVEL_ORANGE; + mNotification.when=System.currentTimeMillis(); + mNotification.setLatestEventInfo(this + , NOTIFICATION_TITLE + ,String.format(getString(R.string.notification_registered),lc.getDefaultProxyConfig().getIdentity()) + , mNofificationContentIntent); + mNotificationManager.notify(NOTIFICATION_ID, mNotification); + } + if (state == GeneralState.GSTATE_REG_FAILED ) { + mNotification.iconLevel=IC_LEVEL_OFFLINE; + mNotification.when=System.currentTimeMillis(); + mNotification.setLatestEventInfo(this + , NOTIFICATION_TITLE + ,String.format(getString(R.string.notification_register_failure),lc.getDefaultProxyConfig().getIdentity()) + , mNofificationContentIntent); + mNotificationManager.notify(NOTIFICATION_ID, mNotification); + } + if (DialerActivity.getDialer()!=null) { mHandler.post(new Runnable() { public void run() { DialerActivity.getDialer().generalState(lc,state); } }); + } + if (state == GeneralState.GSTATE_CALL_IN_INVITE) { + //wakeup linphone + Intent lIntent = new Intent(); + lIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + lIntent.setClass(this, LinphoneActivity.class); + startActivity(lIntent); } } public void inviteReceived(LinphoneCore lc, String from) { - // TODO Auto-generated method stub + } public void show(LinphoneCore lc) { @@ -213,7 +271,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener { //auth mLinphoneCore.clearAuthInfos(); - LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(lUserName, lPasswd); + LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(lUserName, lPasswd,null); mLinphoneCore.addAuthInfo(lAuthInfo); @@ -276,6 +334,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener { mTimer.cancel(); mLinphoneCore.destroy(); theLinphone=null; + mNotificationManager.cancel(NOTIFICATION_ID); } } \ No newline at end of file diff --git a/src/org/linphone/core/LinphoneAddressImpl.java b/src/org/linphone/core/LinphoneAddressImpl.java index 3f11322ed..bf4670ec3 100644 --- a/src/org/linphone/core/LinphoneAddressImpl.java +++ b/src/org/linphone/core/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/src/org/linphone/core/LinphoneAuthInfoImpl.java b/src/org/linphone/core/LinphoneAuthInfoImpl.java index fcea4900c..7f9e54dd2 100644 --- a/src/org/linphone/core/LinphoneAuthInfoImpl.java +++ b/src/org/linphone/core/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/src/org/linphone/core/LinphoneCallLogImpl.java b/src/org/linphone/core/LinphoneCallLogImpl.java index c35eea2c7..b0360d194 100644 --- a/src/org/linphone/core/LinphoneCallLogImpl.java +++ b/src/org/linphone/core/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/src/org/linphone/core/LinphoneCoreFactoryImpl.java b/src/org/linphone/core/LinphoneCoreFactoryImpl.java new file mode 100644 index 000000000..a34eabcae --- /dev/null +++ b/src/org/linphone/core/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/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java index d752cfdc0..547e4bc0d 100644 --- a/src/org/linphone/core/LinphoneCoreImpl.java +++ b/src/org/linphone/core/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/src/org/linphone/core/LinphoneProxyConfigImpl.java b/src/org/linphone/core/LinphoneProxyConfigImpl.java index 90cc16bfb..01080bfc0 100644 --- a/src/org/linphone/core/LinphoneProxyConfigImpl.java +++ b/src/org/linphone/core/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); } } diff --git a/submodules/linphone b/submodules/linphone index 572b69652..ec20c5451 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 572b696529119810350e083cec72e59b2d3e75d5 +Subproject commit ec20c545196905108f76a78190b8273f1d3e698e