/** * %BusObject constructor. * * @param path Object path for object. * @param isPlaceholder Place-holder objects are created by the bus itself and serve only * as parent objects (in the object path sense) to other objects. */ public BusObject(string path, bool isPlaceholder) { // Can't let the GC free these delegates so they must be members _propertyGet = new InternalPropertyGetEventHandler(this._PropertyGet); _propertySet = new InternalPropertySetEventHandler(this._PropertySet); _objectRegistered = new InternalObjectRegisteredEventHandler(this._ObjectRegistered); _objectUnregistered = new InternalObjectUnregisteredEventHandler(this._ObjectUnregistered); // Ref holder for method handler internal delegates _methodHandlerDelegateRefHolder = new List <InternalMethodHandler>(); callbacks.property_get = Marshal.GetFunctionPointerForDelegate(_propertyGet); callbacks.property_set = Marshal.GetFunctionPointerForDelegate(_propertySet); callbacks.object_registered = Marshal.GetFunctionPointerForDelegate(_objectRegistered); callbacks.object_unregistered = Marshal.GetFunctionPointerForDelegate(_objectUnregistered); main = GCHandle.Alloc(callbacks, GCHandleType.Pinned); _busObject = alljoyn_busobject_create(path, isPlaceholder ? 1 : 0, main.AddrOfPinnedObject(), IntPtr.Zero); }
/** * %BusObject constructor. * * @param path Object path for object. * @param isPlaceholder Place-holder objects are created by the bus itself and serve only * as parent objects (in the object path sense) to other objects. */ public BusObject(string path, bool isPlaceholder) { // Can't let the GC free these delegates so they must be members _propertyGet = new InternalPropertyGetEventHandler(this._PropertyGet); _propertySet = new InternalPropertySetEventHandler(this._PropertySet); _objectRegistered = new InternalObjectRegisteredEventHandler(this._ObjectRegistered); _objectUnregistered = new InternalObjectUnregisteredEventHandler(this._ObjectUnregistered); // Ref holder for method handler internal delegates _methodHandlerDelegateRefHolder = new List<InternalMethodHandler>(); callbacks.property_get = Marshal.GetFunctionPointerForDelegate(_propertyGet); callbacks.property_set = Marshal.GetFunctionPointerForDelegate(_propertySet); callbacks.object_registered = Marshal.GetFunctionPointerForDelegate(_objectRegistered); callbacks.object_unregistered = Marshal.GetFunctionPointerForDelegate(_objectUnregistered); main = GCHandle.Alloc(callbacks, GCHandleType.Pinned); _busObject = alljoyn_busobject_create(path, isPlaceholder ? 1 : 0, main.AddrOfPinnedObject(), IntPtr.Zero); }