oozerooo / upnpx

Automatically exported from code.google.com/p/upnpx
0 stars 0 forks source link

better BasicUPnPDevice implementation #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
After playing a bit more with upnpx I realized that I had some more needs, 
which required additional refactorings.
For instance I need the childdevices of a device - and if there are additional 
attributes in the device description, I'd also love to retrieve them.
After implementing issue #12 (filters for SSDP discovery) I also realized that 
in its current form upnpx requires to find all services via SSDP. I changed 
that to rely on the service description in the devices descrption as per the 
UPnP spec.

As always attached is a patch file, which includes all my changes.

Some notes from my own commit notes, with some additional info:
------------

reworked BasicUPnPDevice and corresponding parser
- UPnPDevice now contains the childDevices (can also be retrieved by UDN)
- UPnPDevice now contains a dictionary with all attributes (for clients to also 
retrieve custom attributes of devices)
- UPnPDevice now has more consistent fields  
      - uuid removed (as was the same as udn)
      - type removed (as was some arbitrary/strange field, not corresponding to deviceType)
      - smallIcon removed (as image should be downloaded async and if needed at all)
- deleted ServiceFactory - there are no subclasses, so no factory is needed
- when a device is parsed (BasicUPnPParser) its services are parsed along (only 
keys available in the description.xml) directly in the BasicUPnPParser
- services of a device are not dependend on SSDP anymore (as a filter can be 
set and the services aren't recognized via SSDP anyways)
- BasicServiceParser only parses the the service description now
- downloads of device descriptions are reduced, as BasicUPnPParser retrieves 
all information available at once
- retrieving the actual service parameters via BasisServiceParser is still done 
lazy (i.e. when the client actually tries to get a service object)

Original issue reported on code.google.com by bluegasp...@gmail.com on 22 Jul 2012 at 9:15

Attachments: