mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 16:49:20 +00:00
Finished removeCallbacks in JNI layer for Java wrapper for multi listenable classes
This commit is contained in:
parent
6310bfb10b
commit
ff688cd975
5 changed files with 42 additions and 3 deletions
|
|
@ -332,6 +332,16 @@ void linphone_core_remove_listener(LinphoneCore *lc, const LinphoneCoreVTable *v
|
|||
}
|
||||
}
|
||||
|
||||
bctbx_list_t *linphone_core_get_callbacks(const LinphoneCore *lc) {
|
||||
bctbx_list_t *result;
|
||||
bctbx_list_t *it;
|
||||
for(it=lc->vtable_refs; it!=NULL; it=it->next){
|
||||
VTableReference *ref=(VTableReference*)it->data;
|
||||
result = bctbx_list_append(result, ref->cbs);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void linphone_core_remove_callbacks(LinphoneCore *lc, const LinphoneCoreCbs *cbs) {
|
||||
bctbx_list_t *it;
|
||||
ms_message("Callbacks [%p] unregistered on core [%p]",cbs,lc);
|
||||
|
|
|
|||
|
|
@ -756,6 +756,13 @@ LINPHONE_PUBLIC void linphone_call_add_callbacks(LinphoneCall *call, LinphoneCal
|
|||
*/
|
||||
LINPHONE_PUBLIC void linphone_call_remove_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs);
|
||||
|
||||
/**
|
||||
* Gets the list of listener in the call
|
||||
* @param[in] call LinphoneCall object
|
||||
* @return the list of LinphoneCallCbs
|
||||
*/
|
||||
LINPHONE_PUBLIC const bctbx_list_t *linphone_call_get_callbacks(const LinphoneCall *call);
|
||||
|
||||
/**
|
||||
* Gets the current LinphoneCallCbs.
|
||||
* This is meant only to be called from a callback to be able to get the user_data associated with the LinphoneCallCbs that is calling the callback.
|
||||
|
|
|
|||
|
|
@ -975,6 +975,14 @@ LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_remove_listener(LinphoneC
|
|||
*/
|
||||
LINPHONE_PUBLIC void linphone_core_remove_callbacks(LinphoneCore *lc, const LinphoneCoreCbs *cbs);
|
||||
|
||||
/**
|
||||
* @ingroup initializing
|
||||
* Gets the list of listener in the core
|
||||
* @param lc The #LinphoneCore
|
||||
* @return the list of LinphoneCoreCbs
|
||||
*/
|
||||
LINPHONE_PUBLIC bctbx_list_t *linphone_core_get_callbacks(const LinphoneCore *lc);
|
||||
|
||||
/**
|
||||
* Sets the user agent string used in SIP messages, ideally called just after linphone_core_new() or linphone_core_init().
|
||||
* @param[in] lc LinphoneCore object
|
||||
|
|
|
|||
|
|
@ -1097,6 +1097,10 @@ LinphoneCallCbs *linphone_call_get_current_callbacks (const LinphoneCall *call)
|
|||
return call->currentCbs;
|
||||
}
|
||||
|
||||
const bctbx_list_t *linphone_call_get_callbacks(const LinphoneCall *call) {
|
||||
return call->callbacks;
|
||||
}
|
||||
|
||||
void linphone_call_set_params (LinphoneCall *call, const LinphoneCallParams *params) {
|
||||
#if 0
|
||||
if ( call->state == LinphoneCallOutgoingInit || call->state == LinphoneCallIncomingReceived){
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ void {{jniPackage}}{{classCName}}Impl_addListener(JNIEnv* env, jobject thiz, jlo
|
|||
{{classCName}} *cptr = ({{classCName}}*)ptr;
|
||||
jobject listener = env->NewGlobalRef(jlistener);
|
||||
{{#isSingleListener}}
|
||||
{{classCName}}Cbs *cbs = {{cPrefix}}_get_callbacks(request);
|
||||
{{classCName}}Cbs *cbs = {{cPrefix}}_get_callbacks(cptr);
|
||||
{{/isSingleListener}}
|
||||
{{#isMultiListener}}
|
||||
{{classCName}}Cbs *cbs = linphone_factory_create_{{factoryName}}_cbs(NULL);
|
||||
|
|
@ -233,13 +233,23 @@ void {{jniPackage}}{{classCName}}Impl_addListener(JNIEnv* env, jobject thiz, jlo
|
|||
{{#callbacksList}}
|
||||
{{cPrefix}}_cbs_set_{{callback}}(cbs, {{callbackName}});
|
||||
{{/callbacksList}}
|
||||
{{#isMultiListener}}
|
||||
{{cPrefix}}_add_callbacks(cptr, cbs);
|
||||
{{/isMultiListener}}
|
||||
}
|
||||
{{#isMultiListener}}
|
||||
|
||||
void {{jniPackage}}{{classCName}}Impl_removeListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
{{classCName}} *cptr = ({{classCName}}*)ptr;
|
||||
//TODO
|
||||
{{cPrefix}}_remove_callbacks(ptr, );
|
||||
const bctbx_list_t *cbs_list = {{cPrefix}}_get_callbacks(cptr);
|
||||
bctbx_list_t *it;
|
||||
for (it = cbs_list; it != NULL; it = it->next) {
|
||||
{{classCName}}Cbs *cbs = ({{classCName}}Cbs *)it->data;
|
||||
if ({{cPrefix}}_cbs_get_user_data(cbs) == jlistener) {
|
||||
{{cPrefix}}_remove_callbacks(cptr, cbs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/isMultiListener}}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue