PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 24 → WD - Código para ler a raiz de um dispositivo UPnP
WD - Código para ler a raiz de um dispositivo UPnP
Iniciado por BOLLER ADRIANO, ago., 04 2016 8:22 AM - Sem resposta
Membro registado
2.949 mensagems
Popularité : +89 (91 votes)
Publicado em agosto, 04 2016 - 8:22 AM
Prezados,

Segue código para ler a raiz de um dispositivo UPnP
deve usar o serviço: urn: schemas-upnp-org: serviço: ContentDirectory: 1
(assim certifique-se antes se o dispositivo tem este serviço ...)
que a seguinte documentação: http://upnp.org/specs/av/UPnP-av-ContentDirectory-v1-Service.pdf

//Example UPnP
_tab_upnp_periph est un tableau de upnpPériphérique
_tab_upnp_periph = UPNPListePériphérique("upnp:rootdevice",51300)
SI ErreurDétectée ALORS
Info(ErreurInfo(errComplet))
SINON
POUR TOUT _upnp_periph DE _tab_upnp_periph
Trace(_upnp_periph.Nom)
Trace(_upnp_periph.NomUnique)

POUR TOUT _service DE _upnp_periph.Service
Trace("Service type : "+_service.Type)
Trace("Service URL Control : "+_service.URLContrôle)

SI _service.Type="urn:schemas-upnp-org:service:ContentDirectory:1" ALORS
_browse_result est un tableau de chaîne=UPNPExecuteAction(_service,"Browse",0,"BrowseDirectChildren","*",0,0,"")
SI PAS ErreurDétectée ALORS
Trace("Browse Result : ")
POUR TOUT _result DE _browse_result
Trace(_result)
FIN
FIN
FIN
FIN
FIN
FIN



O primeiro parâmetro é a identificação do objeto, 0 = root.
Você vai ter uma seqüência de caracteres XML, todas as informações ....
vai demorar contra descascando o doc !!! Um resultado da amostra Recebo conectando a um servidor Universal Media:

<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"><container id="302" childCount="1" parentID="0" restricted="true"><dc:title>Joué récemment</dc:title><upnp:albumArtURI xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" dlna:profileID="PNG_TN">http://192.168.254.99:5001/get/302/thumbnail0000Jou%C3%A9+r%C3%A9cemment</upnp:albumArtURI><upnp:albumArtURI xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" dlna:profileID="PNG_TN">http://192.168.254.99:5001/get/302/thumbnail0000Jou%C3%A9+r%C3%A9cemment</upnp:albumArtURI><upnp:class>object.container.storageFolder</upnp:class></container><container id="303" childCount="1" parentID="0" restricted="true"><dc:title>Nouveau média</dc:title><upnp:albumArtURI xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" dlna:profileID="PNG_TN">http://192.168.254.99:5001/get/303/thumbnail0000Nouveau+m%C3%A9dia</upnp:albumArtURI><upnp:albumArtURI xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" dlna:profileID="PNG_TN">http://192.168.254.99:5001/get/303/thumbnail0000Nouveau+m%C3%A9dia</upnp:albumArtURI><upnp:class>object.container.storageFolder</upnp:class></container><container id="304" childCount="1" parentID="0" restricted="true"><dc:title>Chris</dc:title><upnp:albumArtURI xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" dlna:profileID="JPEG_TN">http://192.168.254.99:5001/get/304/thumbnail0000Chris</upnp:albumArtURI><upnp:albumArtURI xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" dlna:profileID="JPEG_SM">http://192.168.254.99:5001/get/304/thumbnail0000Chris</upnp:albumArtURI><dc:date>2016-07-29T12:06:40</dc:date><upnp:class>object.container.storageFolder</upnp:class></container><container id="305" childCount="6" parentID="0" restricted="true"><dc:title>Web</dc:title><upnp:albumArtURI xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" dlna:profileID="JPEG_TN">http://192.168.254.99:5001/get/305/thumbnail0000Web</upnp:albumArtURI><upnp:albumArtURI xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" dlna:profileID="JPEG_SM">http://192.168.254.99:5001/get/305/thumbnail0000Web</upnp:albumArtURI><upnp:class>object.container.storageFolder</upnp:class></container></DIDL-Lite>


:merci:

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/