Giter Club home page Giter Club logo

simple_upnp's Introduction

Code Climate

simple_upnp

A few libraries already exist for working with Universal Plug and Play (UPnP) devices.

This library tries to provide a minimal implementation for discovery with a small amount of code and library dependencies.

For more info on uPnP, see: http://www.upnp-hacks.org/upnp.html

Installation

Add this line to your application's Gemfile:

gem 'simple_upnp'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_upnp

Usage

The below code (which can be triggered with the included rake task: "rake simple_upnp:discover"):

include_location_details = true
devices = SimpleUpnp::Discovery.search()
devices.each do |device|
  puts 'Device Found: '
  puts device.to_json(include_location_details)
  puts ''
end

Should produce output similar to the following:

Searching for devices...
Device Found: 
{:st=>"upnp:rootdevice", :server=>"Darwin 11.4.2 CyberLinkC/2.3 UPnP/1.0 DLNADOC/1.50", :usn=>"uuid:7DD8D98F-6577-582D-AF37-38B92EB830A4", :location=>"http://10.10.10.3:38400/description.xml", "root"=>{"specVersion"=>{"major"=>"1", "minor"=>"0"}, "device"=>{"deviceType"=>"urn:dmc-samsung-com:device:SyncServer:1", "friendlyName"=>"Adam’s MacBook Pro", "manufacturer"=>"Samsung-Electronics", "manufacturerURL"=>"http://www.samsung.com", "modelDescription"=>"Kies Sync Server", "modelName"=>"Kies Sync Server", "modelNumber"=>"1.0", "modelURL"=>"http://www.samsung.com", "UDN"=>"uuid:7DD8D98F-6577-582D-AF37-38B92EB830A4", "serviceList"=>{"service"=>{"serviceType"=>"urn:dmc-samsung-com:service:SyncManager:1", "serviceId"=>"urn:dmc-samsung-com:serviceId:SyncManager", "controlURL"=>"/KiesControll", "eventSubURL"=>"/KiesEventSub", "SCPDURL"=>"/KiesService_SCPD.xml"}}}, "URLBase"=>"http://10.10.10.3:38400", "@xmlns"=>"urn:schemas-upnp-org:device-1-0"}}

Device Found: 
{:st=>"upnp:rootdevice", :server=>"FreeRTOS/6.0.5, UPnP/1.0, IpBridge/0.1", :usn=>"uuid:2f402f80-da50-11e1-9b23-001788092b7e", :location=>"http://10.10.10.104:80/description.xml", "root"=>{"specVersion"=>{"major"=>"1", "minor"=>"0"}, "URLBase"=>"http://10.10.10.104:80/", "device"=>{"deviceType"=>"urn:schemas-upnp-org:device:Basic:1", "friendlyName"=>"Philips hue (10.10.10.104)", "manufacturer"=>"Royal Philips Electronics", "manufacturerURL"=>"http://www.philips.com", "modelDescription"=>"Philips hue Personal Wireless Lighting", "modelName"=>"Philips hue bridge 2012", "modelNumber"=>"929000242503", "modelURL"=>"http://www.meethue.com", "serialNumber"=>"001788542b7e", "UDN"=>"uuid:2f402f80-da50-11e1-9b23-001788092b7e", "serviceList"=>{"service"=>{"serviceType"=>"(null)", "serviceId"=>"(null)", "controlURL"=>"(null)", "eventSubURL"=>"(null)", "SCPDURL"=>"(null)"}}, "presentationURL"=>"index.html", "iconList"=>{"icon"=>[{"mimetype"=>"image/png", "height"=>"48", "width"=>"48", "depth"=>"24", "url"=>"hue_logo_0.png"}, {"mimetype"=>"image/png", "height"=>"120", "width"=>"120", "depth"=>"24", "url"=>"hue_logo_3.png"}]}}, "@xmlns"=>"urn:schemas-upnp-org:device-1-0"}}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

simple_upnp's People

Contributors

denniskuczynski avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.