diff --git a/tests/src/org/linphone/test/LinphoneTestManager.java b/tests/src/org/linphone/test/LinphoneTestManager.java index e0ba70d59..06298b0e5 100644 --- a/tests/src/org/linphone/test/LinphoneTestManager.java +++ b/tests/src/org/linphone/test/LinphoneTestManager.java @@ -47,45 +47,45 @@ public class LinphoneTestManager implements LinphoneListener { private static LinphoneTestManager instance; private Context mIContext; private LinphoneCore mLc1, mLc2; - + public String lastMessageReceived; public boolean isDTMFReceived = false; public boolean autoAnswer = true; public boolean declineCall = false; - + private final String linphoneRootCaFile; private Timer mTimer1 = new Timer("Linphone scheduler 1"); private Timer mTimer2 = new Timer("Linphone scheduler 2"); - + private LinphoneTestManager(Context ac, Context ic) { mIContext = ic; linphoneRootCaFile = ac.getFilesDir().getAbsolutePath() + "/rootca.pem"; } - + public static LinphoneTestManager createAndStart(Context ac, Context ic, int id) { if (instance == null) instance = new LinphoneTestManager(ac, ic); - + instance.startLibLinphone(ic, id); TelephonyManager tm = (TelephonyManager) ac.getSystemService(Context.TELEPHONY_SERVICE); boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE; setGsmIdle(gsmIdle, id); - + return instance; } - + private synchronized void startLibLinphone(Context c, int id) { try { LinphoneCoreFactory.instance().setDebugMode(true, "LinphoneTester"); - + final LinphoneCore mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, c); if (id == 2) { mLc2 = mLc; } else { mLc1 = mLc; } - + mLc.setContext(c); try { String versionName = c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName; @@ -104,29 +104,29 @@ public class LinphoneTestManager implements LinphoneListener { int availableCores = Runtime.getRuntime().availableProcessors(); Log.w("MediaStreamer : " + availableCores + " cores detected and configured"); mLc.setCpuCount(availableCores); - + Transports t = mLc.getSignalingTransportPorts(); t.udp = -1; t.tcp = -1; mLc.setSignalingTransportPorts(t); - + try { initFromConf(mLc); } catch (LinphoneException e) { Log.w("no config ready yet"); } - + TimerTask lTask = new TimerTask() { @Override public void run() { mLc.iterate(); } }; - + if (id == 2) { - mTimer2.scheduleAtFixedRate(lTask, 0, 20); + mTimer2.scheduleAtFixedRate(lTask, 0, 20); } else { - mTimer1.scheduleAtFixedRate(lTask, 0, 20); + mTimer1.scheduleAtFixedRate(lTask, 0, 20); } resetCameraFromPreferences(); @@ -135,7 +135,7 @@ public class LinphoneTestManager implements LinphoneListener { Log.e(e, "Cannot start linphone"); } } - + private void resetCameraFromPreferences() { boolean useFrontCam = true; int camId = 0; @@ -146,19 +146,19 @@ public class LinphoneTestManager implements LinphoneListener { } LinphoneManager.getLc().setVideoDevice(camId); } - + public void initFromConf(LinphoneCore mLc) throws LinphoneConfigException, LinphoneCoreException { LinphoneCoreFactory.instance().setDebugMode(true, "LinphoneTester"); - + initAccounts(mLc); mLc.setVideoPolicy(true, true); mLc.enableVideo(true, true); - + mLc.setUseRfc2833ForDtmfs(false); mLc.setUseSipInfoForDtmfs(true); - - mLc.setNetworkReachable(true); + + mLc.setNetworkReachable(true); } public boolean detectVideoCodec(String mime, LinphoneCore mLc) { @@ -167,7 +167,7 @@ public class LinphoneTestManager implements LinphoneListener { } return false; } - + public boolean detectAudioCodec(String mime, LinphoneCore mLc){ for (PayloadType audioCodec : mLc.getAudioCodecs()) { if (mime.equals(audioCodec.getMime())) return true; @@ -179,11 +179,11 @@ public class LinphoneTestManager implements LinphoneListener { MediaEncryption me = MediaEncryption.None; mLc.setMediaEncryption(me); } - + private void initAccounts(LinphoneCore mLc) throws LinphoneCoreException { mLc.clearAuthInfos(); mLc.clearProxyConfigs(); - + String username, password, domain; if (mLc.equals(mLc1)) { username = mIContext.getString(org.linphone.test.R.string.account_test_calls_login); @@ -194,7 +194,7 @@ public class LinphoneTestManager implements LinphoneListener { password = mIContext.getString(org.linphone.test.R.string.conference_account_password); domain = mIContext.getString(org.linphone.test.R.string.conference_account_domain); } - + LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(username, password, null, domain); mLc.addAuthInfo(lAuthInfo); String identity = "sip:" + username +"@" + domain; @@ -204,7 +204,7 @@ public class LinphoneTestManager implements LinphoneListener { LinphoneProxyConfig proxycon = mLc.createProxyConfig(identity, proxyAddr.asStringUriOnly(), proxyAddr.asStringUriOnly(), true); mLc.addProxyConfig(proxycon); mLc.setDefaultProxyConfig(proxycon); - + LinphoneProxyConfig lDefaultProxyConfig = mLc.getDefaultProxyConfig(); if (lDefaultProxyConfig != null) { //escape + @@ -217,13 +217,13 @@ public class LinphoneTestManager implements LinphoneListener { public static synchronized final LinphoneTestManager getInstance() { return instance; } - + public static synchronized final LinphoneCore getLc(int i) { if (i == 2) return getInstance().mLc2; return getInstance().mLc1; } - + public static synchronized final LinphoneCore getLc() { return getLc(1); } @@ -261,7 +261,7 @@ public class LinphoneTestManager implements LinphoneListener { mTimer2.cancel(); mLc1.destroy(); mLc2.destroy(); - } + } catch (RuntimeException e) { e.printStackTrace(); } @@ -280,7 +280,7 @@ public class LinphoneTestManager implements LinphoneListener { @Override public void globalState(LinphoneCore lc, GlobalState state, String message) { // TODO Auto-generated method stub - + } @Override @@ -305,14 +305,14 @@ public class LinphoneTestManager implements LinphoneListener { public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) { // TODO Auto-generated method stub - + } @Override public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, boolean encrypted, String authenticationToken) { // TODO Auto-generated method stub - + } @Override @@ -326,20 +326,20 @@ public class LinphoneTestManager implements LinphoneListener { public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url) { // TODO Auto-generated method stub - + } @Override public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { // TODO Auto-generated method stub - + } @Override public void textReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, String message) { // TODO Auto-generated method stub - + } @Override @@ -361,68 +361,68 @@ public class LinphoneTestManager implements LinphoneListener { public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event) { // TODO Auto-generated method stub - + } @Override public void show(LinphoneCore lc) { // TODO Auto-generated method stub - + } @Override public void displayStatus(LinphoneCore lc, String message) { // TODO Auto-generated method stub - + } @Override public void displayMessage(LinphoneCore lc, String message) { // TODO Auto-generated method stub - + } @Override public void displayWarning(LinphoneCore lc, String message) { // TODO Auto-generated method stub - + } @Override public void transferState(LinphoneCore lc, LinphoneCall call, State new_call_state) { // TODO Auto-generated method stub - + } @Override public void infoReceived(LinphoneCore lc, LinphoneCall call, LinphoneInfoMessage info) { // TODO Auto-generated method stub - + } @Override public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev, SubscriptionState state) { // TODO Auto-generated method stub - + } @Override public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content) { // TODO Auto-generated method stub - + } @Override public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev, PublishState state) { // TODO Auto-generated method stub - + } - + @Override public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr) { // TODO Auto-generated method stub @@ -438,27 +438,41 @@ public class LinphoneTestManager implements LinphoneListener { public void authInfoRequested(LinphoneCore lc, String realm, String username, String Domain) { // TODO Auto-generated method stub - + } - + @Override public void fileTransferProgressIndication(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, int progress) { // TODO Auto-generated method stub - + } - + @Override public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, byte[] buffer, int size) { // TODO Auto-generated method stub - + } - + @Override public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, ByteBuffer buffer, int size) { // TODO Auto-generated method stub return 0; } + + @Override + public void uploadProgressIndication(LinphoneCore lc, int offset, int total) { + // TODO Auto-generated method stub + + } + + + @Override + public void uploadStateChanged(LinphoneCore lc, LinphoneCore.LogCollectionUploadState state, + String info) { + // TODO Auto-generated method stub + + } }