UpNP and NETLINX
cheekytigerapps
Junior Member
Hi,
I was wondering if anyone could shed some light on how to send UPnP commands from Netlinx or a Netlinx Module. It would be greatly appreciated if anyone could post an example.
I was wondering if anyone could shed some light on how to send UPnP commands from Netlinx or a Netlinx Module. It would be greatly appreciated if anyone could post an example.
Comments
-
cheekytigerapps wrote: »Hi,
I was wondering if anyone could shed some light on how to send UPnP commands from Netlinx or a Netlinx Module. It would be greatly appreciated if anyone could post an example.
I guess it would really help to know what your trying to do, control, discovery, or get information on with uPnP. Please shed some light on the purpose of your request,
Thanks!
Jeff -
cheekytigerapps wrote: »Hi,
I was wondering if anyone could shed some light on how to send UPnP commands from Netlinx or a Netlinx Module. It would be greatly appreciated if anyone could post an example.
Its no different than sending any TCP packet. UPNP uses a weird mixture of http, xml, soap and a few other ingredients to communicate, so its just a matter of creating http packets and sending them. Here's an example of a function for a Sonos module that uses UPNP. It won't format correctly it seems but you get the point.define_function addURIToQueue(long lInstanceID, char sID[], char sParentID[], char sRestricted[], char sTitle[], char sClass[], integer bPlayNow, integer bPlayNext) { stack_var volatile char sCmd[2048] stack_var volatile integer length sCmd = "stEnvelope.sOpenTag, '<s:Body>', '<u:AddURIToQueue xmlns:u="urn:schemas-pnp-org:service:AVTransport:1">', '<InstanceID>',itoa(lInstanceID),'</InstanceID>', '<EnqueuedURI>',sID,'</EnqueuedURI>', '<EnqueuedURIMetaData>', '<DIDL-Lite ', 'xmlns:dc="http://purl.org/dc/elements/1.1/" ', 'xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" ', 'xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" ', 'xmlns="urn:schemas-upnp-org:metadata-1-0', '/DIDL-Lite/">', '<item id="',sID,'" ', 'parentID="',sParentID,'" ', 'restricted="',sRestricted,'">', '<dc:title>',urlEncode(sTitle),'</dc:title>', '<upnp:class>',sClass,'</upnp:class>', '<desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">', 'RINCON_AssociatedZPUDN</desc>', '</item>', '</DIDL-Lite>', '</EnqueuedURIMetaData>', '<DesiredFirstTrackNumberEnqueued>',itoa(bPlayNext),'</DesiredFirstTrackNumberEnqueued>', '<EnqueueAsNext>',itoa(bPlayNow),'</EnqueueAsNext>', '</u:AddURIToQueue>', '</s:Body>', stEnvelope.sCloseTag" length = length_string(sCmd) sendToControlPort( "stHeader.sPOST[cnServiceAVTransport],cnNL, stHeader.sConnection[cnConnectionClose],cnNL, stHeader.sAcceptEncoding[cnEncodingZip],cnNL, stHeader.sHost,cnNL, stHeader.sUserAgent[cnUserAgentSonos],cnNL, stHeader.sContentLength,itoa(length),cnNL, stHeader.sContentType[cnContentTypeTextXML],cnNL, stHeader.sSoapAction[cnSoapAddURIToQueue],cnNLNL, sCmd") } -
UPNP
Theres also some good books around, there's an Intel one that I used to get background info when I was developing a Module for a mediastreamer. Its partly about UPNP design but it gives you all the basic - think its called UPNP design by example - I found it quite useful. Also there is quite a bit on the web, some of it crap, some good.
As others have said, it depends what you are looking for....
Duncan -
Duncan Ellis wrote: »Theres also some good books around, there's an Intel one that I used to get background info when I was developing a Module for a mediastreamer. Its partly about UPNP design but it gives you all the basic - think its called UPNP design by example - I found it quite useful. Also there is quite a bit on the web, some of it crap, some good.
As others have said, it depends what you are looking for....
Duncan
...or alternatively grab an app that already controls the device you are looking at and watch it on wireshark.takes a bit of getting used to but works -
UPnP control point for AMX (beta):
https://github.com/ok1mpd/Netlinx-UPnP-control-point
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums