Commit 5fed24ef authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Added linphone_config_get_bool and linphone_config_set_bool for Java wrapper +...

Added linphone_config_get_bool and linphone_config_set_bool for Java wrapper + fixes for some Java classes
parent ebe1a5f1
......@@ -648,7 +648,6 @@ bool_t linphone_config_get_range(const LpConfig *lpconfig, const char *section,
}
}
int linphone_config_get_int(const LpConfig *lpconfig,const char *section, const char *key, int default_value){
const char *str=linphone_config_get_string(lpconfig,section,key,NULL);
if (str!=NULL) {
......@@ -663,6 +662,16 @@ int linphone_config_get_int(const LpConfig *lpconfig,const char *section, const
else return default_value;
}
bool_t linphone_config_get_bool(const LpConfig *lpconfig, const char *section, const char *key, bool_t default_value) {
const char *str = linphone_config_get_string(lpconfig, section, key, NULL);
if (str != NULL) {
int ret = 0;
sscanf(str, "%i", &ret);
return ret != 0;
}
return default_value;
}
int64_t linphone_config_get_int64(const LpConfig *lpconfig,const char *section, const char *key, int64_t default_value){
const char *str=linphone_config_get_string(lpconfig,section,key,NULL);
if (str!=NULL) {
......@@ -775,6 +784,14 @@ void linphone_config_set_int(LpConfig *lpconfig,const char *section, const char
linphone_config_set_string(lpconfig,section,key,tmp);
}
void linphone_config_set_bool(LpConfig *lpconfig, const char *section, const char *key, bool_t value) {
if (value) {
linphone_config_set_int(lpconfig, section, key, 1);
} else {
linphone_config_set_int(lpconfig, section, key, 0);
}
}
void linphone_config_set_int_hex(LpConfig *lpconfig,const char *section, const char *key, int value){
char tmp[30];
snprintf(tmp,sizeof(tmp),"0x%x",value);
......
......@@ -132,6 +132,13 @@ LINPHONE_PUBLIC bool_t linphone_config_get_range(const LinphoneConfig *lpconfig,
**/
LINPHONE_PUBLIC int linphone_config_get_int(const LinphoneConfig *lpconfig,const char *section, const char *key, int default_value);
/**
* Retrieves a configuration item as a boolean, given its section, key, and default value.
*
* The default boolean value is returned if the config item isn't found.
**/
LINPHONE_PUBLIC bool_t linphone_config_get_bool(const LpConfig *lpconfig, const char *section, const char *key, bool_t default_value);
/**
* Retrieves a configuration item as a 64 bit integer, given its section, key, and default value.
*
......@@ -170,6 +177,11 @@ LINPHONE_PUBLIC void linphone_config_set_range(LinphoneConfig *lpconfig, const c
**/
LINPHONE_PUBLIC void linphone_config_set_int(LinphoneConfig *lpconfig,const char *section, const char *key, int value);
/**
* Sets a boolean config item
**/
LINPHONE_PUBLIC void linphone_config_set_bool(LinphoneConfig *lpconfig,const char *section, const char *key, bool_t value);
/**
* Sets an integer config item, but store it as hexadecimal
**/
......
......@@ -20,10 +20,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
package org.linphone.core;
public class Utils {
public static int getPrefixFromE164(String e164) {
public static String getPrefixFromE164(String e164) {
DialPlan[] dialPlans = Factory.instance().getDialPlans();
DialPlan dialPlan = dialPlans[0];
return dialPlan.lookupCccFromE164(e164);
return String.valueOf(dialPlan.lookupCccFromE164(e164));
}
public static int getCccFromIso(String countryIso) {
......
......@@ -3,7 +3,7 @@ package org.linphone.core.tools;
import android.os.Build;
import org.linphone.core.LinphoneCore;
import org.linphone.core.Core;
import org.linphone.mediastream.Log;
/**
......@@ -36,38 +36,38 @@ public class H264Helper {
* - Mediacodec to enable Mediacodec only.
* @param mode String value between Auto, OpenH264 and MediaCodec
*/
public static void setH264Mode(String mode, LinphoneCore linphoneCore){
public static void setH264Mode(String mode, Core linphoneCore){
if(mode.equals(MODE_OPENH264)){
Log.i("H264Helper"," setH264Mode MODE_OPENH264 - Mode = "+mode);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_DEC , false);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_ENC , false);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_OPENH264_DEC , true);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_OPENH264_ENC , true);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_DEC , false);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_ENC , false);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_OPENH264_DEC , true);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_OPENH264_ENC , true);
}else if(mode.equals(MODE_MEDIA_CODEC)){
Log.i("H264Helper"," setH264Mode MODE_MEDIA_CODEC - Mode = "+mode);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_OPENH264_DEC , false);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_OPENH264_ENC , false);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_DEC , true);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_ENC , true);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_OPENH264_DEC , false);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_OPENH264_ENC , false);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_DEC , true);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_ENC , true);
}else if(mode.equals(MODE_AUTO)){
Log.i("H264Helper"," setH264Mode MODE_AUTO - Mode = "+mode);
// if android >= 5.0 use MediaCodec
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
Log.i("H264Helper"," setH264Mode MODE_AUTO 1 - Mode = "+mode);
Log.i("H264Helper"," Openh264 disabled on the project, now using MediaCodec");
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_OPENH264_DEC , false);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_OPENH264_ENC , false);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_DEC , true);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_ENC , true);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_OPENH264_DEC , false);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_OPENH264_ENC , false);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_DEC , true);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_ENC , true);
}
//otherwise use OpenH264
else{
Log.i("H264Helper"," setH264Mode MODE_AUTO 2 - Mode = "+mode);
Log.i("H264Helper"," Openh264 enabled on the project");
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_DEC , false);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_ENC , false);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_OPENH264_DEC , true);
linphoneCore.getMSFactory().enableFilterFromName(FILTER_NAME_OPENH264_ENC , true);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_DEC , false);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_MEDIA_CODEC_ENC , false);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_OPENH264_DEC , true);
linphoneCore.getMediastreamerFactory().enableFilterFromName(FILTER_NAME_OPENH264_ENC , true);
}
}else {
Log.i("H264Helper"," Error: Openh264 mode not reconized !");
......
package org.linphone.core.tools;
import org.linphone.core.LpConfig;
import org.linphone.core.Config;
import org.linphone.mediastream.Log;
public class Lpc2Xml {
......@@ -27,7 +27,7 @@ public class Lpc2Xml {
destroy();
}
public native int setLpc(LpConfig lpc);
public native int setLpc(Config lpc);
public native int convertFile(String file);
public native int convertString(StringBuffer content);
......
package org.linphone.core.tools;
import org.linphone.core.LpConfig;
import org.linphone.core.Config;
import org.linphone.mediastream.Log;
public class Xml2Lpc {
......@@ -34,7 +34,7 @@ public class Xml2Lpc {
public native int setXsdString(String content);
public native int validate();
public native int convert(LpConfig config);
public native int convert(Config config);
public void printLog(int level, String message) {
if(level > 0 && level < LogLevel.values().length) {
......
......@@ -6,6 +6,7 @@ SED_END='{} \;'
# Imports
eval "$SED_START 's/import org.linphone.tools/import org.linphone.core.tools/g' $SED_END"
eval "$SED_START 's/import org.linphone.core.OpenH264DownloadHelperListener/import org.linphone.core.tools.OpenH264DownloadHelperListener/g' $SED_END"
eval "$SED_START 's/import org.linphone.core.LinphoneCore.Transports;/import org.linphone.core.Transports/g' $SED_END"
# Listeners
eval "$SED_START 's/LinphoneAccountCreator.LinphoneAccountCreatorListener/AccountCreatorListener/g' $SED_END"
......@@ -116,6 +117,8 @@ eval "$SED_START 's/onAccountCreatorPhoneAccountRecovered/onRecoverAccount/g' $S
eval "$SED_START 's/onAccountCreatorIsAccountLinked/onIsAccountLinked/g' $SED_END"
eval "$SED_START 's/onAccountCreatorIsPhoneNumberUsed/onIsAliasUsed/g' $SED_END"
eval "$SED_START 's/onAccountCreatorPasswordUpdated/onUpdateAccount/g' $SED_END"
eval "$SED_START 's/(AccountCreator accountCreator, Status status)/(AccountCreator accountCreator, Status status, String resp)/g' $SED_END"
eval "$SED_START 's/(AccountCreator accountCreator, AccountCreator.Status status)/(AccountCreator accountCreator, AccountCreator.Status status, String resp)/g' $SED_END"
# # Chat message
eval "$SED_START 's/onChatMessageStateChanged/onMsgStateChanged/g' $SED_END"
......@@ -125,7 +128,7 @@ eval "$SED_START 's/onChatMessageFileTransferProgressChanged/onFileTransferProgr
# # Core
eval "$SED_START 's/authInfoRequested/removed/g' $SED_END" # Removed
eval "$SED_START 's/show(Core/removed/g' $SED_END" # Removed
eval "$SED_START 's/show(Core/removed(/g' $SED_END" # Removed
eval "$SED_START 's/displayStatus/removed/g' $SED_END" # Removed
eval "$SED_START 's/displayMessage/removed/g' $SED_END" # Removed
eval "$SED_START 's/displayWarning/removed/g' $SED_END" # Removed
......@@ -136,6 +139,7 @@ eval "$SED_START 's/notifyReceived(Core lc, Event/onNotifyReceived(Core lc, Even
eval "$SED_START 's/notifyReceived/removed/g' $SED_END" # Removed
#eval "$SED_START 's/ecCalibrationStatus//g' $SED_END"
eval "$SED_START 's/publishStateChanged/onPublishStateChanged/g' $SED_END" # Removed
eval "$SED_START 's/messageReceivedUnableToDecrypted/removed/g' $SED_END" # Removed
eval "$SED_START 's/callStatsUpdated/onCallStatsUpdated/g' $SED_END"
eval "$SED_START 's/authenticationRequested/onAuthenticationRequested/g' $SED_END"
eval "$SED_START 's/newSubscriptionRequest/onNewSubscriptionRequested/g' $SED_END"
......@@ -148,7 +152,6 @@ eval "$SED_START 's/globalState/onGlobalStateChanged/g' $SED_END"
eval "$SED_START 's/registrationState/onRegistrationStateChanged/g' $SED_END"
eval "$SED_START 's/configuringStatus/onConfiguringStatus/g' $SED_END"
eval "$SED_START 's/messageReceived/onMessageReceived/g' $SED_END"
eval "$SED_START 's/messageReceivedUnableToDecrypted//g' $SED_END"
eval "$SED_START 's/callState/onCallStateChanged/g' $SED_END"
eval "$SED_START 's/callEncryptionChanged/onCallEncryptionChanged/g' $SED_END"
eval "$SED_START 's/isComposingReceived/onIsComposingReceived/g' $SED_END"
......@@ -218,11 +221,13 @@ eval "$SED_START 's/lpc.getAddress()/lpc.getIdentityAddress()/g' $SED_END"
eval "$SED_START 's/cfg.getAddress()/cfg.getIdentityAddress()/g' $SED_END"
eval "$SED_START 's/prxCfg.getAddress()/prxCfg.getIdentityAddress()/g' $SED_END"
eval "$SED_START 's/proxy.getAddress()/proxy.getIdentityAddress()/g' $SED_END"
eval "$SED_START 's/getProxyConfig(n).getAddress()/getProxyConfig(n).getIdentityAddress()/g' $SED_END"
#
eval "$SED_START 's/getCallDuration()/getDuration()/g' $SED_END"
eval "$SED_START 's/isVCardSupported()/vcardSupported()/g' $SED_END"
eval "$SED_START 's/getPresenceModelForUri(/getPresenceModelForUriOrTel(/g' $SED_END"
eval "$SED_START 's/setAvpfRRInterval(/setAvpfRrInterval(/g' $SED_END"
eval "$SED_START 's/getAvpfRRInterval(/getAvpfRrInterval(/g' $SED_END"
eval "$SED_START 's/getProxy()/getServerAddr()/g' $SED_END"
eval "$SED_START 's/setProxy(/setServerAddr(/g' $SED_END"
eval "$SED_START 's/setIdentity(/setIdentityAddress(/g' $SED_END"
......@@ -257,7 +262,8 @@ eval "$SED_START 's/migrateCallLogs()/migrateLogsFromRcToDb()/g' $SED_END"
eval "$SED_START 's/setRLSUri/setRlsUri/g' $SED_END"
eval "$SED_START 's/hasCrappyOpenGL(/hasCrappyOpenGl(/g' $SED_END"
eval "$SED_START 's/needsEchoCalibration(/isEchoCancellerCalibrationRequired(/g' $SED_END"
eval "$SED_START 's//getCountryCode()/getCountryCallingCode()/g' $SED_END"
eval "$SED_START 's/getCountryCode()/getCountryCallingCode()/g' $SED_END"
eval "$SED_START 's/isEchoCancellationEnabled()/echoCancellationEnabled()/g' $SED_END"
# Removed methods
eval "$SED_START 's/.isRegistered()/.getState() == RegistrationState.Ok/g' $SED_END"
......@@ -270,10 +276,10 @@ eval "$SED_START 's/getVcardToString()/getVcard().asVcard4String()/g' $SED_END"
eval "$SED_START 's/getVideoAutoInitiatePolicy()/getVideoActivationPolicy().getAutomaticallyInitiate()/g' $SED_END"
eval "$SED_START 's/setFamilyName(/getVcard().setFamilyName(/g' $SED_END"
eval "$SED_START 's/setGivenName(/getVcard().setGivenName(/g' $SED_END"
eval "$SED_START 's/setOrganization(/getVcard().setOrganization(/g' $SED_END"
eval "$SED_START 's/\.setOrganization(/\.getVcard().setOrganization(/g' $SED_END"
eval "$SED_START 's/getFamilyName()/getVcard().getFamilyName()/g' $SED_END"
eval "$SED_START 's/getGivenName()/getVcard().getGivenName()/g' $SED_END"
eval "$SED_START 's/getOrganization()/getVcard().getOrganization()/g' $SED_END"
eval "$SED_START 's/\.getOrganization()/\.getVcard().getOrganization()/g' $SED_END"
eval "$SED_START 's/enableAvpf(/setAvpfMode(AVPFMode.Enabled)/g' $SED_END"
eval "$SED_START 's/transports.udp = /transports.setUdpPort(/g' $SED_END"
eval "$SED_START 's/transports.tcp = /transports.setTcpPort(/g' $SED_END"
......@@ -286,6 +292,8 @@ eval "$SED_START 's/getPrimaryContactDisplayName()/getPrimaryContactParsed().get
eval "$SED_START 's/.sendDtmf(/.getCurrentCall().sendDtmf(/g' $SED_END"
eval "$SED_START 's/content.getData() == null/content.getSize() == 0/'g $SED_END"
eval "$SED_START 's/lc.downloadOpenH264Enabled()/OpenH264DownloadHelper.isOpenH264DownloadEnabled()/g' $SED_END"
eval "$SED_START 's/LinphoneManager.getLc().downloadOpenH264Enabled()/OpenH264DownloadHelper.isOpenH264DownloadEnabled()/g' $SED_END"
eval "$SED_START 's/getLc().enableDownloadOpenH264(/OpenH264DownloadHelper.setOpenH264DownloadEnabled(/g' $SED_END"
eval "$SED_START 's/enableDownloadOpenH264(/OpenH264DownloadHelper.enableDownloadOpenH264(/g' $SED_END"
eval "$SED_START 's/mLc.destroy()/mLc = null/g' $SED_END"
eval "$SED_START 's/getAllDialPlan()/getDialPlans()/g' $SED_END"
......@@ -295,33 +303,68 @@ eval "$SED_START 's/accountCreator.getPrefix(/org.linphone.core.Utils.getPrefixF
eval "$SED_START 's/proxyConfig.lookupCCCFromIso(/org.linphone.core.Utils.getCccFromIso(/g' $SED_END"
eval "$SED_START 's/linkPhoneNumberWithAccount()/linkAccount()/g' $SED_END"
eval "$SED_START 's/zoomVideo(/zoom(/g' $SED_END"
eval "$SED_START 's/mLc.setCpuCount(/\/\/mLc.setCpuCount(/g' $SED_END"
#Changes in library required
#Tunnel
#Core.setCpuCount() => Not needed anymore, can be removed
# TODO
#Tunnel, TunnelConfig
#LinphoneBuffer
#AccountCreator.updatePassword
#AccountCreator.updatePassword => What to do ?
# XmlRpcStatus ! must be XmlRpcRequest.Status
# XmlRpcRequest and XmlRpcSession constructors...
# Factory.createContent(
# Callbacks with return like chat messages' file transfer
# createConfigFromString / createConfig
#
#Android specifics not wrapped automatically
#Core.startEchoCalibration
# For the payloads, get the list from the Core, call the method on the object directly and set it back if required
#Core.enablePayloadType()
#Core.isPayloadTypeEnabled()
#Core.payloadTypeIsVbr()
#Core.setPayloadTypeBitrate()
# Manual changes required
# Some callbacks no longer exist, their name will be "removed", remove them
# Above sed commands will create erros in syntax you need to manually fix:
# # !micEnabled()
# # (getConference() != null)
# # (AVPFMode.Enabled)
# # (port;
# Some methods that used to take or return String or LinphoneAddress now take the other
# createAddress, addAddress, addFriend, acceptCall, acceptCallWithParams no longer throws a CoreException
# AccountCreator's Status.Ok must be renamed in Status.RequestOk
# VideoDevices were int, now are String
# XmlRpcSessionImpl => XmlRpcSession
# getFriendsLists() returned Friend[], now is a FriendList[]
# No need anymore to cast to a Impl class to be able to use setUserData or getUserData
# findFriend now takes an Address instead of a String
# createOpenH264DownloadHelper() now takes a Context
# Factory.createCore(this, mConfigFile, mLinphoneFactoryConfigFile, null, c) => createCore(this, mConfigFile, mLinphoneFactoryConfigFile)
# startEchoTester and stopEchoTester now return void
# createProxyConfig no longer takes any parameter
# setPrimaryContact only takes one String argument
# AdaptiveRateAlgorithm was an enum, now is nothing
# createAddress(userName,domain,null); no longer exists
# # Factory
#Factory.createLpConfigFromString => Config.newFromBuffer
#Factory.createLpConfig => Config.newWithFactory or Core.createConfig
#Core.getVideoDevice and Core.setVideoDevice now takes/returns String instead of int
#Factory.createAccountCreator() => Core.createAccountCreator()
#Factory.createPresenceModel() => Core.createPresenceModel()
#CallParams.getJitterBufferSize() => CallStatsImpl.getJitterBufferSizeMs()
#Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath()); => Core.setLogCollectionPath
#Factory.instance().enableLogCollection(isDebugEnabled); => Core.enableLogCollection
#Factory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name)); => Core.setLogLevelMask
# # Core
#Core.getVideoDevice and Core.setVideoDevice now takes/returns String instead of int
#Core.getSupportedVideoSizes() => Factory.getSupportedVideoDefinitions()
#Core.removeFriend() => FriendList.removeFriend()
#Core.getFriendsLists() => now returns a FriendList[] instead of a Friend[]
#Core.enableSpeaker / isSpeakerEnabled() => mAudioManager.setSpeakerphoneOn(speakerOn);
#Core.enableVideo(true, true) => Core.enableVideoCapture(bool) & Core.enableVideoDisplay(bool)
#Core.setCpuCount() => Not needed anymore, can be removed
#Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath()); => Core.setLogCollectionPath
#Factory.instance().enableLogCollection(isDebugEnabled); => COre.enableLogCollection
#Factory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name)); => Core.setLogLevelMask
# # Other
#CallParams.getJitterBufferSize() => CallStatsImpl.getJitterBufferSizeMs()
# # Payloads
#Core.enablePayloadType() => PayloadType.enable()
#Core.isPayloadTypeEnabled() => PayloadType.enabled()
#Core.payloadTypeIsVbr() => PayloadType.isVbr()
#Core.setPayloadTypeBitrate() => PayloadType.setNormalBitrate()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment