/** * Constructor for SessionPortListener. */ public SessionPortListener() { _acceptSessionJoiner = new InternalAcceptSessionJoiner(this._AcceptSessionJoiner); _sessionJoined = new InternalSessionJoined(this._SessionJoined); callbacks.acceptSessionJoiner = Marshal.GetFunctionPointerForDelegate(_acceptSessionJoiner); callbacks.sessionJoined = Marshal.GetFunctionPointerForDelegate(_sessionJoined); main = GCHandle.Alloc(callbacks, GCHandleType.Pinned); _sessionPortListener = alljoyn_sessionportlistener_create(main.AddrOfPinnedObject(), IntPtr.Zero); }
public SessionPortListener() { _acceptSessionJoiner = new InternalAcceptSessionJoiner(_AcceptSessionJoiner); _sessionJoined = new InternalSessionJoined(_SessionJoined); #if UNITY_ANDROID _sessionPortListener = alljoyn_unitysessionportlistener_create(this, _acceptSessionJoiner, _sessionJoined); #else SessionPortListenerCallbacks callbacks; callbacks.acceptSessionJoiner = Marshal.GetFunctionPointerForDelegate(_acceptSessionJoiner); callbacks.sessionJoined = Marshal.GetFunctionPointerForDelegate(_sessionJoined); GCHandle gch = GCHandle.Alloc(callbacks, GCHandleType.Pinned); _sessionPortListener = alljoyn_sessionportlistener_create(gch.AddrOfPinnedObject(), IntPtr.Zero); gch.Free(); #endif }