Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linphone
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
7
Issues
7
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
linphone
Commits
3f53d5f0
Commit
3f53d5f0
authored
Nov 28, 2014
by
Sylvain Berfini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked jni layer to be able to set multiple vtables for callbacks in android app
parent
1bb6ebed
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
358 additions
and
246 deletions
+358
-246
linphonecore.c
coreapi/linphonecore.c
+20
-2
linphonecore.h
coreapi/linphonecore.h
+24
-1
linphonecore_jni.cc
coreapi/linphonecore_jni.cc
+313
-243
private.h
coreapi/private.h
+1
-0
No files found.
coreapi/linphonecore.c
View file @
3f53d5f0
...
@@ -7025,16 +7025,34 @@ LinphoneCoreVTable *linphone_core_v_table_new() {
...
@@ -7025,16 +7025,34 @@ LinphoneCoreVTable *linphone_core_v_table_new() {
return
ms_new0
(
LinphoneCoreVTable
,
1
);
return
ms_new0
(
LinphoneCoreVTable
,
1
);
}
}
void
linphone_core_v_table_set_user_data
(
LinphoneCoreVTable
*
table
,
void
*
data
)
{
if
(
table
->
user_data
)
{
ms_free
(
table
->
user_data
);
}
table
->
user_data
=
data
;
}
void
*
linphone_core_v_table_get_user_data
(
LinphoneCoreVTable
*
table
)
{
return
table
->
user_data
;
}
void
linphone_core_v_table_destroy
(
LinphoneCoreVTable
*
table
)
{
void
linphone_core_v_table_destroy
(
LinphoneCoreVTable
*
table
)
{
if
(
table
->
user_data
)
{
ms_free
(
table
->
user_data
);
}
ms_free
(
table
);
ms_free
(
table
);
}
}
LinphoneCoreVTable
*
linphone_core_get_current_vtable
(
LinphoneCore
*
lc
)
{
return
lc
->
current_vtable
;
}
#define NOTIFY_IF_EXIST(function_name) \
#define NOTIFY_IF_EXIST(function_name) \
MSList* iterator; \
MSList* iterator; \
ms_message ("Linphone core [%p] notifying [%s]",lc,#function_name);\
ms_message ("Linphone core [%p] notifying [%s]",lc,#function_name);\
for (iterator=lc->vtables; iterator!=NULL; iterator=iterator->next) \
for (iterator=lc->vtables; iterator!=NULL; iterator=iterator->next) \
if ((
(LinphoneCoreVTable*)(iterator->data
))->function_name)\
if ((
lc->current_vtable=((LinphoneCoreVTable*)(iterator->data)
))->function_name)\
((LinphoneCoreVTable*)(iterator->data))->function_name
((LinphoneCoreVTable*)(iterator->data))->function_name
void
linphone_core_notify_global_state_changed
(
LinphoneCore
*
lc
,
LinphoneGlobalState
gstate
,
const
char
*
message
)
{
void
linphone_core_notify_global_state_changed
(
LinphoneCore
*
lc
,
LinphoneGlobalState
gstate
,
const
char
*
message
)
{
NOTIFY_IF_EXIST
(
global_state_changed
)(
lc
,
gstate
,
message
);
NOTIFY_IF_EXIST
(
global_state_changed
)(
lc
,
gstate
,
message
);
}
}
...
...
coreapi/linphonecore.h
View file @
3f53d5f0
...
@@ -1558,7 +1558,7 @@ typedef enum _LinphoneCoreLogCollectionUploadState {
...
@@ -1558,7 +1558,7 @@ typedef enum _LinphoneCoreLogCollectionUploadState {
* @param gstate the global state
* @param gstate the global state
* @param message informational message.
* @param message informational message.
*/
*/
typedef
void
(
*
LinphoneCoreGlobalStateChangedCb
)(
LinphoneCore
*
lc
,
LinphoneGlobalState
gstate
,
const
char
*
message
);
typedef
void
(
*
LinphoneCoreGlobalStateChangedCb
)(
LinphoneCore
*
lc
,
LinphoneGlobalState
gstate
,
const
char
*
message
);
/**
/**
* Call state notification callback.
* Call state notification callback.
* @param lc the LinphoneCore
* @param lc the LinphoneCore
...
@@ -1809,6 +1809,7 @@ typedef struct _LinphoneCoreVTable{
...
@@ -1809,6 +1809,7 @@ typedef struct _LinphoneCoreVTable{
LinphoneCoreNetworkReachableCb
network_reachable
;
/**< Callback to report IP network status (I.E up/down )*/
LinphoneCoreNetworkReachableCb
network_reachable
;
/**< Callback to report IP network status (I.E up/down )*/
LinphoneCoreLogCollectionUploadStateChangedCb
log_collection_upload_state_changed
;
/**< Callback to upload collected logs */
LinphoneCoreLogCollectionUploadStateChangedCb
log_collection_upload_state_changed
;
/**< Callback to upload collected logs */
LinphoneCoreLogCollectionUploadProgressIndicationCb
log_collection_upload_progress_indication
;
/**< Callback to indicate log collection upload progress */
LinphoneCoreLogCollectionUploadProgressIndicationCb
log_collection_upload_progress_indication
;
/**< Callback to indicate log collection upload progress */
void
*
user_data
;
}
LinphoneCoreVTable
;
}
LinphoneCoreVTable
;
/**
/**
...
@@ -1817,6 +1818,28 @@ typedef struct _LinphoneCoreVTable{
...
@@ -1817,6 +1818,28 @@ typedef struct _LinphoneCoreVTable{
*/
*/
LINPHONE_PUBLIC
LinphoneCoreVTable
*
linphone_core_v_table_new
();
LINPHONE_PUBLIC
LinphoneCoreVTable
*
linphone_core_v_table_new
();
/**
* Sets a user data pointer in the vtable.
* @param table the vtable
* @param data the user data to attach
*/
LINPHONE_PUBLIC
void
linphone_core_v_table_set_user_data
(
LinphoneCoreVTable
*
table
,
void
*
data
);
/**
* Gets a user data pointer in the vtable.
* @param table the vtable
* @returns the data attached to the vtable
*/
LINPHONE_PUBLIC
void
*
linphone_core_v_table_get_user_data
(
LinphoneCoreVTable
*
table
);
/**
* Gets the current VTable.
* This is meant only to be called from a callback to be able to get the user_data associated with the vtable that called the callback.
* @param lc the linphonecore
* @returns the vtable that called the last callback
*/
LINPHONE_PUBLIC
LinphoneCoreVTable
*
linphone_core_get_current_vtable
(
LinphoneCore
*
lc
);
/**
/**
* Destroy a vtable.
* Destroy a vtable.
* @param vtable to be destroyed
* @param vtable to be destroyed
...
...
coreapi/linphonecore_jni.cc
View file @
3f53d5f0
This diff is collapsed.
Click to expand it.
coreapi/private.h
View file @
3f53d5f0
...
@@ -784,6 +784,7 @@ struct _LinphoneCore
...
@@ -784,6 +784,7 @@ struct _LinphoneCore
LinphoneReason
chat_deny_code
;
LinphoneReason
chat_deny_code
;
const
char
**
supported_formats
;
const
char
**
supported_formats
;
LinphoneContent
*
log_collection_upload_information
;
LinphoneContent
*
log_collection_upload_information
;
LinphoneCoreVTable
*
current_vtable
;
// the latest vtable to call a callback, see linphone_core_get_current_vtable
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment