Problems with UPnPSmartControlPoint

Problems with UPnPSmartControlPoint

I am evaluating the UPnP API and have written a small console app to test it. I am using the UPnPSmartControlPoint object and have added a device handler to receive acknowlegements from the network devices. My handler subroutine fires as expected for each device it finds but the device is not added to the control points device collection. What am I doing wrong? The following is my code. Thanks for any responses.

Imports Intel.UPNP

Module Module1

Dim cp As New UPnPSmartControlPoint

Sub Main()

AddHandler cp.OnAddedDevice, AddressOf doit

cp.Rescan()

System.Threading.Thread.Sleep(5000)

End Sub

Sub doit(ByVal sender As Intel.UPNP.UPnPSmartControlPoint, ByVal device As Intel.UPNP.UPnPDevice)

End Sub

End Module

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

I noticed that the other overloads of the constructor for the UPnPSmartControlPoint object, uses the "DevicePartialMatchFilter" parameter. I also just noticed that the overload that only takes the OnAdded delegate calls the constructor that takes a delegate, and the DevicePartialMatchFilter, and passes in "upnp:rootdevice".

You can rectify the problem, by using that contructor instead of the default constructor. I can have this fixed in the next release of the tools.

As a side note, you should be using the contructor that takes in delegates as parameters, because otherwise you will miss callbacks between the time you construct the object, and when you set the callbacks later. I see you worked around that by calling rescan(), but that is just making the callbacks take longer then they need to.

If you do choose to use those contructors, then you can use "upnp:rootdevice" as the filter, if you are interested in all devices.

Leave a Comment

Please sign in to add a comment. Not a member? Join today