The UPnP control point:
Media Server Interface
The selected NAS is added, once discovered, with the setNAS method. For this CP, only media server with UPnP class "urn:schemas-upnp-org:device:MediaServer:1" are accepted as valid. The srcCPHandler class structure is shown in the diagram below:
srcCPHandler |
---|
-NAS_fn: string |
+«constructor» srcCPHandler() +getNASFriendlyName(): string +setNASFriendlyName() +makeContentDirectoryV1Request(A:Action*,args:vector‹string›): ArgumentList* +browseNodeByNum(act:Action*,al:ArgumentList*,folderId:string&, childNum:string&,i:unsigned=0) +stepIntoFolder(act:Action*,al:ArgumentList*,xmls:string&, folderId:string&,childNum:string&,i:unsigned=0) +getXMLNChildAttribute(p:Parser*,xmls:string&, name:string&,cn:unsigned=0): string +getXMLNSubChildAttribute(n:Node*,name:string&, cn:unsigned=0,isResUrl:bool): string |
With these set of methods, once the NAS subscription is done, the CP can use the ContentDirectory service in order to navigate the NAS folder tree. The navigation is performed by entering in each subfolder of the main "audio" content folder until the bottom of the folders structure is reached. After this navigation, the CP scans the whole file list, essentially by parsing the xml response of the request, and for each subtag (audio file descriptor) reads and saves the ID3 infos (metadata). The data are stored in a private structure on the MyCtrlPoint element, that is a bidimensional array of strings. This sequence of operations has to be repeated each time the NAS changes during the CP execution.