ptrex Posted November 13, 2007 Share Posted November 13, 2007 (edited) UPnP Protocol For those who don't know what UPnP is : Short for Universal Plug and Play, a networking architecture that provides compatibility among networking equipment, software and peripherals of the 400+ vendors that are part of the Universal Plug and Play Forum. UPnP works with wired or wireless networks and can be supported on any operating system. UPnP boasts device-driver independence and zero-configuration networking. UPnP uses the SSDP protocol : SSDP uses UDP unicast and multicast packets to advertise their services. The multicast address is 239.255.255.250. SSDP uses port 1900 Some tilme ago someone in the help forum was asking if it was possible to use UPnP and AU3 .... Well UPnP can access all UPnP compatible devices and retrieve information from it. And the beauty of this all is, it can not on retrieve info from it, it can also control it remotely !! Like you can add port forwarding in your router, remotely. Or block ports etc. So in theory you can access the sound volume button on your UPnP Media player and turn it up or down, as well. Like this : UPnP-based media player devices Here is a little sample of how you get started : expandcollapse popup; http://msdn2.microsoft.com/en-us/library/aa382297.aspx Dim $deviceFinder Dim $DeviceType Dim $Devices Dim $Device Dim $strDescDocURL $DeviceFinder = ObjCreate( "UPnP.UPnPDeviceFinder" ) $DeviceServices = ObjCreate( "UPnP.UPnPServices" ) $DeviceService = ObjCreate( "UPnP.UPnPService" ) $Device = ObjCreate( "UPnP.UPnPDevice" ) $DeviceType = "upnp:rootdevice" $Devices = $DeviceFinder.FindByType($DeviceType,0) ;$strDescDocURL = $DescriptionDoc.GetDocumentURL ConsoleWrite( $strDescDocURL & @LF) ConsoleWrite( "Found # :" & $Devices.Count & " Devices" & @LF & @LF) ;ConsoleWrite( "Services # :" & $DeviceService.Count & " Devices" & @LF & @LF) For $DeviceObj in $Devices ConsoleWrite("Children " & $DeviceObj.Children & @CRLF) ConsoleWrite("Description " & $deviceObj.Description& @CRLF) ConsoleWrite("FriendlyName " & $deviceObj.FriendlyName & @CRLF) ConsoleWrite("HasChildren " & $deviceObj.HasChildren & @CRLF) ConsoleWrite("IsRootDevice " & $deviceObj.IsRootDevice & @CRLF) ConsoleWrite("ManufacturerName " & $deviceObj.ManufacturerName & @CRLF) ConsoleWrite("ManufacturerURL " & $deviceObj.ManufacturerURL & @CRLF) ConsoleWrite("ModelName " & $deviceObj.ModelName & @CRLF) ConsoleWrite("ModelNumber " & $deviceObj.ModelNumber & @CRLF) ConsoleWrite("ModelURL " & $deviceObj.ModelURL & @CRLF) ConsoleWrite("ParentDevice " & $deviceObj.ParentDevice & @CRLF) ConsoleWrite("PresentationURL " & $deviceObj.PresentationURL & @CRLF) ConsoleWrite("RootDevice " & $deviceObj.RootDevice & @CRLF) ConsoleWrite("SerialNumber " & $deviceObj.SerialNumber & @CRLF) ConsoleWrite("Services " & $deviceObj.Services & @CRLF) ConsoleWrite("Device URN Type " & $deviceObj.Type & @CRLF) ConsoleWrite("UniqueDeviceName " & $deviceObj.UniqueDeviceName & @CRLF) ConsoleWrite("Product Code - UPC " & $deviceObj.UPC & @CRLF) ConsoleWrite(@LF) next IMOPORTANT : - Make sure that you UPnP device has the UPnP feature enabled, by default it might not be so. - Make sure that you firewall (in XP) is off or has the UPnP Framework trafic allowed. Enjoy!! ptrex Edited September 14, 2012 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Gif Posted November 13, 2007 Share Posted November 13, 2007 great ptrex, another usefull work from you Link to comment Share on other sites More sharing options...
ptrex Posted November 13, 2007 Author Share Posted November 13, 2007 (edited) @Gif Thanks. The things I showed is only the top of the iceberg. Once you start digging into the UPnP stuff, you are hitting the jackpot !! Got myself amazed the last couple of days, playing around with this. regards, ptrex Edited November 13, 2007 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Avee Posted March 19, 2008 Share Posted March 19, 2008 Hi ptrex, Inspired by your post, I am trying to develop something for my music system. Basically, I want to know when the player is paused or not, so that I can switch my amp on and off. I am a complete novice at autoit, so I might be completely missing something. I added the following bit of test code to your example, and it doesn't work: $UpCallback = $DeviceService.Addcallback("uuid:RINCON_000E5823005801400") $SinkObject=ObjEvent($UpCallback,"pnpEvent_") while True sleep(1000) WEnd Func pnpEvent_StateVariableChanged( $Serviceobject, $ChangedVar, $VarVal ) ConsoleWrite("Var CHanged! :" & $ChangedVar & " = " & $VarVal & @CRLF) EndFunc It does compile, but it never reacts to any event. Did I implement the callback function right? Link to comment Share on other sites More sharing options...
Avee Posted March 29, 2008 Share Posted March 29, 2008 anyone else have an idea? thanks! Link to comment Share on other sites More sharing options...
ptrex Posted March 30, 2008 Author Share Posted March 30, 2008 @AveeIf the AutoIt is new to you AND UPnP is new as well. Then I think this might be a bit over your head to get started with.Anyhow if you want to persist. I recomment to drop the COM interface to UPnP and go for the protocol level.First thing to do is start reading about the protocol here Universal_Plug_and_Play and UPnP StandardsFurhter you can use the TCP functions in AU3 to implement a UPnP test case.I hope this get"s you started on this.regards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Sog Posted March 6, 2012 Share Posted March 6, 2012 Hi ptrex, I've been trying to get the streaming 'Media ID' of the files on my humax hdr, its a upnp dnla media server but having played around with your amazing script for a while I've managed to find a few xml files but I'm now stumped! Background (what Im trying to achieve) I recently started writing a prog to take TV recordings off my TV box, strip the ads and re-encode with the updated humax support files. there is a way to do it but that involves using the remote to copy the file to USB (this decrypts the file if its SD) Then FTP copy it to your PC and run a series of progs to process the file. I can stream and save the file straight to the PC cutting out the need to copy them to USB as they are decrypted on the way (including the HD recordings!) this also means it can be fully automatic as you won't need to use the remote for any stage of the process. bottom line... I can get the filenames but to stream them I need to know the 'Media ID' to initiate the stream (eg: http://192.168.##.#/MyVideo:56444 instead of http://192.168.##.#/MyVideo/tvrecording.ts) I'm completely stumped. any help would be greatfully recieved and you will obviously be given credit in the program's About' info window... Cheers, Sog Link to comment Share on other sites More sharing options...
Sog Posted March 6, 2012 Share Posted March 6, 2012 p.s. The program Im writing is an autoit script (and I stupidly searched the web for days for clues. I should have come here first!) apologies for the double post, Im not allowed to edit my original post... Link to comment Share on other sites More sharing options...
ptrex Posted March 6, 2012 Author Share Posted March 6, 2012 @SogA good way to get started is looking here :http://msdn.microsoft.com/en-us/library/windows/desktop/aa381156(v=vs.85).aspxRgdsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Sog Posted March 10, 2012 Share Posted March 10, 2012 Thanks ptrex, I'll post back the prog if I can get my head round it, Im new to this so I may be some time... lol... Link to comment Share on other sites More sharing options...
Sog Posted March 25, 2012 Share Posted March 25, 2012 Thanks ptrex, I'll post back the prog if I can get my head round it, Im new to this so I may be some time... lol...sadly lifes got in the way of getting on with this, will reply as soon as Ive sussed it out tho.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now