diff --git a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl index a2e836ddc15dc11836b8dff5d070c831f3cdac58..98dfc75ebb2d07eb882bc1842f8fd8bd8283124c 100644 --- a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl +++ b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl @@ -6,6 +6,8 @@ interface ISipService { void accept(in String callID); void hangUp(in String callID); List getAccountList(); + String addAccount(in Map accountDetails); + void removeAccount(in String accoundId); Map getAccountDetails(in String accountID); void setAccountDetails(in String accountId, in Map accountDetails); void setAudioPlugin(in String callID); diff --git a/src/com/savoirfairelinux/sflphone/service/SipService.java b/src/com/savoirfairelinux/sflphone/service/SipService.java index 04e191bd6c4b74327cf1b42b0a398fe483fade66..61b30a6c1c9f1f4f1e22dcb3c948d719ef4bee79 100644 --- a/src/com/savoirfairelinux/sflphone/service/SipService.java +++ b/src/com/savoirfairelinux/sflphone/service/SipService.java @@ -191,9 +191,40 @@ public class SipService extends Service { configurationManagerJNI.setAccountDetails(accountId, swigmap); } }); + } + + @Override + public String addAccount(Map map) { + class AddAccount extends SipRunnableWithReturn { + StringMap map; + AddAccount(StringMap m) { map = m; } + @Override + protected String doRun() throws SameThreadException { + Log.i(TAG, "SipService.getAccountDetails() thread running..."); + return configurationManagerJNI.addAccount(map); + } + }; + + final StringMap swigmap = AccountDetailsHandler.convertFromNativeToSwig((HashMap<String,String>)map); + + AddAccount runInstance = new AddAccount(swigmap); + getExecutor().execute(runInstance); + while(!runInstance.isDone()) {} + String accountId = (String) runInstance.getVal(); + return accountId; } + @Override + public void removeAccount(final String accountId) { + getExecutor().execute(new SipRunnable() { + @Override + protected void doRun() throws SameThreadException { + Log.i(TAG, "SipService.setAccountDetails() thread running..."); + configurationManagerJNI.removeAccount(accountId); + } + }); + } }; /**