forked from mirrors/linphone-iphone
Various fixes for JNI layer of Java wrapper
This commit is contained in:
parent
61652e08a8
commit
12e1ccfe58
3 changed files with 78 additions and 12 deletions
|
|
@ -494,9 +494,10 @@ class JavaTranslator(object):
|
|||
methodDict['isJniUpcallObject'] = True
|
||||
methodDict['jniUpcallType'] = 'jobject'
|
||||
elif type(_method.returnType) is AbsApi.BaseType:
|
||||
methodDict['jniUpcallMethod'] = 'CallIntMethod'
|
||||
methodDict['jniUpcallType'] = self.translate_type(_method.returnType, jni=True)
|
||||
methodDict['isJniUpcallBasicType'] = True
|
||||
if not _method.returnType.name == 'void':
|
||||
methodDict['jniUpcallMethod'] = 'CallIntMethod'
|
||||
methodDict['jniUpcallType'] = self.translate_type(_method.returnType, jni=True)
|
||||
methodDict['isJniUpcallBasicType'] = True
|
||||
methodDict['returnIfFail'] = '' if methodDict['return'] == 'void' else ' NULL'
|
||||
methodDict['hasReturn'] = not methodDict['return'] == 'void'
|
||||
methodDict['isSingleListener'] = not _class.multilistener
|
||||
|
|
@ -761,7 +762,11 @@ class GenWrapper(object):
|
|||
|
||||
self.parser = AbsApi.CParser(project)
|
||||
self.parser.functionBl = \
|
||||
['linphone_vcard_get_belcard',\
|
||||
['linphone_factory_create_core_with_config',\
|
||||
'linphone_factory_create_core',\
|
||||
'linphone_factory_create_core_2',\
|
||||
'linphone_factory_create_core_with_config_2',\
|
||||
'linphone_vcard_get_belcard',\
|
||||
'linphone_core_get_current_vtable',\
|
||||
'linphone_factory_get',\
|
||||
'linphone_factory_clean',\
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ public {{#isLinphoneFactory}}abstract class{{/isLinphoneFactory}}{{#isNotLinphon
|
|||
abstract public OpenH264DownloadHelper createOpenH264DownloadHelper(Context context);
|
||||
|
||||
abstract public void setDebugMode(boolean enable, String tag);
|
||||
|
||||
abstract public Core createCore(CoreListener listener, String configPath, String factoryConfigPath);
|
||||
|
||||
{{/isLinphoneFactory}}
|
||||
{{#isLinphoneCore}}
|
||||
/**
|
||||
|
|
@ -167,6 +170,12 @@ class {{classImplName}} {{#isLinphoneFactory}}extends{{/isLinphoneFactory}}{{#is
|
|||
|
||||
@Override
|
||||
public native void setDebugMode(boolean enable, String tag);
|
||||
|
||||
private native Core createCore(long nativePtr, CoreListener listener, String configPath, String factoryConfigPath);
|
||||
@Override
|
||||
public Core createCore(CoreListener listener, String configPath, String factoryConfigPath) {
|
||||
return createCore(nativePtr, listener, configPath, factoryConfigPath);
|
||||
}
|
||||
{{/isLinphoneFactory}}
|
||||
|
||||
{{#methods}}
|
||||
|
|
|
|||
|
|
@ -181,6 +181,9 @@ public:
|
|||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
{{#objects}}
|
||||
jobject get{{className}}(JNIEnv *env, {{classCName}} *cptr) {
|
||||
|
|
@ -306,16 +309,12 @@ static {{return}} {{callbackName}}({{params}}) {
|
|||
{{/callbacks}}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
{{#interfaces}}
|
||||
{{#isSingleListener}}
|
||||
void {{jniPackage}}{{className}}Impl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
void Java_{{jniPackage}}{{className}}Impl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
{{/isSingleListener}}
|
||||
{{#isMultiListener}}
|
||||
void {{jniPackage}}{{className}}Impl_addListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
void Java_{{jniPackage}}{{className}}Impl_addListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
{{/isMultiListener}}
|
||||
{{classCName}} *cptr = ({{classCName}}*)ptr;
|
||||
jobject listener = env->NewGlobalRef(jlistener);
|
||||
|
|
@ -335,7 +334,7 @@ void {{jniPackage}}{{className}}Impl_addListener(JNIEnv* env, jobject thiz, jlon
|
|||
}
|
||||
{{#isMultiListener}}
|
||||
|
||||
void {{jniPackage}}{{className}}Impl_removeListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
void Java_{{jniPackage}}{{className}}Impl_removeListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
{{classCName}} *cptr = ({{classCName}}*)ptr;
|
||||
const bctbx_list_t *cbs_list = {{cPrefix}}_get_callbacks_list(cptr);
|
||||
bctbx_list_t *it;
|
||||
|
|
@ -352,12 +351,65 @@ void {{jniPackage}}{{className}}Impl_removeListener(JNIEnv* env, jobject thiz, j
|
|||
{{/interfaces}}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
jobject {{jni_package}}CoreImpl_getMediastreamerFactory(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
jobject Java_{{jni_package}}CoreImpl_getMediastreamerFactory(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_factory_get_user_data(linphone_factory_get());
|
||||
MSFactory *factory = linphone_core_get_ms_factory((LinphoneCore*)ptr);
|
||||
return env->NewObject(ljb->ms_factory_class, ljb->ms_factory_class_constructor, (jlong)factory);
|
||||
}
|
||||
|
||||
jobject Java_{{jni_package}}FactoryImpl_createCore(JNIEnv *env, jobject thiz, jlong ptr, jobject jlistener, jstring jconfig_path, jstring jfactory_config_path) {
|
||||
LinphoneFactory *cptr = (LinphoneFactory*)ptr;
|
||||
|
||||
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(cptr);
|
||||
jobject listener = env->NewGlobalRef(jlistener);
|
||||
|
||||
const char *config_path = GetStringUTFChars(env, jconfig_path);
|
||||
const char *factory_config_path = GetStringUTFChars(env, jfactory_config_path);
|
||||
LinphoneCore *core = NULL;
|
||||
|
||||
linphone_core_cbs_set_user_data(cbs, listener);
|
||||
linphone_core_cbs_set_transfer_state_changed(cbs, linphone_core_on_transfer_state_changed);
|
||||
linphone_core_cbs_set_chat_room_instantiated(cbs, linphone_core_on_chat_room_instantiated);
|
||||
linphone_core_cbs_set_friend_list_created(cbs, linphone_core_on_friend_list_created);
|
||||
linphone_core_cbs_set_subscription_state_changed(cbs, linphone_core_on_subscription_state_changed);
|
||||
linphone_core_cbs_set_call_log_updated(cbs, linphone_core_on_call_log_updated);
|
||||
linphone_core_cbs_set_call_state_changed(cbs, linphone_core_on_call_state_changed);
|
||||
linphone_core_cbs_set_authentication_requested(cbs, linphone_core_on_authentication_requested);
|
||||
linphone_core_cbs_set_notify_presence_received_for_uri_or_tel(cbs, linphone_core_on_notify_presence_received_for_uri_or_tel);
|
||||
linphone_core_cbs_set_buddy_info_updated(cbs, linphone_core_on_buddy_info_updated);
|
||||
linphone_core_cbs_set_network_reachable(cbs, linphone_core_on_network_reachable);
|
||||
linphone_core_cbs_set_notify_received(cbs, linphone_core_on_notify_received);
|
||||
linphone_core_cbs_set_new_subscription_requested(cbs, linphone_core_on_new_subscription_requested);
|
||||
linphone_core_cbs_set_registration_state_changed(cbs, linphone_core_on_registration_state_changed);
|
||||
linphone_core_cbs_set_notify_presence_received(cbs, linphone_core_on_notify_presence_received);
|
||||
linphone_core_cbs_set_ec_calibration_audio_init(cbs, linphone_core_on_ec_calibration_audio_init);
|
||||
linphone_core_cbs_set_message_received(cbs, linphone_core_on_message_received);
|
||||
linphone_core_cbs_set_ec_calibration_result(cbs, linphone_core_on_ec_calibration_result);
|
||||
linphone_core_cbs_set_info_received(cbs, linphone_core_on_info_received);
|
||||
linphone_core_cbs_set_call_stats_updated(cbs, linphone_core_on_call_stats_updated);
|
||||
linphone_core_cbs_set_friend_list_removed(cbs, linphone_core_on_friend_list_removed);
|
||||
linphone_core_cbs_set_refer_received(cbs, linphone_core_on_refer_received);
|
||||
linphone_core_cbs_set_configuring_status(cbs, linphone_core_on_configuring_status);
|
||||
linphone_core_cbs_set_call_created(cbs, linphone_core_on_call_created);
|
||||
linphone_core_cbs_set_publish_state_changed(cbs, linphone_core_on_publish_state_changed);
|
||||
linphone_core_cbs_set_call_encryption_changed(cbs, linphone_core_on_call_encryption_changed);
|
||||
linphone_core_cbs_set_is_composing_received(cbs, linphone_core_on_is_composing_received);
|
||||
linphone_core_cbs_set_message_received_unable_decrypt(cbs, linphone_core_on_message_received_unable_decrypt);
|
||||
linphone_core_cbs_set_log_collection_upload_progress_indication(cbs, linphone_core_on_log_collection_upload_progress_indication);
|
||||
linphone_core_cbs_set_version_update_check_result_received(cbs, linphone_core_on_version_update_check_result_received);
|
||||
linphone_core_cbs_set_ec_calibration_audio_uninit(cbs, linphone_core_on_ec_calibration_audio_uninit);
|
||||
linphone_core_cbs_set_global_state_changed(cbs, linphone_core_on_global_state_changed);
|
||||
linphone_core_cbs_set_log_collection_upload_state_changed(cbs, linphone_core_on_log_collection_upload_state_changed);
|
||||
linphone_core_cbs_set_dtmf_received(cbs, linphone_core_on_dtmf_received);
|
||||
|
||||
core = linphone_factory_create_core(linphone_factory_get(), cbs, config_path, factory_config_path);
|
||||
|
||||
ReleaseStringUTFChars(env, jconfig_path, config_path);
|
||||
ReleaseStringUTFChars(env, jfactory_config_path, factory_config_path);
|
||||
|
||||
return getCore(env, core);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
{{#methods}}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue