Merge remote branch 'bc/master' into video

This commit is contained in:
Jehan Monnier 2010-11-09 14:07:00 +01:00
commit df4852cf66
18 changed files with 656 additions and 18 deletions

View file

@ -4,6 +4,7 @@
<classpathentry kind="src" path="submodules/linphone/java/j2se"/>
<classpathentry kind="src" path="submodules/linphone/java/common"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="src" path="submodules/linphone/coreapi/help/java"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -20,6 +20,37 @@
<data android:scheme="tel" />
</intent-filter>
</activity>
<activity android:name=".core.tutorials.TutorialHelloWorldActivity"
android:label="Hello World" android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".core.tutorials.TutorialRegistrationActivity"
android:label="Registration"
android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".core.tutorials.TutorialBuddyStatusActivity"
android:label="Buddy status"
android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".core.tutorials.TutorialChatRoomActivity"
android:label="Chat Room"
android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LinphonePreferencesActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -73,4 +104,4 @@
<uses-permission android:name="android.permission.BOOT_COMPLETED"></uses-permission>
</manifest>
</manifest>

3
deliver_sdk.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
zip -r ../liblinphone-android-sdk.zip submodules/linphone/coreapi/help/java libs src/org/linphone/core submodules/linphone/java/j2se/ submodules/linphone/java/common res/layout/hello_world.xml

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
<EditText android:layout_height="wrap_content" android:id="@+id/AddressId" android:hint="sip:user@host:port" android:layout_width="fill_parent" android:layout_weight="1" android:text="sip:[user@]host[:port]"></EditText>
<Button android:layout_height="wrap_content" android:id="@+id/CallButton" android:text="Call" android:layout_width="wrap_content"></Button>
</LinearLayout><EditText android:hint="password" android:id="@+id/Password" android:layout_width="fill_parent" android:layout_height="wrap_content" android:visibility="gone"></EditText>
<TextView android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/OutputText" android:text="Debug"></TextView>
<Button android:text="STOP" android:id="@+id/ButtonStop" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
</LinearLayout>

View file

@ -34,4 +34,5 @@ public class BootReceiver extends BroadcastReceiver {
context.startService(lLinphoneServiceIntent);;
}
}
}

View file

@ -32,6 +32,9 @@ public class LinphoneAddressImpl implements LinphoneAddress {
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);

View file

@ -0,0 +1,37 @@
/*
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

@ -39,8 +39,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
}
@Override
public LinphoneAddress createLinphoneAddress(String address) {
throw new RuntimeException("Not implemeneted yet");
public LinphoneAddress createLinphoneAddress(String identity) {
return new LinphoneAddressImpl(identity);
}
@Override
@ -54,6 +54,15 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
}
}
@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 {
@ -70,14 +79,12 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
}
@Override
LinphoneFriend createLinphoneFriend(String friendUri) {
// TODO Auto-generated method stub
return null;
public LinphoneFriend createLinphoneFriend(String friendUri) {
return new LinphoneFriendImpl(friendUri);
}
@Override
LinphoneFriend createLinphoneFriend() {
// TODO Auto-generated method stub
return null;
public LinphoneFriend createLinphoneFriend() {
return createLinphoneFriend(null);
}
}

View file

@ -68,10 +68,19 @@ class LinphoneCoreImpl implements LinphoneCore {
private AndroidVideoWindowImpl mVideoWindow;
private AndroidVideoWindowImpl mPreviewWindow;
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);
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 {
}
@ -274,18 +283,18 @@ class LinphoneCoreImpl implements LinphoneCore {
public void stopDtmf() {
stopDtmf(nativePtr);
}
public void addFriend(LinphoneFriend lf) throws LinphoneCoreException {
// TODO Auto-generated method stub
addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr);
}
public void setPresenceInfo(int minute_away, String alternative_contact,
OnlineStatus status) {
setPresenceInfo(nativePtr,minute_away,alternative_contact,status.mValue);
}
public LinphoneChatRoom createChatRoom(String to) {
// TODO Auto-generated method stub
return null;
}
public void setPresenceInfo(int minuteAway, String alternativeContact,
OnlineStatus status) {
// TODO Auto-generated method stub
return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to));
}
public void setPreviewWindow(VideoWindow w) {
if (mPreviewWindow!=null)

View file

@ -0,0 +1,80 @@
/*
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

@ -0,0 +1,49 @@
/*
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.
*
* @author Guillaume Beraudo
*
*/
public 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

@ -0,0 +1,98 @@
/*
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:tested@10.0.2.6:5059";
private TextView sipAddressWidget;
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);
// 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 {
tutorial.launchTutorial(sipAddressWidget.getText().toString());
mHandler.post(new Runnable() {
public void run() {
buttonCall.setEnabled(true);
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
}

View file

@ -0,0 +1,98 @@
/*
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:tested@10.0.2.6:5059";
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

@ -0,0 +1,98 @@
/*
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:tested@10.0.2.6:5059";
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

@ -0,0 +1,105 @@
/*
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:8182449901ip@mty11.axtel.net";
private static final String defaultSipPassword = "49901";
private TextView sipAddressWidget;
private TextView sipPasswordWidget;
private TutorialRegistration tutorial;
private Button buttonCall;
private Handler mHandler = new Handler();
@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
final TextView 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.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(),
sipPasswordWidget.getText().toString());
mHandler.post(new Runnable() {
public void run() {
buttonCall.setEnabled(true);
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
}

@ -1 +1 @@
Subproject commit 92b5747b7cfcff39dd64bffae481d3c00dcee75a
Subproject commit 7db8fc8c965d7c482bec62d84c8030469f2fdef3