Removed previous xmlrpc lib by the one in liblinphone
This commit is contained in:
parent
937b7d9953
commit
74e19a769a
12 changed files with 321 additions and 809 deletions
|
@ -4,7 +4,6 @@
|
||||||
<classpathentry kind="src" path="submodules/linphone/java/j2se"/>
|
<classpathentry kind="src" path="submodules/linphone/java/j2se"/>
|
||||||
<classpathentry kind="src" path="submodules/linphone/java/common"/>
|
<classpathentry kind="src" path="submodules/linphone/java/common"/>
|
||||||
<classpathentry kind="src" path="submodules/linphone/java/impl"/>
|
<classpathentry kind="src" path="submodules/linphone/java/impl"/>
|
||||||
<classpathentry kind="src" path="submodules/externals/axmlrpc/src/main/java"/>
|
|
||||||
<classpathentry kind="src" path="submodules/linphone/coreapi/help/java"/>
|
<classpathentry kind="src" path="submodules/linphone/coreapi/help/java"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||||
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -55,9 +55,6 @@
|
||||||
[submodule "submodules/externals/libupnp"]
|
[submodule "submodules/externals/libupnp"]
|
||||||
path = submodules/externals/libupnp
|
path = submodules/externals/libupnp
|
||||||
url = git://git.linphone.org/libupnp.git
|
url = git://git.linphone.org/libupnp.git
|
||||||
[submodule "submodules/externals/axmlrpc"]
|
|
||||||
path = submodules/externals/axmlrpc
|
|
||||||
url = git://git.linphone.org/axmlrpc.git
|
|
||||||
[submodule "submodules/externals/opus"]
|
[submodule "submodules/externals/opus"]
|
||||||
path = submodules/externals/opus
|
path = submodules/externals/opus
|
||||||
url = git://git.linphone.org/opus.git
|
url = git://git.linphone.org/opus.git
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
source.dir=src:submodules/linphone/mediastreamer2/java/src:submodules/linphone/java/j2se:submodules/linphone/java/common:submodules/linphone/java/impl:submodules/linphone/coreapi/help/java:submodules/externals/axmlrpc/src/main/java
|
source.dir=src:submodules/linphone/mediastreamer2/java/src:submodules/linphone/java/j2se:submodules/linphone/java/common:submodules/linphone/java/impl:submodules/linphone/coreapi/help/java
|
||||||
key.store=bc-android.keystore
|
key.store=bc-android.keystore
|
||||||
key.alias=nw8000
|
key.alias=nw8000
|
||||||
version.name=2.5.0
|
version.name=2.5.0
|
||||||
|
|
|
@ -372,7 +372,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
if (lc == null) return;
|
if (lc == null) return;
|
||||||
|
|
||||||
friend.edit();
|
friend.edit();
|
||||||
friend.setFamillyName(lastName);
|
friend.setFamilyName(lastName);
|
||||||
friend.setGivenName(firstName);
|
friend.setGivenName(firstName);
|
||||||
|
|
||||||
for (LinphoneAddress address : friend.getAddresses()) {
|
for (LinphoneAddress address : friend.getAddresses()) {
|
||||||
|
@ -461,7 +461,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
}
|
}
|
||||||
} else if (isLinphoneFriend()) {
|
} else if (isLinphoneFriend()) {
|
||||||
fullName = friend.getName();
|
fullName = friend.getName();
|
||||||
lastName = friend.getFamillyName();
|
lastName = friend.getFamilyName();
|
||||||
firstName = friend.getGivenName();
|
firstName = friend.getGivenName();
|
||||||
thumbnailUri = null;
|
thumbnailUri = null;
|
||||||
photoUri = null;
|
photoUri = null;
|
||||||
|
@ -491,7 +491,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
createOrUpdateFriend();
|
createOrUpdateFriend();
|
||||||
} else if (isLinphoneFriend()) {
|
} else if (isLinphoneFriend()) {
|
||||||
fullName = friend.getName();
|
fullName = friend.getName();
|
||||||
lastName = friend.getFamillyName();
|
lastName = friend.getFamilyName();
|
||||||
firstName = friend.getGivenName();
|
firstName = friend.getGivenName();
|
||||||
thumbnailUri = null;
|
thumbnailUri = null;
|
||||||
photoUri = null;
|
photoUri = null;
|
||||||
|
|
|
@ -25,16 +25,13 @@ import static android.media.AudioManager.STREAM_VOICE_CALL;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
@ -81,14 +78,11 @@ import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.ContentValues;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.hardware.Sensor;
|
import android.hardware.Sensor;
|
||||||
import android.hardware.SensorEvent;
|
import android.hardware.SensorEvent;
|
||||||
import android.hardware.SensorEventListener;
|
import android.hardware.SensorEventListener;
|
||||||
|
@ -99,13 +93,10 @@ import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.provider.MediaStore.Images;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
import android.provider.Settings.SettingNotFoundException;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
@ -220,14 +211,19 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
routeAudioToSpeakerHelper(true);
|
routeAudioToSpeakerHelper(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserAgent() throws NameNotFoundException {
|
public String getUserAgent() {
|
||||||
StringBuilder userAgent = new StringBuilder();
|
try {
|
||||||
userAgent.append("LinphoneAndroid/" + mServiceContext.getPackageManager().getPackageInfo(mServiceContext.getPackageName(),0).versionCode);
|
StringBuilder userAgent = new StringBuilder();
|
||||||
userAgent.append(" (");
|
userAgent.append("LinphoneAndroid/" + mServiceContext.getPackageManager().getPackageInfo(mServiceContext.getPackageName(),0).versionCode);
|
||||||
userAgent.append("Linphone/" + LinphoneManager.getLc().getVersion() + "; ");
|
userAgent.append(" (");
|
||||||
userAgent.append(Build.DEVICE + " " + Build.MODEL + " Android/" + Build.VERSION.SDK_INT);
|
userAgent.append("Linphone/" + LinphoneManager.getLc().getVersion() + "; ");
|
||||||
userAgent.append(")");
|
userAgent.append(Build.DEVICE + " " + Build.MODEL + " Android/" + Build.VERSION.SDK_INT);
|
||||||
return userAgent.toString();
|
userAgent.append(")");
|
||||||
|
return userAgent.toString();
|
||||||
|
} catch (NameNotFoundException nnfe) {
|
||||||
|
Log.e(nnfe);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void routeAudioToReceiver() {
|
public void routeAudioToReceiver() {
|
||||||
|
|
|
@ -17,20 +17,22 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphoneService;
|
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcRequest;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcRequestImpl;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcSession;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcSessionImpl;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
@ -45,10 +47,6 @@ import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import de.timroes.axmlrpc.XMLRPCCallback;
|
|
||||||
import de.timroes.axmlrpc.XMLRPCClient;
|
|
||||||
import de.timroes.axmlrpc.XMLRPCException;
|
|
||||||
import de.timroes.axmlrpc.XMLRPCServerException;
|
|
||||||
/**
|
/**
|
||||||
* @author Sylvain Berfini
|
* @author Sylvain Berfini
|
||||||
*/
|
*/
|
||||||
|
@ -63,6 +61,7 @@ public class CreateAccountFragment extends Fragment {
|
||||||
private boolean confirmPasswordOk = false;
|
private boolean confirmPasswordOk = false;
|
||||||
private Button createAccount;
|
private Button createAccount;
|
||||||
private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]");
|
private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]");
|
||||||
|
private LinphoneXmlRpcSession xmlRpcSession;
|
||||||
|
|
||||||
private String getUsername() {
|
private String getUsername() {
|
||||||
String username = usernameEdit.getText().toString();
|
String username = usernameEdit.getText().toString();
|
||||||
|
@ -120,6 +119,8 @@ public class CreateAccountFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), getString(R.string.wizard_url));
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,58 +146,46 @@ public class CreateAccountFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void isUsernameRegistred(final String username, final ImageView icon) {
|
private void isUsernameRegistred(final String username, final ImageView icon) {
|
||||||
|
final Runnable runNotOk = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
usernameOk = false;
|
||||||
|
displayError(usernameOk, usernameError, usernameEdit, LinphoneManager.getInstance().getContext().getString(R.string.wizard_username_unavailable));
|
||||||
|
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
final Runnable runOk = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
usernameOk = true;
|
||||||
|
displayError(usernameOk, usernameError, usernameEdit, "");
|
||||||
|
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
||||||
|
}
|
||||||
|
};
|
||||||
final Runnable runNotReachable = new Runnable() {
|
final Runnable runNotReachable = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
usernameOk = false;
|
usernameOk = false;
|
||||||
displayError(usernameOk, usernameError, usernameEdit, getResources().getString(R.string.wizard_server_unavailable));
|
displayError(usernameOk, usernameError, usernameEdit, LinphoneManager.getInstance().getContext().getString(R.string.wizard_server_unavailable));
|
||||||
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_account", LinphoneXmlRpcRequest.ArgType.Int);
|
||||||
XMLRPCClient client = new XMLRPCClient(new URL(getString(R.string.wizard_url)));
|
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||||
|
@Override
|
||||||
XMLRPCCallback listener = new XMLRPCCallback() {
|
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||||
Runnable runNotOk = new Runnable() {
|
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||||
public void run() {
|
int response = request.getIntResponse();
|
||||||
usernameOk = false;
|
if (response != 0) {
|
||||||
displayError(usernameOk, usernameError, usernameEdit, getResources().getString(R.string.wizard_username_unavailable));
|
mHandler.post(runNotOk);
|
||||||
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
} else {
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Runnable runOk = new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
usernameOk = true;
|
|
||||||
displayError(usernameOk, usernameError, usernameEdit, "");
|
|
||||||
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public void onResponse(long id, Object result) {
|
|
||||||
int answer = (Integer) result;
|
|
||||||
if (answer != 0) {
|
|
||||||
mHandler.post(runNotOk);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mHandler.post(runOk);
|
mHandler.post(runOk);
|
||||||
}
|
}
|
||||||
}
|
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||||
|
mHandler.post(runNotReachable);
|
||||||
public void onError(long id, XMLRPCException error) {
|
}
|
||||||
mHandler.post(runNotReachable);
|
}
|
||||||
}
|
});
|
||||||
|
xmlRpcRequest.addStringArg(username);
|
||||||
public void onServerError(long id, XMLRPCServerException error) {
|
xmlRpcSession.sendRequest(xmlRpcRequest);
|
||||||
mHandler.post(runNotReachable);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
client.callAsync(listener, "check_account", username);
|
|
||||||
}
|
|
||||||
catch(Exception ex) {
|
|
||||||
mHandler.post(runNotReachable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEmailCorrect(String email) {
|
private boolean isEmailCorrect(String email) {
|
||||||
|
@ -209,53 +198,43 @@ public class CreateAccountFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAccount(final String username, final String password, String email, boolean suscribe) {
|
private void createAccount(final String username, final String password, String email, boolean suscribe) {
|
||||||
|
final Runnable runNotOk = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
//TODO errorMessage.setText(R.string.wizard_failed);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
final Runnable runOk = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
AssistantActivity.instance().displayAssistantConfirm(username, password);
|
||||||
|
}
|
||||||
|
};
|
||||||
final Runnable runNotReachable = new Runnable() {
|
final Runnable runNotReachable = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
//TODO errorMessage.setText(R.string.wizard_server_unavailable);
|
//TODO errorMessage.setText(R.string.wizard_not_reachable);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
final Context context = AssistantActivity.instance() == null ? LinphoneService.instance().getApplicationContext() : AssistantActivity.instance();
|
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("create_account_with_useragent", LinphoneXmlRpcRequest.ArgType.Int);
|
||||||
|
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||||
try {
|
@Override
|
||||||
XMLRPCClient client = new XMLRPCClient(new URL(context.getString(R.string.wizard_url)));
|
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||||
|
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||||
XMLRPCCallback listener = new XMLRPCCallback() {
|
int response = request.getIntResponse();
|
||||||
Runnable runNotOk = new Runnable() {
|
if (response != 0) {
|
||||||
public void run() {
|
mHandler.post(runNotOk);
|
||||||
//TODO errorMessage.setText(R.string.wizard_failed);
|
} else {
|
||||||
|
mHandler.post(runOk);
|
||||||
}
|
}
|
||||||
};
|
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||||
|
mHandler.post(runNotReachable);
|
||||||
Runnable runOk = new Runnable() {
|
}
|
||||||
public void run() {
|
}
|
||||||
AssistantActivity.instance().displayAssistantConfirm(username, password);
|
});
|
||||||
}
|
xmlRpcRequest.addStringArg(username);
|
||||||
};
|
xmlRpcRequest.addStringArg(password);
|
||||||
|
xmlRpcRequest.addStringArg(email);
|
||||||
public void onResponse(long id, Object result) {
|
xmlRpcRequest.addStringArg(LinphoneManager.getInstance().getUserAgent());
|
||||||
int answer = (Integer) result;
|
xmlRpcSession.sendRequest(xmlRpcRequest);
|
||||||
if (answer != 0) {
|
|
||||||
mHandler.post(runNotOk);
|
|
||||||
} else {
|
|
||||||
mHandler.post(runOk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onError(long id, XMLRPCException error) {
|
|
||||||
mHandler.post(runNotReachable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServerError(long id, XMLRPCServerException error) {
|
|
||||||
mHandler.post(runNotReachable);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
client.callAsync(listener, "create_account_with_useragent", username, password, email, LinphoneManager.getInstance().getUserAgent());
|
|
||||||
}
|
|
||||||
catch(Exception ex) {
|
|
||||||
mHandler.post(runNotReachable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addXMLRPCUsernameHandler(final EditText field, final ImageView icon) {
|
private void addXMLRPCUsernameHandler(final EditText field, final ImageView icon) {
|
||||||
|
|
|
@ -19,35 +19,37 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
|
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreListenerBase;
|
import org.linphone.core.LinphoneCoreListenerBase;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcRequest;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcRequestImpl;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcSession;
|
||||||
|
import org.linphone.core.LinphoneXmlRpcSessionImpl;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import de.timroes.axmlrpc.XMLRPCCallback;
|
|
||||||
import de.timroes.axmlrpc.XMLRPCClient;
|
|
||||||
import de.timroes.axmlrpc.XMLRPCException;
|
|
||||||
import de.timroes.axmlrpc.XMLRPCServerException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ghislain MARY
|
* @author Ghislain MARY
|
||||||
*/
|
*/
|
||||||
public class EchoCancellerCalibrationFragment extends Fragment {
|
public class EchoCancellerCalibrationFragment extends Fragment implements LinphoneXmlRpcRequestListener {
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
private boolean mSendEcCalibrationResult = false;
|
private boolean mSendEcCalibrationResult = false;
|
||||||
private LinphoneCoreListenerBase mListener;
|
private LinphoneCoreListenerBase mListener;
|
||||||
|
private LinphoneXmlRpcSession xmlRpcSession;
|
||||||
|
private LinphoneXmlRpcRequest xmlRpcRequest;
|
||||||
|
private Runnable runFinished;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
@ -56,7 +58,7 @@ public class EchoCancellerCalibrationFragment extends Fragment {
|
||||||
|
|
||||||
mListener = new LinphoneCoreListenerBase(){
|
mListener = new LinphoneCoreListenerBase(){
|
||||||
@Override
|
@Override
|
||||||
public void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) {
|
public void ecCalibrationStatus(LinphoneCore lc, LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) {
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
if (mSendEcCalibrationResult) {
|
if (mSendEcCalibrationResult) {
|
||||||
sendEcCalibrationResult(status, delay_ms);
|
sendEcCalibrationResult(status, delay_ms);
|
||||||
|
@ -65,6 +67,15 @@ public class EchoCancellerCalibrationFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
runFinished = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
AssistantActivity.instance().isEchoCalibrationFinished();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), getString(R.string.wizard_url));
|
||||||
|
xmlRpcRequest = new LinphoneXmlRpcRequestImpl("add_ec_calibration_result", LinphoneXmlRpcRequest.ArgType.None);
|
||||||
|
xmlRpcRequest.setListener(this);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LinphoneManager.getInstance().startEcCalibration(mListener);
|
LinphoneManager.getInstance().startEcCalibration(mListener);
|
||||||
|
@ -79,34 +90,19 @@ public class EchoCancellerCalibrationFragment extends Fragment {
|
||||||
mSendEcCalibrationResult = enabled;
|
mSendEcCalibrationResult = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||||
|
mHandler.post(runFinished);
|
||||||
|
}
|
||||||
|
|
||||||
private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) {
|
private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) {
|
||||||
try {
|
Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltInEchoCanceler();
|
||||||
XMLRPCClient client = new XMLRPCClient(new URL(getString(R.string.wizard_url)));
|
Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model=" + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms" + " hasBuiltInEchoCanceler " + hasBuiltInEchoCanceler);
|
||||||
|
xmlRpcRequest.addStringArg(Build.MANUFACTURER);
|
||||||
XMLRPCCallback listener = new XMLRPCCallback() {
|
xmlRpcRequest.addStringArg(Build.MODEL);
|
||||||
Runnable runFinished = new Runnable() {
|
xmlRpcRequest.addStringArg(status.toString());
|
||||||
public void run() {
|
xmlRpcRequest.addIntArg(delayMs);
|
||||||
AssistantActivity.instance().isEchoCalibrationFinished();
|
xmlRpcRequest.addIntArg(hasBuiltInEchoCanceler ? 1 : 0);
|
||||||
}
|
xmlRpcSession.sendRequest(xmlRpcRequest);
|
||||||
};
|
|
||||||
|
|
||||||
public void onResponse(long id, Object result) {
|
|
||||||
mHandler.post(runFinished);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onError(long id, XMLRPCException error) {
|
|
||||||
mHandler.post(runFinished);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServerError(long id, XMLRPCServerException error) {
|
|
||||||
mHandler.post(runFinished);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltInEchoCanceler();
|
|
||||||
Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model=" + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms" + " hasBuiltInEchoCanceler " + hasBuiltInEchoCanceler);
|
|
||||||
client.callAsync(listener, "add_ec_calibration_result", Build.MANUFACTURER, Build.MODEL, status.toString(), delayMs, hasBuiltInEchoCanceler);
|
|
||||||
}
|
|
||||||
catch(Exception ex) {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,7 +339,8 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Purchasable verifySignature(String payload, String signature) {
|
private Purchasable verifySignature(String payload, String signature) {
|
||||||
XmlRpcHelper helper = new XmlRpcHelper();
|
// TODO FIXME rework to be async
|
||||||
|
/*XmlRpcHelper helper = new XmlRpcHelper();
|
||||||
if (helper.verifySignature(payload, signature)) {
|
if (helper.verifySignature(payload, signature)) {
|
||||||
try {
|
try {
|
||||||
JSONObject json = new JSONObject(payload);
|
JSONObject json = new JSONObject(payload);
|
||||||
|
@ -350,7 +351,7 @@ public class InAppPurchaseHelper {
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1 +1 @@
|
||||||
Subproject commit 856a7ce3dc94e61c4c1d5796b1bdb8dbaaee10b4
|
Subproject commit 9daabd3dbfc72d6799f6bd54474a8f262e6716f2
|
1
submodules/externals/axmlrpc
vendored
1
submodules/externals/axmlrpc
vendored
|
@ -1 +0,0 @@
|
||||||
Subproject commit c47eaa453fb75d55d32304413672c16706af85e0
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit eb17eca54aba68112788af79d81bd2614c3ef6f6
|
Subproject commit 7bd469baa080f657cfe3fd015f58ae32f57dbafc
|
Loading…
Reference in a new issue