Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
8891799e
Commit
8891799e
authored
Aug 11, 2017
by
Erwan Croze
👋🏻
Browse files
Fix wrapper for UWP
parent
30cd7658
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
27 deletions
+38
-27
wrappers/csharp/wrapper_impl.mustache
wrappers/csharp/wrapper_impl.mustache
+38
-27
No files found.
wrappers/csharp/wrapper_impl.mustache
View file @
8891799e
...
...
@@ -30,7 +30,7 @@ namespace Linphone
///
<summary>
/// Only contains the LIB_NAME value that represents the library in which all DllImport are made
///
</summary>
public class LinphoneWrapper
public class LinphoneWrapper
{
#if __IOS__
public const string LIB_NAME = "linphone.framework/linphone";
...
...
@@ -86,7 +86,7 @@ namespace Linphone
protected LinphoneException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
#endif
[StructLayout(LayoutKind.Sequential)]
///
<summary>
/// Parent class for a Linphone public objects
...
...
@@ -94,7 +94,7 @@ namespace Linphone
public class LinphoneObject
{
internal IntPtr nativePtr;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void OnLinphoneObjectDataDestroyed(IntPtr data);
...
...
@@ -103,16 +103,16 @@ namespace Linphone
[DllImport(LinphoneWrapper.BELLE_SIP_LIB_NAME)]
static extern IntPtr belle_sip_object_data_get(IntPtr ptr, string name);
[DllImport(LinphoneWrapper.BELLE_SIP_LIB_NAME)]
static extern IntPtr belle_sip_object_ref(IntPtr ptr);
[DllImport(LinphoneWrapper.BELLE_SIP_LIB_NAME)]
static extern void belle_sip_object_unref(IntPtr ptr);
[DllImport(LinphoneWrapper.BELLE_SIP_LIB_NAME)]
static extern IntPtr bctbx_list_next(IntPtr ptr);
[DllImport(LinphoneWrapper.BELLE_SIP_LIB_NAME)]
static extern IntPtr bctbx_list_get_data(IntPtr ptr);
...
...
@@ -134,7 +134,7 @@ namespace Linphone
handle.Free();
}
}
~LinphoneObject()
{
//Console.WriteLine("Destroying " + this.ToString());
...
...
@@ -143,7 +143,7 @@ namespace Linphone
belle_sip_object_unref(nativePtr);
}
}
internal static T fromNativePtr
<T>
(IntPtr ptr, bool takeRef=true) where T : LinphoneObject, new()
{
if (ptr == IntPtr.Zero) return null;
...
...
@@ -184,7 +184,7 @@ namespace Linphone
}
return null;
}
internal static IEnumerable
<string>
MarshalStringArray(IntPtr arrayPtr)
{
if (arrayPtr != IntPtr.Zero)
...
...
@@ -199,7 +199,7 @@ namespace Linphone
}
}
}
internal static IEnumerable
<T>
MarshalBctbxList
<T>
(IntPtr listPtr) where T : LinphoneObject, new()
{
if (listPtr != IntPtr.Zero)
...
...
@@ -239,7 +239,7 @@ namespace Linphone
return bctbx_list;
}
}
#if ANDROID
///
<summary>
/// Methods that are only found in Android version of Linphone libraries and related to JNI
...
...
@@ -251,7 +251,7 @@ namespace Linphone
[DllImport(LinphoneWrapper.LIB_NAME)]
static extern void setMediastreamerAndroidContext(IntPtr jnienv, IntPtr context);
///
<summary>
/// Sets the JVM and JNI pointers in Linphone, required to be able to make JAVA upcalls.
/// Calling this method is mandatory and must be done as soon as possible !
...
...
@@ -264,7 +264,7 @@ namespace Linphone
}
#endif
#endregion
#region Enums
{{#
enums
}}
{{#
enum
}}
...
...
@@ -284,11 +284,11 @@ namespace Linphone
{{
name
}}
=
{{
value
}}
,
{{/
values
}}
}
{{/
enum
}}
{{/
enums
}}
#endregion
#region Listeners
{{#
interfaces
}}
{{#
interface
}}
...
...
@@ -298,14 +298,19 @@ namespace Linphone
{{#
methods
}}
[DllImport(LinphoneWrapper.LIB_NAME)]
{{#
cb_setter
}}
#if WINDOWS_UWP
static extern void
{{
name
}}
(IntPtr thiz, IntPtr cb);
#else
static extern void
{{
name
}}
(IntPtr thiz,
{{
name_private
}}
cb);
#endif
{{/
cb_setter
}}
{{#
delegate
}}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void
{{
name_private
}}
(
{{
params_private
}}
);
public delegate void
{{
name_public
}}
(
{{
params_public
}}
);
private
{{
name_private
}}
{{
var_private
}}
;
private
{{
name_public
}}
{{
var_public
}}
;
#if __IOS__
...
...
@@ -328,17 +333,23 @@ namespace Linphone
set
{
{{
var_public
}}
= value;
#if WINDOWS_UWP
{{
var_private
}}
=
{{
cb_name
}}
;
IntPtr cb = Marshal.GetFunctionPointerForDelegate(
{{
var_private
}}
);
{{
c_name_setter
}}
(nativePtr, cb);
#else
{{
c_name_setter
}}
(nativePtr,
{{
cb_name
}}
);
#endif
}
}
{{/
delegate
}}
{{/
delegate
}}
{{/
methods
}}
}
{{/
interface
}}
{{/
interfaces
}}
#endregion
#region Classes
{{#
classes
}}
{{#
_class
}}
...
...
@@ -353,21 +364,21 @@ namespace Linphone
{{#
isLinphoneFactory
}}
[DllImport(LinphoneWrapper.LIB_NAME)]
static extern IntPtr linphone_factory_create_core_cbs(IntPtr factory);
public CoreListener CreateCoreListener()
{
IntPtr coreCbsPtr = linphone_factory_create_core_cbs(nativePtr);
return fromNativePtr
<CoreListener>
(coreCbsPtr, false);
}
{{/
isLinphoneFactory
}}
{{#
dllImports
}}
{{/
isLinphoneFactory
}}
{{#
dllImports
}}
[DllImport(LinphoneWrapper.LIB_NAME)]
{{{
prototype
}}}
{{#
has_second_prototype
}}
[DllImport(LinphoneWrapper.LIB_NAME)]
{{
second_prototype
}}
{{/
has_second_prototype
}}
{{#
has_property
}}
{{#
doc
}}
{{#
lines
}}
...
...
@@ -478,7 +489,7 @@ namespace Linphone
{{/
has_impl
}}
{{/
dllImports
}}
}
{{/
_class
}}
{{/
_class
}}
{{/
classes
}}
#endregion
}
\ No newline at end of file
}
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