forked from mirrors/linphone-iphone
142 lines
No EOL
3.7 KiB
Text
142 lines
No EOL
3.7 KiB
Text
/*
|
|
{{className}}.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
package {{packageName}};
|
|
|
|
{{#imports}}
|
|
import {{import}}
|
|
{{/imports}}
|
|
{{#isLinphoneFactory}}
|
|
import org.linphone.mediastream.Version;
|
|
{{/isLinphoneFactory}}
|
|
|
|
{{#doc}}
|
|
/**
|
|
{{#lines}}
|
|
* {{line}}
|
|
{{/lines}}
|
|
*/
|
|
{{/doc}}
|
|
public interface {{className}} {
|
|
{{#enums}}
|
|
enum {{className}} {
|
|
{{#values}}
|
|
{{#doc}}
|
|
/**
|
|
{{#lines}}
|
|
* {{line}}
|
|
{{/lines}}
|
|
*/
|
|
{{/doc}}
|
|
{{name}}({{value}}){{commarorsemicolon}}
|
|
|
|
{{/values}}
|
|
protected final int mValue;
|
|
|
|
private {{className}} (int value) {
|
|
mValue = value;
|
|
}
|
|
|
|
static public {{className}} fromInt(int value) throws CoreException {
|
|
switch(value) {
|
|
{{#values}}
|
|
case {{value}}: return {{name}};
|
|
{{/values}}
|
|
default:
|
|
throw new CoreException("Unhandled enum value " + value + " for {{className}}");
|
|
}
|
|
}
|
|
|
|
public int toInt() {
|
|
return mValue;
|
|
}
|
|
};
|
|
|
|
{{/enums}}
|
|
{{#isLinphoneFactory}}
|
|
|
|
{{/isLinphoneFactory}}
|
|
{{#methods}}
|
|
{{#doc}}
|
|
/**
|
|
{{#lines}}
|
|
* {{line}}
|
|
{{/lines}}
|
|
*/
|
|
{{/doc}}
|
|
{{#deprecated}}@Deprecated
|
|
{{/deprecated}}public {{return}} {{name}}({{params}}){{#exception}} throws CoreException{{/exception}};
|
|
|
|
{{/methods}}
|
|
|
|
{{#staticMethods}}
|
|
{{#doc}}
|
|
/**
|
|
{{#lines}}
|
|
* {{line}}
|
|
{{/lines}}
|
|
*/
|
|
{{/doc}}
|
|
public {{return}} {{name}}({{params}}){{#exception}} throws CoreException{{/exception}};
|
|
|
|
{{/staticMethods}}
|
|
}
|
|
|
|
class {{classImplName}} implements {{className}} {
|
|
|
|
protected long nativePtr = 0;
|
|
|
|
{{#isLinphoneFactory}}
|
|
private static boolean loadOptionalLibrary(String s) {
|
|
try {
|
|
System.loadLibrary(s);
|
|
return true;
|
|
} catch (Throwable e) {
|
|
android.util.Log.w("LinphoneCoreFactoryImpl", "Unable to load optional library " + s + ": " +e.getMessage());
|
|
}
|
|
return false;
|
|
}
|
|
|
|
static {
|
|
System.loadLibrary("gnustl_shared");
|
|
loadOptionalLibrary("ffmpeg-linphone");
|
|
System.loadLibrary("bctoolbox");
|
|
System.loadLibrary("ortp");
|
|
System.loadLibrary("mediastreamer_base");
|
|
System.loadLibrary("mediastreamer_voip");
|
|
System.loadLibrary("linphone");
|
|
Version.dumpCapabilities();
|
|
}
|
|
{{/isLinphoneFactory}}
|
|
|
|
{{#methods}}
|
|
private native {{return_native}} {{name}}({{native_params}});
|
|
public {{return}} {{name}}({{params}}) {{#exception}}throws CoreException{{/exception}} {
|
|
{{#exception}}int exceptionResult = {{/exception}}{{return_keyword}}{{#enumCast}}{{return}}.fromInt({{/enumCast}}{{#classCast}}({{return}}){{/classCast}}{{name}}(nativePtr{{native_params_impl}}){{#enumCast}}){{/enumCast}};
|
|
{{#exception}}if (exceptionResult != 0) throw new CoreException("{{name}} returned value " + exceptionResult){{/exception}}
|
|
}
|
|
|
|
{{/methods}}
|
|
|
|
{{#staticMethods}}
|
|
@Override
|
|
public native {{return_native}} {{name}}({{static_native_params}});
|
|
|
|
{{/staticMethods}}
|
|
} |