Software Archive
Read-only legacy content
17061 Discussions

Problems with UPnPSmartControlPoint

crashingsucks
Beginner
375 Views

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

0 Kudos
1 Reply
BRYAN_R_Intel
Employee
375 Views

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.

0 Kudos
Reply