/// <summary> /// Constructor. Creates a device capable of serving UI files and of operating on any of the /// protocols the device stack supports as standard but with no services or attributes as yet /// </summary> /// <param name="aUdn">Universally unique identifier. The caller is responsible for calculating/assigning this</param> /// <param name="aResourceManager">Allows the owner of a device to serve UI files</param> public unsafe DvDeviceStandard(string aUdn, IResourceManager aResourceManager) { iResourceManager = aResourceManager; iGch = GCHandle.Alloc(this); IntPtr ptr = GCHandle.ToIntPtr(iGch); IntPtr udn = InteropUtils.StringToHGlobalUtf8(aUdn); iCallbackResourceManager = new CallbackResourceManager(WriteResource); iHandle = DvDeviceStandardCreate(udn, iCallbackResourceManager, ptr); Marshal.FreeHGlobal(udn); }
/// <summary> /// Constructor. Creates a device capable of serving UI files and of operating on any of the /// protocols the device stack supports as standard but with no services or attributes as yet /// </summary> /// <param name="aUdn">Universally unique identifier. The caller is responsible for calculating/assigning this</param> /// <param name="aResourceManager">Allows the owner of a device to serve UI files</param> public DvDeviceStandard(string aUdn, IResourceManager aResourceManager) { iResourceManager = aResourceManager; iGch = GCHandle.Alloc(this); IntPtr ptr = GCHandle.ToIntPtr(iGch); IntPtr udn = InteropUtils.StringToHGlobalUtf8(aUdn); iCallbackResourceManager = new CallbackResourceManager(WriteResource); iHandle = DvDeviceStandardCreate(udn, iCallbackResourceManager, ptr); Marshal.FreeHGlobal(udn); }
static extern IntPtr DvDeviceStandardCreate(IntPtr aUdn, CallbackResourceManager aResourceManager, IntPtr aPtr);
static extern unsafe uint DvDeviceCreate(char *aUdn, CallbackResourceManager aResourceManager, IntPtr aPtr);
static unsafe extern IntPtr DvDeviceStandardCreate(char* aUdn, CallbackResourceManager aResourceManager, IntPtr aPtr);
/// <summary> /// Constructor. Creates a device capable of serving UI files and of operating on any of the /// protocols the device stack supports as standard but with no services or attributes as yet /// </summary> /// <param name="aUdn">Universally unique identifier. The caller is responsible for calculating/assigning this</param> /// <param name="aResourceManager">Allows the owner of a device to serve UI files</param> public unsafe DvDeviceStandard(string aUdn, IResourceManager aResourceManager) { iResourceManager = aResourceManager; iGch = GCHandle.Alloc(this); IntPtr ptr = GCHandle.ToIntPtr(iGch); char* udn = (char*)Marshal.StringToHGlobalAnsi(aUdn).ToPointer(); iCallbackResourceManager = new CallbackResourceManager(WriteResource); iHandle = DvDeviceStandardCreate(udn, iCallbackResourceManager, ptr); Marshal.FreeHGlobal((IntPtr)udn); }